xref: /openbmc/linux/arch/mips/include/asm/mach-ralink/rt3883.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2293840b9SJohn Crispin /*
3293840b9SJohn Crispin  * Ralink RT3662/RT3883 SoC register definitions
4293840b9SJohn Crispin  *
5293840b9SJohn Crispin  * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
6293840b9SJohn Crispin  */
7293840b9SJohn Crispin 
8293840b9SJohn Crispin #ifndef _RT3883_REGS_H_
9293840b9SJohn Crispin #define _RT3883_REGS_H_
10293840b9SJohn Crispin 
11293840b9SJohn Crispin #include <linux/bitops.h>
12293840b9SJohn Crispin 
13*7edb1775SSergio Paracuellos #define IOMEM(x)		((void __iomem *)(KSEG1ADDR(x)))
14*7edb1775SSergio Paracuellos 
15293840b9SJohn Crispin #define RT3883_SDRAM_BASE	0x00000000
16*7edb1775SSergio Paracuellos #define RT3883_SYSC_BASE	IOMEM(0x10000000)
17293840b9SJohn Crispin #define RT3883_TIMER_BASE	0x10000100
18293840b9SJohn Crispin #define RT3883_INTC_BASE	0x10000200
19293840b9SJohn Crispin #define RT3883_MEMC_BASE	0x10000300
20293840b9SJohn Crispin #define RT3883_UART0_BASE	0x10000500
21293840b9SJohn Crispin #define RT3883_PIO_BASE		0x10000600
22293840b9SJohn Crispin #define RT3883_FSCC_BASE	0x10000700
23293840b9SJohn Crispin #define RT3883_NANDC_BASE	0x10000810
24293840b9SJohn Crispin #define RT3883_I2C_BASE		0x10000900
25293840b9SJohn Crispin #define RT3883_I2S_BASE		0x10000a00
26293840b9SJohn Crispin #define RT3883_SPI_BASE		0x10000b00
27293840b9SJohn Crispin #define RT3883_UART1_BASE	0x10000c00
28293840b9SJohn Crispin #define RT3883_PCM_BASE		0x10002000
29293840b9SJohn Crispin #define RT3883_GDMA_BASE	0x10002800
30293840b9SJohn Crispin #define RT3883_CODEC1_BASE	0x10003000
31293840b9SJohn Crispin #define RT3883_CODEC2_BASE	0x10003800
32293840b9SJohn Crispin #define RT3883_FE_BASE		0x10100000
33293840b9SJohn Crispin #define RT3883_ROM_BASE		0x10118000
34293840b9SJohn Crispin #define RT3883_USBDEV_BASE	0x10112000
35293840b9SJohn Crispin #define RT3883_PCI_BASE		0x10140000
36293840b9SJohn Crispin #define RT3883_WLAN_BASE	0x10180000
37293840b9SJohn Crispin #define RT3883_USBHOST_BASE	0x101c0000
38293840b9SJohn Crispin #define RT3883_BOOT_BASE	0x1c000000
39293840b9SJohn Crispin #define RT3883_SRAM_BASE	0x1e000000
40293840b9SJohn Crispin #define RT3883_PCIMEM_BASE	0x20000000
41293840b9SJohn Crispin 
42293840b9SJohn Crispin #define RT3883_EHCI_BASE	(RT3883_USBHOST_BASE)
43293840b9SJohn Crispin #define RT3883_OHCI_BASE	(RT3883_USBHOST_BASE + 0x1000)
44293840b9SJohn Crispin 
45293840b9SJohn Crispin #define RT3883_SYSC_SIZE	0x100
46293840b9SJohn Crispin #define RT3883_TIMER_SIZE	0x100
47293840b9SJohn Crispin #define RT3883_INTC_SIZE	0x100
48293840b9SJohn Crispin #define RT3883_MEMC_SIZE	0x100
49293840b9SJohn Crispin #define RT3883_UART0_SIZE	0x100
50293840b9SJohn Crispin #define RT3883_UART1_SIZE	0x100
51293840b9SJohn Crispin #define RT3883_PIO_SIZE		0x100
52293840b9SJohn Crispin #define RT3883_FSCC_SIZE	0x100
53293840b9SJohn Crispin #define RT3883_NANDC_SIZE	0x0f0
54293840b9SJohn Crispin #define RT3883_I2C_SIZE		0x100
55293840b9SJohn Crispin #define RT3883_I2S_SIZE		0x100
56293840b9SJohn Crispin #define RT3883_SPI_SIZE		0x100
57293840b9SJohn Crispin #define RT3883_PCM_SIZE		0x800
58293840b9SJohn Crispin #define RT3883_GDMA_SIZE	0x800
59293840b9SJohn Crispin #define RT3883_CODEC1_SIZE	0x800
60293840b9SJohn Crispin #define RT3883_CODEC2_SIZE	0x800
61293840b9SJohn Crispin #define RT3883_FE_SIZE		0x10000
62293840b9SJohn Crispin #define RT3883_ROM_SIZE		0x4000
63293840b9SJohn Crispin #define RT3883_USBDEV_SIZE	0x4000
64293840b9SJohn Crispin #define RT3883_PCI_SIZE		0x40000
65293840b9SJohn Crispin #define RT3883_WLAN_SIZE	0x40000
66293840b9SJohn Crispin #define RT3883_USBHOST_SIZE	0x40000
67293840b9SJohn Crispin #define RT3883_BOOT_SIZE	(32 * 1024 * 1024)
68293840b9SJohn Crispin #define RT3883_SRAM_SIZE	(32 * 1024 * 1024)
69293840b9SJohn Crispin 
70293840b9SJohn Crispin /* SYSC registers */
71293840b9SJohn Crispin #define RT3883_SYSC_REG_CHIPID0_3	0x00	/* Chip ID 0 */
72293840b9SJohn Crispin #define RT3883_SYSC_REG_CHIPID4_7	0x04	/* Chip ID 1 */
73293840b9SJohn Crispin #define RT3883_SYSC_REG_REVID		0x0c	/* Chip Revision Identification */
74293840b9SJohn Crispin #define RT3883_SYSC_REG_SYSCFG0		0x10	/* System Configuration 0 */
75293840b9SJohn Crispin #define RT3883_SYSC_REG_SYSCFG1		0x14	/* System Configuration 1 */
76293840b9SJohn Crispin #define RT3883_SYSC_REG_CLKCFG0		0x2c	/* Clock Configuration 0 */
77293840b9SJohn Crispin #define RT3883_SYSC_REG_CLKCFG1		0x30	/* Clock Configuration 1 */
78293840b9SJohn Crispin #define RT3883_SYSC_REG_RSTCTRL		0x34	/* Reset Control*/
79293840b9SJohn Crispin #define RT3883_SYSC_REG_RSTSTAT		0x38	/* Reset Status*/
80293840b9SJohn Crispin #define RT3883_SYSC_REG_USB_PS		0x5c	/* USB Power saving control */
81293840b9SJohn Crispin #define RT3883_SYSC_REG_GPIO_MODE	0x60	/* GPIO Purpose Select */
82293840b9SJohn Crispin #define RT3883_SYSC_REG_PCIE_CLK_GEN0	0x7c
83293840b9SJohn Crispin #define RT3883_SYSC_REG_PCIE_CLK_GEN1	0x80
84293840b9SJohn Crispin #define RT3883_SYSC_REG_PCIE_CLK_GEN2	0x84
85293840b9SJohn Crispin #define RT3883_SYSC_REG_PMU		0x88
86293840b9SJohn Crispin #define RT3883_SYSC_REG_PMU1		0x8c
87293840b9SJohn Crispin 
88293840b9SJohn Crispin #define RT3883_CHIP_NAME0		0x38335452
89293840b9SJohn Crispin #define RT3883_CHIP_NAME1		0x20203338
90293840b9SJohn Crispin 
91293840b9SJohn Crispin #define RT3883_REVID_VER_ID_MASK	0x0f
92293840b9SJohn Crispin #define RT3883_REVID_VER_ID_SHIFT	8
93293840b9SJohn Crispin #define RT3883_REVID_ECO_ID_MASK	0x0f
94293840b9SJohn Crispin 
95293840b9SJohn Crispin #define RT3883_SYSCFG1_USB0_HOST_MODE	BIT(10)
96293840b9SJohn Crispin #define RT3883_SYSCFG1_PCIE_RC_MODE	BIT(8)
97293840b9SJohn Crispin #define RT3883_SYSCFG1_PCI_HOST_MODE	BIT(7)
98293840b9SJohn Crispin #define RT3883_SYSCFG1_PCI_66M_MODE	BIT(6)
99293840b9SJohn Crispin #define RT3883_SYSCFG1_GPIO2_AS_WDT_OUT	BIT(2)
100293840b9SJohn Crispin 
101293840b9SJohn Crispin #define RT3883_CLKCFG1_PCIE_CLK_EN	BIT(21)
102293840b9SJohn Crispin #define RT3883_CLKCFG1_UPHY1_CLK_EN	BIT(20)
103293840b9SJohn Crispin #define RT3883_CLKCFG1_PCI_CLK_EN	BIT(19)
104293840b9SJohn Crispin #define RT3883_CLKCFG1_UPHY0_CLK_EN	BIT(18)
105293840b9SJohn Crispin 
106293840b9SJohn Crispin #define RT3883_GPIO_I2C_SD		1
107293840b9SJohn Crispin #define RT3883_GPIO_I2C_SCLK		2
108293840b9SJohn Crispin #define RT3883_GPIO_SPI_CS0		3
109293840b9SJohn Crispin #define RT3883_GPIO_SPI_CLK		4
110293840b9SJohn Crispin #define RT3883_GPIO_SPI_MOSI		5
111293840b9SJohn Crispin #define RT3883_GPIO_SPI_MISO		6
112293840b9SJohn Crispin #define RT3883_GPIO_7			7
113293840b9SJohn Crispin #define RT3883_GPIO_10			10
114293840b9SJohn Crispin #define RT3883_GPIO_11			11
115293840b9SJohn Crispin #define RT3883_GPIO_14			14
116293840b9SJohn Crispin #define RT3883_GPIO_UART1_TXD		15
117293840b9SJohn Crispin #define RT3883_GPIO_UART1_RXD		16
118293840b9SJohn Crispin #define RT3883_GPIO_JTAG_TDO		17
119293840b9SJohn Crispin #define RT3883_GPIO_JTAG_TDI		18
120293840b9SJohn Crispin #define RT3883_GPIO_JTAG_TMS		19
121293840b9SJohn Crispin #define RT3883_GPIO_JTAG_TCLK		20
122293840b9SJohn Crispin #define RT3883_GPIO_JTAG_TRST_N		21
123293840b9SJohn Crispin #define RT3883_GPIO_MDIO_MDC		22
124293840b9SJohn Crispin #define RT3883_GPIO_MDIO_MDIO		23
125293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_A0		32
126293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_A1		33
127293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_A2		34
128293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_G0		35
129293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_G1		36
130293840b9SJohn Crispin #define RT3883_GPIO_LNA_PE_G2		37
131293840b9SJohn Crispin #define RT3883_GPIO_PCI_AD0		40
132293840b9SJohn Crispin #define RT3883_GPIO_PCI_AD31		71
133293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXD0		72
134293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXD1		73
135293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXD2		74
136293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXD3		75
137293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXEN		76
138293840b9SJohn Crispin #define RT3883_GPIO_GE2_TXCLK		77
139293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXD0		78
140293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXD1		79
141293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXD2		80
142293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXD3		81
143293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXDV		82
144293840b9SJohn Crispin #define RT3883_GPIO_GE2_RXCLK		83
145293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXD0		84
146293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXD1		85
147293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXD2		86
148293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXD3		87
149293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXEN		88
150293840b9SJohn Crispin #define RT3883_GPIO_GE1_TXCLK		89
151293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXD0		90
152293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXD1		91
153293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXD2		92
154293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXD3		93
155293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXDV		94
156293840b9SJohn Crispin #define RT3883_GPIO_GE1_RXCLK	95
157293840b9SJohn Crispin 
158293840b9SJohn Crispin #define RT3883_RSTCTRL_PCIE_PCI_PDM	BIT(27)
159293840b9SJohn Crispin #define RT3883_RSTCTRL_FLASH		BIT(26)
160293840b9SJohn Crispin #define RT3883_RSTCTRL_UDEV		BIT(25)
161293840b9SJohn Crispin #define RT3883_RSTCTRL_PCI		BIT(24)
162293840b9SJohn Crispin #define RT3883_RSTCTRL_PCIE		BIT(23)
163293840b9SJohn Crispin #define RT3883_RSTCTRL_UHST		BIT(22)
164293840b9SJohn Crispin #define RT3883_RSTCTRL_FE		BIT(21)
165293840b9SJohn Crispin #define RT3883_RSTCTRL_WLAN		BIT(20)
166293840b9SJohn Crispin #define RT3883_RSTCTRL_UART1		BIT(29)
167293840b9SJohn Crispin #define RT3883_RSTCTRL_SPI		BIT(18)
168293840b9SJohn Crispin #define RT3883_RSTCTRL_I2S		BIT(17)
169293840b9SJohn Crispin #define RT3883_RSTCTRL_I2C		BIT(16)
170293840b9SJohn Crispin #define RT3883_RSTCTRL_NAND		BIT(15)
171293840b9SJohn Crispin #define RT3883_RSTCTRL_DMA		BIT(14)
172293840b9SJohn Crispin #define RT3883_RSTCTRL_PIO		BIT(13)
173293840b9SJohn Crispin #define RT3883_RSTCTRL_UART		BIT(12)
174293840b9SJohn Crispin #define RT3883_RSTCTRL_PCM		BIT(11)
175293840b9SJohn Crispin #define RT3883_RSTCTRL_MC		BIT(10)
176293840b9SJohn Crispin #define RT3883_RSTCTRL_INTC		BIT(9)
177293840b9SJohn Crispin #define RT3883_RSTCTRL_TIMER		BIT(8)
178293840b9SJohn Crispin #define RT3883_RSTCTRL_SYS		BIT(0)
179293840b9SJohn Crispin 
180293840b9SJohn Crispin #define RT3883_INTC_INT_SYSCTL	BIT(0)
181293840b9SJohn Crispin #define RT3883_INTC_INT_TIMER0	BIT(1)
182293840b9SJohn Crispin #define RT3883_INTC_INT_TIMER1	BIT(2)
183293840b9SJohn Crispin #define RT3883_INTC_INT_IA	BIT(3)
184293840b9SJohn Crispin #define RT3883_INTC_INT_PCM	BIT(4)
185293840b9SJohn Crispin #define RT3883_INTC_INT_UART0	BIT(5)
186293840b9SJohn Crispin #define RT3883_INTC_INT_PIO	BIT(6)
187293840b9SJohn Crispin #define RT3883_INTC_INT_DMA	BIT(7)
188293840b9SJohn Crispin #define RT3883_INTC_INT_NAND	BIT(8)
189293840b9SJohn Crispin #define RT3883_INTC_INT_PERFC	BIT(9)
190293840b9SJohn Crispin #define RT3883_INTC_INT_I2S	BIT(10)
191293840b9SJohn Crispin #define RT3883_INTC_INT_UART1	BIT(12)
192293840b9SJohn Crispin #define RT3883_INTC_INT_UHST	BIT(18)
193293840b9SJohn Crispin #define RT3883_INTC_INT_UDEV	BIT(19)
194293840b9SJohn Crispin 
195293840b9SJohn Crispin /* FLASH/SRAM/Codec Controller registers */
196293840b9SJohn Crispin #define RT3883_FSCC_REG_FLASH_CFG0	0x00
197293840b9SJohn Crispin #define RT3883_FSCC_REG_FLASH_CFG1	0x04
198293840b9SJohn Crispin #define RT3883_FSCC_REG_CODEC_CFG0	0x40
199293840b9SJohn Crispin #define RT3883_FSCC_REG_CODEC_CFG1	0x44
200293840b9SJohn Crispin 
201293840b9SJohn Crispin #define RT3883_FLASH_CFG_WIDTH_SHIFT	26
202293840b9SJohn Crispin #define RT3883_FLASH_CFG_WIDTH_MASK	0x3
203293840b9SJohn Crispin #define RT3883_FLASH_CFG_WIDTH_8BIT	0x0
204293840b9SJohn Crispin #define RT3883_FLASH_CFG_WIDTH_16BIT	0x1
205293840b9SJohn Crispin #define RT3883_FLASH_CFG_WIDTH_32BIT	0x2
206293840b9SJohn Crispin 
207293840b9SJohn Crispin #define RT3883_SDRAM_BASE		0x00000000
208293840b9SJohn Crispin #define RT3883_MEM_SIZE_MIN		2
209293840b9SJohn Crispin #define RT3883_MEM_SIZE_MAX		256
210293840b9SJohn Crispin 
211293840b9SJohn Crispin #endif /* _RT3883_REGS_H_ */
212293840b9SJohn Crispin