Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / sparc64 / dev / lpt_ebus.c
blobc59dcfd39446adc24e060d19c9c67f2e7cbf8322
1 /* $NetBSD: lpt_ebus.c,v 1.21 2008/03/07 17:15:51 cube Exp $ */
3 /*
4 * Copyright (c) 1999, 2000 Matthew R. Green
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
30 * NS Super I/O PC87332VLJ "lpt" to ebus attachment
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: lpt_ebus.c,v 1.21 2008/03/07 17:15:51 cube Exp $");
36 #include <sys/types.h>
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/device.h>
40 #include <sys/tty.h>
42 #include <machine/bus.h>
44 #include <dev/ebus/ebusreg.h>
45 #include <dev/ebus/ebusvar.h>
47 #include <dev/ic/lptvar.h>
49 int lpt_ebus_match(device_t, cfdata_t , void *);
50 void lpt_ebus_attach(device_t, device_t, void *);
52 CFATTACH_DECL_NEW(lpt_ebus, sizeof(struct lpt_softc),
53 lpt_ebus_match, lpt_ebus_attach, NULL, NULL);
55 #define ROM_LPT_NAME "ecpp"
57 int
58 lpt_ebus_match(device_t parent, cfdata_t match, void *aux)
60 struct ebus_attach_args *ea = aux;
62 if (strcmp(ea->ea_name, ROM_LPT_NAME) == 0)
63 return (1);
65 return (0);
68 void
69 lpt_ebus_attach(device_t parent, device_t self, void *aux)
71 struct lpt_softc *sc = device_private(self);
72 struct ebus_attach_args *ea = aux;
73 int i;
75 sc->sc_dev = self;
76 sc->sc_iot = ea->ea_bustag;
78 * Addresses that should be supplied by the prom:
79 * - normal lpt registers
80 * - ns873xx configuration registers
81 * - DMA space
82 * The `lpt' driver does not use DMA accesses, so we can
83 * ignore that for now. We should enable the lpt port in
84 * the ns873xx registers here. XXX
86 * Use the prom address if there.
88 if (ea->ea_nvaddr)
89 sparc_promaddr_to_handle(sc->sc_iot, ea->ea_vaddr[0],
90 &sc->sc_ioh);
91 else if (bus_space_map(sc->sc_iot,
92 EBUS_ADDR_FROM_REG(&ea->ea_reg[0]),
93 ea->ea_reg[0].size,
95 &sc->sc_ioh) != 0) {
96 aprint_error(": can't map register space\n");
97 return;
100 for (i = 0; i < ea->ea_nintr; i++)
101 bus_intr_establish(ea->ea_bustag, ea->ea_intr[i],
102 IPL_SERIAL, lptintr, sc);
103 aprint_normal("\n");
105 lpt_attach_subr(sc);