1 /*
2  * Atheros AR71XX/AR724X/AR913X SoC register definitions
3  *
4  * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
5  * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
6  * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
7  * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8  *
9  * SPDX-License-Identifier:     GPL-2.0+
10  */
11 
12 #ifndef __ASM_MACH_AR71XX_REGS_H
13 #define __ASM_MACH_AR71XX_REGS_H
14 
15 #ifndef __ASSEMBLY__
16 #include <linux/bitops.h>
17 #else
18 #ifndef BIT
19 #define BIT(nr)		(1 << (nr))
20 #endif
21 #endif
22 
23 #define AR71XX_APB_BASE					0x18000000
24 #define AR71XX_GE0_BASE					0x19000000
25 #define AR71XX_GE0_SIZE					0x10000
26 #define AR71XX_GE1_BASE					0x1a000000
27 #define AR71XX_GE1_SIZE					0x10000
28 #define AR71XX_EHCI_BASE				0x1b000000
29 #define AR71XX_EHCI_SIZE				0x1000
30 #define AR71XX_OHCI_BASE				0x1c000000
31 #define AR71XX_OHCI_SIZE				0x1000
32 #define AR71XX_SPI_BASE					0x1f000000
33 #define AR71XX_SPI_SIZE					0x01000000
34 
35 #define AR71XX_DDR_CTRL_BASE \
36 	(AR71XX_APB_BASE + 0x00000000)
37 #define AR71XX_DDR_CTRL_SIZE				0x100
38 #define AR71XX_UART_BASE \
39 	(AR71XX_APB_BASE + 0x00020000)
40 #define AR71XX_UART_SIZE				0x100
41 #define AR71XX_USB_CTRL_BASE \
42 	(AR71XX_APB_BASE + 0x00030000)
43 #define AR71XX_USB_CTRL_SIZE				0x100
44 #define AR71XX_GPIO_BASE \
45 	(AR71XX_APB_BASE + 0x00040000)
46 #define AR71XX_GPIO_SIZE				0x100
47 #define AR71XX_PLL_BASE \
48 	(AR71XX_APB_BASE + 0x00050000)
49 #define AR71XX_PLL_SIZE					0x100
50 #define AR71XX_RESET_BASE \
51 	(AR71XX_APB_BASE + 0x00060000)
52 #define AR71XX_RESET_SIZE				0x100
53 #define AR71XX_MII_BASE \
54 	(AR71XX_APB_BASE + 0x00070000)
55 #define AR71XX_MII_SIZE					0x100
56 
57 #define AR71XX_PCI_MEM_BASE				0x10000000
58 #define AR71XX_PCI_MEM_SIZE				0x07000000
59 
60 #define AR71XX_PCI_WIN0_OFFS				0x10000000
61 #define AR71XX_PCI_WIN1_OFFS				0x11000000
62 #define AR71XX_PCI_WIN2_OFFS				0x12000000
63 #define AR71XX_PCI_WIN3_OFFS				0x13000000
64 #define AR71XX_PCI_WIN4_OFFS				0x14000000
65 #define AR71XX_PCI_WIN5_OFFS				0x15000000
66 #define AR71XX_PCI_WIN6_OFFS				0x16000000
67 #define AR71XX_PCI_WIN7_OFFS				0x07000000
68 
69 #define AR71XX_PCI_CFG_BASE \
70 	(AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000)
71 #define AR71XX_PCI_CFG_SIZE				0x100
72 
73 #define AR7240_USB_CTRL_BASE \
74 	(AR71XX_APB_BASE + 0x00030000)
75 #define AR7240_USB_CTRL_SIZE				0x100
76 #define AR7240_OHCI_BASE				0x1b000000
77 #define AR7240_OHCI_SIZE				0x1000
78 
79 #define AR724X_PCI_MEM_BASE				0x10000000
80 #define AR724X_PCI_MEM_SIZE				0x04000000
81 
82 #define AR724X_PCI_CFG_BASE				0x14000000
83 #define AR724X_PCI_CFG_SIZE				0x1000
84 #define AR724X_PCI_CRP_BASE \
85 	(AR71XX_APB_BASE + 0x000c0000)
86 #define AR724X_PCI_CRP_SIZE				0x1000
87 #define AR724X_PCI_CTRL_BASE \
88 	(AR71XX_APB_BASE + 0x000f0000)
89 #define AR724X_PCI_CTRL_SIZE				0x100
90 
91 #define AR724X_EHCI_BASE				0x1b000000
92 #define AR724X_EHCI_SIZE				0x1000
93 
94 #define AR913X_EHCI_BASE				0x1b000000
95 #define AR913X_EHCI_SIZE				0x1000
96 #define AR913X_WMAC_BASE \
97 	(AR71XX_APB_BASE + 0x000C0000)
98 #define AR913X_WMAC_SIZE				0x30000
99 
100 #define AR933X_UART_BASE \
101 	(AR71XX_APB_BASE + 0x00020000)
102 #define AR933X_UART_SIZE				0x14
103 #define AR933X_GMAC_BASE \
104 	(AR71XX_APB_BASE + 0x00070000)
105 #define AR933X_GMAC_SIZE				0x04
106 #define AR933X_WMAC_BASE \
107 	(AR71XX_APB_BASE + 0x00100000)
108 #define AR933X_WMAC_SIZE				0x20000
109 #define AR933X_RTC_BASE \
110 	(AR71XX_APB_BASE + 0x00107000)
111 #define AR933X_RTC_SIZE					0x1000
112 #define AR933X_EHCI_BASE				0x1b000000
113 #define AR933X_EHCI_SIZE				0x1000
114 #define AR933X_SRIF_BASE \
115 	(AR71XX_APB_BASE + 0x00116000)
116 #define AR933X_SRIF_SIZE				0x1000
117 
118 #define AR934X_GMAC_BASE \
119 	(AR71XX_APB_BASE + 0x00070000)
120 #define AR934X_GMAC_SIZE				0x14
121 #define AR934X_WMAC_BASE \
122 	(AR71XX_APB_BASE + 0x00100000)
123 #define AR934X_WMAC_SIZE				0x20000
124 #define AR934X_EHCI_BASE				0x1b000000
125 #define AR934X_EHCI_SIZE				0x200
126 #define AR934X_NFC_BASE					0x1b000200
127 #define AR934X_NFC_SIZE					0xb8
128 #define AR934X_SRIF_BASE \
129 	(AR71XX_APB_BASE + 0x00116000)
130 #define AR934X_SRIF_SIZE				0x1000
131 
132 #define QCA953X_GMAC_BASE \
133 	(AR71XX_APB_BASE + 0x00070000)
134 #define QCA953X_GMAC_SIZE				0x14
135 #define QCA953X_WMAC_BASE \
136 	(AR71XX_APB_BASE + 0x00100000)
137 #define QCA953X_WMAC_SIZE				0x20000
138 #define QCA953X_RTC_BASE \
139 	(AR71XX_APB_BASE + 0x00107000)
140 #define QCA953X_RTC_SIZE				0x1000
141 #define QCA953X_EHCI_BASE				0x1b000000
142 #define QCA953X_EHCI_SIZE				0x200
143 #define QCA953X_SRIF_BASE \
144 	(AR71XX_APB_BASE + 0x00116000)
145 #define QCA953X_SRIF_SIZE				0x1000
146 
147 #define QCA953X_PCI_CFG_BASE0				0x14000000
148 #define QCA953X_PCI_CTRL_BASE0 \
149 	(AR71XX_APB_BASE + 0x000f0000)
150 #define QCA953X_PCI_CRP_BASE0 \
151 	(AR71XX_APB_BASE + 0x000c0000)
152 #define QCA953X_PCI_MEM_BASE0				0x10000000
153 #define QCA953X_PCI_MEM_SIZE				0x02000000
154 
155 #define QCA955X_PCI_MEM_BASE0				0x10000000
156 #define QCA955X_PCI_MEM_BASE1				0x12000000
157 #define QCA955X_PCI_MEM_SIZE				0x02000000
158 #define QCA955X_PCI_CFG_BASE0				0x14000000
159 #define QCA955X_PCI_CFG_BASE1				0x16000000
160 #define QCA955X_PCI_CFG_SIZE				0x1000
161 #define QCA955X_PCI_CRP_BASE0 \
162 	(AR71XX_APB_BASE + 0x000c0000)
163 #define QCA955X_PCI_CRP_BASE1 \
164 	(AR71XX_APB_BASE + 0x00250000)
165 #define QCA955X_PCI_CRP_SIZE				0x1000
166 #define QCA955X_PCI_CTRL_BASE0 \
167 	(AR71XX_APB_BASE + 0x000f0000)
168 #define QCA955X_PCI_CTRL_BASE1 \
169 	(AR71XX_APB_BASE + 0x00280000)
170 #define QCA955X_PCI_CTRL_SIZE				0x100
171 
172 #define QCA955X_GMAC_BASE \
173 	(AR71XX_APB_BASE + 0x00070000)
174 #define QCA955X_GMAC_SIZE				0x40
175 #define QCA955X_WMAC_BASE \
176 	(AR71XX_APB_BASE + 0x00100000)
177 #define QCA955X_WMAC_SIZE				0x20000
178 #define QCA955X_EHCI0_BASE				0x1b000000
179 #define QCA955X_EHCI1_BASE				0x1b400000
180 #define QCA955X_EHCI_SIZE				0x1000
181 #define QCA955X_NFC_BASE				0x1b800200
182 #define QCA955X_NFC_SIZE				0xb8
183 
184 #define QCA956X_PCI_MEM_BASE1				0x12000000
185 #define QCA956X_PCI_MEM_SIZE				0x02000000
186 #define QCA956X_PCI_CFG_BASE1				0x16000000
187 #define QCA956X_PCI_CFG_SIZE				0x1000
188 #define QCA956X_PCI_CRP_BASE1 \
189 	(AR71XX_APB_BASE + 0x00250000)
190 #define QCA956X_PCI_CRP_SIZE				0x1000
191 #define QCA956X_PCI_CTRL_BASE1 \
192 	(AR71XX_APB_BASE + 0x00280000)
193 #define QCA956X_PCI_CTRL_SIZE				0x100
194 
195 #define QCA956X_WMAC_BASE \
196 	(AR71XX_APB_BASE + 0x00100000)
197 #define QCA956X_WMAC_SIZE				0x20000
198 #define QCA956X_EHCI0_BASE				0x1b000000
199 #define QCA956X_EHCI1_BASE				0x1b400000
200 #define QCA956X_EHCI_SIZE				0x200
201 #define QCA956X_GMAC_BASE \
202 	(AR71XX_APB_BASE + 0x00070000)
203 #define QCA956X_GMAC_SIZE				0x64
204 
205 /*
206  * DDR_CTRL block
207  */
208 #define AR71XX_DDR_REG_CONFIG				0x00
209 #define AR71XX_DDR_REG_CONFIG2				0x04
210 #define AR71XX_DDR_REG_MODE				0x08
211 #define AR71XX_DDR_REG_EMR				0x0c
212 #define AR71XX_DDR_REG_CONTROL				0x10
213 #define AR71XX_DDR_REG_REFRESH				0x14
214 #define AR71XX_DDR_REG_RD_CYCLE				0x18
215 #define AR71XX_DDR_REG_TAP_CTRL0			0x1c
216 #define AR71XX_DDR_REG_TAP_CTRL1			0x20
217 
218 #define AR71XX_DDR_REG_PCI_WIN0				0x7c
219 #define AR71XX_DDR_REG_PCI_WIN1				0x80
220 #define AR71XX_DDR_REG_PCI_WIN2				0x84
221 #define AR71XX_DDR_REG_PCI_WIN3				0x88
222 #define AR71XX_DDR_REG_PCI_WIN4				0x8c
223 #define AR71XX_DDR_REG_PCI_WIN5				0x90
224 #define AR71XX_DDR_REG_PCI_WIN6				0x94
225 #define AR71XX_DDR_REG_PCI_WIN7				0x98
226 #define AR71XX_DDR_REG_FLUSH_GE0			0x9c
227 #define AR71XX_DDR_REG_FLUSH_GE1			0xa0
228 #define AR71XX_DDR_REG_FLUSH_USB			0xa4
229 #define AR71XX_DDR_REG_FLUSH_PCI			0xa8
230 
231 #define AR724X_DDR_REG_FLUSH_GE0			0x7c
232 #define AR724X_DDR_REG_FLUSH_GE1			0x80
233 #define AR724X_DDR_REG_FLUSH_USB			0x84
234 #define AR724X_DDR_REG_FLUSH_PCIE			0x88
235 
236 #define AR913X_DDR_REG_FLUSH_GE0			0x7c
237 #define AR913X_DDR_REG_FLUSH_GE1			0x80
238 #define AR913X_DDR_REG_FLUSH_USB			0x84
239 #define AR913X_DDR_REG_FLUSH_WMAC			0x88
240 
241 #define AR933X_DDR_REG_FLUSH_GE0			0x7c
242 #define AR933X_DDR_REG_FLUSH_GE1			0x80
243 #define AR933X_DDR_REG_FLUSH_USB			0x84
244 #define AR933X_DDR_REG_FLUSH_WMAC			0x88
245 #define AR933X_DDR_REG_DDR2_CONFIG			0x8c
246 #define AR933X_DDR_REG_EMR2				0x90
247 #define AR933X_DDR_REG_EMR3				0x94
248 #define AR933X_DDR_REG_BURST				0x98
249 #define AR933X_DDR_REG_TIMEOUT_MAX			0x9c
250 #define AR933X_DDR_REG_TIMEOUT_CNT			0x9c
251 #define AR933X_DDR_REG_TIMEOUT_ADDR			0x9c
252 
253 #define AR934X_DDR_REG_TAP_CTRL2			0x24
254 #define AR934X_DDR_REG_TAP_CTRL3			0x28
255 #define AR934X_DDR_REG_FLUSH_GE0			0x9c
256 #define AR934X_DDR_REG_FLUSH_GE1			0xa0
257 #define AR934X_DDR_REG_FLUSH_USB			0xa4
258 #define AR934X_DDR_REG_FLUSH_PCIE			0xa8
259 #define AR934X_DDR_REG_FLUSH_WMAC			0xac
260 #define AR934X_DDR_REG_FLUSH_SRC1			0xb0
261 #define AR934X_DDR_REG_FLUSH_SRC2			0xb4
262 #define AR934X_DDR_REG_DDR2_CONFIG			0xb8
263 #define AR934X_DDR_REG_EMR2				0xbc
264 #define AR934X_DDR_REG_EMR3				0xc0
265 #define AR934X_DDR_REG_BURST				0xc4
266 #define AR934X_DDR_REG_BURST2				0xc8
267 #define AR934X_DDR_REG_TIMEOUT_MAX			0xcc
268 #define AR934X_DDR_REG_CTL_CONF				0x108
269 
270 #define QCA953X_DDR_REG_FLUSH_GE0			0x9c
271 #define QCA953X_DDR_REG_FLUSH_GE1			0xa0
272 #define QCA953X_DDR_REG_FLUSH_USB			0xa4
273 #define QCA953X_DDR_REG_FLUSH_PCIE			0xa8
274 #define QCA953X_DDR_REG_FLUSH_WMAC			0xac
275 #define QCA953X_DDR_REG_DDR2_CONFIG			0xb8
276 #define QCA953X_DDR_REG_BURST				0xc4
277 #define QCA953X_DDR_REG_BURST2				0xc8
278 #define QCA953X_DDR_REG_TIMEOUT_MAX			0xcc
279 #define QCA953X_DDR_REG_CTL_CONF			0x108
280 #define QCA953X_DDR_REG_CONFIG3				0x15c
281 
282 /*
283  * PLL block
284  */
285 #define AR71XX_PLL_REG_CPU_CONFIG			0x00
286 #define AR71XX_PLL_REG_SEC_CONFIG			0x04
287 #define AR71XX_PLL_REG_ETH0_INT_CLOCK			0x10
288 #define AR71XX_PLL_REG_ETH1_INT_CLOCK			0x14
289 
290 #define AR71XX_PLL_DIV_SHIFT				3
291 #define AR71XX_PLL_DIV_MASK				0x1f
292 #define AR71XX_CPU_DIV_SHIFT				16
293 #define AR71XX_CPU_DIV_MASK				0x3
294 #define AR71XX_DDR_DIV_SHIFT				18
295 #define AR71XX_DDR_DIV_MASK				0x3
296 #define AR71XX_AHB_DIV_SHIFT				20
297 #define AR71XX_AHB_DIV_MASK				0x7
298 
299 #define AR71XX_ETH0_PLL_SHIFT				17
300 #define AR71XX_ETH1_PLL_SHIFT				19
301 
302 #define AR724X_PLL_REG_CPU_CONFIG			0x00
303 #define AR724X_PLL_REG_PCIE_CONFIG			0x18
304 
305 #define AR724X_PLL_DIV_SHIFT				0
306 #define AR724X_PLL_DIV_MASK				0x3ff
307 #define AR724X_PLL_REF_DIV_SHIFT			10
308 #define AR724X_PLL_REF_DIV_MASK				0xf
309 #define AR724X_AHB_DIV_SHIFT				19
310 #define AR724X_AHB_DIV_MASK				0x1
311 #define AR724X_DDR_DIV_SHIFT				22
312 #define AR724X_DDR_DIV_MASK				0x3
313 
314 #define AR7242_PLL_REG_ETH0_INT_CLOCK			0x2c
315 
316 #define AR913X_PLL_REG_CPU_CONFIG			0x00
317 #define AR913X_PLL_REG_ETH_CONFIG			0x04
318 #define AR913X_PLL_REG_ETH0_INT_CLOCK			0x14
319 #define AR913X_PLL_REG_ETH1_INT_CLOCK			0x18
320 
321 #define AR913X_PLL_DIV_SHIFT				0
322 #define AR913X_PLL_DIV_MASK				0x3ff
323 #define AR913X_DDR_DIV_SHIFT				22
324 #define AR913X_DDR_DIV_MASK				0x3
325 #define AR913X_AHB_DIV_SHIFT				19
326 #define AR913X_AHB_DIV_MASK				0x1
327 
328 #define AR913X_ETH0_PLL_SHIFT				20
329 #define AR913X_ETH1_PLL_SHIFT				22
330 
331 #define AR933X_PLL_CPU_CONFIG_REG			0x00
332 #define AR933X_PLL_CLK_CTRL_REG				0x08
333 #define AR933X_PLL_DITHER_FRAC_REG			0x10
334 #define AR933X_PLL_SWITCH_CLOCK_CONTROL_REG		0x24
335 
336 #define AR933X_PLL_CPU_CONFIG_NINT_SHIFT		10
337 #define AR933X_PLL_CPU_CONFIG_NINT_MASK			0x3f
338 #define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT		16
339 #define AR933X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
340 #define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT		23
341 #define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK		0x7
342 
343 #define AR933X_PLL_CLK_CTRL_BYPASS			BIT(2)
344 #define AR933X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT		5
345 #define AR933X_PLL_CLK_CTRL_CPU_POST_DIV_MASK		0x3
346 #define AR933X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT		10
347 #define AR933X_PLL_CLK_CTRL_DDR_POST_DIV_MASK		0x3
348 #define AR933X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT		15
349 #define AR933X_PLL_CLK_CTRL_AHB_POST_DIV_MASK		0x7
350 
351 #define AR934X_PLL_CPU_CONFIG_REG			0x00
352 #define AR934X_PLL_DDR_CONFIG_REG			0x04
353 #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG			0x08
354 #define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG		0x24
355 #define AR934X_PLL_ETH_XMII_CONTROL_REG			0x2c
356 #define AR934X_PLL_DDR_DIT_FRAC_REG			0x44
357 #define AR934X_PLL_CPU_DIT_FRAC_REG			0x48
358 
359 #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT		0
360 #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK		0x3f
361 #define AR934X_PLL_CPU_CONFIG_NINT_SHIFT		6
362 #define AR934X_PLL_CPU_CONFIG_NINT_MASK			0x3f
363 #define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
364 #define AR934X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
365 #define AR934X_PLL_CPU_CONFIG_RANGE_SHIFT		17
366 #define AR934X_PLL_CPU_CONFIG_RANGE_MASK		0x3
367 #define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT		19
368 #define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK		0x3
369 #define AR934X_PLL_CPU_CONFIG_PLLPWD			BIT(30)
370 #define AR934X_PLL_CPU_CONFIG_UPDATING			BIT(31)
371 
372 #define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT		0
373 #define AR934X_PLL_DDR_CONFIG_NFRAC_MASK		0x3ff
374 #define AR934X_PLL_DDR_CONFIG_NINT_SHIFT		10
375 #define AR934X_PLL_DDR_CONFIG_NINT_MASK			0x3f
376 #define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT		16
377 #define AR934X_PLL_DDR_CONFIG_REFDIV_MASK		0x1f
378 #define AR934X_PLL_DDR_CONFIG_RANGE_SHIFT		21
379 #define AR934X_PLL_DDR_CONFIG_RANGE_MASK		0x3
380 #define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT		23
381 #define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK		0x7
382 #define AR934X_PLL_DDR_CONFIG_PLLPWD			BIT(30)
383 #define AR934X_PLL_DDR_CONFIG_UPDATING			BIT(31)
384 
385 #define AR934X_PLL_CLK_CTRL_CPU_PLL_BYPASS		BIT(2)
386 #define AR934X_PLL_CLK_CTRL_DDR_PLL_BYPASS		BIT(3)
387 #define AR934X_PLL_CLK_CTRL_AHB_PLL_BYPASS		BIT(4)
388 #define AR934X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT		5
389 #define AR934X_PLL_CLK_CTRL_CPU_POST_DIV_MASK		0x1f
390 #define AR934X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT		10
391 #define AR934X_PLL_CLK_CTRL_DDR_POST_DIV_MASK		0x1f
392 #define AR934X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT		15
393 #define AR934X_PLL_CLK_CTRL_AHB_POST_DIV_MASK		0x1f
394 #define AR934X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL		BIT(20)
395 #define AR934X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL		BIT(21)
396 #define AR934X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
397 
398 #define AR934X_PLL_SWITCH_CLK_CTRL_MDIO_CLK_SEL		BIT(6)
399 
400 #define AR934X_PLL_DDR_DIT_FRAC_MAX_SHIFT		0
401 #define AR934X_PLL_DDR_DIT_FRAC_MAX_MASK		0x3ff
402 #define AR934X_PLL_DDR_DIT_FRAC_MIN_SHIFT		10
403 #define AR934X_PLL_DDR_DIT_FRAC_MIN_MASK		0x3ff
404 #define AR934X_PLL_DDR_DIT_FRAC_STEP_SHIFT		20
405 #define AR934X_PLL_DDR_DIT_FRAC_STEP_MASK		0x3f
406 #define AR934X_PLL_DDR_DIT_UPD_CNT_SHIFT		27
407 #define AR934X_PLL_DDR_DIT_UPD_CNT_MASK			0x3f
408 #define AR934X_PLL_DDR_DIT_DITHER_EN			BIT(31)
409 
410 #define AR934X_PLL_CPU_DIT_FRAC_MAX_SHIFT		0
411 #define AR934X_PLL_CPU_DIT_FRAC_MAX_MASK		0x3f
412 #define AR934X_PLL_CPU_DIT_FRAC_MIN_SHIFT		6
413 #define AR934X_PLL_CPU_DIT_FRAC_MIN_MASK		0x3f
414 #define AR934X_PLL_CPU_DIT_FRAC_STEP_SHIFT		12
415 #define AR934X_PLL_CPU_DIT_FRAC_STEP_MASK		0x3f
416 #define AR934X_PLL_CPU_DIT_UPD_CNT_SHIFT		18
417 #define AR934X_PLL_CPU_DIT_UPD_CNT_MASK			0x3f
418 #define AR934X_PLL_CPU_DIT_DITHER_EN			BIT(31)
419 
420 #define QCA953X_PLL_CPU_CONFIG_REG			0x00
421 #define QCA953X_PLL_DDR_CONFIG_REG			0x04
422 #define QCA953X_PLL_CLK_CTRL_REG			0x08
423 #define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG		0x24
424 #define QCA953X_PLL_ETH_XMII_CONTROL_REG		0x2c
425 #define QCA953X_PLL_DDR_DIT_FRAC_REG			0x44
426 #define QCA953X_PLL_CPU_DIT_FRAC_REG			0x48
427 
428 #define QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT		0
429 #define QCA953X_PLL_CPU_CONFIG_NFRAC_MASK		0x3f
430 #define QCA953X_PLL_CPU_CONFIG_NINT_SHIFT		6
431 #define QCA953X_PLL_CPU_CONFIG_NINT_MASK		0x3f
432 #define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
433 #define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
434 #define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT		19
435 #define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK		0x7
436 
437 #define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT		0
438 #define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK		0x3ff
439 #define QCA953X_PLL_DDR_CONFIG_NINT_SHIFT		10
440 #define QCA953X_PLL_DDR_CONFIG_NINT_MASK		0x3f
441 #define QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT		16
442 #define QCA953X_PLL_DDR_CONFIG_REFDIV_MASK		0x1f
443 #define QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT		23
444 #define QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK		0x7
445 
446 #define QCA953X_PLL_CONFIG_PWD		BIT(30)
447 
448 #define QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS		BIT(2)
449 #define QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS		BIT(3)
450 #define QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS		BIT(4)
451 #define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT		5
452 #define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK		0x1f
453 #define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT		10
454 #define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK		0x1f
455 #define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT		15
456 #define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK		0x1f
457 #define QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL		BIT(20)
458 #define QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL		BIT(21)
459 #define QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
460 
461 #define QCA953X_PLL_CPU_DIT_FRAC_MAX_SHIFT		0
462 #define QCA953X_PLL_CPU_DIT_FRAC_MAX_MASK		0x3f
463 #define QCA953X_PLL_CPU_DIT_FRAC_MIN_SHIFT		6
464 #define QCA953X_PLL_CPU_DIT_FRAC_MIN_MASK		0x3f
465 #define QCA953X_PLL_CPU_DIT_FRAC_STEP_SHIFT		12
466 #define QCA953X_PLL_CPU_DIT_FRAC_STEP_MASK		0x3f
467 #define QCA953X_PLL_CPU_DIT_UPD_CNT_SHIFT		18
468 #define QCA953X_PLL_CPU_DIT_UPD_CNT_MASK		0x3f
469 
470 #define QCA953X_PLL_DDR_DIT_FRAC_MAX_SHIFT		0
471 #define QCA953X_PLL_DDR_DIT_FRAC_MAX_MASK		0x3ff
472 #define QCA953X_PLL_DDR_DIT_FRAC_MIN_SHIFT		9
473 #define QCA953X_PLL_DDR_DIT_FRAC_MIN_MASK		0x3ff
474 #define QCA953X_PLL_DDR_DIT_FRAC_STEP_SHIFT		20
475 #define QCA953X_PLL_DDR_DIT_FRAC_STEP_MASK		0x3f
476 #define QCA953X_PLL_DDR_DIT_UPD_CNT_SHIFT		27
477 #define QCA953X_PLL_DDR_DIT_UPD_CNT_MASK		0x3f
478 
479 #define QCA953X_PLL_DIT_FRAC_EN				BIT(31)
480 
481 #define QCA955X_PLL_CPU_CONFIG_REG			0x00
482 #define QCA955X_PLL_DDR_CONFIG_REG			0x04
483 #define QCA955X_PLL_CLK_CTRL_REG			0x08
484 #define QCA955X_PLL_ETH_XMII_CONTROL_REG		0x28
485 #define QCA955X_PLL_ETH_SGMII_CONTROL_REG		0x48
486 
487 #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT		0
488 #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK		0x3f
489 #define QCA955X_PLL_CPU_CONFIG_NINT_SHIFT		6
490 #define QCA955X_PLL_CPU_CONFIG_NINT_MASK		0x3f
491 #define QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
492 #define QCA955X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
493 #define QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT		19
494 #define QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK		0x3
495 
496 #define QCA955X_PLL_DDR_CONFIG_NFRAC_SHIFT		0
497 #define QCA955X_PLL_DDR_CONFIG_NFRAC_MASK		0x3ff
498 #define QCA955X_PLL_DDR_CONFIG_NINT_SHIFT		10
499 #define QCA955X_PLL_DDR_CONFIG_NINT_MASK		0x3f
500 #define QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT		16
501 #define QCA955X_PLL_DDR_CONFIG_REFDIV_MASK		0x1f
502 #define QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT		23
503 #define QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK		0x7
504 
505 #define QCA955X_PLL_CLK_CTRL_CPU_PLL_BYPASS		BIT(2)
506 #define QCA955X_PLL_CLK_CTRL_DDR_PLL_BYPASS		BIT(3)
507 #define QCA955X_PLL_CLK_CTRL_AHB_PLL_BYPASS		BIT(4)
508 #define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT		5
509 #define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK		0x1f
510 #define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT		10
511 #define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_MASK		0x1f
512 #define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT		15
513 #define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_MASK		0x1f
514 #define QCA955X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL		BIT(20)
515 #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL		BIT(21)
516 #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
517 
518 #define QCA956X_PLL_CPU_CONFIG_REG			0x00
519 #define QCA956X_PLL_CPU_CONFIG1_REG			0x04
520 #define QCA956X_PLL_DDR_CONFIG_REG			0x08
521 #define QCA956X_PLL_DDR_CONFIG1_REG			0x0c
522 #define QCA956X_PLL_CLK_CTRL_REG			0x10
523 
524 #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT		12
525 #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK		0x1f
526 #define QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT		19
527 #define QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK		0x7
528 
529 #define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT		0
530 #define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK		0x1f
531 #define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT		5
532 #define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK		0x3fff
533 #define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT		18
534 #define QCA956X_PLL_CPU_CONFIG1_NINT_MASK		0x1ff
535 
536 #define QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT		16
537 #define QCA956X_PLL_DDR_CONFIG_REFDIV_MASK		0x1f
538 #define QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT		23
539 #define QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK		0x7
540 
541 #define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT		0
542 #define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK		0x1f
543 #define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT		5
544 #define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK		0x3fff
545 #define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT		18
546 #define QCA956X_PLL_DDR_CONFIG1_NINT_MASK		0x1ff
547 
548 #define QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS		BIT(2)
549 #define QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS		BIT(3)
550 #define QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS		BIT(4)
551 #define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT		5
552 #define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK		0x1f
553 #define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT		10
554 #define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK		0x1f
555 #define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT		15
556 #define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK		0x1f
557 #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL	BIT(20)
558 #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL	BIT(21)
559 #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL		BIT(24)
560 
561 /*
562  * USB_CONFIG block
563  */
564 #define AR71XX_USB_CTRL_REG_FLADJ			0x00
565 #define AR71XX_USB_CTRL_REG_CONFIG			0x04
566 
567 /*
568  * RESET block
569  */
570 #define AR71XX_RESET_REG_TIMER				0x00
571 #define AR71XX_RESET_REG_TIMER_RELOAD			0x04
572 #define AR71XX_RESET_REG_WDOG_CTRL			0x08
573 #define AR71XX_RESET_REG_WDOG				0x0c
574 #define AR71XX_RESET_REG_MISC_INT_STATUS		0x10
575 #define AR71XX_RESET_REG_MISC_INT_ENABLE		0x14
576 #define AR71XX_RESET_REG_PCI_INT_STATUS			0x18
577 #define AR71XX_RESET_REG_PCI_INT_ENABLE			0x1c
578 #define AR71XX_RESET_REG_GLOBAL_INT_STATUS		0x20
579 #define AR71XX_RESET_REG_RESET_MODULE			0x24
580 #define AR71XX_RESET_REG_PERFC_CTRL			0x2c
581 #define AR71XX_RESET_REG_PERFC0				0x30
582 #define AR71XX_RESET_REG_PERFC1				0x34
583 #define AR71XX_RESET_REG_REV_ID				0x90
584 
585 #define AR913X_RESET_REG_GLOBAL_INT_STATUS		0x18
586 #define AR913X_RESET_REG_RESET_MODULE			0x1c
587 #define AR913X_RESET_REG_PERF_CTRL			0x20
588 #define AR913X_RESET_REG_PERFC0				0x24
589 #define AR913X_RESET_REG_PERFC1				0x28
590 
591 #define AR724X_RESET_REG_RESET_MODULE			0x1c
592 
593 #define AR933X_RESET_REG_RESET_MODULE			0x1c
594 #define AR933X_RESET_REG_BOOTSTRAP			0xac
595 
596 #define AR934X_RESET_REG_RESET_MODULE			0x1c
597 #define AR934X_RESET_REG_BOOTSTRAP			0xb0
598 #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS		0xac
599 
600 #define QCA953X_RESET_REG_RESET_MODULE			0x1c
601 #define QCA953X_RESET_REG_BOOTSTRAP			0xb0
602 #define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS		0xac
603 
604 #define QCA955X_RESET_REG_RESET_MODULE			0x1c
605 #define QCA955X_RESET_REG_BOOTSTRAP			0xb0
606 #define QCA955X_RESET_REG_EXT_INT_STATUS		0xac
607 
608 #define QCA956X_RESET_REG_RESET_MODULE			0x1c
609 #define QCA956X_RESET_REG_BOOTSTRAP			0xb0
610 #define QCA956X_RESET_REG_EXT_INT_STATUS		0xac
611 
612 #define MISC_INT_MIPS_SI_TIMERINT_MASK			BIT(28)
613 #define MISC_INT_ETHSW					BIT(12)
614 #define MISC_INT_TIMER4					BIT(10)
615 #define MISC_INT_TIMER3					BIT(9)
616 #define MISC_INT_TIMER2					BIT(8)
617 #define MISC_INT_DMA					BIT(7)
618 #define MISC_INT_OHCI					BIT(6)
619 #define MISC_INT_PERFC					BIT(5)
620 #define MISC_INT_WDOG					BIT(4)
621 #define MISC_INT_UART					BIT(3)
622 #define MISC_INT_GPIO					BIT(2)
623 #define MISC_INT_ERROR					BIT(1)
624 #define MISC_INT_TIMER					BIT(0)
625 
626 #define AR71XX_RESET_EXTERNAL				BIT(28)
627 #define AR71XX_RESET_FULL_CHIP				BIT(24)
628 #define AR71XX_RESET_CPU_NMI				BIT(21)
629 #define AR71XX_RESET_CPU_COLD				BIT(20)
630 #define AR71XX_RESET_DMA				BIT(19)
631 #define AR71XX_RESET_SLIC				BIT(18)
632 #define AR71XX_RESET_STEREO				BIT(17)
633 #define AR71XX_RESET_DDR				BIT(16)
634 #define AR71XX_RESET_GE1_MAC				BIT(13)
635 #define AR71XX_RESET_GE1_PHY				BIT(12)
636 #define AR71XX_RESET_USBSUS_OVERRIDE			BIT(10)
637 #define AR71XX_RESET_GE0_MAC				BIT(9)
638 #define AR71XX_RESET_GE0_PHY				BIT(8)
639 #define AR71XX_RESET_USB_OHCI_DLL			BIT(6)
640 #define AR71XX_RESET_USB_HOST				BIT(5)
641 #define AR71XX_RESET_USB_PHY				BIT(4)
642 #define AR71XX_RESET_PCI_BUS				BIT(1)
643 #define AR71XX_RESET_PCI_CORE				BIT(0)
644 
645 #define AR7240_RESET_USB_HOST				BIT(5)
646 #define AR7240_RESET_OHCI_DLL				BIT(3)
647 
648 #define AR724X_RESET_GE1_MDIO				BIT(23)
649 #define AR724X_RESET_GE0_MDIO				BIT(22)
650 #define AR724X_RESET_PCIE_PHY_SERIAL			BIT(10)
651 #define AR724X_RESET_PCIE_PHY				BIT(7)
652 #define AR724X_RESET_PCIE				BIT(6)
653 #define AR724X_RESET_USB_HOST				BIT(5)
654 #define AR724X_RESET_USB_PHY				BIT(4)
655 #define AR724X_RESET_USBSUS_OVERRIDE			BIT(3)
656 
657 #define AR913X_RESET_AMBA2WMAC				BIT(22)
658 #define AR913X_RESET_USBSUS_OVERRIDE			BIT(10)
659 #define AR913X_RESET_USB_HOST				BIT(5)
660 #define AR913X_RESET_USB_PHY				BIT(4)
661 
662 #define AR933X_RESET_GE1_MDIO				BIT(23)
663 #define AR933X_RESET_GE0_MDIO				BIT(22)
664 #define AR933X_RESET_ETH_SWITCH_ANALOG			BIT(14)
665 #define AR933X_RESET_GE1_MAC				BIT(13)
666 #define AR933X_RESET_WMAC				BIT(11)
667 #define AR933X_RESET_GE0_MAC				BIT(9)
668 #define AR933X_RESET_ETH_SWITCH				BIT(8)
669 #define AR933X_RESET_USB_HOST				BIT(5)
670 #define AR933X_RESET_USB_PHY				BIT(4)
671 #define AR933X_RESET_USBSUS_OVERRIDE			BIT(3)
672 
673 #define AR934X_RESET_HOST				BIT(31)
674 #define AR934X_RESET_SLIC				BIT(30)
675 #define AR934X_RESET_HDMA				BIT(29)
676 #define AR934X_RESET_EXTERNAL				BIT(28)
677 #define AR934X_RESET_RTC				BIT(27)
678 #define AR934X_RESET_PCIE_EP_INT			BIT(26)
679 #define AR934X_RESET_CHKSUM_ACC				BIT(25)
680 #define AR934X_RESET_FULL_CHIP				BIT(24)
681 #define AR934X_RESET_GE1_MDIO				BIT(23)
682 #define AR934X_RESET_GE0_MDIO				BIT(22)
683 #define AR934X_RESET_CPU_NMI				BIT(21)
684 #define AR934X_RESET_CPU_COLD				BIT(20)
685 #define AR934X_RESET_HOST_RESET_INT			BIT(19)
686 #define AR934X_RESET_PCIE_EP				BIT(18)
687 #define AR934X_RESET_UART1				BIT(17)
688 #define AR934X_RESET_DDR				BIT(16)
689 #define AR934X_RESET_USB_PHY_PLL_PWD_EXT		BIT(15)
690 #define AR934X_RESET_NANDF				BIT(14)
691 #define AR934X_RESET_GE1_MAC				BIT(13)
692 #define AR934X_RESET_ETH_SWITCH_ANALOG			BIT(12)
693 #define AR934X_RESET_USB_PHY_ANALOG			BIT(11)
694 #define AR934X_RESET_HOST_DMA_INT			BIT(10)
695 #define AR934X_RESET_GE0_MAC				BIT(9)
696 #define AR934X_RESET_ETH_SWITCH				BIT(8)
697 #define AR934X_RESET_PCIE_PHY				BIT(7)
698 #define AR934X_RESET_PCIE				BIT(6)
699 #define AR934X_RESET_USB_HOST				BIT(5)
700 #define AR934X_RESET_USB_PHY				BIT(4)
701 #define AR934X_RESET_USBSUS_OVERRIDE			BIT(3)
702 #define AR934X_RESET_LUT				BIT(2)
703 #define AR934X_RESET_MBOX				BIT(1)
704 #define AR934X_RESET_I2S				BIT(0)
705 
706 #define QCA953X_RESET_USB_EXT_PWR			BIT(29)
707 #define QCA953X_RESET_EXTERNAL				BIT(28)
708 #define QCA953X_RESET_RTC				BIT(27)
709 #define QCA953X_RESET_FULL_CHIP				BIT(24)
710 #define QCA953X_RESET_GE1_MDIO				BIT(23)
711 #define QCA953X_RESET_GE0_MDIO				BIT(22)
712 #define QCA953X_RESET_CPU_NMI				BIT(21)
713 #define QCA953X_RESET_CPU_COLD				BIT(20)
714 #define QCA953X_RESET_DDR				BIT(16)
715 #define QCA953X_RESET_USB_PHY_PLL_PWD_EXT		BIT(15)
716 #define QCA953X_RESET_GE1_MAC				BIT(13)
717 #define QCA953X_RESET_ETH_SWITCH_ANALOG			BIT(12)
718 #define QCA953X_RESET_USB_PHY_ANALOG			BIT(11)
719 #define QCA953X_RESET_GE0_MAC				BIT(9)
720 #define QCA953X_RESET_ETH_SWITCH			BIT(8)
721 #define QCA953X_RESET_PCIE_PHY				BIT(7)
722 #define QCA953X_RESET_PCIE				BIT(6)
723 #define QCA953X_RESET_USB_HOST				BIT(5)
724 #define QCA953X_RESET_USB_PHY				BIT(4)
725 #define QCA953X_RESET_USBSUS_OVERRIDE			BIT(3)
726 
727 #define QCA955X_RESET_HOST				BIT(31)
728 #define QCA955X_RESET_SLIC				BIT(30)
729 #define QCA955X_RESET_HDMA				BIT(29)
730 #define QCA955X_RESET_EXTERNAL				BIT(28)
731 #define QCA955X_RESET_RTC				BIT(27)
732 #define QCA955X_RESET_PCIE_EP_INT			BIT(26)
733 #define QCA955X_RESET_CHKSUM_ACC			BIT(25)
734 #define QCA955X_RESET_FULL_CHIP				BIT(24)
735 #define QCA955X_RESET_GE1_MDIO				BIT(23)
736 #define QCA955X_RESET_GE0_MDIO				BIT(22)
737 #define QCA955X_RESET_CPU_NMI				BIT(21)
738 #define QCA955X_RESET_CPU_COLD				BIT(20)
739 #define QCA955X_RESET_HOST_RESET_INT			BIT(19)
740 #define QCA955X_RESET_PCIE_EP				BIT(18)
741 #define QCA955X_RESET_UART1				BIT(17)
742 #define QCA955X_RESET_DDR				BIT(16)
743 #define QCA955X_RESET_USB_PHY_PLL_PWD_EXT		BIT(15)
744 #define QCA955X_RESET_NANDF				BIT(14)
745 #define QCA955X_RESET_GE1_MAC				BIT(13)
746 #define QCA955X_RESET_SGMII_ANALOG			BIT(12)
747 #define QCA955X_RESET_USB_PHY_ANALOG			BIT(11)
748 #define QCA955X_RESET_HOST_DMA_INT			BIT(10)
749 #define QCA955X_RESET_GE0_MAC				BIT(9)
750 #define QCA955X_RESET_SGMII				BIT(8)
751 #define QCA955X_RESET_PCIE_PHY				BIT(7)
752 #define QCA955X_RESET_PCIE				BIT(6)
753 #define QCA955X_RESET_USB_HOST				BIT(5)
754 #define QCA955X_RESET_USB_PHY				BIT(4)
755 #define QCA955X_RESET_USBSUS_OVERRIDE			BIT(3)
756 #define QCA955X_RESET_LUT				BIT(2)
757 #define QCA955X_RESET_MBOX				BIT(1)
758 #define QCA955X_RESET_I2S				BIT(0)
759 
760 #define AR933X_BOOTSTRAP_MDIO_GPIO_EN			BIT(18)
761 #define AR933X_BOOTSTRAP_DDR2				BIT(13)
762 #define AR933X_BOOTSTRAP_EEPBUSY			BIT(4)
763 #define AR933X_BOOTSTRAP_REF_CLK_40			BIT(0)
764 
765 #define AR934X_BOOTSTRAP_SW_OPTION8			BIT(23)
766 #define AR934X_BOOTSTRAP_SW_OPTION7			BIT(22)
767 #define AR934X_BOOTSTRAP_SW_OPTION6			BIT(21)
768 #define AR934X_BOOTSTRAP_SW_OPTION5			BIT(20)
769 #define AR934X_BOOTSTRAP_SW_OPTION4			BIT(19)
770 #define AR934X_BOOTSTRAP_SW_OPTION3			BIT(18)
771 #define AR934X_BOOTSTRAP_SW_OPTION2			BIT(17)
772 #define AR934X_BOOTSTRAP_SW_OPTION1			BIT(16)
773 #define AR934X_BOOTSTRAP_USB_MODE_DEVICE		BIT(7)
774 #define AR934X_BOOTSTRAP_PCIE_RC			BIT(6)
775 #define AR934X_BOOTSTRAP_EJTAG_MODE			BIT(5)
776 #define AR934X_BOOTSTRAP_REF_CLK_40			BIT(4)
777 #define AR934X_BOOTSTRAP_BOOT_FROM_SPI			BIT(2)
778 #define AR934X_BOOTSTRAP_SDRAM_DISABLED			BIT(1)
779 #define AR934X_BOOTSTRAP_DDR1				BIT(0)
780 
781 #define QCA953X_BOOTSTRAP_SW_OPTION2			BIT(12)
782 #define QCA953X_BOOTSTRAP_SW_OPTION1			BIT(11)
783 #define QCA953X_BOOTSTRAP_EJTAG_MODE			BIT(5)
784 #define QCA953X_BOOTSTRAP_REF_CLK_40			BIT(4)
785 #define QCA953X_BOOTSTRAP_SDRAM_DISABLED		BIT(1)
786 #define QCA953X_BOOTSTRAP_DDR1				BIT(0)
787 
788 #define QCA955X_BOOTSTRAP_REF_CLK_40			BIT(4)
789 
790 #define QCA956X_BOOTSTRAP_REF_CLK_40			BIT(2)
791 
792 #define AR934X_PCIE_WMAC_INT_WMAC_MISC			BIT(0)
793 #define AR934X_PCIE_WMAC_INT_WMAC_TX			BIT(1)
794 #define AR934X_PCIE_WMAC_INT_WMAC_RXLP			BIT(2)
795 #define AR934X_PCIE_WMAC_INT_WMAC_RXHP			BIT(3)
796 #define AR934X_PCIE_WMAC_INT_PCIE_RC			BIT(4)
797 #define AR934X_PCIE_WMAC_INT_PCIE_RC0			BIT(5)
798 #define AR934X_PCIE_WMAC_INT_PCIE_RC1			BIT(6)
799 #define AR934X_PCIE_WMAC_INT_PCIE_RC2			BIT(7)
800 #define AR934X_PCIE_WMAC_INT_PCIE_RC3			BIT(8)
801 #define AR934X_PCIE_WMAC_INT_WMAC_ALL \
802 	(AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
803 	 AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
804 
805 #define AR934X_PCIE_WMAC_INT_PCIE_ALL \
806 	(AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
807 	 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
808 	 AR934X_PCIE_WMAC_INT_PCIE_RC3)
809 
810 #define QCA953X_PCIE_WMAC_INT_WMAC_MISC			BIT(0)
811 #define QCA953X_PCIE_WMAC_INT_WMAC_TX			BIT(1)
812 #define QCA953X_PCIE_WMAC_INT_WMAC_RXLP			BIT(2)
813 #define QCA953X_PCIE_WMAC_INT_WMAC_RXHP			BIT(3)
814 #define QCA953X_PCIE_WMAC_INT_PCIE_RC			BIT(4)
815 #define QCA953X_PCIE_WMAC_INT_PCIE_RC0			BIT(5)
816 #define QCA953X_PCIE_WMAC_INT_PCIE_RC1			BIT(6)
817 #define QCA953X_PCIE_WMAC_INT_PCIE_RC2			BIT(7)
818 #define QCA953X_PCIE_WMAC_INT_PCIE_RC3			BIT(8)
819 #define QCA953X_PCIE_WMAC_INT_WMAC_ALL \
820 	(QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \
821 	 QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP)
822 
823 #define QCA953X_PCIE_WMAC_INT_PCIE_ALL \
824 	(QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \
825 	 QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \
826 	 QCA953X_PCIE_WMAC_INT_PCIE_RC3)
827 
828 #define QCA955X_EXT_INT_WMAC_MISC			BIT(0)
829 #define QCA955X_EXT_INT_WMAC_TX				BIT(1)
830 #define QCA955X_EXT_INT_WMAC_RXLP			BIT(2)
831 #define QCA955X_EXT_INT_WMAC_RXHP			BIT(3)
832 #define QCA955X_EXT_INT_PCIE_RC1			BIT(4)
833 #define QCA955X_EXT_INT_PCIE_RC1_INT0			BIT(5)
834 #define QCA955X_EXT_INT_PCIE_RC1_INT1			BIT(6)
835 #define QCA955X_EXT_INT_PCIE_RC1_INT2			BIT(7)
836 #define QCA955X_EXT_INT_PCIE_RC1_INT3			BIT(8)
837 #define QCA955X_EXT_INT_PCIE_RC2			BIT(12)
838 #define QCA955X_EXT_INT_PCIE_RC2_INT0			BIT(13)
839 #define QCA955X_EXT_INT_PCIE_RC2_INT1			BIT(14)
840 #define QCA955X_EXT_INT_PCIE_RC2_INT2			BIT(15)
841 #define QCA955X_EXT_INT_PCIE_RC2_INT3			BIT(16)
842 #define QCA955X_EXT_INT_USB1				BIT(24)
843 #define QCA955X_EXT_INT_USB2				BIT(28)
844 
845 #define QCA955X_EXT_INT_WMAC_ALL \
846 	(QCA955X_EXT_INT_WMAC_MISC | QCA955X_EXT_INT_WMAC_TX | \
847 	 QCA955X_EXT_INT_WMAC_RXLP | QCA955X_EXT_INT_WMAC_RXHP)
848 
849 #define QCA955X_EXT_INT_PCIE_RC1_ALL \
850 	(QCA955X_EXT_INT_PCIE_RC1 | QCA955X_EXT_INT_PCIE_RC1_INT0 | \
851 	 QCA955X_EXT_INT_PCIE_RC1_INT1 | QCA955X_EXT_INT_PCIE_RC1_INT2 | \
852 	 QCA955X_EXT_INT_PCIE_RC1_INT3)
853 
854 #define QCA955X_EXT_INT_PCIE_RC2_ALL \
855 	(QCA955X_EXT_INT_PCIE_RC2 | QCA955X_EXT_INT_PCIE_RC2_INT0 | \
856 	 QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
857 	 QCA955X_EXT_INT_PCIE_RC2_INT3)
858 
859 #define QCA956X_EXT_INT_WMAC_MISC			BIT(0)
860 #define QCA956X_EXT_INT_WMAC_TX				BIT(1)
861 #define QCA956X_EXT_INT_WMAC_RXLP			BIT(2)
862 #define QCA956X_EXT_INT_WMAC_RXHP			BIT(3)
863 #define QCA956X_EXT_INT_PCIE_RC1			BIT(4)
864 #define QCA956X_EXT_INT_PCIE_RC1_INT0			BIT(5)
865 #define QCA956X_EXT_INT_PCIE_RC1_INT1			BIT(6)
866 #define QCA956X_EXT_INT_PCIE_RC1_INT2			BIT(7)
867 #define QCA956X_EXT_INT_PCIE_RC1_INT3			BIT(8)
868 #define QCA956X_EXT_INT_PCIE_RC2			BIT(12)
869 #define QCA956X_EXT_INT_PCIE_RC2_INT0			BIT(13)
870 #define QCA956X_EXT_INT_PCIE_RC2_INT1			BIT(14)
871 #define QCA956X_EXT_INT_PCIE_RC2_INT2			BIT(15)
872 #define QCA956X_EXT_INT_PCIE_RC2_INT3			BIT(16)
873 #define QCA956X_EXT_INT_USB1				BIT(24)
874 #define QCA956X_EXT_INT_USB2				BIT(28)
875 
876 #define QCA956X_EXT_INT_WMAC_ALL \
877 	(QCA956X_EXT_INT_WMAC_MISC | QCA956X_EXT_INT_WMAC_TX | \
878 	 QCA956X_EXT_INT_WMAC_RXLP | QCA956X_EXT_INT_WMAC_RXHP)
879 
880 #define QCA956X_EXT_INT_PCIE_RC1_ALL \
881 	(QCA956X_EXT_INT_PCIE_RC1 | QCA956X_EXT_INT_PCIE_RC1_INT0 | \
882 	 QCA956X_EXT_INT_PCIE_RC1_INT1 | QCA956X_EXT_INT_PCIE_RC1_INT2 | \
883 	 QCA956X_EXT_INT_PCIE_RC1_INT3)
884 
885 #define QCA956X_EXT_INT_PCIE_RC2_ALL \
886 	(QCA956X_EXT_INT_PCIE_RC2 | QCA956X_EXT_INT_PCIE_RC2_INT0 | \
887 	 QCA956X_EXT_INT_PCIE_RC2_INT1 | QCA956X_EXT_INT_PCIE_RC2_INT2 | \
888 	 QCA956X_EXT_INT_PCIE_RC2_INT3)
889 
890 #define REV_ID_MAJOR_MASK				0xfff0
891 #define REV_ID_MAJOR_AR71XX				0x00a0
892 #define REV_ID_MAJOR_AR913X				0x00b0
893 #define REV_ID_MAJOR_AR7240				0x00c0
894 #define REV_ID_MAJOR_AR7241				0x0100
895 #define REV_ID_MAJOR_AR7242				0x1100
896 #define REV_ID_MAJOR_AR9330				0x0110
897 #define REV_ID_MAJOR_AR9331				0x1110
898 #define REV_ID_MAJOR_AR9341				0x0120
899 #define REV_ID_MAJOR_AR9342				0x1120
900 #define REV_ID_MAJOR_AR9344				0x2120
901 #define REV_ID_MAJOR_QCA9533				0x0140
902 #define REV_ID_MAJOR_QCA9533_V2				0x0160
903 #define REV_ID_MAJOR_QCA9556				0x0130
904 #define REV_ID_MAJOR_QCA9558				0x1130
905 #define REV_ID_MAJOR_TP9343				0x0150
906 #define REV_ID_MAJOR_QCA9561				0x1150
907 
908 #define AR71XX_REV_ID_MINOR_MASK			0x3
909 #define AR71XX_REV_ID_MINOR_AR7130			0x0
910 #define AR71XX_REV_ID_MINOR_AR7141			0x1
911 #define AR71XX_REV_ID_MINOR_AR7161			0x2
912 #define AR913X_REV_ID_MINOR_AR9130			0x0
913 #define AR913X_REV_ID_MINOR_AR9132			0x1
914 
915 #define AR71XX_REV_ID_REVISION_MASK			0x3
916 #define AR71XX_REV_ID_REVISION_SHIFT			2
917 #define AR71XX_REV_ID_REVISION2_MASK			0xf
918 
919 /*
920  * RTC block
921  */
922 #define AR933X_RTC_REG_RESET				0x40
923 #define AR933X_RTC_REG_STATUS				0x44
924 #define AR933X_RTC_REG_DERIVED				0x48
925 #define AR933X_RTC_REG_FORCE_WAKE			0x4c
926 #define AR933X_RTC_REG_INT_CAUSE			0x50
927 #define AR933X_RTC_REG_CAUSE_CLR			0x50
928 #define AR933X_RTC_REG_INT_ENABLE			0x54
929 #define AR933X_RTC_REG_INT_MASKE			0x58
930 
931 #define QCA953X_RTC_REG_SYNC_RESET			0x40
932 #define QCA953X_RTC_REG_SYNC_STATUS			0x44
933 
934 /*
935  * SPI block
936  */
937 #define AR71XX_SPI_REG_FS				0x00
938 #define AR71XX_SPI_REG_CTRL				0x04
939 #define AR71XX_SPI_REG_IOC				0x08
940 #define AR71XX_SPI_REG_RDS				0x0c
941 
942 #define AR71XX_SPI_FS_GPIO				BIT(0)
943 
944 #define AR71XX_SPI_CTRL_RD				BIT(6)
945 #define AR71XX_SPI_CTRL_DIV_MASK			0x3f
946 
947 #define AR71XX_SPI_IOC_DO				BIT(0)
948 #define AR71XX_SPI_IOC_CLK				BIT(8)
949 #define AR71XX_SPI_IOC_CS(n)				BIT(16 + (n))
950 #define AR71XX_SPI_IOC_CS0				AR71XX_SPI_IOC_CS(0)
951 #define AR71XX_SPI_IOC_CS1				AR71XX_SPI_IOC_CS(1)
952 #define AR71XX_SPI_IOC_CS2				AR71XX_SPI_IOC_CS(2)
953 #define AR71XX_SPI_IOC_CS_ALL \
954 	(AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | AR71XX_SPI_IOC_CS2)
955 
956 /*
957  * GPIO block
958  */
959 #define AR71XX_GPIO_REG_OE				0x00
960 #define AR71XX_GPIO_REG_IN				0x04
961 #define AR71XX_GPIO_REG_OUT				0x08
962 #define AR71XX_GPIO_REG_SET				0x0c
963 #define AR71XX_GPIO_REG_CLEAR				0x10
964 #define AR71XX_GPIO_REG_INT_MODE			0x14
965 #define AR71XX_GPIO_REG_INT_TYPE			0x18
966 #define AR71XX_GPIO_REG_INT_POLARITY			0x1c
967 #define AR71XX_GPIO_REG_INT_PENDING			0x20
968 #define AR71XX_GPIO_REG_INT_ENABLE			0x24
969 #define AR71XX_GPIO_REG_FUNC				0x28
970 #define AR933X_GPIO_REG_FUNC				0x30
971 
972 #define AR934X_GPIO_REG_OUT_FUNC0			0x2c
973 #define AR934X_GPIO_REG_OUT_FUNC1			0x30
974 #define AR934X_GPIO_REG_OUT_FUNC2			0x34
975 #define AR934X_GPIO_REG_OUT_FUNC3			0x38
976 #define AR934X_GPIO_REG_OUT_FUNC4			0x3c
977 #define AR934X_GPIO_REG_OUT_FUNC5			0x40
978 #define AR934X_GPIO_REG_FUNC				0x6c
979 
980 #define QCA953X_GPIO_REG_OUT_FUNC0			0x2c
981 #define QCA953X_GPIO_REG_OUT_FUNC1			0x30
982 #define QCA953X_GPIO_REG_OUT_FUNC2			0x34
983 #define QCA953X_GPIO_REG_OUT_FUNC3			0x38
984 #define QCA953X_GPIO_REG_OUT_FUNC4			0x3c
985 #define QCA953X_GPIO_REG_IN_ENABLE0			0x44
986 #define QCA953X_GPIO_REG_FUNC				0x6c
987 
988 #define QCA955X_GPIO_REG_OUT_FUNC0			0x2c
989 #define QCA955X_GPIO_REG_OUT_FUNC1			0x30
990 #define QCA955X_GPIO_REG_OUT_FUNC2			0x34
991 #define QCA955X_GPIO_REG_OUT_FUNC3			0x38
992 #define QCA955X_GPIO_REG_OUT_FUNC4			0x3c
993 #define QCA955X_GPIO_REG_OUT_FUNC5			0x40
994 #define QCA955X_GPIO_REG_FUNC				0x6c
995 
996 #define QCA956X_GPIO_REG_OUT_FUNC0			0x2c
997 #define QCA956X_GPIO_REG_OUT_FUNC1			0x30
998 #define QCA956X_GPIO_REG_OUT_FUNC2			0x34
999 #define QCA956X_GPIO_REG_OUT_FUNC3			0x38
1000 #define QCA956X_GPIO_REG_OUT_FUNC4			0x3c
1001 #define QCA956X_GPIO_REG_OUT_FUNC5			0x40
1002 #define QCA956X_GPIO_REG_IN_ENABLE0			0x44
1003 #define QCA956X_GPIO_REG_IN_ENABLE3			0x50
1004 #define QCA956X_GPIO_REG_FUNC				0x6c
1005 
1006 #define AR71XX_GPIO_FUNC_STEREO_EN			BIT(17)
1007 #define AR71XX_GPIO_FUNC_SLIC_EN			BIT(16)
1008 #define AR71XX_GPIO_FUNC_SPI_CS2_EN			BIT(13)
1009 #define AR71XX_GPIO_FUNC_SPI_CS1_EN			BIT(12)
1010 #define AR71XX_GPIO_FUNC_UART_EN			BIT(8)
1011 #define AR71XX_GPIO_FUNC_USB_OC_EN			BIT(4)
1012 #define AR71XX_GPIO_FUNC_USB_CLK_EN			BIT(0)
1013 
1014 #define AR724X_GPIO_FUNC_GE0_MII_CLK_EN			BIT(19)
1015 #define AR724X_GPIO_FUNC_SPI_EN				BIT(18)
1016 #define AR724X_GPIO_FUNC_SPI_CS_EN2			BIT(14)
1017 #define AR724X_GPIO_FUNC_SPI_CS_EN1			BIT(13)
1018 #define AR724X_GPIO_FUNC_CLK_OBS5_EN			BIT(12)
1019 #define AR724X_GPIO_FUNC_CLK_OBS4_EN			BIT(11)
1020 #define AR724X_GPIO_FUNC_CLK_OBS3_EN			BIT(10)
1021 #define AR724X_GPIO_FUNC_CLK_OBS2_EN			BIT(9)
1022 #define AR724X_GPIO_FUNC_CLK_OBS1_EN			BIT(8)
1023 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN		BIT(7)
1024 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN		BIT(6)
1025 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN		BIT(5)
1026 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN		BIT(4)
1027 #define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN		BIT(3)
1028 #define AR724X_GPIO_FUNC_UART_RTS_CTS_EN		BIT(2)
1029 #define AR724X_GPIO_FUNC_UART_EN			BIT(1)
1030 #define AR724X_GPIO_FUNC_JTAG_DISABLE			BIT(0)
1031 
1032 #define AR913X_GPIO_FUNC_WMAC_LED_EN			BIT(22)
1033 #define AR913X_GPIO_FUNC_EXP_PORT_CS_EN			BIT(21)
1034 #define AR913X_GPIO_FUNC_I2S_REFCLKEN			BIT(20)
1035 #define AR913X_GPIO_FUNC_I2S_MCKEN			BIT(19)
1036 #define AR913X_GPIO_FUNC_I2S1_EN			BIT(18)
1037 #define AR913X_GPIO_FUNC_I2S0_EN			BIT(17)
1038 #define AR913X_GPIO_FUNC_SLIC_EN			BIT(16)
1039 #define AR913X_GPIO_FUNC_UART_RTSCTS_EN			BIT(9)
1040 #define AR913X_GPIO_FUNC_UART_EN			BIT(8)
1041 #define AR913X_GPIO_FUNC_USB_CLK_EN			BIT(4)
1042 
1043 #define AR933X_GPIO(x)					BIT(x)
1044 #define AR933X_GPIO_FUNC_SPDIF2TCK			BIT(31)
1045 #define AR933X_GPIO_FUNC_SPDIF_EN			BIT(30)
1046 #define AR933X_GPIO_FUNC_I2SO_22_18_EN			BIT(29)
1047 #define AR933X_GPIO_FUNC_I2S_MCK_EN			BIT(27)
1048 #define AR933X_GPIO_FUNC_I2SO_EN			BIT(26)
1049 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL		BIT(25)
1050 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL		BIT(24)
1051 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT		BIT(23)
1052 #define AR933X_GPIO_FUNC_SPI_EN				BIT(18)
1053 #define AR933X_GPIO_FUNC_RES_TRUE			BIT(15)
1054 #define AR933X_GPIO_FUNC_SPI_CS_EN2			BIT(14)
1055 #define AR933X_GPIO_FUNC_SPI_CS_EN1			BIT(13)
1056 #define AR933X_GPIO_FUNC_XLNA_EN			BIT(12)
1057 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN		BIT(7)
1058 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN		BIT(6)
1059 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN		BIT(5)
1060 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN		BIT(4)
1061 #define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN		BIT(3)
1062 #define AR933X_GPIO_FUNC_UART_RTS_CTS_EN		BIT(2)
1063 #define AR933X_GPIO_FUNC_UART_EN			BIT(1)
1064 #define AR933X_GPIO_FUNC_JTAG_DISABLE			BIT(0)
1065 
1066 #define AR934X_GPIO_FUNC_CLK_OBS7_EN			BIT(9)
1067 #define AR934X_GPIO_FUNC_CLK_OBS6_EN			BIT(8)
1068 #define AR934X_GPIO_FUNC_CLK_OBS5_EN			BIT(7)
1069 #define AR934X_GPIO_FUNC_CLK_OBS4_EN			BIT(6)
1070 #define AR934X_GPIO_FUNC_CLK_OBS3_EN			BIT(5)
1071 #define AR934X_GPIO_FUNC_CLK_OBS2_EN			BIT(4)
1072 #define AR934X_GPIO_FUNC_CLK_OBS1_EN			BIT(3)
1073 #define AR934X_GPIO_FUNC_CLK_OBS0_EN			BIT(2)
1074 #define AR934X_GPIO_FUNC_JTAG_DISABLE			BIT(1)
1075 
1076 #define AR934X_GPIO_OUT_GPIO				0
1077 #define AR934X_GPIO_OUT_SPI_CS1				7
1078 #define AR934X_GPIO_OUT_LED_LINK0			41
1079 #define AR934X_GPIO_OUT_LED_LINK1			42
1080 #define AR934X_GPIO_OUT_LED_LINK2			43
1081 #define AR934X_GPIO_OUT_LED_LINK3			44
1082 #define AR934X_GPIO_OUT_LED_LINK4			45
1083 #define AR934X_GPIO_OUT_EXT_LNA0			46
1084 #define AR934X_GPIO_OUT_EXT_LNA1			47
1085 
1086 #define QCA953X_GPIO(x)					BIT(x)
1087 #define QCA953X_GPIO_MUX_MASK(x)			(0xff << (x))
1088 #define QCA953X_GPIO_OUT_MUX_SPI_CS1			10
1089 #define QCA953X_GPIO_OUT_MUX_SPI_CS2			11
1090 #define QCA953X_GPIO_OUT_MUX_SPI_CS0			9
1091 #define QCA953X_GPIO_OUT_MUX_SPI_CLK			8
1092 #define QCA953X_GPIO_OUT_MUX_SPI_MOSI			12
1093 #define QCA953X_GPIO_OUT_MUX_UART0_SOUT			22
1094 #define QCA953X_GPIO_OUT_MUX_LED_LINK1			41
1095 #define QCA953X_GPIO_OUT_MUX_LED_LINK2			42
1096 #define QCA953X_GPIO_OUT_MUX_LED_LINK3			43
1097 #define QCA953X_GPIO_OUT_MUX_LED_LINK4			44
1098 #define QCA953X_GPIO_OUT_MUX_LED_LINK5			45
1099 
1100 #define QCA953X_GPIO_IN_MUX_UART0_SIN			9
1101 #define QCA953X_GPIO_IN_MUX_SPI_DATA_IN			8
1102 
1103 #define QCA956X_GPIO_OUT_MUX_GE0_MDO			32
1104 #define QCA956X_GPIO_OUT_MUX_GE0_MDC			33
1105 
1106 #define AR71XX_GPIO_COUNT				16
1107 #define AR7240_GPIO_COUNT				18
1108 #define AR7241_GPIO_COUNT				20
1109 #define AR913X_GPIO_COUNT				22
1110 #define AR933X_GPIO_COUNT				30
1111 #define AR934X_GPIO_COUNT				23
1112 #define QCA953X_GPIO_COUNT				18
1113 #define QCA955X_GPIO_COUNT				24
1114 #define QCA956X_GPIO_COUNT				23
1115 
1116 /*
1117  * SRIF block
1118  */
1119 #define AR933X_SRIF_DDR_DPLL1_REG			0x240
1120 #define AR933X_SRIF_DDR_DPLL2_REG			0x244
1121 #define AR933X_SRIF_DDR_DPLL3_REG			0x248
1122 #define AR933X_SRIF_DDR_DPLL4_REG			0x24c
1123 
1124 #define AR934X_SRIF_CPU_DPLL1_REG			0x1c0
1125 #define AR934X_SRIF_CPU_DPLL2_REG			0x1c4
1126 #define AR934X_SRIF_CPU_DPLL3_REG			0x1c8
1127 #define AR934X_SRIF_CPU_DPLL4_REG			0x1cc
1128 
1129 #define AR934X_SRIF_DDR_DPLL1_REG			0x240
1130 #define AR934X_SRIF_DDR_DPLL2_REG			0x244
1131 #define AR934X_SRIF_DDR_DPLL3_REG			0x248
1132 #define AR934X_SRIF_DDR_DPLL4_REG			0x24c
1133 
1134 #define AR934X_SRIF_DPLL1_REFDIV_SHIFT			27
1135 #define AR934X_SRIF_DPLL1_REFDIV_MASK			0x1f
1136 #define AR934X_SRIF_DPLL1_NINT_SHIFT			18
1137 #define AR934X_SRIF_DPLL1_NINT_MASK			0x1ff
1138 #define AR934X_SRIF_DPLL1_NFRAC_MASK			0x0003ffff
1139 
1140 #define AR934X_SRIF_DPLL2_LOCAL_PLL			BIT(30)
1141 #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT			13
1142 #define AR934X_SRIF_DPLL2_OUTDIV_MASK			0x7
1143 
1144 #define QCA953X_SRIF_BB_DPLL1_REG			0x180
1145 #define QCA953X_SRIF_BB_DPLL2_REG			0x184
1146 #define QCA953X_SRIF_BB_DPLL3_REG			0x188
1147 
1148 #define QCA953X_SRIF_CPU_DPLL1_REG			0x1c0
1149 #define QCA953X_SRIF_CPU_DPLL2_REG			0x1c4
1150 #define QCA953X_SRIF_CPU_DPLL3_REG			0x1c8
1151 
1152 #define QCA953X_SRIF_DDR_DPLL1_REG			0x240
1153 #define QCA953X_SRIF_DDR_DPLL2_REG			0x244
1154 #define QCA953X_SRIF_DDR_DPLL3_REG			0x248
1155 
1156 #define QCA953X_SRIF_PCIE_DPLL1_REG			0xc00
1157 #define QCA953X_SRIF_PCIE_DPLL2_REG			0xc04
1158 #define QCA953X_SRIF_PCIE_DPLL3_REG			0xc08
1159 
1160 #define QCA953X_SRIF_PMU1_REG				0xc40
1161 #define QCA953X_SRIF_PMU2_REG				0xc44
1162 
1163 #define QCA953X_SRIF_DPLL1_REFDIV_SHIFT			27
1164 #define QCA953X_SRIF_DPLL1_REFDIV_MASK			0x1f
1165 
1166 #define QCA953X_SRIF_DPLL1_NINT_SHIFT			18
1167 #define QCA953X_SRIF_DPLL1_NINT_MASK			0x1ff
1168 #define QCA953X_SRIF_DPLL1_NFRAC_MASK			0x0003ffff
1169 
1170 #define QCA953X_SRIF_DPLL2_LOCAL_PLL			BIT(30)
1171 
1172 #define QCA953X_SRIF_DPLL2_KI_SHIFT			29
1173 #define QCA953X_SRIF_DPLL2_KI_MASK			0x3
1174 
1175 #define QCA953X_SRIF_DPLL2_KD_SHIFT			25
1176 #define QCA953X_SRIF_DPLL2_KD_MASK			0xf
1177 
1178 #define QCA953X_SRIF_DPLL2_PWD				BIT(22)
1179 
1180 #define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT			13
1181 #define QCA953X_SRIF_DPLL2_OUTDIV_MASK			0x7
1182 
1183 /*
1184  * MII_CTRL block
1185  */
1186 #define AR71XX_MII_REG_MII0_CTRL			0x00
1187 #define AR71XX_MII_REG_MII1_CTRL			0x04
1188 
1189 #define AR71XX_MII_CTRL_IF_MASK				3
1190 #define AR71XX_MII_CTRL_SPEED_SHIFT			4
1191 #define AR71XX_MII_CTRL_SPEED_MASK			3
1192 #define AR71XX_MII_CTRL_SPEED_10			0
1193 #define AR71XX_MII_CTRL_SPEED_100			1
1194 #define AR71XX_MII_CTRL_SPEED_1000			2
1195 
1196 #define AR71XX_MII0_CTRL_IF_GMII			0
1197 #define AR71XX_MII0_CTRL_IF_MII				1
1198 #define AR71XX_MII0_CTRL_IF_RGMII			2
1199 #define AR71XX_MII0_CTRL_IF_RMII			3
1200 
1201 #define AR71XX_MII1_CTRL_IF_RGMII			0
1202 #define AR71XX_MII1_CTRL_IF_RMII			1
1203 
1204 /*
1205  * AR933X GMAC interface
1206  */
1207 #define AR933X_GMAC_REG_ETH_CFG				0x00
1208 
1209 #define AR933X_ETH_CFG_RGMII_GE0			BIT(0)
1210 #define AR933X_ETH_CFG_MII_GE0				BIT(1)
1211 #define AR933X_ETH_CFG_GMII_GE0				BIT(2)
1212 #define AR933X_ETH_CFG_MII_GE0_MASTER			BIT(3)
1213 #define AR933X_ETH_CFG_MII_GE0_SLAVE			BIT(4)
1214 #define AR933X_ETH_CFG_MII_GE0_ERR_EN			BIT(5)
1215 #define AR933X_ETH_CFG_SW_PHY_SWAP			BIT(7)
1216 #define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP			BIT(8)
1217 #define AR933X_ETH_CFG_RMII_GE0				BIT(9)
1218 #define AR933X_ETH_CFG_RMII_GE0_SPD_10			0
1219 #define AR933X_ETH_CFG_RMII_GE0_SPD_100			BIT(10)
1220 
1221 /*
1222  * AR934X GMAC Interface
1223  */
1224 #define AR934X_GMAC_REG_ETH_CFG				0x00
1225 
1226 #define AR934X_ETH_CFG_RGMII_GMAC0			BIT(0)
1227 #define AR934X_ETH_CFG_MII_GMAC0			BIT(1)
1228 #define AR934X_ETH_CFG_GMII_GMAC0			BIT(2)
1229 #define AR934X_ETH_CFG_MII_GMAC0_MASTER			BIT(3)
1230 #define AR934X_ETH_CFG_MII_GMAC0_SLAVE			BIT(4)
1231 #define AR934X_ETH_CFG_MII_GMAC0_ERR_EN			BIT(5)
1232 #define AR934X_ETH_CFG_SW_ONLY_MODE			BIT(6)
1233 #define AR934X_ETH_CFG_SW_PHY_SWAP			BIT(7)
1234 #define AR934X_ETH_CFG_SW_APB_ACCESS			BIT(9)
1235 #define AR934X_ETH_CFG_RMII_GMAC0			BIT(10)
1236 #define AR933X_ETH_CFG_MII_CNTL_SPEED			BIT(11)
1237 #define AR934X_ETH_CFG_RMII_GMAC0_MASTER			BIT(12)
1238 #define AR933X_ETH_CFG_SW_ACC_MSB_FIRST			BIT(13)
1239 #define AR934X_ETH_CFG_RXD_DELAY			BIT(14)
1240 #define AR934X_ETH_CFG_RXD_DELAY_MASK			0x3
1241 #define AR934X_ETH_CFG_RXD_DELAY_SHIFT			14
1242 #define AR934X_ETH_CFG_RDV_DELAY			BIT(16)
1243 #define AR934X_ETH_CFG_RDV_DELAY_MASK			0x3
1244 #define AR934X_ETH_CFG_RDV_DELAY_SHIFT			16
1245 
1246 /*
1247  * QCA953X GMAC Interface
1248  */
1249 #define QCA953X_GMAC_REG_ETH_CFG			0x00
1250 
1251 #define QCA953X_ETH_CFG_SW_ONLY_MODE			BIT(6)
1252 #define QCA953X_ETH_CFG_SW_PHY_SWAP			BIT(7)
1253 #define QCA953X_ETH_CFG_SW_APB_ACCESS			BIT(9)
1254 #define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST		BIT(13)
1255 
1256 /*
1257  * QCA955X GMAC Interface
1258  */
1259 
1260 #define QCA955X_GMAC_REG_ETH_CFG			0x00
1261 
1262 #define QCA955X_ETH_CFG_RGMII_EN			BIT(0)
1263 #define QCA955X_ETH_CFG_GE0_SGMII			BIT(6)
1264 
1265 #endif /* __ASM_AR71XX_H */
1266