ar5312reg.h revision 1.1 1 1.1 gdamore /* $Id: ar5312reg.h,v 1.1 2006/08/28 07:21:15 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_AR5312REG_H_
44 1.1 gdamore #define _MIPS_ATHEROS_AR5312REG_H_
45 1.1 gdamore
46 1.1 gdamore #define AR5312_MEM0_BASE 0x00000000 /* sdram */
47 1.1 gdamore #define AR5312_MEM1_BASE 0x08000000 /* sdram/flash */
48 1.1 gdamore #define AR5312_MEM3_BASE 0x10000000 /* flash */
49 1.1 gdamore #define AR5312_WLAN0_BASE 0x18000000
50 1.1 gdamore #define AR5312_ENET0_BASE 0x18100000
51 1.1 gdamore #define AR5312_ENET1_BASE 0x18200000
52 1.1 gdamore #define AR5312_SDRAMCTL_BASE 0x18300000
53 1.1 gdamore #define AR5312_FLASHCTL_BASE 0x18400000
54 1.1 gdamore #define AR5312_WLAN1_BASE 0x18500000
55 1.1 gdamore #define AR5312_UART0_BASE 0x1C000000 /* high speed */
56 1.1 gdamore #define AR5312_UART1_BASE 0x1C001000
57 1.1 gdamore #define AR5312_GPIO_BASE 0x1C002000
58 1.1 gdamore #define AR5312_SYSREG_BASE 0x1C003000
59 1.1 gdamore #define AR5312_UARTDMA_BASE 0x1C004000
60 1.1 gdamore #define AR5312_FLASH_BASE 0x1E000000
61 1.1 gdamore #define AR5312_FLASH_END 0x20000000 /* possibly aliased */
62 1.1 gdamore
63 1.1 gdamore /*
64 1.1 gdamore * FLASHCTL registers -- offset relative to AR531X_FLASHCTL_BASE
65 1.1 gdamore */
66 1.1 gdamore #define AR5312_FLASHCTL_0 0x00
67 1.1 gdamore #define AR5312_FLASHCTL_1 0x04
68 1.1 gdamore #define AR5312_FLASHCTL_2 0x08
69 1.1 gdamore
70 1.1 gdamore #define AR5312_FLASHCTL_IDCY_MASK 0xf /* idle cycle turn */
71 1.1 gdamore #define AR5312_FLASHCTL_IDCY_SHIFT 0
72 1.1 gdamore #define AR5312_FLASHCTL_WST1_MASK 0x3e0 /* wait state 1 */
73 1.1 gdamore #define AR5312_FLASHCTL_WST1_SHIFT 5
74 1.1 gdamore #define AR5312_FLASHCTL_WST2_MASK 0xf800 /* wait state 1 */
75 1.1 gdamore #define AR5312_FLASHCTL_WST2_SHIFT 11
76 1.1 gdamore #define AR5312_FLASHCTL_RBLE 0x00000400 /* rd byte enable */
77 1.1 gdamore #define AR5312_FLASHCTL_AC_MASK 0x00070000 /* addr chk */
78 1.1 gdamore #define AR5312_FLASHCTL_AC_SHIFT 16
79 1.1 gdamore #define AR5312_FLASHCTL_AC_128K 0x00000000
80 1.1 gdamore #define AR5312_FLASHCTL_AC_256K 0x00010000
81 1.1 gdamore #define AR5312_FLASHCTL_AC_512K 0x00020000
82 1.1 gdamore #define AR5312_FLASHCTL_AC_1M 0x00030000
83 1.1 gdamore #define AR5312_FLASHCTL_AC_2M 0x00040000
84 1.1 gdamore #define AR5312_FLASHCTL_AC_4M 0x00050000
85 1.1 gdamore #define AR5312_FLASHCTL_AC_8M 0x00060000
86 1.1 gdamore #define AR5312_FLASHCTL_AC_16M 0x00070000
87 1.1 gdamore #define AR5312_FLASHCTL_E 0x00080000 /* enable */
88 1.1 gdamore #define AR5312_FLASHCTL_MW_MASK 0x30000000 /* mem width */
89 1.1 gdamore
90 1.1 gdamore /*
91 1.1 gdamore * SYSREG registers -- offset relative to AR531X_SYSREG_BASE
92 1.1 gdamore */
93 1.1 gdamore #define AR5312_SYSREG_TIMER 0x0000
94 1.1 gdamore #define AR5312_SYSREG_TIMER_RELOAD 0x0004
95 1.1 gdamore #define AR5312_SYSREG_WDOG_CTL 0x0008
96 1.1 gdamore #define AR5312_SYSREG_WDOG_TIMER 0x000c
97 1.1 gdamore #define AR5312_SYSREG_MISC_INTSTAT 0x0010
98 1.1 gdamore #define AR5312_SYSREG_MISC_INTMASK 0x0014
99 1.1 gdamore #define AR5312_SYSREG_INTSTAT 0x0018
100 1.1 gdamore #define AR5312_SYSREG_RESETCTL 0x0020
101 1.1 gdamore #define AR5312_SYSREG_CLOCKCTL 0x0064
102 1.1 gdamore #define AR5312_SYSREG_SCRATCH 0x006c
103 1.1 gdamore #define AR5312_SYSREG_AHBPERR 0x0070
104 1.1 gdamore #define AR5312_SYSREG_AHBDMAE 0x0078
105 1.1 gdamore #define AR5312_SYSREG_ENABLE 0x0080
106 1.1 gdamore #define AR5312_SYSREG_REVISION 0x0090
107 1.1 gdamore
108 1.1 gdamore /* WDOG_CTL watchdog control bits */
109 1.1 gdamore #define AR5312_WDOG_CTL_IGNORE 0x0000
110 1.1 gdamore #define AR5312_WDOG_CTL_NMI 0x0001
111 1.1 gdamore #define AR5312_WDOG_CTL_RESET 0x0002
112 1.1 gdamore
113 1.1 gdamore /* Resets */
114 1.1 gdamore #define AR5312_RESET_SYSTEM 0x00000001
115 1.1 gdamore #define AR5312_RESET_CPU 0x00000002
116 1.1 gdamore #define AR5312_RESET_WLAN0 0x00000004 /* mac & bb */
117 1.1 gdamore #define AR5312_RESET_PHY0 0x00000008 /* enet phy */
118 1.1 gdamore #define AR5312_RESET_PHY1 0x00000010 /* enet phy */
119 1.1 gdamore #define AR5312_RESET_ENET0 0x00000020 /* mac */
120 1.1 gdamore #define AR5312_RESET_ENET1 0x00000040 /* mac */
121 1.1 gdamore #define AR5312_RESET_UART0 0x00000100 /* mac */
122 1.1 gdamore #define AR5312_RESET_WLAN1 0x00000200 /* mac & bb */
123 1.1 gdamore #define AR5312_RESET_APB 0x00000400 /* bridge */
124 1.1 gdamore #define AR5312_RESET_WARM_CPU 0x00001000
125 1.1 gdamore #define AR5312_RESET_WARM_WLAN0_MAC 0x00002000
126 1.1 gdamore #define AR5312_RESET_WARM_WLAN0_BB 0x00004000
127 1.1 gdamore #define AR5312_RESET_NMI 0x00010000
128 1.1 gdamore #define AR5312_RESET_WARM_WLAN1_MAC 0x00020000
129 1.1 gdamore #define AR5312_RESET_WARM_WLAN1_BB 0x00040000
130 1.1 gdamore #define AR5312_RESET_LOCAL_BUS 0x00080000
131 1.1 gdamore #define AR5312_RESET_WDOG 0x00100000
132 1.1 gdamore
133 1.1 gdamore /* AR5312/2312 clockctl bits */
134 1.1 gdamore #define AR5312_CLOCKCTL_PREDIVIDE_MASK 0x00000030
135 1.1 gdamore #define AR5312_CLOCKCTL_PREDIVIDE_SHIFT 4
136 1.1 gdamore #define AR5312_CLOCKCTL_MULTIPLIER_MASK 0x00001f00
137 1.1 gdamore #define AR5312_CLOCKCTL_MULTIPLIER_SHIFT 8
138 1.1 gdamore #define AR5312_CLOCKCTL_DOUBLER_MASK 0x00010000
139 1.1 gdamore
140 1.1 gdamore /* AR2313 clockctl */
141 1.1 gdamore #define AR2313_CLOCKCTL_PREDIVIDE_MASK 0x00003000
142 1.1 gdamore #define AR2313_CLOCKCTL_PREDIVIDE_SHIFT 12
143 1.1 gdamore #define AR2313_CLOCKCTL_MULTIPLIER_MASK 0x001f0000
144 1.1 gdamore #define AR2313_CLOCKCTL_MULTIPLIER_SHIFT 16
145 1.1 gdamore #define AR2313_CLOCKCTL_DOUBLER_MASK 0x00000000
146 1.1 gdamore
147 1.1 gdamore /* Enables */
148 1.1 gdamore #define AR5312_ENABLE_WLAN0 0x0001
149 1.1 gdamore #define AR5312_ENABLE_ENET0 0x0002
150 1.1 gdamore #define AR5312_ENABLE_ENET1 0x0004
151 1.1 gdamore #define AR5312_ENABLE_WLAN1 0x0018 /* both DMA and PIO */
152 1.1 gdamore
153 1.1 gdamore /* Revision ids */
154 1.1 gdamore #define AR5312_REVISION_WMAC_MAJOR(x) (((x) >> 12) & 0xf)
155 1.1 gdamore #define AR5312_REVISION_WMAC_MINOR(x) (((x) >> 8) & 0xf)
156 1.1 gdamore #define AR5312_REVISION_WMAC(x) (((x) >> 8) & 0xff)
157 1.1 gdamore #define AR5312_REVISION_MAJOR(x) (((x) >> 4) & 0xf)
158 1.1 gdamore #define AR5312_REVISION_MINOR(x) (((x) >> 0) & 0xf)
159 1.1 gdamore
160 1.1 gdamore #define AR5312_REVISION_MAJ_AR5311 0x1
161 1.1 gdamore #define AR5312_REVISION_MAJ_AR5312 0x4
162 1.1 gdamore #define AR5312_REVISION_MAJ_AR2313 0x5
163 1.1 gdamore #define AR5312_REVISION_MAJ_AR5315 0xB
164 1.1 gdamore
165 1.1 gdamore /*
166 1.1 gdamore * SDRAMCTL registers -- offset relative to SDRAMCTL
167 1.1 gdamore */
168 1.1 gdamore #define AR5312_SDRAMCTL_MEM_CFG0 0x0000
169 1.1 gdamore #define AR5312_SDRAMCTL_MEM_CFG1 0x0004
170 1.1 gdamore
171 1.1 gdamore /* memory config 1 bits */
172 1.1 gdamore #define AR5312_MEM_CFG1_BANK0_MASK 0x00000700
173 1.1 gdamore #define AR5312_MEM_CFG1_BANK0_SHIFT 8
174 1.1 gdamore #define AR5312_MEM_CFG1_BANK1_MASK 0x00007000
175 1.1 gdamore #define AR5312_MEM_CFG1_BANK1_SHIFT 12
176 1.1 gdamore
177 1.1 gdamore /* helper macro for accessing system registers without bus space */
178 1.1 gdamore #define REGVAL(x) *((volatile uint32_t *)(MIPS_PHYS_TO_KSEG1((x))))
179 1.1 gdamore #define GETSYSREG(x) REGVAL((x) + AR5312_SYSREG_BASE)
180 1.1 gdamore #define PUTSYSREG(x,v) (REGVAL((x) + AR5312_SYSREG_BASE)) = (v)
181 1.1 gdamore #define GETSDRAMREG(x) REGVAL((x) + AR5312_SDRAMCTL_BASE)
182 1.1 gdamore #define PUTSDRAMREG(x,v) (REGVAL((x) + AR5312_SDRAMCTL_BASE)) = (v)
183 1.1 gdamore
184 1.1 gdamore /*
185 1.1 gdamore * Board data. This is located in flash somewhere, ar531x_board_info
186 1.1 gdamore * locates it.
187 1.1 gdamore */
188 1.1 gdamore #include <contrib/dev/ath/ah_soc.h> /* XXX really doesn't belong in hal */
189 1.1 gdamore
190 1.1 gdamore /* XXX write-around for now */
191 1.1 gdamore #define AR5312_BOARD_MAGIC AR531X_BD_MAGIC
192 1.1 gdamore
193 1.1 gdamore /* config bits */
194 1.1 gdamore #define AR5312_BOARD_CONFIG_ENET0 BD_ENET0
195 1.1 gdamore #define AR5312_BOARD_CONFIG_ENET1 BD_ENET1
196 1.1 gdamore #define AR5312_BOARD_CONFIG_UART1 BD_UART1
197 1.1 gdamore #define AR5312_BOARD_CONFIG_UART0 BD_UART0
198 1.1 gdamore #define AR5312_BOARD_CONFIG_RSTFACTORY BD_RSTFACTORY
199 1.1 gdamore #define AR5312_BOARD_CONFIG_SYSLED BD_SYSLED
200 1.1 gdamore #define AR5312_BOARD_CONFIG_EXTUARTCLK BD_EXTUARTCLK
201 1.1 gdamore #define AR5312_BOARD_CONFIG_CPUFREQ BD_CPUFREQ
202 1.1 gdamore #define AR5312_BOARD_CONFIG_SYSFREQ BD_SYSFREQ
203 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN0 BD_WLAN0
204 1.1 gdamore #define AR5312_BOARD_CONFIG_MEMCAP BD_MEMCAP
205 1.1 gdamore #define AR5312_BOARD_CONFIG_DISWDOG BD_DISWATCHDOG
206 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN1 BD_WLAN1
207 1.1 gdamore #define AR5312_BOARD_CONFIG_AR2312 BD_ISCASPER
208 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN0_2G BD_WLAN0_2G_EN
209 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN0_5G BD_WLAN0_5G_EN
210 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN1_2G BD_WLAN1_2G_EN
211 1.1 gdamore #define AR5312_BOARD_CONFIG_WLAN1_5G BD_WLAN1_5G_EN
212 1.1 gdamore
213 1.1 gdamore #endif /* _MIPS_ATHEROS_AR531XREG_H_ */
214