lpt_elb.c revision 1.4
11.4Shannken/*	$NetBSD: lpt_elb.c,v 1.4 2007/11/27 10:59:25 hannken Exp $	*/
21.1Shannken
31.1Shannken/*-
41.1Shannken * Copyright (c) 2003 The NetBSD Foundation, Inc.
51.1Shannken * All rights reserved.
61.1Shannken *
71.1Shannken * This code is derived from software contributed to The NetBSD Foundation
81.1Shannken * by Juergen Hannken-Illjes.
91.1Shannken *
101.1Shannken * Redistribution and use in source and binary forms, with or without
111.1Shannken * modification, are permitted provided that the following conditions
121.1Shannken * are met:
131.1Shannken * 1. Redistributions of source code must retain the above copyright
141.1Shannken *    notice, this list of conditions and the following disclaimer.
151.1Shannken * 2. Redistributions in binary form must reproduce the above copyright
161.1Shannken *    notice, this list of conditions and the following disclaimer in the
171.1Shannken *    documentation and/or other materials provided with the distribution.
181.1Shannken * 3. All advertising materials mentioning features or use of this software
191.1Shannken *    must display the following acknowledgement:
201.1Shannken *      This product includes software developed by the NetBSD
211.1Shannken *      Foundation, Inc. and its contributors.
221.1Shannken * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Shannken *    contributors may be used to endorse or promote products derived
241.1Shannken *    from this software without specific prior written permission.
251.1Shannken *
261.1Shannken * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Shannken * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Shannken * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Shannken * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Shannken * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Shannken * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Shannken * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Shannken * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Shannken * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Shannken * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Shannken * POSSIBILITY OF SUCH DAMAGE.
371.1Shannken */
381.2Slukem
391.2Slukem#include <sys/cdefs.h>
401.4Shannken__KERNEL_RCSID(0, "$NetBSD: lpt_elb.c,v 1.4 2007/11/27 10:59:25 hannken Exp $");
411.1Shannken
421.1Shannken#include <sys/param.h>
431.1Shannken#include <sys/conf.h>
441.1Shannken#include <sys/device.h>
451.1Shannken#include <sys/systm.h>
461.1Shannken#include <sys/tty.h>
471.1Shannken
481.1Shannken#include <machine/bus.h>
491.1Shannken
501.1Shannken#include <dev/ic/lptreg.h>
511.1Shannken#include <dev/ic/lptvar.h>
521.1Shannken
531.1Shannken#include <evbppc/explora/dev/elbvar.h>
541.1Shannken
551.1Shannkenstatic int	lpt_elb_probe(struct device *, struct cfdata *, void *);
561.1Shannkenstatic void	lpt_elb_attach(struct device *, struct device *, void *);
571.1Shannken
581.1ShannkenCFATTACH_DECL(lpt_elb, sizeof(struct lpt_softc),
591.1Shannken    lpt_elb_probe, lpt_elb_attach, NULL, NULL);
601.1Shannken
611.1Shannkenint
621.1Shannkenlpt_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
631.1Shannken{
641.1Shannken	struct elb_attach_args *oaa = aux;
651.1Shannken
661.1Shannken	if (strcmp(oaa->elb_name, cf->cf_name) != 0)
671.1Shannken		return 0;
681.1Shannken
691.1Shannken	return (1);
701.1Shannken}
711.1Shannken
721.1Shannkenvoid
731.1Shannkenlpt_elb_attach(struct device *parent, struct device *self, void *aux)
741.1Shannken{
751.1Shannken	struct lpt_softc *sc = (struct lpt_softc *)self;
761.1Shannken	struct elb_attach_args *eaa = aux;
771.1Shannken
781.1Shannken	sc->sc_iot = eaa->elb_bt;
791.4Shannken	bus_space_map(sc->sc_iot,
801.4Shannken	    _BUS_SPACE_UNSTRIDE(sc->sc_iot, eaa->elb_base), LPT_NPORTS,
811.4Shannken	    0, &sc->sc_ioh);
821.1Shannken
831.1Shannken	printf("\n");
841.1Shannken
851.1Shannken	lpt_attach_subr(sc);
861.1Shannken}
87