xref: /linux/arch/mips/include/asm/mach-ath79/ar71xx_regs.h (revision fce5cc6e0ddc601e504063548034766c5c5a78d1)
1d4a67d9dSGabor Juhos /*
2d4a67d9dSGabor Juhos  *  Atheros AR71XX/AR724X/AR913X SoC register definitions
3d4a67d9dSGabor Juhos  *
4703327ddSGabor Juhos  *  Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
5d4a67d9dSGabor Juhos  *  Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
6d4a67d9dSGabor Juhos  *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7d4a67d9dSGabor Juhos  *
8703327ddSGabor Juhos  *  Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
9d4a67d9dSGabor Juhos  *
10d4a67d9dSGabor Juhos  *  This program is free software; you can redistribute it and/or modify it
11d4a67d9dSGabor Juhos  *  under the terms of the GNU General Public License version 2 as published
12d4a67d9dSGabor Juhos  *  by the Free Software Foundation.
13d4a67d9dSGabor Juhos  */
14d4a67d9dSGabor Juhos 
15d4a67d9dSGabor Juhos #ifndef __ASM_MACH_AR71XX_REGS_H
16d4a67d9dSGabor Juhos #define __ASM_MACH_AR71XX_REGS_H
17d4a67d9dSGabor Juhos 
18d4a67d9dSGabor Juhos #include <linux/types.h>
19d4a67d9dSGabor Juhos #include <linux/init.h>
20d4a67d9dSGabor Juhos #include <linux/io.h>
21d4a67d9dSGabor Juhos #include <linux/bitops.h>
22d4a67d9dSGabor Juhos 
23d4a67d9dSGabor Juhos #define AR71XX_APB_BASE		0x18000000
247e98aa46SGabor Juhos #define AR71XX_EHCI_BASE	0x1b000000
257e98aa46SGabor Juhos #define AR71XX_EHCI_SIZE	0x1000
267e98aa46SGabor Juhos #define AR71XX_OHCI_BASE	0x1c000000
277e98aa46SGabor Juhos #define AR71XX_OHCI_SIZE	0x1000
2868a1d316SGabor Juhos #define AR71XX_SPI_BASE		0x1f000000
2968a1d316SGabor Juhos #define AR71XX_SPI_SIZE		0x01000000
30d4a67d9dSGabor Juhos 
31d4a67d9dSGabor Juhos #define AR71XX_DDR_CTRL_BASE	(AR71XX_APB_BASE + 0x00000000)
32d4a67d9dSGabor Juhos #define AR71XX_DDR_CTRL_SIZE	0x100
33d4a67d9dSGabor Juhos #define AR71XX_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
34d4a67d9dSGabor Juhos #define AR71XX_UART_SIZE	0x100
357e98aa46SGabor Juhos #define AR71XX_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
367e98aa46SGabor Juhos #define AR71XX_USB_CTRL_SIZE	0x100
376eae43c5SGabor Juhos #define AR71XX_GPIO_BASE        (AR71XX_APB_BASE + 0x00040000)
386eae43c5SGabor Juhos #define AR71XX_GPIO_SIZE        0x100
39d4a67d9dSGabor Juhos #define AR71XX_PLL_BASE		(AR71XX_APB_BASE + 0x00050000)
40d4a67d9dSGabor Juhos #define AR71XX_PLL_SIZE		0x100
41d4a67d9dSGabor Juhos #define AR71XX_RESET_BASE	(AR71XX_APB_BASE + 0x00060000)
42d4a67d9dSGabor Juhos #define AR71XX_RESET_SIZE	0x100
43d4a67d9dSGabor Juhos 
447e98aa46SGabor Juhos #define AR7240_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
457e98aa46SGabor Juhos #define AR7240_USB_CTRL_SIZE	0x100
467e98aa46SGabor Juhos #define AR7240_OHCI_BASE	0x1b000000
477e98aa46SGabor Juhos #define AR7240_OHCI_SIZE	0x1000
487e98aa46SGabor Juhos 
497e98aa46SGabor Juhos #define AR724X_EHCI_BASE	0x1b000000
507e98aa46SGabor Juhos #define AR724X_EHCI_SIZE	0x1000
517e98aa46SGabor Juhos 
527e98aa46SGabor Juhos #define AR913X_EHCI_BASE	0x1b000000
537e98aa46SGabor Juhos #define AR913X_EHCI_SIZE	0x1000
54f5b35d0bSGabor Juhos #define AR913X_WMAC_BASE	(AR71XX_APB_BASE + 0x000C0000)
55f5b35d0bSGabor Juhos #define AR913X_WMAC_SIZE	0x30000
56f5b35d0bSGabor Juhos 
570bd3acdfSGabor Juhos #define AR933X_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
580bd3acdfSGabor Juhos #define AR933X_UART_SIZE	0x14
5934cfcd26SGabor Juhos #define AR933X_WMAC_BASE	(AR71XX_APB_BASE + 0x00100000)
6034cfcd26SGabor Juhos #define AR933X_WMAC_SIZE	0x20000
61c279b775SGabor Juhos #define AR933X_EHCI_BASE	0x1b000000
62c279b775SGabor Juhos #define AR933X_EHCI_SIZE	0x1000
63c279b775SGabor Juhos 
64d4a67d9dSGabor Juhos /*
65d4a67d9dSGabor Juhos  * DDR_CTRL block
66d4a67d9dSGabor Juhos  */
67d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN0		0x7c
68d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN1		0x80
69d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN2		0x84
70d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN3		0x88
71d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN4		0x8c
72d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN5		0x90
73d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN6		0x94
74d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN7		0x98
75d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE0	0x9c
76d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE1	0xa0
77d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_USB	0xa4
78d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_PCI	0xa8
79d4a67d9dSGabor Juhos 
80d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE0	0x7c
81d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE1	0x80
82d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_USB	0x84
83d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_PCIE	0x88
84d4a67d9dSGabor Juhos 
85d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE0	0x7c
86d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE1	0x80
87d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_USB	0x84
88d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_WMAC	0x88
89d4a67d9dSGabor Juhos 
9054eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_GE0	0x7c
9154eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_GE1	0x80
9254eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_USB	0x84
9354eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_WMAC	0x88
9454eed4c7SGabor Juhos 
95*fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_GE0	0x9c
96*fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_GE1	0xa0
97*fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_USB	0xa4
98*fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_PCIE	0xa8
99*fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_WMAC	0xac
100*fce5cc6eSGabor Juhos 
101d4a67d9dSGabor Juhos /*
102d4a67d9dSGabor Juhos  * PLL block
103d4a67d9dSGabor Juhos  */
104d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_CPU_CONFIG	0x00
105d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_SEC_CONFIG	0x04
106d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH0_INT_CLOCK	0x10
107d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH1_INT_CLOCK	0x14
108d4a67d9dSGabor Juhos 
109d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_SHIFT		3
110d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_MASK		0x1f
111d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_SHIFT		16
112d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_MASK		0x3
113d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_SHIFT		18
114d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_MASK		0x3
115d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_SHIFT		20
116d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_MASK		0x7
117d4a67d9dSGabor Juhos 
118d4a67d9dSGabor Juhos #define AR724X_PLL_REG_CPU_CONFIG	0x00
119d4a67d9dSGabor Juhos #define AR724X_PLL_REG_PCIE_CONFIG	0x18
120d4a67d9dSGabor Juhos 
121d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_SHIFT		0
122d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_MASK		0x3ff
123d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_SHIFT	10
124d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_MASK		0xf
125d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_SHIFT		19
126d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_MASK		0x1
127d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_SHIFT		22
128d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_MASK		0x3
129d4a67d9dSGabor Juhos 
130d4a67d9dSGabor Juhos #define AR913X_PLL_REG_CPU_CONFIG	0x00
131d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH_CONFIG	0x04
132d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH0_INT_CLOCK	0x14
133d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH1_INT_CLOCK	0x18
134d4a67d9dSGabor Juhos 
135d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_SHIFT		0
136d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_MASK		0x3ff
137d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_SHIFT		22
138d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_MASK		0x3
139d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_SHIFT		19
140d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_MASK		0x1
141d4a67d9dSGabor Juhos 
14204225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REG	0x00
14304225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_REG	0x08
14404225e1dSGabor Juhos 
14504225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_NINT_SHIFT	10
14604225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_NINT_MASK		0x3f
14704225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT	16
14804225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REFDIV_MASK	0x1f
14904225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT	23
15004225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK	0x7
15104225e1dSGabor Juhos 
15204225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_BYPASS		BIT(2)
15304225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT	5
15404225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK	0x3
15504225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT	10
15604225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK	0x3
15704225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT	15
15804225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK	0x7
15904225e1dSGabor Juhos 
1608889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REG		0x00
1618889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REG		0x04
1628889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG		0x08
1638889612bSGabor Juhos 
1648889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT	0
1658889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK	0x3f
1668889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NINT_SHIFT	6
1678889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NINT_MASK		0x3f
1688889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT	12
1698889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REFDIV_MASK	0x1f
1708889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT	19
1718889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK	0x3
1728889612bSGabor Juhos 
1738889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT	0
1748889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NFRAC_MASK	0x3ff
1758889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NINT_SHIFT	10
1768889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NINT_MASK		0x3f
1778889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT	16
1788889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REFDIV_MASK	0x1f
1798889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT	23
1808889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK	0x7
1818889612bSGabor Juhos 
1828889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS	BIT(2)
1838889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS	BIT(3)
1848889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS	BIT(4)
1858889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT	5
1868889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK	0x1f
1878889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT	10
1888889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK	0x1f
1898889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT	15
1908889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK	0x1f
1918889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL	BIT(20)
1928889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL	BIT(21)
1938889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL	BIT(24)
1948889612bSGabor Juhos 
195d4a67d9dSGabor Juhos /*
1967e98aa46SGabor Juhos  * USB_CONFIG block
1977e98aa46SGabor Juhos  */
1987e98aa46SGabor Juhos #define AR71XX_USB_CTRL_REG_FLADJ	0x00
1997e98aa46SGabor Juhos #define AR71XX_USB_CTRL_REG_CONFIG	0x04
2007e98aa46SGabor Juhos 
2017e98aa46SGabor Juhos /*
202d4a67d9dSGabor Juhos  * RESET block
203d4a67d9dSGabor Juhos  */
204d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER			0x00
205d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER_RELOAD		0x04
206d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG_CTRL		0x08
207d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG			0x0c
208d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_STATUS	0x10
209d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_ENABLE	0x14
210d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_STATUS		0x18
211d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_ENABLE		0x1c
212d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_GLOBAL_INT_STATUS	0x20
213d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_RESET_MODULE		0x24
214d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC_CTRL		0x2c
215d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC0			0x30
216d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC1			0x34
217d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_REV_ID			0x90
218d4a67d9dSGabor Juhos 
219d4a67d9dSGabor Juhos #define AR913X_RESET_REG_GLOBAL_INT_STATUS	0x18
220d4a67d9dSGabor Juhos #define AR913X_RESET_REG_RESET_MODULE		0x1c
221d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERF_CTRL		0x20
222d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC0			0x24
223d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC1			0x28
224d4a67d9dSGabor Juhos 
225d4a67d9dSGabor Juhos #define AR724X_RESET_REG_RESET_MODULE		0x1c
226d4a67d9dSGabor Juhos 
2277ee15d8aSGabor Juhos #define AR933X_RESET_REG_RESET_MODULE		0x1c
22804225e1dSGabor Juhos #define AR933X_RESET_REG_BOOTSTRAP		0xac
22904225e1dSGabor Juhos 
2308889612bSGabor Juhos #define AR934X_RESET_REG_BOOTSTRAP		0xb0
231*fce5cc6eSGabor Juhos #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS	0xac
2328889612bSGabor Juhos 
233d2b4ac1eSGabor Juhos #define MISC_INT_ETHSW			BIT(12)
234d2b4ac1eSGabor Juhos #define MISC_INT_TIMER4			BIT(10)
235d2b4ac1eSGabor Juhos #define MISC_INT_TIMER3			BIT(9)
236d2b4ac1eSGabor Juhos #define MISC_INT_TIMER2			BIT(8)
237d4a67d9dSGabor Juhos #define MISC_INT_DMA			BIT(7)
238d4a67d9dSGabor Juhos #define MISC_INT_OHCI			BIT(6)
239d4a67d9dSGabor Juhos #define MISC_INT_PERFC			BIT(5)
240d4a67d9dSGabor Juhos #define MISC_INT_WDOG			BIT(4)
241d4a67d9dSGabor Juhos #define MISC_INT_UART			BIT(3)
242d4a67d9dSGabor Juhos #define MISC_INT_GPIO			BIT(2)
243d4a67d9dSGabor Juhos #define MISC_INT_ERROR			BIT(1)
244d4a67d9dSGabor Juhos #define MISC_INT_TIMER			BIT(0)
245d4a67d9dSGabor Juhos 
246d4a67d9dSGabor Juhos #define AR71XX_RESET_EXTERNAL		BIT(28)
247d4a67d9dSGabor Juhos #define AR71XX_RESET_FULL_CHIP		BIT(24)
248d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_NMI		BIT(21)
249d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_COLD		BIT(20)
250d4a67d9dSGabor Juhos #define AR71XX_RESET_DMA		BIT(19)
251d4a67d9dSGabor Juhos #define AR71XX_RESET_SLIC		BIT(18)
252d4a67d9dSGabor Juhos #define AR71XX_RESET_STEREO		BIT(17)
253d4a67d9dSGabor Juhos #define AR71XX_RESET_DDR		BIT(16)
254d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_MAC		BIT(13)
255d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_PHY		BIT(12)
256d4a67d9dSGabor Juhos #define AR71XX_RESET_USBSUS_OVERRIDE	BIT(10)
257d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_MAC		BIT(9)
258d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_PHY		BIT(8)
259d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_OHCI_DLL	BIT(6)
260d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_HOST		BIT(5)
261d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_PHY		BIT(4)
262d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_BUS		BIT(1)
263d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_CORE		BIT(0)
264d4a67d9dSGabor Juhos 
2657e98aa46SGabor Juhos #define AR7240_RESET_USB_HOST		BIT(5)
2667e98aa46SGabor Juhos #define AR7240_RESET_OHCI_DLL		BIT(3)
2677e98aa46SGabor Juhos 
268d4a67d9dSGabor Juhos #define AR724X_RESET_GE1_MDIO		BIT(23)
269d4a67d9dSGabor Juhos #define AR724X_RESET_GE0_MDIO		BIT(22)
270d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY_SERIAL	BIT(10)
271d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY		BIT(7)
272d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE		BIT(6)
2737e98aa46SGabor Juhos #define AR724X_RESET_USB_HOST		BIT(5)
2747e98aa46SGabor Juhos #define AR724X_RESET_USB_PHY		BIT(4)
2757e98aa46SGabor Juhos #define AR724X_RESET_USBSUS_OVERRIDE	BIT(3)
276d4a67d9dSGabor Juhos 
277d4a67d9dSGabor Juhos #define AR913X_RESET_AMBA2WMAC		BIT(22)
2787e98aa46SGabor Juhos #define AR913X_RESET_USBSUS_OVERRIDE	BIT(10)
2797e98aa46SGabor Juhos #define AR913X_RESET_USB_HOST		BIT(5)
2807e98aa46SGabor Juhos #define AR913X_RESET_USB_PHY		BIT(4)
281d4a67d9dSGabor Juhos 
28234cfcd26SGabor Juhos #define AR933X_RESET_WMAC		BIT(11)
283c279b775SGabor Juhos #define AR933X_RESET_USB_HOST		BIT(5)
284c279b775SGabor Juhos #define AR933X_RESET_USB_PHY		BIT(4)
285c279b775SGabor Juhos #define AR933X_RESET_USBSUS_OVERRIDE	BIT(3)
286c279b775SGabor Juhos 
28704225e1dSGabor Juhos #define AR933X_BOOTSTRAP_REF_CLK_40	BIT(0)
28804225e1dSGabor Juhos 
2898889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION8	BIT(23)
2908889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION7	BIT(22)
2918889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION6	BIT(21)
2928889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION5	BIT(20)
2938889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION4	BIT(19)
2948889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION3	BIT(18)
2958889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION2	BIT(17)
2968889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION1	BIT(16)
2978889612bSGabor Juhos #define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7)
2988889612bSGabor Juhos #define AR934X_BOOTSTRAP_PCIE_RC	BIT(6)
2998889612bSGabor Juhos #define AR934X_BOOTSTRAP_EJTAG_MODE	BIT(5)
3008889612bSGabor Juhos #define AR934X_BOOTSTRAP_REF_CLK_40	BIT(4)
3018889612bSGabor Juhos #define AR934X_BOOTSTRAP_BOOT_FROM_SPI	BIT(2)
3028889612bSGabor Juhos #define AR934X_BOOTSTRAP_SDRAM_DISABLED	BIT(1)
3038889612bSGabor Juhos #define AR934X_BOOTSTRAP_DDR1		BIT(0)
3048889612bSGabor Juhos 
305*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_MISC		BIT(0)
306*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_TX		BIT(1)
307*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_RXLP		BIT(2)
308*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_RXHP		BIT(3)
309*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC		BIT(4)
310*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC0		BIT(5)
311*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC1		BIT(6)
312*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC2		BIT(7)
313*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC3		BIT(8)
314*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_ALL \
315*fce5cc6eSGabor Juhos 	(AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
316*fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
317*fce5cc6eSGabor Juhos 
318*fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_ALL \
319*fce5cc6eSGabor Juhos 	(AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
320*fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
321*fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_PCIE_RC3)
322*fce5cc6eSGabor Juhos 
323d4a67d9dSGabor Juhos #define REV_ID_MAJOR_MASK		0xfff0
324d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR71XX		0x00a0
325d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR913X		0x00b0
326d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7240		0x00c0
327d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7241		0x0100
328d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7242		0x1100
3296d1c8fdeSGabor Juhos #define REV_ID_MAJOR_AR9330		0x0110
3306d1c8fdeSGabor Juhos #define REV_ID_MAJOR_AR9331		0x1110
331703327ddSGabor Juhos #define REV_ID_MAJOR_AR9341		0x0120
332703327ddSGabor Juhos #define REV_ID_MAJOR_AR9342		0x1120
333703327ddSGabor Juhos #define REV_ID_MAJOR_AR9344		0x2120
334d4a67d9dSGabor Juhos 
335d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_MASK	0x3
336d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7130	0x0
337d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7141	0x1
338d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7161	0x2
339d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_MASK	0x3
340d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_SHIFT	2
341d4a67d9dSGabor Juhos 
342d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_MASK	0x3
343d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9130	0x0
344d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9132	0x1
345d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_MASK	0x3
346d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_SHIFT	2
347d4a67d9dSGabor Juhos 
3486d1c8fdeSGabor Juhos #define AR933X_REV_ID_REVISION_MASK	0x3
3496d1c8fdeSGabor Juhos 
350d4a67d9dSGabor Juhos #define AR724X_REV_ID_REVISION_MASK	0x3
351d4a67d9dSGabor Juhos 
352d8411466SGabor Juhos #define AR934X_REV_ID_REVISION_MASK     0xf
353d8411466SGabor Juhos 
354d4a67d9dSGabor Juhos /*
355d4a67d9dSGabor Juhos  * SPI block
356d4a67d9dSGabor Juhos  */
357d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_FS	0x00	/* Function Select */
358d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_CTRL	0x04	/* SPI Control */
359d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_IOC	0x08	/* SPI I/O Control */
360d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_RDS	0x0c	/* Read Data Shift */
361d4a67d9dSGabor Juhos 
362d4a67d9dSGabor Juhos #define AR71XX_SPI_FS_GPIO	BIT(0)	/* Enable GPIO mode */
363d4a67d9dSGabor Juhos 
364d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_RD	BIT(6)	/* Remap Disable */
365d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_DIV_MASK 0x3f
366d4a67d9dSGabor Juhos 
367d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_DO	BIT(0)	/* Data Out pin */
368d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CLK	BIT(8)	/* CLK pin */
369d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS(n)	BIT(16 + (n))
370d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS0	AR71XX_SPI_IOC_CS(0)
371d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS1	AR71XX_SPI_IOC_CS(1)
372d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS2	AR71XX_SPI_IOC_CS(2)
373d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS_ALL	(AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
374d4a67d9dSGabor Juhos 				 AR71XX_SPI_IOC_CS2)
375d4a67d9dSGabor Juhos 
3766eae43c5SGabor Juhos /*
3776eae43c5SGabor Juhos  * GPIO block
3786eae43c5SGabor Juhos  */
3796eae43c5SGabor Juhos #define AR71XX_GPIO_REG_OE		0x00
3806eae43c5SGabor Juhos #define AR71XX_GPIO_REG_IN		0x04
3816eae43c5SGabor Juhos #define AR71XX_GPIO_REG_OUT		0x08
3826eae43c5SGabor Juhos #define AR71XX_GPIO_REG_SET		0x0c
3836eae43c5SGabor Juhos #define AR71XX_GPIO_REG_CLEAR		0x10
3846eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_MODE	0x14
3856eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_TYPE	0x18
3866eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_POLARITY	0x1c
3876eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_PENDING	0x20
3886eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_ENABLE	0x24
3896eae43c5SGabor Juhos #define AR71XX_GPIO_REG_FUNC		0x28
3906eae43c5SGabor Juhos 
3916eae43c5SGabor Juhos #define AR71XX_GPIO_COUNT		16
3926eae43c5SGabor Juhos #define AR724X_GPIO_COUNT		18
3936eae43c5SGabor Juhos #define AR913X_GPIO_COUNT		22
394fdfbcf47SGabor Juhos #define AR933X_GPIO_COUNT		30
3955b5b544eSGabor Juhos #define AR934X_GPIO_COUNT		23
3966eae43c5SGabor Juhos 
397d4a67d9dSGabor Juhos #endif /* __ASM_MACH_AR71XX_REGS_H */
398