g42xxeb_var.h revision 1.1.8.2 1 1.1.8.2 kent /*-
2 1.1.8.2 kent * Copyright (c) 2001, 2002, 2005 Genetec corp.
3 1.1.8.2 kent * All rights reserved.
4 1.1.8.2 kent *
5 1.1.8.2 kent * Written by Hiroyuki Bessho for Genetec corp.
6 1.1.8.2 kent *
7 1.1.8.2 kent * Redistribution and use in source and binary forms, with or without
8 1.1.8.2 kent * modification, are permitted provided that the following conditions
9 1.1.8.2 kent * are met:
10 1.1.8.2 kent * 1. Redistributions of source code must retain the above copyright
11 1.1.8.2 kent * notice, this list of conditions and the following disclaimer.
12 1.1.8.2 kent * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.8.2 kent * notice, this list of conditions and the following disclaimer in the
14 1.1.8.2 kent * documentation and/or other materials provided with the distribution.
15 1.1.8.2 kent * 3. Neither the name of The NetBSD Foundation nor the names of its
16 1.1.8.2 kent * contributors may be used to endorse or promote products derived
17 1.1.8.2 kent * from this software without specific prior written permission.
18 1.1.8.2 kent *
19 1.1.8.2 kent * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1.8.2 kent * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1.8.2 kent * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1.8.2 kent * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1.8.2 kent * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1.8.2 kent * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1.8.2 kent * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1.8.2 kent * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1.8.2 kent * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1.8.2 kent * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1.8.2 kent * POSSIBILITY OF SUCH DAMAGE.
30 1.1.8.2 kent */
31 1.1.8.2 kent
32 1.1.8.2 kent #ifndef _EVBARM_G42XXEB_VAR_H
33 1.1.8.2 kent #define _EVBARM_G42XXEB_VAR_H
34 1.1.8.2 kent
35 1.1.8.2 kent #include <sys/conf.h>
36 1.1.8.2 kent #include <sys/device.h>
37 1.1.8.2 kent
38 1.1.8.2 kent #include <machine/bus.h>
39 1.1.8.2 kent #include <evbarm/g42xxeb/g42xxeb_reg.h>
40 1.1.8.2 kent
41 1.1.8.2 kent
42 1.1.8.2 kent /*
43 1.1.8.2 kent * G42xxeb on-board IO bus
44 1.1.8.2 kent */
45 1.1.8.2 kent struct obio_softc {
46 1.1.8.2 kent struct device sc_dev;
47 1.1.8.2 kent bus_space_tag_t sc_iot;
48 1.1.8.2 kent bus_space_handle_t sc_obioreg_ioh;
49 1.1.8.2 kent
50 1.1.8.2 kent /* handle to PXA2x0's memory controller.
51 1.1.8.2 kent XXX: shouldn't be here. */
52 1.1.8.2 kent bus_space_handle_t sc_memctl_ioh;
53 1.1.8.2 kent
54 1.1.8.2 kent void *sc_ih; /* interrupt handler for obio on pxaip */
55 1.1.8.2 kent void *sc_si; /* software interrupt handler */
56 1.1.8.2 kent int sc_intr;
57 1.1.8.2 kent uint16_t sc_intr_mask;
58 1.1.8.2 kent uint16_t sc_intr_pending;
59 1.1.8.2 kent int sc_ipl; /* Max ipl among sub interrupts */
60 1.1.8.2 kent struct obio_handler {
61 1.1.8.2 kent int (* func)(void *);
62 1.1.8.2 kent void *arg;
63 1.1.8.2 kent int level;
64 1.1.8.2 kent } sc_handler[G42XXEB_N_INTS];
65 1.1.8.2 kent };
66 1.1.8.2 kent
67 1.1.8.2 kent typedef void *obio_chipset_tag_t;
68 1.1.8.2 kent
69 1.1.8.2 kent struct obio_attach_args {
70 1.1.8.2 kent obio_chipset_tag_t oba_sc;
71 1.1.8.2 kent bus_space_tag_t oba_iot; /* Bus tag */
72 1.1.8.2 kent bus_addr_t oba_addr; /* i/o address */
73 1.1.8.2 kent int oba_intr;
74 1.1.8.2 kent };
75 1.1.8.2 kent
76 1.1.8.2 kent /* on-board hex LED */
77 1.1.8.2 kent void hex_led( uint32_t value );
78 1.1.8.2 kent
79 1.1.8.2 kent /*
80 1.1.8.2 kent * IRQ handler
81 1.1.8.2 kent */
82 1.1.8.2 kent void *obio_intr_establish(struct obio_softc *, int, int, int,
83 1.1.8.2 kent int (*)(void *), void *);
84 1.1.8.2 kent void obio_intr_disestablish(struct obio_softc *, int, int (*)(void *));
85 1.1.8.2 kent void obio_intr_mask(struct obio_softc *, struct obio_handler *);
86 1.1.8.2 kent void obio_intr_unmask(struct obio_softc *, struct obio_handler *);
87 1.1.8.2 kent
88 1.1.8.2 kent #define obio_update_intrmask(sc) \
89 1.1.8.2 kent bus_space_write_2( (sc)->sc_iot, (sc)->sc_obioreg_ioh, \
90 1.1.8.2 kent G42XXEB_INTMASK, (sc)->sc_intr_mask | (sc)->sc_intr_pending );
91 1.1.8.2 kent
92 1.1.8.2 kent void obio_peripheral_reset(struct obio_softc *, int, int);
93 1.1.8.2 kent
94 1.1.8.2 kent #endif /* _EVBARM_G42XXEB_VAR_H */
95