2 * Atheros AR71xx SoC specific definitions
4 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 * Parts of this file are based on Atheros 2.6.15 BSP
9 * Parts of this file are based on Atheros 2.6.31 BSP
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
16 #ifndef __ASM_MACH_AR71XX_H
17 #define __ASM_MACH_AR71XX_H
19 #include <linux/types.h>
20 #include <linux/init.h>
22 #include <linux/bitops.h>
26 #define AR71XX_PCI_MEM_BASE 0x10000000
27 #define AR71XX_PCI_MEM_SIZE 0x08000000
28 #define AR71XX_APB_BASE 0x18000000
29 #define AR71XX_GE0_BASE 0x19000000
30 #define AR71XX_GE0_SIZE 0x01000000
31 #define AR71XX_GE1_BASE 0x1a000000
32 #define AR71XX_GE1_SIZE 0x01000000
33 #define AR71XX_EHCI_BASE 0x1b000000
34 #define AR71XX_EHCI_SIZE 0x01000000
35 #define AR71XX_OHCI_BASE 0x1c000000
36 #define AR71XX_OHCI_SIZE 0x01000000
37 #define AR7240_OHCI_BASE 0x1b000000
38 #define AR7240_OHCI_SIZE 0x01000000
39 #define AR71XX_SPI_BASE 0x1f000000
40 #define AR71XX_SPI_SIZE 0x01000000
42 #define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000)
43 #define AR71XX_DDR_CTRL_SIZE 0x10000
44 #define AR71XX_CPU_BASE (AR71XX_APB_BASE + 0x00010000)
45 #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
46 #define AR71XX_UART_SIZE 0x10000
47 #define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
48 #define AR71XX_USB_CTRL_SIZE 0x10000
49 #define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000)
50 #define AR71XX_GPIO_SIZE 0x10000
51 #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
52 #define AR71XX_PLL_SIZE 0x10000
53 #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
54 #define AR71XX_RESET_SIZE 0x10000
55 #define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000)
56 #define AR71XX_MII_SIZE 0x10000
57 #define AR71XX_SLIC_BASE (AR71XX_APB_BASE + 0x00090000)
58 #define AR71XX_SLIC_SIZE 0x10000
59 #define AR71XX_DMA_BASE (AR71XX_APB_BASE + 0x000A0000)
60 #define AR71XX_DMA_SIZE 0x10000
61 #define AR71XX_STEREO_BASE (AR71XX_APB_BASE + 0x000B0000)
62 #define AR71XX_STEREO_SIZE 0x10000
64 #define AR724X_PCI_CRP_BASE (AR71XX_APB_BASE + 0x000C0000)
65 #define AR724X_PCI_CRP_SIZE 0x100
67 #define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000F0000)
68 #define AR724X_PCI_CTRL_SIZE 0x100
70 #define AR91XX_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000)
71 #define AR91XX_WMAC_SIZE 0x30000
73 #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
74 #define AR933X_UART_SIZE 0x14
75 #define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
76 #define AR933X_GMAC_SIZE 0x04
77 #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
78 #define AR933X_WMAC_SIZE 0x20000
80 #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
81 #define AR934X_WMAC_SIZE 0x20000
83 #define AR71XX_MEM_SIZE_MIN 0x0200000
84 #define AR71XX_MEM_SIZE_MAX 0x10000000
86 #define AR71XX_CPU_IRQ_BASE 0
87 #define AR71XX_MISC_IRQ_BASE 8
88 #define AR71XX_MISC_IRQ_COUNT 32
89 #define AR71XX_GPIO_IRQ_BASE 40
90 #define AR71XX_GPIO_IRQ_COUNT 32
91 #define AR71XX_PCI_IRQ_BASE 72
92 #define AR71XX_PCI_IRQ_COUNT 6
93 #define AR934X_IP2_IRQ_BASE 78
94 #define AR934X_IP2_IRQ_COUNT 2
96 #define AR71XX_CPU_IRQ_IP2 (AR71XX_CPU_IRQ_BASE + 2)
97 #define AR71XX_CPU_IRQ_USB (AR71XX_CPU_IRQ_BASE + 3)
98 #define AR71XX_CPU_IRQ_GE0 (AR71XX_CPU_IRQ_BASE + 4)
99 #define AR71XX_CPU_IRQ_GE1 (AR71XX_CPU_IRQ_BASE + 5)
100 #define AR71XX_CPU_IRQ_MISC (AR71XX_CPU_IRQ_BASE + 6)
101 #define AR71XX_CPU_IRQ_TIMER (AR71XX_CPU_IRQ_BASE + 7)
103 #define AR71XX_MISC_IRQ_TIMER (AR71XX_MISC_IRQ_BASE + 0)
104 #define AR71XX_MISC_IRQ_ERROR (AR71XX_MISC_IRQ_BASE + 1)
105 #define AR71XX_MISC_IRQ_GPIO (AR71XX_MISC_IRQ_BASE + 2)
106 #define AR71XX_MISC_IRQ_UART (AR71XX_MISC_IRQ_BASE + 3)
107 #define AR71XX_MISC_IRQ_WDOG (AR71XX_MISC_IRQ_BASE + 4)
108 #define AR71XX_MISC_IRQ_PERFC (AR71XX_MISC_IRQ_BASE + 5)
109 #define AR71XX_MISC_IRQ_OHCI (AR71XX_MISC_IRQ_BASE + 6)
110 #define AR71XX_MISC_IRQ_DMA (AR71XX_MISC_IRQ_BASE + 7)
111 #define AR71XX_MISC_IRQ_TIMER2 (AR71XX_MISC_IRQ_BASE + 8)
112 #define AR71XX_MISC_IRQ_TIMER3 (AR71XX_MISC_IRQ_BASE + 9)
113 #define AR71XX_MISC_IRQ_TIMER4 (AR71XX_MISC_IRQ_BASE + 10)
114 #define AR71XX_MISC_IRQ_DDR_PERF (AR71XX_MISC_IRQ_BASE + 11)
115 #define AR71XX_MISC_IRQ_ENET_LINK (AR71XX_MISC_IRQ_BASE + 12)
117 #define AR71XX_GPIO_IRQ(_x) (AR71XX_GPIO_IRQ_BASE + (_x))
119 #define AR71XX_PCI_IRQ_DEV0 (AR71XX_PCI_IRQ_BASE + 0)
120 #define AR71XX_PCI_IRQ_DEV1 (AR71XX_PCI_IRQ_BASE + 1)
121 #define AR71XX_PCI_IRQ_DEV2 (AR71XX_PCI_IRQ_BASE + 2)
122 #define AR71XX_PCI_IRQ_CORE (AR71XX_PCI_IRQ_BASE + 4)
124 #define AR934X_IP2_IRQ_WMAC (AR934X_IP2_IRQ_BASE + 0)
125 #define AR934X_IP2_IRQ_PCIE (AR934X_IP2_IRQ_BASE + 1)
127 extern u32 ar71xx_ahb_freq
;
128 extern u32 ar71xx_cpu_freq
;
129 extern u32 ar71xx_ddr_freq
;
130 extern u32 ar71xx_ref_freq
;
132 enum ar71xx_soc_type
{
148 extern u32 ar71xx_soc_rev
;
150 extern enum ar71xx_soc_type ar71xx_soc
;
155 #define AR71XX_PLL_REG_CPU_CONFIG 0x00
156 #define AR71XX_PLL_REG_SEC_CONFIG 0x04
157 #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10
158 #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14
160 #define AR71XX_PLL_DIV_SHIFT 3
161 #define AR71XX_PLL_DIV_MASK 0x1f
162 #define AR71XX_CPU_DIV_SHIFT 16
163 #define AR71XX_CPU_DIV_MASK 0x3
164 #define AR71XX_DDR_DIV_SHIFT 18
165 #define AR71XX_DDR_DIV_MASK 0x3
166 #define AR71XX_AHB_DIV_SHIFT 20
167 #define AR71XX_AHB_DIV_MASK 0x7
169 #define AR71XX_ETH0_PLL_SHIFT 17
170 #define AR71XX_ETH1_PLL_SHIFT 19
172 #define AR724X_PLL_REG_CPU_CONFIG 0x00
173 #define AR724X_PLL_REG_PCIE_CONFIG 0x18
175 #define AR724X_PLL_DIV_SHIFT 0
176 #define AR724X_PLL_DIV_MASK 0x3ff
177 #define AR724X_PLL_REF_DIV_SHIFT 10
178 #define AR724X_PLL_REF_DIV_MASK 0xf
179 #define AR724X_AHB_DIV_SHIFT 19
180 #define AR724X_AHB_DIV_MASK 0x1
181 #define AR724X_DDR_DIV_SHIFT 22
182 #define AR724X_DDR_DIV_MASK 0x3
184 #define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c
186 #define AR91XX_PLL_REG_CPU_CONFIG 0x00
187 #define AR91XX_PLL_REG_ETH_CONFIG 0x04
188 #define AR91XX_PLL_REG_ETH0_INT_CLOCK 0x14
189 #define AR91XX_PLL_REG_ETH1_INT_CLOCK 0x18
191 #define AR91XX_PLL_DIV_SHIFT 0
192 #define AR91XX_PLL_DIV_MASK 0x3ff
193 #define AR91XX_DDR_DIV_SHIFT 22
194 #define AR91XX_DDR_DIV_MASK 0x3
195 #define AR91XX_AHB_DIV_SHIFT 19
196 #define AR91XX_AHB_DIV_MASK 0x1
198 #define AR91XX_ETH0_PLL_SHIFT 20
199 #define AR91XX_ETH1_PLL_SHIFT 22
201 #define AR933X_PLL_CPU_CONFIG_REG 0x00
202 #define AR933X_PLL_CLOCK_CTRL_REG 0x08
204 #define AR933X_PLL_CPU_CONFIG_NINT_SHIFT 10
205 #define AR933X_PLL_CPU_CONFIG_NINT_MASK 0x3f
206 #define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT 16
207 #define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
208 #define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23
209 #define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
211 #define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2)
212 #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5
213 #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK 0x3
214 #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT 10
215 #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK 0x3
216 #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15
217 #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7
219 #define AR934X_PLL_REG_CPU_CONFIG 0x00
220 #define AR934X_PLL_REG_DDR_CONFIG 0x04
221 #define AR934X_PLL_REG_DDR_CTRL_CLOCK 0x8
223 #define AR934X_CPU_PLL_CFG_OUTDIV_MSB 21
224 #define AR934X_CPU_PLL_CFG_OUTDIV_LSB 19
225 #define AR934X_CPU_PLL_CFG_OUTDIV_MASK 0x00380000
227 #define AR934X_CPU_PLL_CFG_OUTDIV_GET(x) \
228 (((x) & AR934X_CPU_PLL_CFG_OUTDIV_MASK) >> \
229 AR934X_CPU_PLL_CFG_OUTDIV_LSB)
231 #define AR934X_DDR_PLL_CFG_OUTDIV_MSB 25
232 #define AR934X_DDR_PLL_CFG_OUTDIV_LSB 23
233 #define AR934X_DDR_PLL_CFG_OUTDIV_MASK 0x03800000
235 #define AR934X_DDR_PLL_CFG_OUTDIV_GET(x) \
236 (((x) & AR934X_DDR_PLL_CFG_OUTDIV_MASK) >> \
237 AR934X_DDR_PLL_CFG_OUTDIV_LSB)
239 #define AR934X_DDR_PLL_CFG_OUTDIV_SET(x) \
240 (((x) << AR934X_DDR_PLL_CFG_OUTDIV_LSB) & \
241 AR934X_DDR_PLL_CFG_OUTDIV_MASK)
243 #define AR934X_CPU_PLL_CFG_REFDIV_MSB 16
244 #define AR934X_CPU_PLL_CFG_REFDIV_LSB 12
245 #define AR934X_CPU_PLL_CFG_REFDIV_MASK 0x0001f000
247 #define AR934X_CPU_PLL_CFG_REFDIV_GET(x) \
248 (((x) & AR934X_CPU_PLL_CFG_REFDIV_MASK) >> \
249 AR934X_CPU_PLL_CFG_REFDIV_LSB)
251 #define AR934X_CPU_PLL_CFG_REFDIV_SET(x) \
252 (((x) << AR934X_CPU_PLL_CFG_REFDIV_LSB) & \
253 AR934X_CPU_PLL_CFG_REFDIV_MASK)
255 #define AR934X_CPU_PLL_CFG_REFDIV_RESET 2
257 #define AR934X_CPU_PLL_CFG_NINT_MSB 11
258 #define AR934X_CPU_PLL_CFG_NINT_LSB 6
259 #define AR934X_CPU_PLL_CFG_NINT_MASK 0x00000fc0
261 #define AR934X_CPU_PLL_CFG_NINT_GET(x) \
262 (((x) & AR934X_CPU_PLL_CFG_NINT_MASK) >> \
263 AR934X_CPU_PLL_CFG_NINT_LSB)
265 #define AR934X_CPU_PLL_CFG_NINT_SET(x) \
266 (((x) << AR934X_CPU_PLL_CFG_NINT_LSB) & \
267 AR934X_CPU_PLL_CFG_NINT_MASK)
269 #define AR934X_CPU_PLL_CFG_NINT_RESET 20
271 #define AR934X_CPU_PLL_CFG_NFRAC_MSB 5
272 #define AR934X_CPU_PLL_CFG_NFRAC_LSB 0
273 #define AR934X_CPU_PLL_CFG_NFRAC_MASK 0x0000003f
275 #define AR934X_CPU_PLL_CFG_NFRAC_GET(x) \
276 (((x) & AR934X_CPU_PLL_CFG_NFRAC_MASK) >> \
277 AR934X_CPU_PLL_CFG_NFRAC_LSB)
279 #define AR934X_CPU_PLL_CFG_NFRAC_SET(x) \
280 (((x) << AR934X_CPU_PLL_CFG_NFRAC_LSB) & \
281 AR934X_CPU_PLL_CFG_NFRAC_MASK)
283 #define AR934X_DDR_PLL_CFG_REFDIV_MSB 20
284 #define AR934X_DDR_PLL_CFG_REFDIV_LSB 16
285 #define AR934X_DDR_PLL_CFG_REFDIV_MASK 0x001f0000
287 #define AR934X_DDR_PLL_CFG_REFDIV_GET(x) \
288 (((x) & AR934X_DDR_PLL_CFG_REFDIV_MASK) >> \
289 AR934X_DDR_PLL_CFG_REFDIV_LSB)
291 #define AR934X_DDR_PLL_CFG_REFDIV_SET(x) \
292 (((x) << AR934X_DDR_PLL_CFG_REFDIV_LSB) & \
293 AR934X_DDR_PLL_CFG_REFDIV_MASK)
295 #define AR934X_DDR_PLL_CFG_REFDIV_RESET 2
297 #define AR934X_DDR_PLL_CFG_NINT_MSB 15
298 #define AR934X_DDR_PLL_CFG_NINT_LSB 10
299 #define AR934X_DDR_PLL_CFG_NINT_MASK 0x0000fc00
301 #define AR934X_DDR_PLL_CFG_NINT_GET(x) \
302 (((x) & AR934X_DDR_PLL_CFG_NINT_MASK) >> \
303 AR934X_DDR_PLL_CFG_NINT_LSB)
305 #define AR934X_DDR_PLL_CFG_NINT_SET(x) \
306 (((x) << AR934X_DDR_PLL_CFG_NINT_LSB) & \
307 AR934X_DDR_PLL_CFG_NINT_MASK)
309 #define AR934X_DDR_PLL_CFG_NINT_RESET 20
311 #define AR934X_DDR_PLL_CFG_NFRAC_MSB 9
312 #define AR934X_DDR_PLL_CFG_NFRAC_LSB 0
313 #define AR934X_DDR_PLL_CFG_NFRAC_MASK 0x000003ff
315 #define AR934X_DDR_PLL_CFG_NFRAC_GET(x) \
316 (((x) & AR934X_DDR_PLL_CFG_NFRAC_MASK) >> \
317 AR934X_DDR_PLL_CFG_NFRAC_LSB)
319 #define AR934X_DDR_PLL_CFG_NFRAC_SET(x) \
320 (((x) << AR934X_DDR_PLL_CFG_NFRAC_LSB) & \
321 AR934X_DDR_PLL_CFG_NFRAC_MASK)
323 #define AR934X_DDR_PLL_CFG_NFRAC_RESET 512
325 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MSB 19
326 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_LSB 15
327 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK 0x000f8000
329 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_GET(x) \
330 (((x) & AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK) >> \
331 AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_LSB)
333 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SET(x) \
334 (((x) << AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_LSB) & \
335 AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK)
337 #define AR934X_CPU_DDR_CLK_CTRL_AHB_POST_DIV_RESET 0
339 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MSB 14
340 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_LSB 10
341 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK 0x00007c00
343 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_GET(x) \
344 (((x) & AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK) >> \
345 AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_LSB)
347 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SET(x) \
348 (((x) << AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_LSB) & \
349 AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK)
351 #define AR934X_CPU_DDR_CLK_CTRL_DDR_POST_DIV_RESET 0
353 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MSB 9
354 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_LSB 5
355 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK 0x000003e0
357 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_GET(x) \
358 (((x) & AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK) >> \
359 AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_LSB)
361 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SET(x) \
362 (((x) << AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_LSB) & \
363 AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK)
365 #define AR934X_CPU_DDR_CLK_CTRL_CPU_POST_DIV_RESET 0
367 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_MSB 24
368 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_LSB 24
369 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_MASK 0x01000000
371 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_GET(x) \
372 (((x) & AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_MASK) >> \
373 AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_LSB)
375 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_SET(x) \
376 (((x) << AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_LSB) & \
377 AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_MASK)
379 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL_RESET 1
381 #define AR934X_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
382 #define AR934X_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
383 #define AR934X_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
384 #define AR934X_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
385 #define AR934X_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
386 #define AR934X_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
388 extern void __iomem
*ar71xx_pll_base
;
390 static inline void ar71xx_pll_wr(unsigned reg
, u32 val
)
392 __raw_writel(val
, ar71xx_pll_base
+ reg
);
395 static inline u32
ar71xx_pll_rr(unsigned reg
)
397 return __raw_readl(ar71xx_pll_base
+ reg
);
403 #define USB_CTRL_REG_FLADJ 0x00
404 #define USB_CTRL_REG_CONFIG 0x04
406 extern void __iomem
*ar71xx_usb_ctrl_base
;
408 static inline void ar71xx_usb_ctrl_wr(unsigned reg
, u32 val
)
410 __raw_writel(val
, ar71xx_usb_ctrl_base
+ reg
);
413 static inline u32
ar71xx_usb_ctrl_rr(unsigned reg
)
415 return __raw_readl(ar71xx_usb_ctrl_base
+ reg
);
421 #define AR71XX_GPIO_REG_OE 0x00
422 #define AR71XX_GPIO_REG_IN 0x04
423 #define AR71XX_GPIO_REG_OUT 0x08
424 #define AR71XX_GPIO_REG_SET 0x0c
425 #define AR71XX_GPIO_REG_CLEAR 0x10
426 #define AR71XX_GPIO_REG_INT_MODE 0x14
427 #define AR71XX_GPIO_REG_INT_TYPE 0x18
428 #define AR71XX_GPIO_REG_INT_POLARITY 0x1c
429 #define AR71XX_GPIO_REG_INT_PENDING 0x20
430 #define AR71XX_GPIO_REG_INT_ENABLE 0x24
431 #define AR71XX_GPIO_REG_FUNC 0x28
433 #define AR934X_GPIO_REG_OUT_FUNC0 0x2c
434 #define AR934X_GPIO_REG_OUT_FUNC1 0x30
435 #define AR934X_GPIO_REG_OUT_FUNC2 0x34
436 #define AR934X_GPIO_REG_OUT_FUNC3 0x38
437 #define AR934X_GPIO_REG_OUT_FUNC4 0x3c
438 #define AR934X_GPIO_REG_OUT_FUNC5 0x40
439 #define AR934X_GPIO_REG_FUNC 0x6c
441 #define AR71XX_GPIO_FUNC_STEREO_EN BIT(17)
442 #define AR71XX_GPIO_FUNC_SLIC_EN BIT(16)
443 #define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13)
444 #define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12)
445 #define AR71XX_GPIO_FUNC_UART_EN BIT(8)
446 #define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4)
447 #define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0)
449 #define AR71XX_GPIO_COUNT 16
451 #define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19)
452 #define AR724X_GPIO_FUNC_SPI_EN BIT(18)
453 #define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
454 #define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
455 #define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12)
456 #define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11)
457 #define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10)
458 #define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9)
459 #define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8)
460 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
461 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
462 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
463 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
464 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
465 #define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
466 #define AR724X_GPIO_FUNC_UART_EN BIT(1)
467 #define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)
469 #define AR724X_GPIO_COUNT 18
471 #define AR91XX_GPIO_FUNC_WMAC_LED_EN BIT(22)
472 #define AR91XX_GPIO_FUNC_EXP_PORT_CS_EN BIT(21)
473 #define AR91XX_GPIO_FUNC_I2S_REFCLKEN BIT(20)
474 #define AR91XX_GPIO_FUNC_I2S_MCKEN BIT(19)
475 #define AR91XX_GPIO_FUNC_I2S1_EN BIT(18)
476 #define AR91XX_GPIO_FUNC_I2S0_EN BIT(17)
477 #define AR91XX_GPIO_FUNC_SLIC_EN BIT(16)
478 #define AR91XX_GPIO_FUNC_UART_RTSCTS_EN BIT(9)
479 #define AR91XX_GPIO_FUNC_UART_EN BIT(8)
480 #define AR91XX_GPIO_FUNC_USB_CLK_EN BIT(4)
482 #define AR91XX_GPIO_COUNT 22
484 #define AR933X_GPIO_COUNT 30
486 #define AR934X_GPIO_FUNC_SPI_CS_1_EN BIT(14)
487 #define AR934X_GPIO_FUNC_SPI_CS_0_EN BIT(13)
489 #define AR934X_GPIO_COUNT 23
490 #define AR934X_GPIO_FUNC_DDR_DQOE_EN BIT(17)
492 #define AR934X_GPIO_OUT_GPIO 0x00
494 extern void __iomem
*ar71xx_gpio_base
;
496 static inline void ar71xx_gpio_wr(unsigned reg
, u32 value
)
498 __raw_writel(value
, ar71xx_gpio_base
+ reg
);
501 static inline u32
ar71xx_gpio_rr(unsigned reg
)
503 return __raw_readl(ar71xx_gpio_base
+ reg
);
506 void ar71xx_gpio_init(void) __init
;
507 void ar71xx_gpio_function_enable(u32 mask
);
508 void ar71xx_gpio_function_disable(u32 mask
);
509 void ar71xx_gpio_function_setup(u32 set
, u32 clear
);
510 void ar71xx_gpio_output_select(unsigned gpio
, u8 val
);
515 #define AR71XX_DDR_REG_PCI_WIN0 0x7c
516 #define AR71XX_DDR_REG_PCI_WIN1 0x80
517 #define AR71XX_DDR_REG_PCI_WIN2 0x84
518 #define AR71XX_DDR_REG_PCI_WIN3 0x88
519 #define AR71XX_DDR_REG_PCI_WIN4 0x8c
520 #define AR71XX_DDR_REG_PCI_WIN5 0x90
521 #define AR71XX_DDR_REG_PCI_WIN6 0x94
522 #define AR71XX_DDR_REG_PCI_WIN7 0x98
523 #define AR71XX_DDR_REG_FLUSH_GE0 0x9c
524 #define AR71XX_DDR_REG_FLUSH_GE1 0xa0
525 #define AR71XX_DDR_REG_FLUSH_USB 0xa4
526 #define AR71XX_DDR_REG_FLUSH_PCI 0xa8
528 #define AR724X_DDR_REG_FLUSH_GE0 0x7c
529 #define AR724X_DDR_REG_FLUSH_GE1 0x80
530 #define AR724X_DDR_REG_FLUSH_USB 0x84
531 #define AR724X_DDR_REG_FLUSH_PCIE 0x88
533 #define AR91XX_DDR_REG_FLUSH_GE0 0x7c
534 #define AR91XX_DDR_REG_FLUSH_GE1 0x80
535 #define AR91XX_DDR_REG_FLUSH_USB 0x84
536 #define AR91XX_DDR_REG_FLUSH_WMAC 0x88
538 #define AR933X_DDR_REG_FLUSH_GE0 0x7c
539 #define AR933X_DDR_REG_FLUSH_GE1 0x80
540 #define AR933X_DDR_REG_FLUSH_USB 0x84
541 #define AR933X_DDR_REG_FLUSH_WMAC 0x88
543 #define AR934X_DDR_REG_FLUSH_GE0 0x9c
544 #define AR934X_DDR_REG_FLUSH_GE1 0xa0
545 #define AR934X_DDR_REG_FLUSH_USB 0xa4
546 #define AR934X_DDR_REG_FLUSH_PCIE 0xa8
547 #define AR934X_DDR_REG_FLUSH_WMAC 0xac
550 #define PCI_WIN0_OFFS 0x10000000
551 #define PCI_WIN1_OFFS 0x11000000
552 #define PCI_WIN2_OFFS 0x12000000
553 #define PCI_WIN3_OFFS 0x13000000
554 #define PCI_WIN4_OFFS 0x14000000
555 #define PCI_WIN5_OFFS 0x15000000
556 #define PCI_WIN6_OFFS 0x16000000
557 #define PCI_WIN7_OFFS 0x07000000
559 extern void __iomem
*ar71xx_ddr_base
;
561 static inline void ar71xx_ddr_wr(unsigned reg
, u32 val
)
563 __raw_writel(val
, ar71xx_ddr_base
+ reg
);
566 static inline u32
ar71xx_ddr_rr(unsigned reg
)
568 return __raw_readl(ar71xx_ddr_base
+ reg
);
571 void ar71xx_ddr_flush(u32 reg
);
576 #define AR71XX_PCI_CFG_BASE (AR71XX_PCI_MEM_BASE + PCI_WIN7_OFFS + 0x10000)
577 #define AR71XX_PCI_CFG_SIZE 0x100
579 #define PCI_REG_CRP_AD_CBE 0x00
580 #define PCI_REG_CRP_WRDATA 0x04
581 #define PCI_REG_CRP_RDDATA 0x08
582 #define PCI_REG_CFG_AD 0x0c
583 #define PCI_REG_CFG_CBE 0x10
584 #define PCI_REG_CFG_WRDATA 0x14
585 #define PCI_REG_CFG_RDDATA 0x18
586 #define PCI_REG_PCI_ERR 0x1c
587 #define PCI_REG_PCI_ERR_ADDR 0x20
588 #define PCI_REG_AHB_ERR 0x24
589 #define PCI_REG_AHB_ERR_ADDR 0x28
591 #define PCI_CRP_CMD_WRITE 0x00010000
592 #define PCI_CRP_CMD_READ 0x00000000
593 #define PCI_CFG_CMD_READ 0x0000000a
594 #define PCI_CFG_CMD_WRITE 0x0000000b
596 #define PCI_IDSEL_ADL_START 17
598 #define AR724X_PCI_CFG_BASE (AR71XX_PCI_MEM_BASE + 0x4000000)
599 #define AR724X_PCI_CFG_SIZE 0x1000
601 #define AR724X_PCI_REG_APP 0x00
602 #define AR724X_PCI_REG_RESET 0x18
603 #define AR724X_PCI_REG_INT_STATUS 0x4c
604 #define AR724X_PCI_REG_INT_MASK 0x50
606 #define AR724X_PCI_APP_LTSSM_ENABLE BIT(0)
607 #define AR724X_PCI_RESET_LINK_UP BIT(0)
609 #define AR724X_PCI_INT_DEV0 BIT(14)
614 #define AR71XX_RESET_REG_TIMER 0x00
615 #define AR71XX_RESET_REG_TIMER_RELOAD 0x04
616 #define AR71XX_RESET_REG_WDOG_CTRL 0x08
617 #define AR71XX_RESET_REG_WDOG 0x0c
618 #define AR71XX_RESET_REG_MISC_INT_STATUS 0x10
619 #define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14
620 #define AR71XX_RESET_REG_PCI_INT_STATUS 0x18
621 #define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c
622 #define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20
623 #define AR71XX_RESET_REG_RESET_MODULE 0x24
624 #define AR71XX_RESET_REG_PERFC_CTRL 0x2c
625 #define AR71XX_RESET_REG_PERFC0 0x30
626 #define AR71XX_RESET_REG_PERFC1 0x34
627 #define AR71XX_RESET_REG_REV_ID 0x90
629 #define AR91XX_RESET_REG_GLOBAL_INT_STATUS 0x18
630 #define AR91XX_RESET_REG_RESET_MODULE 0x1c
631 #define AR91XX_RESET_REG_PERF_CTRL 0x20
632 #define AR91XX_RESET_REG_PERFC0 0x24
633 #define AR91XX_RESET_REG_PERFC1 0x28
635 #define AR724X_RESET_REG_RESET_MODULE 0x1c
637 #define AR933X_RESET_REG_RESET_MODULE 0x1c
638 #define AR933X_RESET_REG_BOOTSTRAP 0xac
639 #define AR933X_BOOTSTRAP_EEPBUSY BIT(4)
640 #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
642 #define AR934X_RESET_REG_RESET_MODULE 0x1c
644 #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
645 #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
646 #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
647 #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
648 #define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
649 #define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4)
650 #define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
651 #define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
652 #define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
653 #define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
654 #define AR934X_PCIE_WMAC_INT_WMAC_ALL \
655 (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
656 AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
658 #define AR934X_PCIE_WMAC_INT_PCIE_ALL \
659 (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
660 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
661 AR934X_PCIE_WMAC_INT_PCIE_RC3)
663 #define AR934X_RESET_REG_BOOTSTRAP 0xb0
664 #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
665 #define AR934X_BOOTSTRAP_SW_OPTION7 BIT(22)
666 #define AR934X_BOOTSTRAP_SW_OPTION6 BIT(21)
667 #define AR934X_BOOTSTRAP_SW_OPTION5 BIT(20)
668 #define AR934X_BOOTSTRAP_SW_OPTION4 BIT(19)
669 #define AR934X_BOOTSTRAP_SW_OPTION3 BIT(18)
670 #define AR934X_BOOTSTRAP_SW_OPTION2 BIT(17)
671 #define AR934X_BOOTSTRAP_SW_OPTION1 BIT(16)
672 #define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7)
673 #define AR934X_BOOTSTRAP_PCIE_RC BIT(6)
674 #define AR934X_BOOTSTRAP_EJTAG_MODE BIT(5)
675 #define AR934X_BOOTSTRAP_REF_CLK_40 BIT(4)
676 #define AR934X_BOOTSTRAP_BOOT_FROM_SPI BIT(2)
677 #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
678 #define AR934X_BOOTSTRAP_DDR1 BIT(0)
680 #define WDOG_CTRL_LAST_RESET BIT(31)
681 #define WDOG_CTRL_ACTION_MASK 3
682 #define WDOG_CTRL_ACTION_NONE 0 /* no action */
683 #define WDOG_CTRL_ACTION_GPI 1 /* general purpose interrupt */
684 #define WDOG_CTRL_ACTION_NMI 2 /* NMI */
685 #define WDOG_CTRL_ACTION_FCR 3 /* full chip reset */
687 #define MISC_INT_ENET_LINK BIT(12)
688 #define MISC_INT_DDR_PERF BIT(11)
689 #define MISC_INT_TIMER4 BIT(10)
690 #define MISC_INT_TIMER3 BIT(9)
691 #define MISC_INT_TIMER2 BIT(8)
692 #define MISC_INT_DMA BIT(7)
693 #define MISC_INT_OHCI BIT(6)
694 #define MISC_INT_PERFC BIT(5)
695 #define MISC_INT_WDOG BIT(4)
696 #define MISC_INT_UART BIT(3)
697 #define MISC_INT_GPIO BIT(2)
698 #define MISC_INT_ERROR BIT(1)
699 #define MISC_INT_TIMER BIT(0)
701 #define PCI_INT_CORE BIT(4)
702 #define PCI_INT_DEV2 BIT(2)
703 #define PCI_INT_DEV1 BIT(1)
704 #define PCI_INT_DEV0 BIT(0)
706 #define RESET_MODULE_EXTERNAL BIT(28)
707 #define RESET_MODULE_FULL_CHIP BIT(24)
708 #define RESET_MODULE_AMBA2WMAC BIT(22)
709 #define RESET_MODULE_CPU_NMI BIT(21)
710 #define RESET_MODULE_CPU_COLD BIT(20)
711 #define RESET_MODULE_DMA BIT(19)
712 #define RESET_MODULE_SLIC BIT(18)
713 #define RESET_MODULE_STEREO BIT(17)
714 #define RESET_MODULE_DDR BIT(16)
715 #define RESET_MODULE_GE1_MAC BIT(13)
716 #define RESET_MODULE_GE1_PHY BIT(12)
717 #define RESET_MODULE_USBSUS_OVERRIDE BIT(10)
718 #define RESET_MODULE_GE0_MAC BIT(9)
719 #define RESET_MODULE_GE0_PHY BIT(8)
720 #define RESET_MODULE_USB_OHCI_DLL BIT(6)
721 #define RESET_MODULE_USB_HOST BIT(5)
722 #define RESET_MODULE_USB_PHY BIT(4)
723 #define RESET_MODULE_USB_OHCI_DLL_7240 BIT(3)
724 #define RESET_MODULE_PCI_BUS BIT(1)
725 #define RESET_MODULE_PCI_CORE BIT(0)
727 #define AR724X_RESET_GE1_MDIO BIT(23)
728 #define AR724X_RESET_GE0_MDIO BIT(22)
729 #define AR724X_RESET_PCIE_PHY_SERIAL BIT(10)
730 #define AR724X_RESET_PCIE_PHY BIT(7)
731 #define AR724X_RESET_PCIE BIT(6)
732 #define AR724X_RESET_USB_HOST BIT(5)
733 #define AR724X_RESET_USB_PHY BIT(4)
734 #define AR724X_RESET_USBSUS_OVERRIDE BIT(3)
736 #define AR933X_RESET_WMAC BIT(11)
737 #define AR933X_RESET_GE1_MDIO BIT(23)
738 #define AR933X_RESET_GE0_MDIO BIT(22)
739 #define AR933X_RESET_GE1_MAC BIT(13)
740 #define AR933X_RESET_GE0_MAC BIT(9)
741 #define AR933X_RESET_USB_HOST BIT(5)
742 #define AR933X_RESET_USB_PHY BIT(4)
743 #define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
745 #define AR934X_RESET_HOST BIT(31)
746 #define AR934X_RESET_SLIC BIT(30)
747 #define AR934X_RESET_HDMA BIT(29)
748 #define AR934X_RESET_EXTERNAL BIT(28)
749 #define AR934X_RESET_RTC BIT(27)
750 #define AR934X_RESET_PCIE_EP_INT BIT(26)
751 #define AR934X_RESET_CHKSUM_ACC BIT(25)
752 #define AR934X_RESET_FULL_CHIP BIT(24)
753 #define AR934X_RESET_GE1_MDIO BIT(23)
754 #define AR934X_RESET_GE0_MDIO BIT(22)
755 #define AR934X_RESET_CPU_NMI BIT(21)
756 #define AR934X_RESET_CPU_COLD BIT(20)
757 #define AR934X_RESET_HOST_RESET_INT BIT(19)
758 #define AR934X_RESET_PCIE_EP BIT(18)
759 #define AR934X_RESET_UART1 BIT(17)
760 #define AR934X_RESET_DDR BIT(16)
761 #define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
762 #define AR934X_RESET_NANDF BIT(14)
763 #define AR934X_RESET_GE1_MAC BIT(13)
764 #define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12)
765 #define AR934X_RESET_USB_PHY_ANALOG BIT(11)
766 #define AR934X_RESET_HOST_DMA_INT BIT(10)
767 #define AR934X_RESET_GE0_MAC BIT(9)
768 #define AR934X_RESET_ETH_SIWTCH BIT(8)
769 #define AR934X_RESET_PCIE_PHY BIT(7)
770 #define AR934X_RESET_PCIE BIT(6)
771 #define AR934X_RESET_USB_HOST BIT(5)
772 #define AR934X_RESET_USB_PHY BIT(4)
773 #define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
774 #define AR934X_RESET_LUT BIT(2)
775 #define AR934X_RESET_MBOX BIT(1)
776 #define AR934X_RESET_I2S BIT(0)
778 #define REV_ID_MAJOR_MASK 0xfff0
779 #define REV_ID_MAJOR_AR71XX 0x00a0
780 #define REV_ID_MAJOR_AR913X 0x00b0
781 #define REV_ID_MAJOR_AR7240 0x00c0
782 #define REV_ID_MAJOR_AR7241 0x0100
783 #define REV_ID_MAJOR_AR7242 0x1100
784 #define REV_ID_MAJOR_AR9330 0x0110
785 #define REV_ID_MAJOR_AR9331 0x1110
786 #define REV_ID_MAJOR_AR9341 0x0120
787 #define REV_ID_MAJOR_AR9342 0x1120
788 #define REV_ID_MAJOR_AR9344 0x2120
790 #define AR71XX_REV_ID_MINOR_MASK 0x3
791 #define AR71XX_REV_ID_MINOR_AR7130 0x0
792 #define AR71XX_REV_ID_MINOR_AR7141 0x1
793 #define AR71XX_REV_ID_MINOR_AR7161 0x2
794 #define AR71XX_REV_ID_REVISION_MASK 0x3
795 #define AR71XX_REV_ID_REVISION_SHIFT 2
797 #define AR91XX_REV_ID_MINOR_MASK 0x3
798 #define AR91XX_REV_ID_MINOR_AR9130 0x0
799 #define AR91XX_REV_ID_MINOR_AR9132 0x1
800 #define AR91XX_REV_ID_REVISION_MASK 0x3
801 #define AR91XX_REV_ID_REVISION_SHIFT 2
803 #define AR724X_REV_ID_REVISION_MASK 0x3
805 #define AR933X_REV_ID_REVISION_MASK 0xf
807 #define AR934X_REV_ID_REVISION_MASK 0xf
809 extern void __iomem
*ar71xx_reset_base
;
811 static inline void ar71xx_reset_wr(unsigned reg
, u32 val
)
813 __raw_writel(val
, ar71xx_reset_base
+ reg
);
816 static inline u32
ar71xx_reset_rr(unsigned reg
)
818 return __raw_readl(ar71xx_reset_base
+ reg
);
821 void ar71xx_device_stop(u32 mask
);
822 void ar71xx_device_start(u32 mask
);
823 void ar71xx_device_reset_rmw(u32 clear
, u32 set
);
824 int ar71xx_device_stopped(u32 mask
);
829 #define SPI_REG_FS 0x00 /* Function Select */
830 #define SPI_REG_CTRL 0x04 /* SPI Control */
831 #define SPI_REG_IOC 0x08 /* SPI I/O Control */
832 #define SPI_REG_RDS 0x0c /* Read Data Shift */
834 #define SPI_FS_GPIO BIT(0) /* Enable GPIO mode */
836 #define SPI_CTRL_RD BIT(6) /* Remap Disable */
837 #define SPI_CTRL_DIV_MASK 0x3f
839 #define SPI_IOC_DO BIT(0) /* Data Out pin */
840 #define SPI_IOC_CLK BIT(8) /* CLK pin */
841 #define SPI_IOC_CS(n) BIT(16 + (n))
842 #define SPI_IOC_CS0 SPI_IOC_CS(0)
843 #define SPI_IOC_CS1 SPI_IOC_CS(1)
844 #define SPI_IOC_CS2 SPI_IOC_CS(2)
845 #define SPI_IOC_CS_ALL (SPI_IOC_CS0 | SPI_IOC_CS1 | SPI_IOC_CS2)
847 void ar71xx_flash_acquire(void);
848 void ar71xx_flash_release(void);
853 #define MII_REG_MII0_CTRL 0x00
854 #define MII_REG_MII1_CTRL 0x04
856 #define MII_CTRL_IF_MASK 3
857 #define MII_CTRL_SPEED_SHIFT 4
858 #define MII_CTRL_SPEED_MASK 3
859 #define MII_CTRL_SPEED_10 0
860 #define MII_CTRL_SPEED_100 1
861 #define MII_CTRL_SPEED_1000 2
863 #define MII0_CTRL_IF_GMII 0
864 #define MII0_CTRL_IF_MII 1
865 #define MII0_CTRL_IF_RGMII 2
866 #define MII0_CTRL_IF_RMII 3
868 #define MII1_CTRL_IF_RGMII 0
869 #define MII1_CTRL_IF_RMII 1
874 #define AR933X_GMAC_REG_ETH_CFG 0x00
876 #define AR933X_ETH_CFG_RGMII_GE0 BIT(0)
877 #define AR933X_ETH_CFG_MII_GE0 BIT(1)
878 #define AR933X_ETH_CFG_GMII_GE0 BIT(2)
879 #define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3)
880 #define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4)
881 #define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5)
882 #define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7)
883 #define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8)
884 #define AR933X_ETH_CFG_RMII_GE0 BIT(9)
885 #define AR933X_ETH_CFG_RMII_GE0_SPD_10 0
886 #define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10)
888 #endif /* __ASSEMBLER__ */
890 #endif /* __ASM_MACH_AR71XX_H */