xref: /linux/arch/mips/include/asm/mach-ath79/ar71xx_regs.h (revision ad4ce92e919f7ad5561a2060deb58899de58b40c)
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 
44*ad4ce92eSGabor Juhos #define AR71XX_PCI_MEM_BASE	0x10000000
45*ad4ce92eSGabor Juhos #define AR71XX_PCI_MEM_SIZE	0x07000000
46*ad4ce92eSGabor Juhos 
47*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN0_OFFS	0x10000000
48*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN1_OFFS	0x11000000
49*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN2_OFFS	0x12000000
50*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN3_OFFS	0x13000000
51*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN4_OFFS	0x14000000
52*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN5_OFFS	0x15000000
53*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN6_OFFS	0x16000000
54*ad4ce92eSGabor Juhos #define AR71XX_PCI_WIN7_OFFS	0x07000000
55*ad4ce92eSGabor Juhos 
56*ad4ce92eSGabor Juhos #define AR71XX_PCI_CFG_BASE	\
57*ad4ce92eSGabor Juhos 	(AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000)
58*ad4ce92eSGabor Juhos #define AR71XX_PCI_CFG_SIZE	0x100
59*ad4ce92eSGabor Juhos 
607e98aa46SGabor Juhos #define AR7240_USB_CTRL_BASE	(AR71XX_APB_BASE + 0x00030000)
617e98aa46SGabor Juhos #define AR7240_USB_CTRL_SIZE	0x100
627e98aa46SGabor Juhos #define AR7240_OHCI_BASE	0x1b000000
637e98aa46SGabor Juhos #define AR7240_OHCI_SIZE	0x1000
647e98aa46SGabor Juhos 
65*ad4ce92eSGabor Juhos #define AR724X_PCI_MEM_BASE	0x10000000
66*ad4ce92eSGabor Juhos #define AR724X_PCI_MEM_SIZE	0x04000000
67*ad4ce92eSGabor Juhos 
68*ad4ce92eSGabor Juhos #define AR724X_PCI_CFG_BASE	0x14000000
69*ad4ce92eSGabor Juhos #define AR724X_PCI_CFG_SIZE	0x1000
70*ad4ce92eSGabor Juhos #define AR724X_PCI_CTRL_BASE	(AR71XX_APB_BASE + 0x000f0000)
71*ad4ce92eSGabor Juhos #define AR724X_PCI_CTRL_SIZE	0x100
72*ad4ce92eSGabor Juhos 
737e98aa46SGabor Juhos #define AR724X_EHCI_BASE	0x1b000000
747e98aa46SGabor Juhos #define AR724X_EHCI_SIZE	0x1000
757e98aa46SGabor Juhos 
767e98aa46SGabor Juhos #define AR913X_EHCI_BASE	0x1b000000
777e98aa46SGabor Juhos #define AR913X_EHCI_SIZE	0x1000
78f5b35d0bSGabor Juhos #define AR913X_WMAC_BASE	(AR71XX_APB_BASE + 0x000C0000)
79f5b35d0bSGabor Juhos #define AR913X_WMAC_SIZE	0x30000
80f5b35d0bSGabor Juhos 
810bd3acdfSGabor Juhos #define AR933X_UART_BASE	(AR71XX_APB_BASE + 0x00020000)
820bd3acdfSGabor Juhos #define AR933X_UART_SIZE	0x14
8334cfcd26SGabor Juhos #define AR933X_WMAC_BASE	(AR71XX_APB_BASE + 0x00100000)
8434cfcd26SGabor Juhos #define AR933X_WMAC_SIZE	0x20000
85c279b775SGabor Juhos #define AR933X_EHCI_BASE	0x1b000000
86c279b775SGabor Juhos #define AR933X_EHCI_SIZE	0x1000
87c279b775SGabor Juhos 
88574d6e70SGabor Juhos #define AR934X_WMAC_BASE	(AR71XX_APB_BASE + 0x00100000)
89574d6e70SGabor Juhos #define AR934X_WMAC_SIZE	0x20000
9000ffed58SGabor Juhos #define AR934X_EHCI_BASE	0x1b000000
9100ffed58SGabor Juhos #define AR934X_EHCI_SIZE	0x200
9297541ccfSGabor Juhos #define AR934X_SRIF_BASE	(AR71XX_APB_BASE + 0x00116000)
9397541ccfSGabor Juhos #define AR934X_SRIF_SIZE	0x1000
94574d6e70SGabor Juhos 
95d4a67d9dSGabor Juhos /*
96d4a67d9dSGabor Juhos  * DDR_CTRL block
97d4a67d9dSGabor Juhos  */
98d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN0		0x7c
99d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN1		0x80
100d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN2		0x84
101d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN3		0x88
102d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN4		0x8c
103d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN5		0x90
104d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN6		0x94
105d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN7		0x98
106d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE0	0x9c
107d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE1	0xa0
108d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_USB	0xa4
109d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_PCI	0xa8
110d4a67d9dSGabor Juhos 
111d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE0	0x7c
112d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE1	0x80
113d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_USB	0x84
114d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_PCIE	0x88
115d4a67d9dSGabor Juhos 
116d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE0	0x7c
117d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE1	0x80
118d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_USB	0x84
119d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_WMAC	0x88
120d4a67d9dSGabor Juhos 
12154eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_GE0	0x7c
12254eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_GE1	0x80
12354eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_USB	0x84
12454eed4c7SGabor Juhos #define AR933X_DDR_REG_FLUSH_WMAC	0x88
12554eed4c7SGabor Juhos 
126fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_GE0	0x9c
127fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_GE1	0xa0
128fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_USB	0xa4
129fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_PCIE	0xa8
130fce5cc6eSGabor Juhos #define AR934X_DDR_REG_FLUSH_WMAC	0xac
131fce5cc6eSGabor Juhos 
132d4a67d9dSGabor Juhos /*
133d4a67d9dSGabor Juhos  * PLL block
134d4a67d9dSGabor Juhos  */
135d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_CPU_CONFIG	0x00
136d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_SEC_CONFIG	0x04
137d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH0_INT_CLOCK	0x10
138d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH1_INT_CLOCK	0x14
139d4a67d9dSGabor Juhos 
140d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_SHIFT		3
141d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_MASK		0x1f
142d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_SHIFT		16
143d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_MASK		0x3
144d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_SHIFT		18
145d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_MASK		0x3
146d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_SHIFT		20
147d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_MASK		0x7
148d4a67d9dSGabor Juhos 
149d4a67d9dSGabor Juhos #define AR724X_PLL_REG_CPU_CONFIG	0x00
150d4a67d9dSGabor Juhos #define AR724X_PLL_REG_PCIE_CONFIG	0x18
151d4a67d9dSGabor Juhos 
152d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_SHIFT		0
153d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_MASK		0x3ff
154d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_SHIFT	10
155d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_MASK		0xf
156d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_SHIFT		19
157d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_MASK		0x1
158d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_SHIFT		22
159d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_MASK		0x3
160d4a67d9dSGabor Juhos 
161d4a67d9dSGabor Juhos #define AR913X_PLL_REG_CPU_CONFIG	0x00
162d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH_CONFIG	0x04
163d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH0_INT_CLOCK	0x14
164d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH1_INT_CLOCK	0x18
165d4a67d9dSGabor Juhos 
166d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_SHIFT		0
167d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_MASK		0x3ff
168d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_SHIFT		22
169d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_MASK		0x3
170d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_SHIFT		19
171d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_MASK		0x1
172d4a67d9dSGabor Juhos 
17304225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REG	0x00
17404225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_REG	0x08
17504225e1dSGabor Juhos 
17604225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_NINT_SHIFT	10
17704225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_NINT_MASK		0x3f
17804225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT	16
17904225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_REFDIV_MASK	0x1f
18004225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT	23
18104225e1dSGabor Juhos #define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK	0x7
18204225e1dSGabor Juhos 
18304225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_BYPASS		BIT(2)
18404225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT	5
18504225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK	0x3
18604225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT	10
18704225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK	0x3
18804225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT	15
18904225e1dSGabor Juhos #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK	0x7
19004225e1dSGabor Juhos 
1918889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REG		0x00
1928889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REG		0x04
1938889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG		0x08
1948889612bSGabor Juhos 
1958889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT	0
1968889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK	0x3f
1978889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NINT_SHIFT	6
1988889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_NINT_MASK		0x3f
1998889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT	12
2008889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_REFDIV_MASK	0x1f
2018889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT	19
2028889612bSGabor Juhos #define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK	0x3
2038889612bSGabor Juhos 
2048889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT	0
2058889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NFRAC_MASK	0x3ff
2068889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NINT_SHIFT	10
2078889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_NINT_MASK		0x3f
2088889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT	16
2098889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_REFDIV_MASK	0x1f
2108889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT	23
2118889612bSGabor Juhos #define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK	0x7
2128889612bSGabor Juhos 
2138889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS	BIT(2)
2148889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS	BIT(3)
2158889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS	BIT(4)
2168889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT	5
2178889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK	0x1f
2188889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT	10
2198889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK	0x1f
2208889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT	15
2218889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK	0x1f
2228889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL	BIT(20)
2238889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL	BIT(21)
2248889612bSGabor Juhos #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL	BIT(24)
2258889612bSGabor Juhos 
226d4a67d9dSGabor Juhos /*
2277e98aa46SGabor Juhos  * USB_CONFIG block
2287e98aa46SGabor Juhos  */
2297e98aa46SGabor Juhos #define AR71XX_USB_CTRL_REG_FLADJ	0x00
2307e98aa46SGabor Juhos #define AR71XX_USB_CTRL_REG_CONFIG	0x04
2317e98aa46SGabor Juhos 
2327e98aa46SGabor Juhos /*
233d4a67d9dSGabor Juhos  * RESET block
234d4a67d9dSGabor Juhos  */
235d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER			0x00
236d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER_RELOAD		0x04
237d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG_CTRL		0x08
238d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG			0x0c
239d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_STATUS	0x10
240d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_ENABLE	0x14
241d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_STATUS		0x18
242d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_ENABLE		0x1c
243d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_GLOBAL_INT_STATUS	0x20
244d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_RESET_MODULE		0x24
245d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC_CTRL		0x2c
246d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC0			0x30
247d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC1			0x34
248d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_REV_ID			0x90
249d4a67d9dSGabor Juhos 
250d4a67d9dSGabor Juhos #define AR913X_RESET_REG_GLOBAL_INT_STATUS	0x18
251d4a67d9dSGabor Juhos #define AR913X_RESET_REG_RESET_MODULE		0x1c
252d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERF_CTRL		0x20
253d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC0			0x24
254d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC1			0x28
255d4a67d9dSGabor Juhos 
256d4a67d9dSGabor Juhos #define AR724X_RESET_REG_RESET_MODULE		0x1c
257d4a67d9dSGabor Juhos 
2587ee15d8aSGabor Juhos #define AR933X_RESET_REG_RESET_MODULE		0x1c
25904225e1dSGabor Juhos #define AR933X_RESET_REG_BOOTSTRAP		0xac
26004225e1dSGabor Juhos 
26142184768SGabor Juhos #define AR934X_RESET_REG_RESET_MODULE		0x1c
2628889612bSGabor Juhos #define AR934X_RESET_REG_BOOTSTRAP		0xb0
263fce5cc6eSGabor Juhos #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS	0xac
2648889612bSGabor Juhos 
265d2b4ac1eSGabor Juhos #define MISC_INT_ETHSW			BIT(12)
266d2b4ac1eSGabor Juhos #define MISC_INT_TIMER4			BIT(10)
267d2b4ac1eSGabor Juhos #define MISC_INT_TIMER3			BIT(9)
268d2b4ac1eSGabor Juhos #define MISC_INT_TIMER2			BIT(8)
269d4a67d9dSGabor Juhos #define MISC_INT_DMA			BIT(7)
270d4a67d9dSGabor Juhos #define MISC_INT_OHCI			BIT(6)
271d4a67d9dSGabor Juhos #define MISC_INT_PERFC			BIT(5)
272d4a67d9dSGabor Juhos #define MISC_INT_WDOG			BIT(4)
273d4a67d9dSGabor Juhos #define MISC_INT_UART			BIT(3)
274d4a67d9dSGabor Juhos #define MISC_INT_GPIO			BIT(2)
275d4a67d9dSGabor Juhos #define MISC_INT_ERROR			BIT(1)
276d4a67d9dSGabor Juhos #define MISC_INT_TIMER			BIT(0)
277d4a67d9dSGabor Juhos 
278d4a67d9dSGabor Juhos #define AR71XX_RESET_EXTERNAL		BIT(28)
279d4a67d9dSGabor Juhos #define AR71XX_RESET_FULL_CHIP		BIT(24)
280d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_NMI		BIT(21)
281d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_COLD		BIT(20)
282d4a67d9dSGabor Juhos #define AR71XX_RESET_DMA		BIT(19)
283d4a67d9dSGabor Juhos #define AR71XX_RESET_SLIC		BIT(18)
284d4a67d9dSGabor Juhos #define AR71XX_RESET_STEREO		BIT(17)
285d4a67d9dSGabor Juhos #define AR71XX_RESET_DDR		BIT(16)
286d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_MAC		BIT(13)
287d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_PHY		BIT(12)
288d4a67d9dSGabor Juhos #define AR71XX_RESET_USBSUS_OVERRIDE	BIT(10)
289d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_MAC		BIT(9)
290d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_PHY		BIT(8)
291d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_OHCI_DLL	BIT(6)
292d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_HOST		BIT(5)
293d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_PHY		BIT(4)
294d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_BUS		BIT(1)
295d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_CORE		BIT(0)
296d4a67d9dSGabor Juhos 
2977e98aa46SGabor Juhos #define AR7240_RESET_USB_HOST		BIT(5)
2987e98aa46SGabor Juhos #define AR7240_RESET_OHCI_DLL		BIT(3)
2997e98aa46SGabor Juhos 
300d4a67d9dSGabor Juhos #define AR724X_RESET_GE1_MDIO		BIT(23)
301d4a67d9dSGabor Juhos #define AR724X_RESET_GE0_MDIO		BIT(22)
302d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY_SERIAL	BIT(10)
303d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY		BIT(7)
304d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE		BIT(6)
3057e98aa46SGabor Juhos #define AR724X_RESET_USB_HOST		BIT(5)
3067e98aa46SGabor Juhos #define AR724X_RESET_USB_PHY		BIT(4)
3077e98aa46SGabor Juhos #define AR724X_RESET_USBSUS_OVERRIDE	BIT(3)
308d4a67d9dSGabor Juhos 
309d4a67d9dSGabor Juhos #define AR913X_RESET_AMBA2WMAC		BIT(22)
3107e98aa46SGabor Juhos #define AR913X_RESET_USBSUS_OVERRIDE	BIT(10)
3117e98aa46SGabor Juhos #define AR913X_RESET_USB_HOST		BIT(5)
3127e98aa46SGabor Juhos #define AR913X_RESET_USB_PHY		BIT(4)
313d4a67d9dSGabor Juhos 
31434cfcd26SGabor Juhos #define AR933X_RESET_WMAC		BIT(11)
315c279b775SGabor Juhos #define AR933X_RESET_USB_HOST		BIT(5)
316c279b775SGabor Juhos #define AR933X_RESET_USB_PHY		BIT(4)
317c279b775SGabor Juhos #define AR933X_RESET_USBSUS_OVERRIDE	BIT(3)
318c279b775SGabor Juhos 
31900ffed58SGabor Juhos #define AR934X_RESET_USB_PHY_ANALOG	BIT(11)
32000ffed58SGabor Juhos #define AR934X_RESET_USB_HOST		BIT(5)
32100ffed58SGabor Juhos #define AR934X_RESET_USB_PHY		BIT(4)
32200ffed58SGabor Juhos #define AR934X_RESET_USBSUS_OVERRIDE	BIT(3)
32300ffed58SGabor Juhos 
32404225e1dSGabor Juhos #define AR933X_BOOTSTRAP_REF_CLK_40	BIT(0)
32504225e1dSGabor Juhos 
3268889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION8	BIT(23)
3278889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION7	BIT(22)
3288889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION6	BIT(21)
3298889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION5	BIT(20)
3308889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION4	BIT(19)
3318889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION3	BIT(18)
3328889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION2	BIT(17)
3338889612bSGabor Juhos #define AR934X_BOOTSTRAP_SW_OPTION1	BIT(16)
3348889612bSGabor Juhos #define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7)
3358889612bSGabor Juhos #define AR934X_BOOTSTRAP_PCIE_RC	BIT(6)
3368889612bSGabor Juhos #define AR934X_BOOTSTRAP_EJTAG_MODE	BIT(5)
3378889612bSGabor Juhos #define AR934X_BOOTSTRAP_REF_CLK_40	BIT(4)
3388889612bSGabor Juhos #define AR934X_BOOTSTRAP_BOOT_FROM_SPI	BIT(2)
3398889612bSGabor Juhos #define AR934X_BOOTSTRAP_SDRAM_DISABLED	BIT(1)
3408889612bSGabor Juhos #define AR934X_BOOTSTRAP_DDR1		BIT(0)
3418889612bSGabor Juhos 
342fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_MISC		BIT(0)
343fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_TX		BIT(1)
344fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_RXLP		BIT(2)
345fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_RXHP		BIT(3)
346fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC		BIT(4)
347fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC0		BIT(5)
348fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC1		BIT(6)
349fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC2		BIT(7)
350fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_RC3		BIT(8)
351fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_WMAC_ALL \
352fce5cc6eSGabor Juhos 	(AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
353fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
354fce5cc6eSGabor Juhos 
355fce5cc6eSGabor Juhos #define AR934X_PCIE_WMAC_INT_PCIE_ALL \
356fce5cc6eSGabor Juhos 	(AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
357fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
358fce5cc6eSGabor Juhos 	 AR934X_PCIE_WMAC_INT_PCIE_RC3)
359fce5cc6eSGabor Juhos 
360d4a67d9dSGabor Juhos #define REV_ID_MAJOR_MASK		0xfff0
361d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR71XX		0x00a0
362d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR913X		0x00b0
363d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7240		0x00c0
364d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7241		0x0100
365d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7242		0x1100
3666d1c8fdeSGabor Juhos #define REV_ID_MAJOR_AR9330		0x0110
3676d1c8fdeSGabor Juhos #define REV_ID_MAJOR_AR9331		0x1110
368703327ddSGabor Juhos #define REV_ID_MAJOR_AR9341		0x0120
369703327ddSGabor Juhos #define REV_ID_MAJOR_AR9342		0x1120
370703327ddSGabor Juhos #define REV_ID_MAJOR_AR9344		0x2120
371d4a67d9dSGabor Juhos 
372d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_MASK	0x3
373d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7130	0x0
374d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7141	0x1
375d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7161	0x2
376d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_MASK	0x3
377d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_SHIFT	2
378d4a67d9dSGabor Juhos 
379d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_MASK	0x3
380d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9130	0x0
381d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9132	0x1
382d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_MASK	0x3
383d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_SHIFT	2
384d4a67d9dSGabor Juhos 
3856d1c8fdeSGabor Juhos #define AR933X_REV_ID_REVISION_MASK	0x3
3866d1c8fdeSGabor Juhos 
387d4a67d9dSGabor Juhos #define AR724X_REV_ID_REVISION_MASK	0x3
388d4a67d9dSGabor Juhos 
389d8411466SGabor Juhos #define AR934X_REV_ID_REVISION_MASK     0xf
390d8411466SGabor Juhos 
391d4a67d9dSGabor Juhos /*
392d4a67d9dSGabor Juhos  * SPI block
393d4a67d9dSGabor Juhos  */
394d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_FS	0x00	/* Function Select */
395d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_CTRL	0x04	/* SPI Control */
396d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_IOC	0x08	/* SPI I/O Control */
397d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_RDS	0x0c	/* Read Data Shift */
398d4a67d9dSGabor Juhos 
399d4a67d9dSGabor Juhos #define AR71XX_SPI_FS_GPIO	BIT(0)	/* Enable GPIO mode */
400d4a67d9dSGabor Juhos 
401d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_RD	BIT(6)	/* Remap Disable */
402d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_DIV_MASK 0x3f
403d4a67d9dSGabor Juhos 
404d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_DO	BIT(0)	/* Data Out pin */
405d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CLK	BIT(8)	/* CLK pin */
406d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS(n)	BIT(16 + (n))
407d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS0	AR71XX_SPI_IOC_CS(0)
408d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS1	AR71XX_SPI_IOC_CS(1)
409d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS2	AR71XX_SPI_IOC_CS(2)
410d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS_ALL	(AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
411d4a67d9dSGabor Juhos 				 AR71XX_SPI_IOC_CS2)
412d4a67d9dSGabor Juhos 
4136eae43c5SGabor Juhos /*
4146eae43c5SGabor Juhos  * GPIO block
4156eae43c5SGabor Juhos  */
4166eae43c5SGabor Juhos #define AR71XX_GPIO_REG_OE		0x00
4176eae43c5SGabor Juhos #define AR71XX_GPIO_REG_IN		0x04
4186eae43c5SGabor Juhos #define AR71XX_GPIO_REG_OUT		0x08
4196eae43c5SGabor Juhos #define AR71XX_GPIO_REG_SET		0x0c
4206eae43c5SGabor Juhos #define AR71XX_GPIO_REG_CLEAR		0x10
4216eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_MODE	0x14
4226eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_TYPE	0x18
4236eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_POLARITY	0x1c
4246eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_PENDING	0x20
4256eae43c5SGabor Juhos #define AR71XX_GPIO_REG_INT_ENABLE	0x24
4266eae43c5SGabor Juhos #define AR71XX_GPIO_REG_FUNC		0x28
4276eae43c5SGabor Juhos 
4288838becdSGabor Juhos #define AR934X_GPIO_REG_FUNC		0x6c
4298838becdSGabor Juhos 
4306eae43c5SGabor Juhos #define AR71XX_GPIO_COUNT		16
431b4da14abSGabor Juhos #define AR7240_GPIO_COUNT		18
432b4da14abSGabor Juhos #define AR7241_GPIO_COUNT		20
4336eae43c5SGabor Juhos #define AR913X_GPIO_COUNT		22
434fdfbcf47SGabor Juhos #define AR933X_GPIO_COUNT		30
4355b5b544eSGabor Juhos #define AR934X_GPIO_COUNT		23
4366eae43c5SGabor Juhos 
43797541ccfSGabor Juhos /*
43897541ccfSGabor Juhos  * SRIF block
43997541ccfSGabor Juhos  */
44097541ccfSGabor Juhos #define AR934X_SRIF_CPU_DPLL1_REG	0x1c0
44197541ccfSGabor Juhos #define AR934X_SRIF_CPU_DPLL2_REG	0x1c4
44297541ccfSGabor Juhos #define AR934X_SRIF_CPU_DPLL3_REG	0x1c8
44397541ccfSGabor Juhos 
44497541ccfSGabor Juhos #define AR934X_SRIF_DDR_DPLL1_REG	0x240
44597541ccfSGabor Juhos #define AR934X_SRIF_DDR_DPLL2_REG	0x244
44697541ccfSGabor Juhos #define AR934X_SRIF_DDR_DPLL3_REG	0x248
44797541ccfSGabor Juhos 
44897541ccfSGabor Juhos #define AR934X_SRIF_DPLL1_REFDIV_SHIFT	27
44997541ccfSGabor Juhos #define AR934X_SRIF_DPLL1_REFDIV_MASK	0x1f
45097541ccfSGabor Juhos #define AR934X_SRIF_DPLL1_NINT_SHIFT	18
45197541ccfSGabor Juhos #define AR934X_SRIF_DPLL1_NINT_MASK	0x1ff
45297541ccfSGabor Juhos #define AR934X_SRIF_DPLL1_NFRAC_MASK	0x0003ffff
45397541ccfSGabor Juhos 
45497541ccfSGabor Juhos #define AR934X_SRIF_DPLL2_LOCAL_PLL	BIT(30)
45597541ccfSGabor Juhos #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT	13
45697541ccfSGabor Juhos #define AR934X_SRIF_DPLL2_OUTDIV_MASK	0x7
45797541ccfSGabor Juhos 
458d4a67d9dSGabor Juhos #endif /* __ASM_MACH_AR71XX_REGS_H */
459