1*cf10107dSdyoung /* $NetBSD: lpt_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $ */
2249e0067Shannken
3249e0067Shannken /*-
4249e0067Shannken * Copyright (c) 2003 The NetBSD Foundation, Inc.
5249e0067Shannken * All rights reserved.
6249e0067Shannken *
7249e0067Shannken * This code is derived from software contributed to The NetBSD Foundation
8249e0067Shannken * by Juergen Hannken-Illjes.
9249e0067Shannken *
10249e0067Shannken * Redistribution and use in source and binary forms, with or without
11249e0067Shannken * modification, are permitted provided that the following conditions
12249e0067Shannken * are met:
13249e0067Shannken * 1. Redistributions of source code must retain the above copyright
14249e0067Shannken * notice, this list of conditions and the following disclaimer.
15249e0067Shannken * 2. Redistributions in binary form must reproduce the above copyright
16249e0067Shannken * notice, this list of conditions and the following disclaimer in the
17249e0067Shannken * documentation and/or other materials provided with the distribution.
18249e0067Shannken *
19249e0067Shannken * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20249e0067Shannken * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21249e0067Shannken * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22249e0067Shannken * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23249e0067Shannken * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24249e0067Shannken * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25249e0067Shannken * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26249e0067Shannken * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27249e0067Shannken * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28249e0067Shannken * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29249e0067Shannken * POSSIBILITY OF SUCH DAMAGE.
30249e0067Shannken */
31249e0067Shannken
3214172728Slukem #include <sys/cdefs.h>
33*cf10107dSdyoung __KERNEL_RCSID(0, "$NetBSD: lpt_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $");
3414172728Slukem
35249e0067Shannken #include <sys/param.h>
36249e0067Shannken #include <sys/conf.h>
37249e0067Shannken #include <sys/device.h>
38249e0067Shannken #include <sys/systm.h>
39249e0067Shannken #include <sys/tty.h>
40249e0067Shannken
41*cf10107dSdyoung #include <sys/bus.h>
42249e0067Shannken
43249e0067Shannken #include <dev/ic/lptreg.h>
44249e0067Shannken #include <dev/ic/lptvar.h>
45249e0067Shannken
46249e0067Shannken #include <evbppc/explora/dev/elbvar.h>
47249e0067Shannken
488ecf8999Scube static int lpt_elb_probe(device_t, cfdata_t , void *);
498ecf8999Scube static void lpt_elb_attach(device_t, device_t, void *);
50249e0067Shannken
518ecf8999Scube CFATTACH_DECL_NEW(lpt_elb, sizeof(struct lpt_softc),
52249e0067Shannken lpt_elb_probe, lpt_elb_attach, NULL, NULL);
53249e0067Shannken
54249e0067Shannken int
lpt_elb_probe(device_t parent,cfdata_t cf,void * aux)558ecf8999Scube lpt_elb_probe(device_t parent, cfdata_t cf, void *aux)
56249e0067Shannken {
57249e0067Shannken struct elb_attach_args *oaa = aux;
58249e0067Shannken
59249e0067Shannken if (strcmp(oaa->elb_name, cf->cf_name) != 0)
60249e0067Shannken return 0;
61249e0067Shannken
62249e0067Shannken return (1);
63249e0067Shannken }
64249e0067Shannken
65249e0067Shannken void
lpt_elb_attach(device_t parent,device_t self,void * aux)668ecf8999Scube lpt_elb_attach(device_t parent, device_t self, void *aux)
67249e0067Shannken {
688ecf8999Scube struct lpt_softc *sc = device_private(self);
69249e0067Shannken struct elb_attach_args *eaa = aux;
70249e0067Shannken
718ecf8999Scube sc->sc_dev = self;
72249e0067Shannken sc->sc_iot = eaa->elb_bt;
738b992330Shannken bus_space_map(sc->sc_iot,
748b992330Shannken _BUS_SPACE_UNSTRIDE(sc->sc_iot, eaa->elb_base), LPT_NPORTS,
758b992330Shannken 0, &sc->sc_ioh);
76249e0067Shannken
778ecf8999Scube aprint_normal("\n");
78249e0067Shannken
79249e0067Shannken lpt_attach_subr(sc);
80249e0067Shannken }
81