No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hpcarm / dev / ipaq_saip.c
blobd68a64ea6db3057a760f59fadefc4ae70bf5cd26
1 /* $NetBSD: ipaq_saip.c,v 1.21 2008/04/28 20:23:21 martin Exp $ */
3 /*-
4 * Copyright (c) 2001, The NetBSD Foundation, Inc. All rights reserved.
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Ichiro FUKUHARA (ichiro@ichiro.org).
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: ipaq_saip.c,v 1.21 2008/04/28 20:23:21 martin Exp $");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/types.h>
37 #include <sys/conf.h>
38 #include <sys/device.h>
39 #include <sys/kernel.h>
40 #include <sys/malloc.h>
41 #include <sys/uio.h>
43 #include <machine/cpu.h>
44 #include <machine/bus.h>
46 #include <arm/sa11x0/sa11x0_var.h>
47 #include <arm/sa11x0/sa11x0_reg.h>
48 #include <arm/sa11x0/sa11x0_dmacreg.h>
49 #include <arm/sa11x0/sa11x0_ppcreg.h>
50 #include <arm/sa11x0/sa11x0_gpioreg.h>
51 #include <arm/sa11x0/sa11x0_sspreg.h>
53 #include <hpcarm/dev/ipaq_saipvar.h>
54 #include <hpcarm/dev/ipaq_gpioreg.h>
56 /* prototypes */
57 static int ipaq_match(device_t, cfdata_t, void *);
58 static void ipaq_attach(device_t, device_t, void *);
59 static int ipaq_search(device_t, cfdata_t, const int *, void *);
60 static int ipaq_print(void *, const char *);
62 /* attach structures */
63 CFATTACH_DECL_NEW(ipaqbus, sizeof(struct ipaq_softc),
64 ipaq_match, ipaq_attach, NULL, NULL);
66 static int
67 ipaq_print(void *aux, const char *name)
69 return (UNCONF);
72 int
73 ipaq_match(device_t parent, cfdata_t match, void *aux)
75 return (1);
78 void
79 ipaq_attach(device_t parent, device_t self, void *aux)
81 struct ipaq_softc *sc = device_private(self);
82 struct sa11x0_softc *psc = device_private(parent);
84 aprint_normal("\n");
86 sc->sc_dev = self;
87 sc->sc_iot = psc->sc_iot;
88 sc->sc_ioh = psc->sc_ioh;
89 sc->sc_gpioh = psc->sc_gpioh;
91 /* Map the Extended GPIO registers */
92 if (bus_space_map(sc->sc_iot, SAEGPIO_BASE, 1, 0, &sc->sc_egpioh))
93 panic("%s: unable to map Extended GPIO registers",
94 device_xname(self));
96 sc->ipaq_egpio = EGPIO_INIT;
97 bus_space_write_2(sc->sc_iot, sc->sc_egpioh, 0, sc->ipaq_egpio);
99 /* Map the SSP registers */
100 if (bus_space_map(sc->sc_iot, SASSP_BASE, SASSP_NPORTS, 0, &sc->sc_ssph))
101 panic("%s: unable to map SSP registers",
102 device_xname(self));
104 sc->sc_ppch = psc->sc_ppch;
105 sc->sc_dmach = psc->sc_dmach;
108 * Attach each devices
110 config_search_ia(ipaq_search, self, "ipaqbus", NULL);
114 ipaq_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
116 if (config_match(parent, cf, NULL) > 0)
117 config_attach(parent, cf, NULL, ipaq_print);
119 return 0;