1 /*
2  * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
3  * (C) Copyright 2007-2013
4  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
5  * Jerry Wang <wangflord@allwinnertech.com>
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef _SUNXI_CPU_SUN9I_H
11 #define _SUNXI_CPU_SUN9I_H
12 
13 #define REGS_AHB0_BASE			0x01C00000
14 #define REGS_AHB1_BASE			0x00800000
15 #define REGS_AHB2_BASE			0x03000000
16 #define REGS_APB0_BASE			0x06000000
17 #define REGS_APB1_BASE			0x07000000
18 #define REGS_RCPUS_BASE			0x08000000
19 
20 #define SUNXI_SRAM_D_BASE		0x08100000
21 
22 /* AHB0 Module */
23 #define SUNXI_NFC_BASE			(REGS_AHB0_BASE + 0x3000)
24 #define SUNXI_TSC_BASE			(REGS_AHB0_BASE + 0x4000)
25 
26 #define SUNXI_MMC0_BASE			(REGS_AHB0_BASE + 0x0f000)
27 #define SUNXI_MMC1_BASE			(REGS_AHB0_BASE + 0x10000)
28 #define SUNXI_MMC2_BASE			(REGS_AHB0_BASE + 0x11000)
29 #define SUNXI_MMC3_BASE			(REGS_AHB0_BASE + 0x12000)
30 #define SUNXI_MMC_COMMON_BASE		(REGS_AHB0_BASE + 0x13000)
31 
32 #define SUNXI_SPI0_BASE			(REGS_AHB0_BASE + 0x1A000)
33 #define SUNXI_SPI1_BASE			(REGS_AHB0_BASE + 0x1B000)
34 #define SUNXI_SPI2_BASE			(REGS_AHB0_BASE + 0x1C000)
35 #define SUNXI_SPI3_BASE			(REGS_AHB0_BASE + 0x1D000)
36 
37 #define SUNXI_GIC400_BASE		(REGS_AHB0_BASE + 0x40000)
38 #define SUNXI_ARMA9_GIC_BASE		(REGS_AHB0_BASE + 0x41000)
39 #define SUNXI_ARMA9_CPUIF_BASE		(REGS_AHB0_BASE + 0x42000)
40 
41 /* AHB1 Module */
42 #define SUNXI_DMA_BASE			(REGS_AHB1_BASE + 0x002000)
43 #define SUNXI_USBOTG_BASE		(REGS_AHB1_BASE + 0x100000)
44 #define SUNXI_USBEHCI0_BASE		(REGS_AHB1_BASE + 0x200000)
45 #define SUNXI_USBEHCI1_BASE		(REGS_AHB1_BASE + 0x201000)
46 #define SUNXI_USBEHCI2_BASE		(REGS_AHB1_BASE + 0x202000)
47 
48 /* AHB2 Module */
49 #define SUNXI_DE_SYS_BASE		(REGS_AHB2_BASE + 0x000000)
50 #define SUNXI_DISP_SYS_BASE		(REGS_AHB2_BASE + 0x010000)
51 #define SUNXI_DE_FE0_BASE		(REGS_AHB2_BASE + 0x100000)
52 #define SUNXI_DE_FE1_BASE		(REGS_AHB2_BASE + 0x140000)
53 #define SUNXI_DE_FE2_BASE		(REGS_AHB2_BASE + 0x180000)
54 
55 #define SUNXI_DE_BE0_BASE		(REGS_AHB2_BASE + 0x200000)
56 #define SUNXI_DE_BE1_BASE		(REGS_AHB2_BASE + 0x240000)
57 #define SUNXI_DE_BE2_BASE		(REGS_AHB2_BASE + 0x280000)
58 
59 #define SUNXI_DE_DEU0_BASE		(REGS_AHB2_BASE + 0x300000)
60 #define SUNXI_DE_DEU1_BASE		(REGS_AHB2_BASE + 0x340000)
61 #define SUNXI_DE_DRC0_BASE		(REGS_AHB2_BASE + 0x400000)
62 #define SUNXI_DE_DRC1_BASE		(REGS_AHB2_BASE + 0x440000)
63 
64 #define SUNXI_LCD0_BASE			(REGS_AHB2_BASE + 0xC00000)
65 #define SUNXI_LCD1_BASE			(REGS_AHB2_BASE + 0xC10000)
66 #define SUNXI_LCD2_BASE			(REGS_AHB2_BASE + 0xC20000)
67 #define SUNXI_MIPI_DSI0_BASE		(REGS_AHB2_BASE + 0xC40000)
68 /* Also seen as SUNXI_MIPI_DSI0_DPHY_BASE 0x01ca1000 */
69 #define SUNXI_MIPI_DSI0_DPHY_BASE	(REGS_AHB2_BASE + 0xC40100)
70 #define SUNXI_HDMI_BASE			(REGS_AHB2_BASE + 0xD00000)
71 
72 /* APB0 Module */
73 #define SUNXI_CCM_BASE			(REGS_APB0_BASE + 0x0000)
74 #define SUNXI_CCMMODULE_BASE		(REGS_APB0_BASE + 0x0400)
75 #define SUNXI_PIO_BASE			(REGS_APB0_BASE + 0x0800)
76 #define SUNXI_TIMER_BASE		(REGS_APB0_BASE + 0x0C00)
77 #define SUNXI_PWM_BASE			(REGS_APB0_BASE + 0x1400)
78 #define SUNXI_LRADC_BASE		(REGS_APB0_BASE + 0x1800)
79 
80 /* APB1 Module */
81 #define SUNXI_UART0_BASE		(REGS_APB1_BASE + 0x0000)
82 #define SUNXI_UART1_BASE		(REGS_APB1_BASE + 0x0400)
83 #define SUNXI_UART2_BASE		(REGS_APB1_BASE + 0x0800)
84 #define SUNXI_UART3_BASE		(REGS_APB1_BASE + 0x0C00)
85 #define SUNXI_UART4_BASE		(REGS_APB1_BASE + 0x1000)
86 #define SUNXI_UART5_BASE		(REGS_APB1_BASE + 0x1400)
87 #define SUNXI_TWI0_BASE			(REGS_APB1_BASE + 0x2800)
88 #define SUNXI_TWI1_BASE			(REGS_APB1_BASE + 0x2C00)
89 #define SUNXI_TWI2_BASE			(REGS_APB1_BASE + 0x3000)
90 #define SUNXI_TWI3_BASE			(REGS_APB1_BASE + 0x3400)
91 #define SUNXI_TWI4_BASE			(REGS_APB1_BASE + 0x3800)
92 
93 /* RCPUS Module */
94 #define SUNXI_PRCM_BASE			(REGS_RCPUS_BASE + 0x1400)
95 #define SUNXI_R_UART_BASE		(REGS_RCPUS_BASE + 0x2800)
96 #define SUNXI_R_PIO_BASE		(REGS_RCPUS_BASE + 0x2c00)
97 #define SUNXI_RSB_BASE			(REGS_RCPUS_BASE + 0x3400)
98 
99 /* Misc. */
100 #define SUNXI_BROM_BASE			0xFFFF0000 /* 32K */
101 #define SUNXI_CPU_CFG			(SUNXI_TIMER_BASE + 0x13c)
102 
103 #ifndef __ASSEMBLY__
104 void sunxi_board_init(void);
105 void sunxi_reset(void);
106 int sunxi_get_sid(unsigned int *sid);
107 #endif
108 
109 #endif /* _SUNXI_CPU_SUN9I_H */
110