arbusvar.h revision 1.1 1 1.1 gdamore /* $Id: arbusvar.h,v 1.1 2006/03/21 08:15:19 gdamore Exp $ */
2 1.1 gdamore /*
3 1.1 gdamore * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
4 1.1 gdamore * Copyright (c) 2006 Garrett D'Amore.
5 1.1 gdamore * All rights reserved.
6 1.1 gdamore *
7 1.1 gdamore * This code was written by Garrett D'Amore for the Champaign-Urbana
8 1.1 gdamore * Community Wireless Network Project.
9 1.1 gdamore *
10 1.1 gdamore * Redistribution and use in source and binary forms, with or
11 1.1 gdamore * without modification, are permitted provided that the following
12 1.1 gdamore * conditions are met:
13 1.1 gdamore * 1. Redistributions of source code must retain the above copyright
14 1.1 gdamore * notice, this list of conditions and the following disclaimer.
15 1.1 gdamore * 2. Redistributions in binary form must reproduce the above
16 1.1 gdamore * copyright notice, this list of conditions and the following
17 1.1 gdamore * disclaimer in the documentation and/or other materials provided
18 1.1 gdamore * with the distribution.
19 1.1 gdamore * 3. All advertising materials mentioning features or use of this
20 1.1 gdamore * software must display the following acknowledgements:
21 1.1 gdamore * This product includes software developed by the Urbana-Champaign
22 1.1 gdamore * Independent Media Center.
23 1.1 gdamore * This product includes software developed by Garrett D'Amore.
24 1.1 gdamore * 4. Urbana-Champaign Independent Media Center's name and Garrett
25 1.1 gdamore * D'Amore's name may not be used to endorse or promote products
26 1.1 gdamore * derived from this software without specific prior written permission.
27 1.1 gdamore *
28 1.1 gdamore * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT
29 1.1 gdamore * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR
30 1.1 gdamore * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 1.1 gdamore * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 1.1 gdamore * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
33 1.1 gdamore * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
34 1.1 gdamore * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
35 1.1 gdamore * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 1.1 gdamore * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 1.1 gdamore * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
38 1.1 gdamore * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 1.1 gdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40 1.1 gdamore * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 1.1 gdamore */
42 1.1 gdamore
43 1.1 gdamore #ifndef _MIPS_ATHEROS_ARBUSVAR_H_
44 1.1 gdamore #define _MIPS_ATHEROS_ARBUSVAR_H_
45 1.1 gdamore
46 1.1 gdamore #include <machine/bus.h>
47 1.1 gdamore
48 1.1 gdamore struct arbus_attach_args {
49 1.1 gdamore const char *aa_name;
50 1.1 gdamore bus_space_tag_t aa_bst;
51 1.1 gdamore bus_dma_tag_t aa_dmat;
52 1.1 gdamore
53 1.1 gdamore bus_addr_t aa_addr;
54 1.1 gdamore bus_size_t aa_size;
55 1.1 gdamore int aa_irq;
56 1.1 gdamore };
57 1.1 gdamore
58 1.1 gdamore void arbus_init(void);
59 1.1 gdamore bus_space_tag_t arbus_get_bus_space_tag(void);
60 1.1 gdamore bus_dma_tag_t arbus_get_bus_dma_tag(void);
61 1.1 gdamore
62 1.1 gdamore void *arbus_intr_establish(int, int (*)(void *), void *);
63 1.1 gdamore void arbus_intr_disestablish(void *);
64 1.1 gdamore
65 1.1 gdamore void com_arbus_cnattach(bus_addr_t);
66 1.1 gdamore
67 1.1 gdamore /*
68 1.1 gdamore * These definitions are "funny". To distinquish between
69 1.1 gdamore * miscellaneous IRQs and global processor interrupts, we encode the
70 1.1 gdamore * IRQ as (cpuirq) | ((miscirq) << 4).
71 1.1 gdamore *
72 1.1 gdamore * Note that these IRQs seem to be general on all AR531X based parts.
73 1.1 gdamore */
74 1.1 gdamore
75 1.1 gdamore #define ARBUS_IRQ_CPU_M 0xf
76 1.1 gdamore #define ARBUS_IRQ_CPU_S 0
77 1.1 gdamore #define ARBUS_IRQ_MISC_M 0xf0
78 1.1 gdamore #define ARBUS_IRQ_MISC_S 4
79 1.1 gdamore #define ARBUS_IRQ_CPU(x) (((x) & ARBUS_IRQ_CPU_M) >> ARBUS_IRQ_CPU_S)
80 1.1 gdamore #define ARBUS_IRQ_MISC(x) (((x) & ARBUS_IRQ_MISC_M) >> ARBUS_IRQ_MISC_S)
81 1.1 gdamore #define ARBUS_MAKE_IRQ(c,m) \
82 1.1 gdamore (((c) << ARBUS_IRQ_CPU_S) | ((m) << ARBUS_IRQ_MISC_S))
83 1.1 gdamore
84 1.1 gdamore #define ARBUS_IRQ_WLAN0 ARBUS_MAKE_IRQ(0,0)
85 1.1 gdamore #define ARBUS_IRQ_ENET0 ARBUS_MAKE_IRQ(1,0)
86 1.1 gdamore #define ARBUS_IRQ_ENET1 ARBUS_MAKE_IRQ(2,0)
87 1.1 gdamore #define ARBUS_IRQ_WLAN1 ARBUS_MAKE_IRQ(3,0)
88 1.1 gdamore #define ARBUS_IRQ_TIMER ARBUS_MAKE_IRQ(4,0)
89 1.1 gdamore #define ARBUS_IRQ_AHBPERR ARBUS_MAKE_IRQ(4,1)
90 1.1 gdamore #define ARBUS_IRQ_AHBDMAE ARBUS_MAKE_IRQ(4,2)
91 1.1 gdamore #define ARBUS_IRQ_GPIO ARBUS_MAKE_IRQ(4,3)
92 1.1 gdamore #define ARBUS_IRQ_UART0 ARBUS_MAKE_IRQ(4,4)
93 1.1 gdamore #define ARBUS_IRQ_UART0_DMA ARBUS_MAKE_IRQ(4,5)
94 1.1 gdamore #define ARBUS_IRQ_WDOG ARBUS_MAKE_IRQ(4,6)
95 1.1 gdamore
96 1.1 gdamore #endif /* _MIPS_ATHEROS_ARBUSVAR_H_ */
97