xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-sunxi/cpu_sun4i.h (revision d2e1ee686ab16c022d1a3049a35b4ce89a25d34e)
19803e4e1SHans de Goede /*
29803e4e1SHans de Goede  * (C) Copyright 2007-2011
39803e4e1SHans de Goede  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
49803e4e1SHans de Goede  * Tom Cubie <tangliang@allwinnertech.com>
59803e4e1SHans de Goede  *
69803e4e1SHans de Goede  * SPDX-License-Identifier:	GPL-2.0+
79803e4e1SHans de Goede  */
89803e4e1SHans de Goede 
99803e4e1SHans de Goede #ifndef _SUNXI_CPU_SUN4I_H
109803e4e1SHans de Goede #define _SUNXI_CPU_SUN4I_H
119803e4e1SHans de Goede 
129803e4e1SHans de Goede #define SUNXI_SRAM_A1_BASE		0x00000000
139803e4e1SHans de Goede #define SUNXI_SRAM_A1_SIZE		(16 * 1024)	/* 16 kiB */
149803e4e1SHans de Goede 
159803e4e1SHans de Goede #define SUNXI_SRAM_A2_BASE		0x00004000	/* 16 kiB */
169803e4e1SHans de Goede #define SUNXI_SRAM_A3_BASE		0x00008000	/* 13 kiB */
179803e4e1SHans de Goede #define SUNXI_SRAM_A4_BASE		0x0000b400	/* 3 kiB */
189803e4e1SHans de Goede #define SUNXI_SRAM_D_BASE		0x00010000	/* 4 kiB */
199803e4e1SHans de Goede #define SUNXI_SRAM_B_BASE		0x00020000	/* 64 kiB (secure) */
209803e4e1SHans de Goede 
2156009451SJernej Skrabec #define SUNXI_DE2_BASE			0x01000000
2256009451SJernej Skrabec 
230f3b8944SChen-Yu Tsai #ifdef CONFIG_MACH_SUN8I_A83T
240f3b8944SChen-Yu Tsai #define SUNXI_CPUCFG_BASE		0x01700000
250f3b8944SChen-Yu Tsai #endif
260f3b8944SChen-Yu Tsai 
279803e4e1SHans de Goede #define SUNXI_SRAMC_BASE		0x01c00000
289803e4e1SHans de Goede #define SUNXI_DRAMC_BASE		0x01c01000
299803e4e1SHans de Goede #define SUNXI_DMA_BASE			0x01c02000
309803e4e1SHans de Goede #define SUNXI_NFC_BASE			0x01c03000
319803e4e1SHans de Goede #define SUNXI_TS_BASE			0x01c04000
329803e4e1SHans de Goede #define SUNXI_SPI0_BASE			0x01c05000
339803e4e1SHans de Goede #define SUNXI_SPI1_BASE			0x01c06000
349803e4e1SHans de Goede #define SUNXI_MS_BASE			0x01c07000
359803e4e1SHans de Goede #define SUNXI_TVD_BASE			0x01c08000
369803e4e1SHans de Goede #define SUNXI_CSI0_BASE			0x01c09000
37*a8191dfeSJernej Skrabec #ifndef CONFIG_MACH_SUNXI_H3_H5
389803e4e1SHans de Goede #define SUNXI_TVE0_BASE			0x01c0a000
39*a8191dfeSJernej Skrabec #endif
409803e4e1SHans de Goede #define SUNXI_EMAC_BASE			0x01c0b000
419803e4e1SHans de Goede #define SUNXI_LCD0_BASE			0x01c0C000
429803e4e1SHans de Goede #define SUNXI_LCD1_BASE			0x01c0d000
439803e4e1SHans de Goede #define SUNXI_VE_BASE			0x01c0e000
449803e4e1SHans de Goede #define SUNXI_MMC0_BASE			0x01c0f000
459803e4e1SHans de Goede #define SUNXI_MMC1_BASE			0x01c10000
469803e4e1SHans de Goede #define SUNXI_MMC2_BASE			0x01c11000
479803e4e1SHans de Goede #define SUNXI_MMC3_BASE			0x01c12000
4844d8ae5bSHans de Goede #ifdef CONFIG_SUNXI_GEN_SUN4I
499803e4e1SHans de Goede #define SUNXI_USB0_BASE			0x01c13000
509803e4e1SHans de Goede #define SUNXI_USB1_BASE			0x01c14000
519803e4e1SHans de Goede #endif
529803e4e1SHans de Goede #define SUNXI_SS_BASE			0x01c15000
5356009451SJernej Skrabec #if !defined(CONFIG_MACH_SUNXI_H3_H5) && !defined(CONFIG_MACH_SUN50I)
549803e4e1SHans de Goede #define SUNXI_HDMI_BASE			0x01c16000
5556009451SJernej Skrabec #endif
569803e4e1SHans de Goede #define SUNXI_SPI2_BASE			0x01c17000
579803e4e1SHans de Goede #define SUNXI_SATA_BASE			0x01c18000
5844d8ae5bSHans de Goede #ifdef CONFIG_SUNXI_GEN_SUN4I
599803e4e1SHans de Goede #define SUNXI_PATA_BASE			0x01c19000
609803e4e1SHans de Goede #define SUNXI_ACE_BASE			0x01c1a000
619803e4e1SHans de Goede #define SUNXI_TVE1_BASE			0x01c1b000
629803e4e1SHans de Goede #define SUNXI_USB2_BASE			0x01c1c000
6344d8ae5bSHans de Goede #endif
6444d8ae5bSHans de Goede #ifdef CONFIG_SUNXI_GEN_SUN6I
657b82a229SAndre Przywara #if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
66dc44fd8aSJelle van der Waa #define SUNXI_USBPHY_BASE		0x01c19000
67dc44fd8aSJelle van der Waa #define SUNXI_USB0_BASE			0x01c1a000
68dc44fd8aSJelle van der Waa #define SUNXI_USB1_BASE			0x01c1b000
69dc44fd8aSJelle van der Waa #define SUNXI_USB2_BASE			0x01c1c000
70dc44fd8aSJelle van der Waa #define SUNXI_USB3_BASE			0x01c1d000
71dc44fd8aSJelle van der Waa #else
729803e4e1SHans de Goede #define SUNXI_USB0_BASE			0x01c19000
739803e4e1SHans de Goede #define SUNXI_USB1_BASE			0x01c1a000
749803e4e1SHans de Goede #define SUNXI_USB2_BASE			0x01c1b000
759803e4e1SHans de Goede #endif
76dc44fd8aSJelle van der Waa #endif
779803e4e1SHans de Goede #define SUNXI_CSI1_BASE			0x01c1d000
789803e4e1SHans de Goede #define SUNXI_TZASC_BASE		0x01c1e000
799803e4e1SHans de Goede #define SUNXI_SPI3_BASE			0x01c1f000
809803e4e1SHans de Goede 
819803e4e1SHans de Goede #define SUNXI_CCM_BASE			0x01c20000
829803e4e1SHans de Goede #define SUNXI_INTC_BASE			0x01c20400
839803e4e1SHans de Goede #define SUNXI_PIO_BASE			0x01c20800
849803e4e1SHans de Goede #define SUNXI_TIMER_BASE		0x01c20c00
85421c98d7SHans de Goede #ifndef CONFIG_SUNXI_GEN_SUN6I
86421c98d7SHans de Goede #define SUNXI_PWM_BASE			0x01c20e00
87421c98d7SHans de Goede #endif
889803e4e1SHans de Goede #define SUNXI_SPDIF_BASE		0x01c21000
89421c98d7SHans de Goede #ifdef CONFIG_SUNXI_GEN_SUN6I
90421c98d7SHans de Goede #define SUNXI_PWM_BASE			0x01c21400
91421c98d7SHans de Goede #else
929803e4e1SHans de Goede #define SUNXI_AC97_BASE			0x01c21400
93421c98d7SHans de Goede #endif
949803e4e1SHans de Goede #define SUNXI_IR0_BASE			0x01c21800
959803e4e1SHans de Goede #define SUNXI_IR1_BASE			0x01c21c00
969803e4e1SHans de Goede 
979803e4e1SHans de Goede #define SUNXI_IIS_BASE			0x01c22400
989803e4e1SHans de Goede #define SUNXI_LRADC_BASE		0x01c22800
999803e4e1SHans de Goede #define SUNXI_AD_DA_BASE		0x01c22c00
1009803e4e1SHans de Goede #define SUNXI_KEYPAD_BASE		0x01c23000
1019803e4e1SHans de Goede #define SUNXI_TZPC_BASE			0x01c23400
10270fe24edSChen-Yu Tsai 
1037b82a229SAndre Przywara #if defined(CONFIG_MACH_SUN8I_A83T) || defined(CONFIG_MACH_SUNXI_H3_H5) || \
104a29710c5SAmit Singh Tomar defined(CONFIG_MACH_SUN50I)
10570fe24edSChen-Yu Tsai /* SID address space starts at 0x01c1400, but e-fuse is at offset 0x200 */
10665d2d4f2SIcenowy Zheng #define SUNXI_SIDC_BASE			0x01c14000
10770fe24edSChen-Yu Tsai #define SUNXI_SID_BASE			0x01c14200
10870fe24edSChen-Yu Tsai #else
1099803e4e1SHans de Goede #define SUNXI_SID_BASE			0x01c23800
11070fe24edSChen-Yu Tsai #endif
11170fe24edSChen-Yu Tsai 
1129803e4e1SHans de Goede #define SUNXI_SJTAG_BASE		0x01c23c00
1139803e4e1SHans de Goede 
1149803e4e1SHans de Goede #define SUNXI_TP_BASE			0x01c25000
1159803e4e1SHans de Goede #define SUNXI_PMU_BASE			0x01c25400
1160f3b8944SChen-Yu Tsai 
117acef2364SChen-Yu Tsai #if defined CONFIG_MACH_SUN7I || defined CONFIG_MACH_SUN8I_R40
1180f3b8944SChen-Yu Tsai #define SUNXI_CPUCFG_BASE		0x01c25c00
1190f3b8944SChen-Yu Tsai #endif
1209803e4e1SHans de Goede 
1219803e4e1SHans de Goede #define SUNXI_UART0_BASE		0x01c28000
1229803e4e1SHans de Goede #define SUNXI_UART1_BASE		0x01c28400
1239803e4e1SHans de Goede #define SUNXI_UART2_BASE		0x01c28800
1249803e4e1SHans de Goede #define SUNXI_UART3_BASE		0x01c28c00
1259803e4e1SHans de Goede #define SUNXI_UART4_BASE		0x01c29000
1269803e4e1SHans de Goede #define SUNXI_UART5_BASE		0x01c29400
1279803e4e1SHans de Goede #define SUNXI_UART6_BASE		0x01c29800
1289803e4e1SHans de Goede #define SUNXI_UART7_BASE		0x01c29c00
1299803e4e1SHans de Goede #define SUNXI_PS2_0_BASE		0x01c2a000
1309803e4e1SHans de Goede #define SUNXI_PS2_1_BASE		0x01c2a400
1319803e4e1SHans de Goede 
1329803e4e1SHans de Goede #define SUNXI_TWI0_BASE			0x01c2ac00
1339803e4e1SHans de Goede #define SUNXI_TWI1_BASE			0x01c2b000
1349803e4e1SHans de Goede #define SUNXI_TWI2_BASE			0x01c2b400
1356c739c5dSPaul Kocialkowski #ifdef CONFIG_MACH_SUN6I
1366c739c5dSPaul Kocialkowski #define SUNXI_TWI3_BASE			0x01c0b800
1376c739c5dSPaul Kocialkowski #endif
1386c739c5dSPaul Kocialkowski #ifdef CONFIG_MACH_SUN7I
1396c739c5dSPaul Kocialkowski #define SUNXI_TWI3_BASE			0x01c2b800
1406c739c5dSPaul Kocialkowski #define SUNXI_TWI4_BASE			0x01c2c000
1416c739c5dSPaul Kocialkowski #endif
1429803e4e1SHans de Goede 
1439803e4e1SHans de Goede #define SUNXI_CAN_BASE			0x01c2bc00
1449803e4e1SHans de Goede 
1459803e4e1SHans de Goede #define SUNXI_SCR_BASE			0x01c2c400
1469803e4e1SHans de Goede 
1479803e4e1SHans de Goede #ifndef CONFIG_MACH_SUN6I
1489803e4e1SHans de Goede #define SUNXI_GPS_BASE			0x01c30000
1499803e4e1SHans de Goede #define SUNXI_MALI400_BASE		0x01c40000
1509803e4e1SHans de Goede #define SUNXI_GMAC_BASE			0x01c50000
1519803e4e1SHans de Goede #else
1529803e4e1SHans de Goede #define SUNXI_GMAC_BASE			0x01c30000
1539803e4e1SHans de Goede #endif
1549803e4e1SHans de Goede 
1559803e4e1SHans de Goede #define SUNXI_DRAM_COM_BASE		0x01c62000
1569803e4e1SHans de Goede #define SUNXI_DRAM_CTL0_BASE		0x01c63000
1579803e4e1SHans de Goede #define SUNXI_DRAM_CTL1_BASE		0x01c64000
1589803e4e1SHans de Goede #define SUNXI_DRAM_PHY0_BASE		0x01c65000
1599803e4e1SHans de Goede #define SUNXI_DRAM_PHY1_BASE		0x01c66000
1609803e4e1SHans de Goede 
1613424c3f2SChen-Yu Tsai #define SUNXI_GIC400_BASE		0x01c80000
1623424c3f2SChen-Yu Tsai 
1639803e4e1SHans de Goede /* module sram */
1649803e4e1SHans de Goede #define SUNXI_SRAM_C_BASE		0x01d00000
1659803e4e1SHans de Goede 
166*a8191dfeSJernej Skrabec #ifndef CONFIG_MACH_SUN8I_H3
1679803e4e1SHans de Goede #define SUNXI_DE_FE0_BASE		0x01e00000
168*a8191dfeSJernej Skrabec #else
169*a8191dfeSJernej Skrabec #define SUNXI_TVE0_BASE			0x01e00000
170*a8191dfeSJernej Skrabec #endif
1719803e4e1SHans de Goede #define SUNXI_DE_FE1_BASE		0x01e20000
1729803e4e1SHans de Goede #define SUNXI_DE_BE0_BASE		0x01e60000
173*a8191dfeSJernej Skrabec #ifndef CONFIG_MACH_SUN50I_H5
1749803e4e1SHans de Goede #define SUNXI_DE_BE1_BASE		0x01e40000
175*a8191dfeSJernej Skrabec #else
176*a8191dfeSJernej Skrabec #define SUNXI_TVE0_BASE			0x01e40000
177*a8191dfeSJernej Skrabec #endif
1789803e4e1SHans de Goede #define SUNXI_MP_BASE			0x01e80000
1799803e4e1SHans de Goede #define SUNXI_AVG_BASE			0x01ea0000
1809803e4e1SHans de Goede 
18156009451SJernej Skrabec #if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
18256009451SJernej Skrabec #define SUNXI_HDMI_BASE			0x01ee0000
18356009451SJernej Skrabec #endif
18456009451SJernej Skrabec 
1859803e4e1SHans de Goede #define SUNXI_RTC_BASE			0x01f00000
1869803e4e1SHans de Goede #define SUNXI_PRCM_BASE			0x01f01400
1870f3b8944SChen-Yu Tsai 
188acef2364SChen-Yu Tsai #if defined CONFIG_SUNXI_GEN_SUN6I && \
189acef2364SChen-Yu Tsai     !defined CONFIG_MACH_SUN8I_A83T && \
190acef2364SChen-Yu Tsai     !defined CONFIG_MACH_SUN8I_R40
1910f3b8944SChen-Yu Tsai #define SUNXI_CPUCFG_BASE		0x01f01c00
1920f3b8944SChen-Yu Tsai #endif
1930f3b8944SChen-Yu Tsai 
1949d082687SJelle van der Waa #define SUNXI_R_TWI_BASE		0x01f02400
1959803e4e1SHans de Goede #define SUNXI_R_UART_BASE		0x01f02800
1969803e4e1SHans de Goede #define SUNXI_R_PIO_BASE		0x01f02c00
1979803e4e1SHans de Goede #define SUN6I_P2WI_BASE			0x01f03400
1989803e4e1SHans de Goede #define SUNXI_RSB_BASE			0x01f03400
1999803e4e1SHans de Goede 
2009803e4e1SHans de Goede /* CoreSight Debug Module */
2019803e4e1SHans de Goede #define SUNXI_CSDM_BASE			0x3f500000
2029803e4e1SHans de Goede 
2039803e4e1SHans de Goede #define SUNXI_DDRII_DDRIII_BASE		0x40000000	/* 2 GiB */
2049803e4e1SHans de Goede 
2059803e4e1SHans de Goede #define SUNXI_BROM_BASE			0xffff0000	/* 32 kiB */
2069803e4e1SHans de Goede 
2079803e4e1SHans de Goede #define SUNXI_CPU_CFG			(SUNXI_TIMER_BASE + 0x13c)
2089803e4e1SHans de Goede 
2099803e4e1SHans de Goede /* SS bonding ids used for cpu identification */
2109803e4e1SHans de Goede #define SUNXI_SS_BOND_ID_A31		4
2119803e4e1SHans de Goede #define SUNXI_SS_BOND_ID_A31S		5
2129803e4e1SHans de Goede 
2139803e4e1SHans de Goede #ifndef __ASSEMBLY__
2149803e4e1SHans de Goede void sunxi_board_init(void);
2159803e4e1SHans de Goede void sunxi_reset(void);
2169803e4e1SHans de Goede int sunxi_get_ss_bonding_id(void);
2179803e4e1SHans de Goede int sunxi_get_sid(unsigned int *sid);
2189803e4e1SHans de Goede #endif /* __ASSEMBLY__ */
2199803e4e1SHans de Goede 
2209803e4e1SHans de Goede #endif /* _SUNXI_CPU_SUN4I_H */
221