xref: /rk3399_ARM-atf/plat/socionext/synquacer/include/platform_def.h (revision 434454a2710eea3f49ebfca951019d7b6c783fb5)
1c35d59a3SSumit Garg /*
2c35d59a3SSumit Garg  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3c35d59a3SSumit Garg  *
4c35d59a3SSumit Garg  * SPDX-License-Identifier: BSD-3-Clause
5c35d59a3SSumit Garg  */
6c35d59a3SSumit Garg 
71083b2b3SAntonio Nino Diaz #ifndef PLATFORM_DEF_H
81083b2b3SAntonio Nino Diaz #define PLATFORM_DEF_H
9c35d59a3SSumit Garg 
1009d40e0eSAntonio Nino Diaz #include <lib/utils_def.h>
1109d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h>
12c35d59a3SSumit Garg 
13007a7a33SSumit Garg /* CPU topology */
14007a7a33SSumit Garg #define PLAT_MAX_CORES_PER_CLUSTER	2
15007a7a33SSumit Garg #define PLAT_CLUSTER_COUNT		12
16007a7a33SSumit Garg #define PLATFORM_CORE_COUNT		(PLAT_CLUSTER_COUNT *	\
17007a7a33SSumit Garg 					 PLAT_MAX_CORES_PER_CLUSTER)
18007a7a33SSumit Garg 
191083b2b3SAntonio Nino Diaz #define PLAT_MAX_PWR_LVL		U(1)
201083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE		U(1)
211083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE		U(2)
22753701ccSSumit Garg 
23753701ccSSumit Garg #define SQ_LOCAL_STATE_RUN		0
24753701ccSSumit Garg #define SQ_LOCAL_STATE_RET		1
25753701ccSSumit Garg #define SQ_LOCAL_STATE_OFF		2
26753701ccSSumit Garg 
27c35d59a3SSumit Garg #define CACHE_WRITEBACK_SHIFT		6
28c35d59a3SSumit Garg #define CACHE_WRITEBACK_GRANULE		(1 << CACHE_WRITEBACK_SHIFT)
29c35d59a3SSumit Garg 
308cd37d7bSSumit Garg #define PLAT_PHY_ADDR_SPACE_SIZE	(1ULL << 32)
318cd37d7bSSumit Garg #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ULL << 32)
32*434454a2SArd Biesheuvel #define MAX_XLAT_TABLES			8
33*434454a2SArd Biesheuvel #define MAX_MMAP_REGIONS		8
348cd37d7bSSumit Garg 
35c35d59a3SSumit Garg #define PLATFORM_STACK_SIZE		0x400
36c35d59a3SSumit Garg 
37c35d59a3SSumit Garg #define BL31_BASE			0x04000000
38c35d59a3SSumit Garg #define BL31_SIZE			0x00080000
39c35d59a3SSumit Garg #define BL31_LIMIT			(BL31_BASE + BL31_SIZE)
40c35d59a3SSumit Garg 
41e373b6a2SArd Biesheuvel #define BL32_BASE			0xfc000000
42*434454a2SArd Biesheuvel #define BL32_SIZE			0x03c00000
43*434454a2SArd Biesheuvel #define BL32_LIMIT			(BL32_BASE + BL32_SIZE)
44e373b6a2SArd Biesheuvel 
450eb275c9SSumit Garg #define PLAT_SQ_CCN_BASE		0x32000000
460eb275c9SSumit Garg #define PLAT_SQ_CLUSTER_TO_CCN_ID_MAP					\
470eb275c9SSumit Garg 					0,	/* Cluster 0 */		\
480eb275c9SSumit Garg 					18,	/* Cluster 1 */		\
490eb275c9SSumit Garg 					11,	/* Cluster 2 */		\
500eb275c9SSumit Garg 					29,	/* Cluster 3 */		\
510eb275c9SSumit Garg 					35,	/* Cluster 4 */		\
520eb275c9SSumit Garg 					17,	/* Cluster 5 */		\
530eb275c9SSumit Garg 					12,	/* Cluster 6 */		\
540eb275c9SSumit Garg 					30,	/* Cluster 7 */		\
550eb275c9SSumit Garg 					14,	/* Cluster 8 */		\
560eb275c9SSumit Garg 					32,	/* Cluster 9 */		\
570eb275c9SSumit Garg 					15,	/* Cluster 10 */	\
580eb275c9SSumit Garg 					33	/* Cluster 11 */
590eb275c9SSumit Garg 
6067b40070SSumit Garg /* UART related constants */
6167b40070SSumit Garg #define PLAT_SQ_BOOT_UART_BASE		0x2A400000
6267b40070SSumit Garg #define PLAT_SQ_BOOT_UART_CLK_IN_HZ	62500000
6367b40070SSumit Garg #define SQ_CONSOLE_BAUDRATE		115200
6467b40070SSumit Garg 
655931fdacSSumit Garg #define SQ_SYS_CNTCTL_BASE		0x2a430000
665931fdacSSumit Garg 
675931fdacSSumit Garg #define SQ_SYS_TIMCTL_BASE		0x2a810000
685931fdacSSumit Garg #define PLAT_SQ_NSTIMER_FRAME_ID	0
695931fdacSSumit Garg 
70cfe19f85SArd Biesheuvel #define DRAMINFO_BASE			0x2E00FFC0
71cfe19f85SArd Biesheuvel 
7205377100SSumit Garg #define PLAT_SQ_MHU_BASE		0x45000000
7305377100SSumit Garg 
74b7ad0444SSumit Garg #define PLAT_SQ_SCP_COM_SHARED_MEM_BASE		0x45400000
75b7ad0444SSumit Garg #define SCPI_CMD_GET_DRAMINFO			0x1
76b7ad0444SSumit Garg 
7785427debSSumit Garg #define SQ_BOOT_CFG_ADDR			0x45410000
7885427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_SHIFT		8
7985427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH		6
8085427debSSumit Garg 
81b529799fSSumit Garg #define PLAT_SQ_GICD_BASE		0x30000000
82b529799fSSumit Garg #define PLAT_SQ_GICR_BASE		0x30400000
83b529799fSSumit Garg 
84753701ccSSumit Garg #define PLAT_SQ_GPIO_BASE		0x51000000
85753701ccSSumit Garg 
86*434454a2SArd Biesheuvel #define PLAT_SPM_BUF_BASE		(BL32_LIMIT - 32 * PLAT_SPM_BUF_SIZE)
87*434454a2SArd Biesheuvel #define PLAT_SPM_BUF_SIZE		ULL(0x10000)
88*434454a2SArd Biesheuvel #define PLAT_SPM_SPM_BUF_EL0_MMAP	MAP_REGION2(PLAT_SPM_BUF_BASE, \
89*434454a2SArd Biesheuvel 						    PLAT_SPM_BUF_BASE, \
90*434454a2SArd Biesheuvel 						    PLAT_SPM_BUF_SIZE, \
91*434454a2SArd Biesheuvel 						    MT_RO_DATA | MT_SECURE | \
92*434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
93*434454a2SArd Biesheuvel 
94*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_BASE	BL32_LIMIT
95*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_SIZE	ULL(0x200000)
96*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_MMAP	MAP_REGION2(PLAT_SP_IMAGE_NS_BUF_BASE, \
97*434454a2SArd Biesheuvel 						    PLAT_SP_IMAGE_NS_BUF_BASE, \
98*434454a2SArd Biesheuvel 						    PLAT_SP_IMAGE_NS_BUF_SIZE, \
99*434454a2SArd Biesheuvel 						    MT_RW_DATA | MT_NS | \
100*434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
101*434454a2SArd Biesheuvel 
102*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_PCPU_SIZE	ULL(0x10000)
103*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_SIZE	(32 * PLAT_SP_IMAGE_STACK_PCPU_SIZE)
104*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_BASE	(PLAT_SQ_SP_HEAP_BASE + PLAT_SQ_SP_HEAP_SIZE)
105*434454a2SArd Biesheuvel 
106*434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_SIZE		ULL(0x200000)
107*434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_MMAP		MAP_REGION2(BL32_BASE, BL32_BASE, \
108*434454a2SArd Biesheuvel 						    PLAT_SQ_SP_IMAGE_SIZE, \
109*434454a2SArd Biesheuvel 						    MT_CODE | MT_SECURE | \
110*434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
111*434454a2SArd Biesheuvel 
112*434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_BASE		(BL32_BASE + PLAT_SQ_SP_IMAGE_SIZE)
113*434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_SIZE		ULL(0x800000)
114*434454a2SArd Biesheuvel 
115*434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_RW_MMAP	MAP_REGION2(PLAT_SQ_SP_HEAP_BASE, \
116*434454a2SArd Biesheuvel 						    PLAT_SQ_SP_HEAP_BASE, \
117*434454a2SArd Biesheuvel 						    (PLAT_SQ_SP_HEAP_SIZE + \
118*434454a2SArd Biesheuvel 						     PLAT_SP_IMAGE_STACK_SIZE), \
119*434454a2SArd Biesheuvel 						    MT_RW_DATA | MT_SECURE | \
120*434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
121*434454a2SArd Biesheuvel 
122*434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_BASE		(PLAT_SP_IMAGE_STACK_BASE + \
123*434454a2SArd Biesheuvel 					 PLAT_SP_IMAGE_STACK_SIZE)
124*434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_SIZE		ULL(0x40000)
125*434454a2SArd Biesheuvel 
126*434454a2SArd Biesheuvel #define PLAT_SP_PRI			0x20
127*434454a2SArd Biesheuvel #define PLAT_PRI_BITS			2
128*434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_0		ULL(0)
129*434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_1		ULL(0)
130*434454a2SArd Biesheuvel 
131*434454a2SArd Biesheuvel /* Total number of memory regions with distinct properties */
132*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NUM_MEM_REGIONS	6
133*434454a2SArd Biesheuvel 
134*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MMAP_REGIONS	30
135*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MAX_XLAT_TABLES	20
136*434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_XLAT_SECTION_NAME	"sp_xlat_table"
137*434454a2SArd Biesheuvel 
138*434454a2SArd Biesheuvel #define PLAT_SQ_UART1_BASE		PLAT_SQ_BOOT_UART_BASE
139*434454a2SArd Biesheuvel #define PLAT_SQ_UART1_SIZE		ULL(0x1000)
140*434454a2SArd Biesheuvel #define PLAT_SQ_UART1_MMAP		MAP_REGION_FLAT(PLAT_SQ_UART1_BASE, \
141*434454a2SArd Biesheuvel 							PLAT_SQ_UART1_SIZE, \
142*434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
143*434454a2SArd Biesheuvel 							MT_NS | MT_PRIVILEGED)
144*434454a2SArd Biesheuvel 
145*434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_BASE		0x50000000
146*434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_SIZE		ULL(0x8000000)
147*434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_MMAP		MAP_REGION_FLAT(PLAT_SQ_PERIPH_BASE, \
148*434454a2SArd Biesheuvel 							PLAT_SQ_PERIPH_SIZE, \
149*434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
150*434454a2SArd Biesheuvel 							MT_NS | MT_USER)
151*434454a2SArd Biesheuvel 
152*434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_BASE		0x08000000
153*434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_SIZE		ULL(0x8000000)
154*434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_MMAP		MAP_REGION_FLAT(PLAT_SQ_FLASH_BASE, \
155*434454a2SArd Biesheuvel 							PLAT_SQ_FLASH_SIZE, \
156*434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
157*434454a2SArd Biesheuvel 							MT_NS | MT_USER)
158*434454a2SArd Biesheuvel 
1591083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */
160