ar5315reg.h revision 1.1 1 1.1 gdamore /* $Id: ar5315reg.h,v 1.1 2006/09/26 06:37:32 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_AR5315REG_H_
44 1.1 gdamore #define _MIPS_ATHEROS_AR5315REG_H_
45 1.1 gdamore
46 1.1 gdamore #define AR5315_MEM0_BASE 0x00000000 /* sdram */
47 1.1 gdamore #define AR5315_MEM1_BASE 0x08000000 /* spi flash */
48 1.1 gdamore #define AR5315_WLAN_BASE 0x10000000
49 1.1 gdamore #define AR5315_PCI_BASE 0x10100000
50 1.1 gdamore #define AR5315_SDRAMCTL_BASE 0x10300000
51 1.1 gdamore #define AR5315_LOCAL_BASE 0x10400000 /* local bus */
52 1.1 gdamore #define AR5315_ENET_BASE 0x10500000
53 1.1 gdamore #define AR5315_SYSREG_BASE 0x11000000
54 1.1 gdamore #define AR5315_UART_BASE 0x11100000
55 1.1 gdamore #define AR5315_SPI_BASE 0x11300000 /* spi flash */
56 1.1 gdamore #define AR5315_BOOTROM_BASE 0x1FC00000 /* boot rom */
57 1.1 gdamore #define AR5315_CONFIG_BASE 0x087D0000 /* flash start */
58 1.1 gdamore #define AR5315_CONFIG_END 0x087FF000 /* flash end */
59 1.1 gdamore #define AR5315_RADIO_END 0x1FFFF000 /* radio end */
60 1.1 gdamore
61 1.1 gdamore #if 0
62 1.1 gdamore #define AR5315_PCIEXT_BASE 0x80000000 /* pci external */
63 1.1 gdamore #define AR5315_RAM2_BASE 0xc0000000
64 1.1 gdamore #define AR5315_RAM3_BASE 0xe0000000
65 1.1 gdamore #endif
66 1.1 gdamore
67 1.1 gdamore /*
68 1.1 gdamore * SYSREG registers -- offset relative to AR531X_SYSREG_BASE
69 1.1 gdamore */
70 1.1 gdamore #define AR5315_SYSREG_COLDRESET 0x0000
71 1.1 gdamore #define AR5315_SYSREG_RESETCTL 0x0004
72 1.1 gdamore #define AR5315_SYSREG_AHB_ARB_CTL 0x0008
73 1.1 gdamore #define AR5315_SYSREG_ENDIAN 0x000c
74 1.1 gdamore #define AR5315_SYSREG_SREV 0x0014
75 1.1 gdamore #define AR5315_SYSREG_ISR 0x0020
76 1.1 gdamore #define AR5315_SYSREG_IMR 0x0024
77 1.1 gdamore #define AR5315_SYSREG_GISR 0x0028
78 1.1 gdamore #define AR5315_SYSREG_WDOG_TIMER 0x0038
79 1.1 gdamore #define AR5315_SYSREG_WDOG_CTL 0x003c
80 1.1 gdamore #define AR5315_SYSREG_AHB_ERR0 0x0050
81 1.1 gdamore #define AR5315_SYSREG_AHB_ERR1 0x0054
82 1.1 gdamore #define AR5315_SYSREG_AHB_ERR2 0x0058
83 1.1 gdamore #define AR5315_SYSREG_AHB_ERR3 0x005c
84 1.1 gdamore #define AR5315_SYSREG_AHB_ERR4 0x0060
85 1.1 gdamore #define AR5315_SYSREG_PLLC_CTL 0x0064
86 1.1 gdamore #define AR5315_SYSREG_PLLV_CTL 0x0068
87 1.1 gdamore #define AR5315_SYSREG_CPUCLK 0x006c
88 1.1 gdamore #define AR5315_SYSREG_AMBACLK 0x0070
89 1.1 gdamore
90 1.1 gdamore /* Cold resets (AR5315_SYSREG_COLDRESET) */
91 1.1 gdamore #define AR5315_COLD_AHB 0x00000001
92 1.1 gdamore #define AR5315_COLD_APB 0x00000002
93 1.1 gdamore #define AR5315_COLD_CPU 0x00000004
94 1.1 gdamore #define AR5315_COLD_CPU_WARM 0x00000008
95 1.1 gdamore
96 1.1 gdamore /* Resets (AR5315_SYSREG_RESETCTL) */
97 1.1 gdamore #define AR5315_RESET_WARM_WLAN0_MAC 0x00000001
98 1.1 gdamore #define AR5315_RESET_WARM_WLAN0_BB 0x00000002
99 1.1 gdamore #define AR5315_RESET_MPEGTS 0x00000004 /* MPEG-TS */
100 1.1 gdamore #define AR5315_RESET_PCIDMA 0x00000008 /* PCI dma */
101 1.1 gdamore #define AR5315_RESET_MEMCTL 0x00000010
102 1.1 gdamore #define AR5315_RESET_LOCAL 0x00000020 /* local bus */
103 1.1 gdamore #define AR5315_RESET_I2C 0x00000040 /* i2c */
104 1.1 gdamore #define AR5315_RESET_SPI 0x00000080 /* SPI */
105 1.1 gdamore #define AR5315_RESET_UART 0x00000100
106 1.1 gdamore #define AR5315_RESET_IR 0x00000200 /* infrared */
107 1.1 gdamore #define AR5315_RESET_PHY0 0x00000400 /* enet phy */
108 1.1 gdamore #define AR5315_RESET_ENET0 0x00000800
109 1.1 gdamore
110 1.1 gdamore /* Watchdog control (AR5315_SYSREG_WDOG_CTL) */
111 1.1 gdamore #define AR5315_WDOG_CTL_IGNORE 0x0000
112 1.1 gdamore #define AR5315_WDOG_CTL_NMI 0x0001
113 1.1 gdamore #define AR5315_WDOG_CTL_RESET 0x0002
114 1.1 gdamore
115 1.1 gdamore /* AR5315 AHB arbitration control (AR5315_SYSREG_AHB_ARB_CTL) */
116 1.1 gdamore #define AR5315_ARB_CPU 0x00001
117 1.1 gdamore #define AR5315_ARB_WLAN 0x00002
118 1.1 gdamore #define AR5315_ARB_MPEGTS 0x00004
119 1.1 gdamore #define AR5315_ARB_LOCAL 0x00008
120 1.1 gdamore #define AR5315_ARB_PCI 0x00010
121 1.1 gdamore #define AR5315_ARB_ENET 0x00020
122 1.1 gdamore #define AR5315_ARB_RETRY 0x00100
123 1.1 gdamore
124 1.1 gdamore /* AR5315 endianness control (AR5315_SYSREG_ENDIAN) */
125 1.1 gdamore #define AR5315_ENDIAN_AHB 0x00001
126 1.1 gdamore #define AR5315_ENDIAN_WLAN 0x00002
127 1.1 gdamore #define AR5315_ENDIAN_MPEGTS 0x00004
128 1.1 gdamore #define AR5315_ENDIAN_PCI 0x00008
129 1.1 gdamore #define AR5315_ENDIAN_MEMCTL 0x00010
130 1.1 gdamore #define AR5315_ENDIAN_LOCAL 0x00020
131 1.1 gdamore #define AR5315_ENDIAN_ENET 0x00040
132 1.1 gdamore #define AR5315_ENDIAN_MERGE 0x00200
133 1.1 gdamore #define AR5315_ENDIAN_CPU 0x00400
134 1.1 gdamore #define AR5315_ENDIAN_PCIAHB 0x00800
135 1.1 gdamore #define AR5315_ENDIAN_PCIAHB_BRIDGE 0x01000
136 1.1 gdamore #define AR5315_ENDIAN_SPI 0x08000
137 1.1 gdamore #define AR5315_ENDIAN_CPU_DRAM 0x10000
138 1.1 gdamore #define AR5315_ENDIAN_CPU_PCI 0x20000
139 1.1 gdamore #define AR5315_ENDIAN_CPU_MMR 0x40000
140 1.1 gdamore
141 1.1 gdamore /* AR5315 AHB error bits */
142 1.1 gdamore #define AR5315_AHB_ERROR_DET 1 /* error detected */
143 1.1 gdamore #define AR5315_AHB_ERROR_OVR 2 /* AHB overflow */
144 1.1 gdamore #define AR5315_AHB_ERROR_WDT 4 /* wdt (not hresp) */
145 1.1 gdamore
146 1.1 gdamore /* AR5315 clocks */
147 1.1 gdamore #define AR5315_PLLC_REF_DIV(reg) ((reg) & 0x3)
148 1.1 gdamore #define AR5315_PLLC_FB_DIV(reg) (((reg) & 0x7c) >> 2)
149 1.1 gdamore #define AR5315_PLLC_DIV_2(reg) (((reg) & 0x80) >> 7)
150 1.1 gdamore #define AR5315_PLLC_CLKC(reg) (((reg) & 0x1c000) >> 14)
151 1.1 gdamore #define AR5315_PLLC_CLKM(reg) (((reg) & 0x700000) >> 20)
152 1.1 gdamore
153 1.1 gdamore #define AR5315_CLOCKCTL_SELECT(reg) ((reg) & 0x3)
154 1.1 gdamore #define AR5315_CLOCKCTL_DIV(reg) (((reg) & 0xc) >> 2)
155 1.1 gdamore
156 1.1 gdamore /*
157 1.1 gdamore * SDRAMCTL registers -- offset relative to SDRAMCTL
158 1.1 gdamore */
159 1.1 gdamore #define AR531X_SDRAMCTL_MEM_CFG0 0x0000
160 1.1 gdamore #define AR531X_SDRAMCTL_MEM_CFG1 0x0004
161 1.1 gdamore
162 1.1 gdamore /* memory config 1 bits */
163 1.1 gdamore #define AR531X_MEM_CFG1_BANK0_MASK 0x00000700
164 1.1 gdamore #define AR531X_MEM_CFG1_BANK0_SHIFT 8
165 1.1 gdamore #define AR531X_MEM_CFG1_BANK1_MASK 0x00007000
166 1.1 gdamore #define AR531X_MEM_CFG1_BANK1_SHIFT 12
167 1.1 gdamore
168 1.1 gdamore /*
169 1.1 gdamore * PCI configuration stuff. I don't pretend to fully understand these
170 1.1 gdamore * registers, they seem to be magic numbers in the Linux code.
171 1.1 gdamore */
172 1.1 gdamore #define AR5315_PCI_MAC_RC 0x4000
173 1.1 gdamore #define AR5315_PCI_MAC_SCR 0x4004
174 1.1 gdamore #define AR5315_PCI_MAC_INTPEND 0x4008
175 1.1 gdamore #define AR5315_PCI_MAC_SFR 0x400c
176 1.1 gdamore #define AR5315_PCI_MAC_PCICFG 0x4010
177 1.1 gdamore #define AR5315_PCI_MAC_SREV 0x4020
178 1.1 gdamore
179 1.1 gdamore #define PCI_MAC_RC_MAC 0x1
180 1.1 gdamore #define PCI_MAC_RC_BB 0x2
181 1.1 gdamore
182 1.1 gdamore #define PCI_MAC_SCR_SLM_MASK 0x00030000
183 1.1 gdamore #define PCI_MAC_SCR_SLM_FWAKE 0x00000000
184 1.1 gdamore #define PCI_MAC_SCR_SLM_FSLEEP 0x00010000
185 1.1 gdamore #define PCI_MAC_SCR_SLM_NORMAL 0x00020000
186 1.1 gdamore
187 1.1 gdamore #define PCI_MAC_PCICFG_SPWR_DN 0x00010000
188 1.1 gdamore
189 1.1 gdamore /* IRQS */
190 1.1 gdamore #define AR5315_CPU_IRQ_MISC 0
191 1.1 gdamore #define AR5315_CPU_IRQ_WLAN 1
192 1.1 gdamore #define AR5315_CPU_IRQ_ENET 2
193 1.1 gdamore
194 1.1 gdamore #define AR5315_MISC_IRQ_UART 0
195 1.1 gdamore #define AR5315_MISC_IRQ_I2C 1
196 1.1 gdamore #define AR5315_MISC_IRQ_SPI 2
197 1.1 gdamore #define AR5315_MISC_IRQ_AHBE 3
198 1.1 gdamore #define AR5315_MISC_IRQ_AHPE 4
199 1.1 gdamore #define AR5315_MISC_IRQ_TIMER 5
200 1.1 gdamore #define AR5315_MISC_IRQ_GPIO 6
201 1.1 gdamore #define AR5315_MISC_IRQ_WDOG 7
202 1.1 gdamore #define AR5315_MISC_IRQ_IR 8
203 1.1 gdamore
204 1.1 gdamore #endif /* _MIPS_ATHEROS_AR531XREG_H_ */
205