79e53b34609252916d9dad5a89e3594d2c5d5a31
[openwrt/openwrt.git] / target / linux / ar71xx / patches-3.14 / 601-MIPS-ath79-add-more-register-defines.patch
1 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
2 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
3 @@ -20,6 +20,10 @@
4 #include <linux/bitops.h>
5
6 #define AR71XX_APB_BASE 0x18000000
7 +#define AR71XX_GE0_BASE 0x19000000
8 +#define AR71XX_GE0_SIZE 0x10000
9 +#define AR71XX_GE1_BASE 0x1a000000
10 +#define AR71XX_GE1_SIZE 0x10000
11 #define AR71XX_EHCI_BASE 0x1b000000
12 #define AR71XX_EHCI_SIZE 0x1000
13 #define AR71XX_OHCI_BASE 0x1c000000
14 @@ -39,6 +43,8 @@
15 #define AR71XX_PLL_SIZE 0x100
16 #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
17 #define AR71XX_RESET_SIZE 0x100
18 +#define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000)
19 +#define AR71XX_MII_SIZE 0x100
20
21 #define AR71XX_PCI_MEM_BASE 0x10000000
22 #define AR71XX_PCI_MEM_SIZE 0x07000000
23 @@ -81,15 +87,21 @@
24
25 #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
26 #define AR933X_UART_SIZE 0x14
27 +#define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
28 +#define AR933X_GMAC_SIZE 0x04
29 #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
30 #define AR933X_WMAC_SIZE 0x20000
31 #define AR933X_EHCI_BASE 0x1b000000
32 #define AR933X_EHCI_SIZE 0x1000
33
34 +#define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
35 +#define AR934X_GMAC_SIZE 0x14
36 #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
37 #define AR934X_WMAC_SIZE 0x20000
38 #define AR934X_EHCI_BASE 0x1b000000
39 #define AR934X_EHCI_SIZE 0x200
40 +#define AR934X_NFC_BASE 0x1b000200
41 +#define AR934X_NFC_SIZE 0xb8
42 #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
43 #define AR934X_SRIF_SIZE 0x1000
44
45 @@ -106,11 +118,15 @@
46 #define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
47 #define QCA955X_PCI_CTRL_SIZE 0x100
48
49 +#define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
50 +#define QCA955X_GMAC_SIZE 0x40
51 #define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
52 #define QCA955X_WMAC_SIZE 0x20000
53 #define QCA955X_EHCI0_BASE 0x1b000000
54 #define QCA955X_EHCI1_BASE 0x1b400000
55 #define QCA955X_EHCI_SIZE 0x1000
56 +#define QCA955X_NFC_BASE 0x1b800200
57 +#define QCA955X_NFC_SIZE 0xb8
58
59 #define AR9300_OTP_BASE 0x14000
60 #define AR9300_OTP_STATUS 0x15f18
61 @@ -174,6 +190,9 @@
62 #define AR71XX_AHB_DIV_SHIFT 20
63 #define AR71XX_AHB_DIV_MASK 0x7
64
65 +#define AR71XX_ETH0_PLL_SHIFT 17
66 +#define AR71XX_ETH1_PLL_SHIFT 19
67 +
68 #define AR724X_PLL_REG_CPU_CONFIG 0x00
69 #define AR724X_PLL_REG_PCIE_CONFIG 0x18
70
71 @@ -186,6 +205,8 @@
72 #define AR724X_DDR_DIV_SHIFT 22
73 #define AR724X_DDR_DIV_MASK 0x3
74
75 +#define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c
76 +
77 #define AR913X_PLL_REG_CPU_CONFIG 0x00
78 #define AR913X_PLL_REG_ETH_CONFIG 0x04
79 #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14
80 @@ -198,6 +219,9 @@
81 #define AR913X_AHB_DIV_SHIFT 19
82 #define AR913X_AHB_DIV_MASK 0x1
83
84 +#define AR913X_ETH0_PLL_SHIFT 20
85 +#define AR913X_ETH1_PLL_SHIFT 22
86 +
87 #define AR933X_PLL_CPU_CONFIG_REG 0x00
88 #define AR933X_PLL_CLOCK_CTRL_REG 0x08
89
90 @@ -219,6 +243,8 @@
91 #define AR934X_PLL_CPU_CONFIG_REG 0x00
92 #define AR934X_PLL_DDR_CONFIG_REG 0x04
93 #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08
94 +#define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
95 +#define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c
96
97 #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
98 #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
99 @@ -251,9 +277,13 @@
100 #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
101 #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
102
103 +#define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6)
104 +
105 #define QCA955X_PLL_CPU_CONFIG_REG 0x00
106 #define QCA955X_PLL_DDR_CONFIG_REG 0x04
107 #define QCA955X_PLL_CLK_CTRL_REG 0x08
108 +#define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
109 +#define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
110
111 #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
112 #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
113 @@ -378,16 +408,83 @@
114 #define AR913X_RESET_USB_HOST BIT(5)
115 #define AR913X_RESET_USB_PHY BIT(4)
116
117 +#define AR933X_RESET_GE1_MDIO BIT(23)
118 +#define AR933X_RESET_GE0_MDIO BIT(22)
119 +#define AR933X_RESET_GE1_MAC BIT(13)
120 #define AR933X_RESET_WMAC BIT(11)
121 +#define AR933X_RESET_GE0_MAC BIT(9)
122 #define AR933X_RESET_USB_HOST BIT(5)
123 #define AR933X_RESET_USB_PHY BIT(4)
124 #define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
125
126 +#define AR934X_RESET_HOST BIT(31)
127 +#define AR934X_RESET_SLIC BIT(30)
128 +#define AR934X_RESET_HDMA BIT(29)
129 +#define AR934X_RESET_EXTERNAL BIT(28)
130 +#define AR934X_RESET_RTC BIT(27)
131 +#define AR934X_RESET_PCIE_EP_INT BIT(26)
132 +#define AR934X_RESET_CHKSUM_ACC BIT(25)
133 +#define AR934X_RESET_FULL_CHIP BIT(24)
134 +#define AR934X_RESET_GE1_MDIO BIT(23)
135 +#define AR934X_RESET_GE0_MDIO BIT(22)
136 +#define AR934X_RESET_CPU_NMI BIT(21)
137 +#define AR934X_RESET_CPU_COLD BIT(20)
138 +#define AR934X_RESET_HOST_RESET_INT BIT(19)
139 +#define AR934X_RESET_PCIE_EP BIT(18)
140 +#define AR934X_RESET_UART1 BIT(17)
141 +#define AR934X_RESET_DDR BIT(16)
142 +#define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
143 +#define AR934X_RESET_NANDF BIT(14)
144 +#define AR934X_RESET_GE1_MAC BIT(13)
145 +#define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12)
146 #define AR934X_RESET_USB_PHY_ANALOG BIT(11)
147 +#define AR934X_RESET_HOST_DMA_INT BIT(10)
148 +#define AR934X_RESET_GE0_MAC BIT(9)
149 +#define AR934X_RESET_ETH_SWITCH BIT(8)
150 +#define AR934X_RESET_PCIE_PHY BIT(7)
151 +#define AR934X_RESET_PCIE BIT(6)
152 #define AR934X_RESET_USB_HOST BIT(5)
153 #define AR934X_RESET_USB_PHY BIT(4)
154 #define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
155 +#define AR934X_RESET_LUT BIT(2)
156 +#define AR934X_RESET_MBOX BIT(1)
157 +#define AR934X_RESET_I2S BIT(0)
158 +
159 +#define QCA955X_RESET_HOST BIT(31)
160 +#define QCA955X_RESET_SLIC BIT(30)
161 +#define QCA955X_RESET_HDMA BIT(29)
162 +#define QCA955X_RESET_EXTERNAL BIT(28)
163 +#define QCA955X_RESET_RTC BIT(27)
164 +#define QCA955X_RESET_PCIE_EP_INT BIT(26)
165 +#define QCA955X_RESET_CHKSUM_ACC BIT(25)
166 +#define QCA955X_RESET_FULL_CHIP BIT(24)
167 +#define QCA955X_RESET_GE1_MDIO BIT(23)
168 +#define QCA955X_RESET_GE0_MDIO BIT(22)
169 +#define QCA955X_RESET_CPU_NMI BIT(21)
170 +#define QCA955X_RESET_CPU_COLD BIT(20)
171 +#define QCA955X_RESET_HOST_RESET_INT BIT(19)
172 +#define QCA955X_RESET_PCIE_EP BIT(18)
173 +#define QCA955X_RESET_UART1 BIT(17)
174 +#define QCA955X_RESET_DDR BIT(16)
175 +#define QCA955X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
176 +#define QCA955X_RESET_NANDF BIT(14)
177 +#define QCA955X_RESET_GE1_MAC BIT(13)
178 +#define QCA955X_RESET_SGMII_ANALOG BIT(12)
179 +#define QCA955X_RESET_USB_PHY_ANALOG BIT(11)
180 +#define QCA955X_RESET_HOST_DMA_INT BIT(10)
181 +#define QCA955X_RESET_GE0_MAC BIT(9)
182 +#define QCA955X_RESET_SGMII BIT(8)
183 +#define QCA955X_RESET_PCIE_PHY BIT(7)
184 +#define QCA955X_RESET_PCIE BIT(6)
185 +#define QCA955X_RESET_USB_HOST BIT(5)
186 +#define QCA955X_RESET_USB_PHY BIT(4)
187 +#define QCA955X_RESET_USBSUS_OVERRIDE BIT(3)
188 +#define QCA955X_RESET_LUT BIT(2)
189 +#define QCA955X_RESET_MBOX BIT(1)
190 +#define QCA955X_RESET_I2S BIT(0)
191
192 +#define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18)
193 +#define AR933X_BOOTSTRAP_EEPBUSY BIT(4)
194 #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
195
196 #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
197 @@ -529,6 +626,12 @@
198 #define AR71XX_GPIO_REG_INT_ENABLE 0x24
199 #define AR71XX_GPIO_REG_FUNC 0x28
200
201 +#define AR934X_GPIO_REG_OUT_FUNC0 0x2c
202 +#define AR934X_GPIO_REG_OUT_FUNC1 0x30
203 +#define AR934X_GPIO_REG_OUT_FUNC2 0x34
204 +#define AR934X_GPIO_REG_OUT_FUNC3 0x38
205 +#define AR934X_GPIO_REG_OUT_FUNC4 0x3c
206 +#define AR934X_GPIO_REG_OUT_FUNC5 0x40
207 #define AR934X_GPIO_REG_FUNC 0x6c
208
209 #define AR71XX_GPIO_COUNT 16
210 @@ -560,4 +663,148 @@
211 #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13
212 #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7
213
214 +#define AR71XX_GPIO_FUNC_STEREO_EN BIT(17)
215 +#define AR71XX_GPIO_FUNC_SLIC_EN BIT(16)
216 +#define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13)
217 +#define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12)
218 +#define AR71XX_GPIO_FUNC_UART_EN BIT(8)
219 +#define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4)
220 +#define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0)
221 +
222 +#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19)
223 +#define AR724X_GPIO_FUNC_SPI_EN BIT(18)
224 +#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
225 +#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
226 +#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12)
227 +#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11)
228 +#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10)
229 +#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9)
230 +#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8)
231 +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
232 +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
233 +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
234 +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
235 +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
236 +#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
237 +#define AR724X_GPIO_FUNC_UART_EN BIT(1)
238 +#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)
239 +
240 +#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22)
241 +#define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21)
242 +#define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20)
243 +#define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19)
244 +#define AR913X_GPIO_FUNC_I2S1_EN BIT(18)
245 +#define AR913X_GPIO_FUNC_I2S0_EN BIT(17)
246 +#define AR913X_GPIO_FUNC_SLIC_EN BIT(16)
247 +#define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9)
248 +#define AR913X_GPIO_FUNC_UART_EN BIT(8)
249 +#define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4)
250 +
251 +#define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31)
252 +#define AR933X_GPIO_FUNC_SPDIF_EN BIT(30)
253 +#define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29)
254 +#define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27)
255 +#define AR933X_GPIO_FUNC_I2SO_EN BIT(26)
256 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25)
257 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24)
258 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23)
259 +#define AR933X_GPIO_FUNC_SPI_EN BIT(18)
260 +#define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
261 +#define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
262 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
263 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
264 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
265 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
266 +#define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
267 +#define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
268 +#define AR933X_GPIO_FUNC_UART_EN BIT(1)
269 +#define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0)
270 +
271 +#define AR934X_GPIO_FUNC_CLK_OBS7_EN BIT(9)
272 +#define AR934X_GPIO_FUNC_CLK_OBS6_EN BIT(8)
273 +#define AR934X_GPIO_FUNC_CLK_OBS5_EN BIT(7)
274 +#define AR934X_GPIO_FUNC_CLK_OBS4_EN BIT(6)
275 +#define AR934X_GPIO_FUNC_CLK_OBS3_EN BIT(5)
276 +#define AR934X_GPIO_FUNC_CLK_OBS2_EN BIT(4)
277 +#define AR934X_GPIO_FUNC_CLK_OBS1_EN BIT(3)
278 +#define AR934X_GPIO_FUNC_CLK_OBS0_EN BIT(2)
279 +#define AR934X_GPIO_FUNC_JTAG_DISABLE BIT(1)
280 +
281 +#define AR934X_GPIO_OUT_GPIO 0
282 +#define AR934X_GPIO_OUT_LED_LINK0 41
283 +#define AR934X_GPIO_OUT_LED_LINK1 42
284 +#define AR934X_GPIO_OUT_LED_LINK2 43
285 +#define AR934X_GPIO_OUT_LED_LINK3 44
286 +#define AR934X_GPIO_OUT_LED_LINK4 45
287 +#define AR934X_GPIO_OUT_EXT_LNA0 46
288 +#define AR934X_GPIO_OUT_EXT_LNA1 47
289 +
290 +/*
291 + * MII_CTRL block
292 + */
293 +#define AR71XX_MII_REG_MII0_CTRL 0x00
294 +#define AR71XX_MII_REG_MII1_CTRL 0x04
295 +
296 +#define AR71XX_MII_CTRL_IF_MASK 3
297 +#define AR71XX_MII_CTRL_SPEED_SHIFT 4
298 +#define AR71XX_MII_CTRL_SPEED_MASK 3
299 +#define AR71XX_MII_CTRL_SPEED_10 0
300 +#define AR71XX_MII_CTRL_SPEED_100 1
301 +#define AR71XX_MII_CTRL_SPEED_1000 2
302 +
303 +#define AR71XX_MII0_CTRL_IF_GMII 0
304 +#define AR71XX_MII0_CTRL_IF_MII 1
305 +#define AR71XX_MII0_CTRL_IF_RGMII 2
306 +#define AR71XX_MII0_CTRL_IF_RMII 3
307 +
308 +#define AR71XX_MII1_CTRL_IF_RGMII 0
309 +#define AR71XX_MII1_CTRL_IF_RMII 1
310 +
311 +/*
312 + * AR933X GMAC interface
313 + */
314 +#define AR933X_GMAC_REG_ETH_CFG 0x00
315 +
316 +#define AR933X_ETH_CFG_RGMII_GE0 BIT(0)
317 +#define AR933X_ETH_CFG_MII_GE0 BIT(1)
318 +#define AR933X_ETH_CFG_GMII_GE0 BIT(2)
319 +#define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3)
320 +#define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4)
321 +#define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5)
322 +#define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7)
323 +#define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8)
324 +#define AR933X_ETH_CFG_RMII_GE0 BIT(9)
325 +#define AR933X_ETH_CFG_RMII_GE0_SPD_10 0
326 +#define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10)
327 +
328 +/*
329 + * AR934X GMAC Interface
330 + */
331 +#define AR934X_GMAC_REG_ETH_CFG 0x00
332 +
333 +#define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0)
334 +#define AR934X_ETH_CFG_MII_GMAC0 BIT(1)
335 +#define AR934X_ETH_CFG_GMII_GMAC0 BIT(2)
336 +#define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3)
337 +#define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4)
338 +#define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5)
339 +#define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6)
340 +#define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7)
341 +#define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9)
342 +#define AR934X_ETH_CFG_RMII_GMAC0 BIT(10)
343 +#define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11)
344 +#define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12)
345 +#define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
346 +#define AR934X_ETH_CFG_RXD_DELAY BIT(14)
347 +#define AR934X_ETH_CFG_RDV_DELAY BIT(16)
348 +
349 +/*
350 + * QCA955X GMAC Interface
351 + */
352 +
353 +#define QCA955X_GMAC_REG_ETH_CFG 0x00
354 +
355 +#define QCA955X_ETH_CFG_RGMII_EN BIT(0)
356 +#define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
357 +
358 #endif /* __ASM_MACH_AR71XX_REGS_H */