xref: /rk3399_ARM-atf/plat/socionext/synquacer/include/platform_def.h (revision 19aaeea00bc4fba94af7aca508af878136930f4a)
1c35d59a3SSumit Garg /*
248ab3904SJassi Brar  * Copyright (c) 2018-2022, 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 */
1450dae22eSDeepika Bhavnani #define PLAT_MAX_CORES_PER_CLUSTER	U(2)
1550dae22eSDeepika Bhavnani #define PLAT_CLUSTER_COUNT		U(12)
16007a7a33SSumit Garg #define PLATFORM_CORE_COUNT		(PLAT_CLUSTER_COUNT *	\
17007a7a33SSumit Garg 					 PLAT_MAX_CORES_PER_CLUSTER)
18007a7a33SSumit Garg 
19b67d2029SMasahisa Kojima /* Macros to read the SQ power domain state */
20b67d2029SMasahisa Kojima #define SQ_PWR_LVL0		MPIDR_AFFLVL0
21b67d2029SMasahisa Kojima #define SQ_PWR_LVL1		MPIDR_AFFLVL1
22b67d2029SMasahisa Kojima #define SQ_PWR_LVL2		MPIDR_AFFLVL2
23b67d2029SMasahisa Kojima 
24b67d2029SMasahisa Kojima #define SQ_CORE_PWR_STATE(state)	(state)->pwr_domain_state[SQ_PWR_LVL0]
25b67d2029SMasahisa Kojima #define SQ_CLUSTER_PWR_STATE(state)	(state)->pwr_domain_state[SQ_PWR_LVL1]
26b67d2029SMasahisa Kojima #define SQ_SYSTEM_PWR_STATE(state)	((PLAT_MAX_PWR_LVL > SQ_PWR_LVL1) ?\
27b67d2029SMasahisa Kojima 				(state)->pwr_domain_state[SQ_PWR_LVL2] : 0)
28b67d2029SMasahisa Kojima 
291083b2b3SAntonio Nino Diaz #define PLAT_MAX_PWR_LVL		U(1)
301083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE		U(1)
311083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE		U(2)
32753701ccSSumit Garg 
33753701ccSSumit Garg #define SQ_LOCAL_STATE_RUN		0
34753701ccSSumit Garg #define SQ_LOCAL_STATE_RET		1
35753701ccSSumit Garg #define SQ_LOCAL_STATE_OFF		2
36753701ccSSumit Garg 
37c35d59a3SSumit Garg #define CACHE_WRITEBACK_SHIFT		6
38c35d59a3SSumit Garg #define CACHE_WRITEBACK_GRANULE		(1 << CACHE_WRITEBACK_SHIFT)
39c35d59a3SSumit Garg 
408cd37d7bSSumit Garg #define PLAT_PHY_ADDR_SPACE_SIZE	(1ULL << 32)
418cd37d7bSSumit Garg #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ULL << 32)
42434454a2SArd Biesheuvel #define MAX_XLAT_TABLES			8
43434454a2SArd Biesheuvel #define MAX_MMAP_REGIONS		8
448cd37d7bSSumit Garg 
45*19aaeea0SJassi Brar #if TRUSTED_BOARD_BOOT
46*19aaeea0SJassi Brar #define PLATFORM_STACK_SIZE		0x1000
47*19aaeea0SJassi Brar #else
48c35d59a3SSumit Garg #define PLATFORM_STACK_SIZE		0x400
49*19aaeea0SJassi Brar #endif
50c35d59a3SSumit Garg 
5148ab3904SJassi Brar #if !RESET_TO_BL31
5248ab3904SJassi Brar 
5348ab3904SJassi Brar /* A mailbox page will be mapped from BL2 and BL31 */
5448ab3904SJassi Brar #define BL2_MAILBOX_BASE		0x0403f000
5548ab3904SJassi Brar #define BL2_MAILBOX_SIZE		0x1000
5648ab3904SJassi Brar 
5748ab3904SJassi Brar #define MAX_IO_HANDLES			2
5848ab3904SJassi Brar #define MAX_IO_DEVICES			2
5948ab3904SJassi Brar #define MAX_IO_BLOCK_DEVICES	U(1)
6048ab3904SJassi Brar 
6148ab3904SJassi Brar #define BL2_BASE			0x04000000
6248ab3904SJassi Brar #define BL2_SIZE			(256 * 1024)
6348ab3904SJassi Brar #define BL2_LIMIT			(BL2_BASE + BL2_SIZE)
6448ab3904SJassi Brar 
6548ab3904SJassi Brar /* If BL2 is enabled, the BL31 is loaded on secure DRAM */
6648ab3904SJassi Brar #define BL31_BASE			0xfbe00000
6748ab3904SJassi Brar #define BL31_SIZE			0x00100000
6848ab3904SJassi Brar #else
6948ab3904SJassi Brar 
70c35d59a3SSumit Garg #define BL31_BASE			0x04000000
71c35d59a3SSumit Garg #define BL31_SIZE			0x00080000
7248ab3904SJassi Brar #endif
7348ab3904SJassi Brar 
74c35d59a3SSumit Garg #define BL31_LIMIT			(BL31_BASE + BL31_SIZE)
75c35d59a3SSumit Garg 
76e373b6a2SArd Biesheuvel #define BL32_BASE			0xfc000000
77434454a2SArd Biesheuvel #define BL32_SIZE			0x03c00000
78434454a2SArd Biesheuvel #define BL32_LIMIT			(BL32_BASE + BL32_SIZE)
79e373b6a2SArd Biesheuvel 
8048ab3904SJassi Brar /* Alternative BL33 */
8148ab3904SJassi Brar #define PLAT_SQ_BL33_BASE		0xe0000000
8248ab3904SJassi Brar #define PLAT_SQ_BL33_SIZE		0x00100000
8348ab3904SJassi Brar 
8448ab3904SJassi Brar /* FIP IO base */
8548ab3904SJassi Brar #define PLAT_SQ_FIP_IOBASE		0x08600000
8648ab3904SJassi Brar #define PLAT_SQ_FIP_MAXSIZE		0x00400000
8748ab3904SJassi Brar 
880eb275c9SSumit Garg #define PLAT_SQ_CCN_BASE		0x32000000
890eb275c9SSumit Garg #define PLAT_SQ_CLUSTER_TO_CCN_ID_MAP					\
900eb275c9SSumit Garg 					0,	/* Cluster 0 */		\
910eb275c9SSumit Garg 					18,	/* Cluster 1 */		\
920eb275c9SSumit Garg 					11,	/* Cluster 2 */		\
930eb275c9SSumit Garg 					29,	/* Cluster 3 */		\
940eb275c9SSumit Garg 					35,	/* Cluster 4 */		\
950eb275c9SSumit Garg 					17,	/* Cluster 5 */		\
960eb275c9SSumit Garg 					12,	/* Cluster 6 */		\
970eb275c9SSumit Garg 					30,	/* Cluster 7 */		\
980eb275c9SSumit Garg 					14,	/* Cluster 8 */		\
990eb275c9SSumit Garg 					32,	/* Cluster 9 */		\
1000eb275c9SSumit Garg 					15,	/* Cluster 10 */	\
1010eb275c9SSumit Garg 					33	/* Cluster 11 */
1020eb275c9SSumit Garg 
10367b40070SSumit Garg /* UART related constants */
10467b40070SSumit Garg #define PLAT_SQ_BOOT_UART_BASE		0x2A400000
10567b40070SSumit Garg #define PLAT_SQ_BOOT_UART_CLK_IN_HZ	62500000
10667b40070SSumit Garg #define SQ_CONSOLE_BAUDRATE		115200
10767b40070SSumit Garg 
1085931fdacSSumit Garg #define SQ_SYS_CNTCTL_BASE		0x2a430000
1095931fdacSSumit Garg 
1105931fdacSSumit Garg #define SQ_SYS_TIMCTL_BASE		0x2a810000
1115931fdacSSumit Garg #define PLAT_SQ_NSTIMER_FRAME_ID	0
1124d4911d7SMasahisa Kojima #define SQ_SYS_CNT_BASE_NS		0x2a830000
1135931fdacSSumit Garg 
114cfe19f85SArd Biesheuvel #define DRAMINFO_BASE			0x2E00FFC0
115cfe19f85SArd Biesheuvel 
11605377100SSumit Garg #define PLAT_SQ_MHU_BASE		0x45000000
11705377100SSumit Garg 
118b7ad0444SSumit Garg #define PLAT_SQ_SCP_COM_SHARED_MEM_BASE		0x45400000
119b7ad0444SSumit Garg #define SCPI_CMD_GET_DRAMINFO			0x1
120b7ad0444SSumit Garg 
12185427debSSumit Garg #define SQ_BOOT_CFG_ADDR			0x45410000
12285427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_SHIFT		8
12385427debSSumit Garg #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH		6
12485427debSSumit Garg 
125b529799fSSumit Garg #define PLAT_SQ_GICD_BASE		0x30000000
126b529799fSSumit Garg #define PLAT_SQ_GICR_BASE		0x30400000
127b529799fSSumit Garg 
128753701ccSSumit Garg #define PLAT_SQ_GPIO_BASE		0x51000000
129753701ccSSumit Garg 
130434454a2SArd Biesheuvel #define PLAT_SPM_BUF_BASE		(BL32_LIMIT - 32 * PLAT_SPM_BUF_SIZE)
131434454a2SArd Biesheuvel #define PLAT_SPM_BUF_SIZE		ULL(0x10000)
132434454a2SArd Biesheuvel #define PLAT_SPM_SPM_BUF_EL0_MMAP	MAP_REGION2(PLAT_SPM_BUF_BASE, \
133434454a2SArd Biesheuvel 						    PLAT_SPM_BUF_BASE, \
134434454a2SArd Biesheuvel 						    PLAT_SPM_BUF_SIZE, \
135434454a2SArd Biesheuvel 						    MT_RO_DATA | MT_SECURE | \
136434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
137434454a2SArd Biesheuvel 
138434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_BASE	BL32_LIMIT
139434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_SIZE	ULL(0x200000)
140434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NS_BUF_MMAP	MAP_REGION2(PLAT_SP_IMAGE_NS_BUF_BASE, \
141434454a2SArd Biesheuvel 						    PLAT_SP_IMAGE_NS_BUF_BASE, \
142434454a2SArd Biesheuvel 						    PLAT_SP_IMAGE_NS_BUF_SIZE, \
143434454a2SArd Biesheuvel 						    MT_RW_DATA | MT_NS | \
144434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
145434454a2SArd Biesheuvel 
146434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_PCPU_SIZE	ULL(0x10000)
147434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_SIZE	(32 * PLAT_SP_IMAGE_STACK_PCPU_SIZE)
148434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_STACK_BASE	(PLAT_SQ_SP_HEAP_BASE + PLAT_SQ_SP_HEAP_SIZE)
149434454a2SArd Biesheuvel 
150434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_SIZE		ULL(0x200000)
151434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_MMAP		MAP_REGION2(BL32_BASE, BL32_BASE, \
152434454a2SArd Biesheuvel 						    PLAT_SQ_SP_IMAGE_SIZE, \
153434454a2SArd Biesheuvel 						    MT_CODE | MT_SECURE | \
154434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
155434454a2SArd Biesheuvel 
156434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_BASE		(BL32_BASE + PLAT_SQ_SP_IMAGE_SIZE)
157434454a2SArd Biesheuvel #define PLAT_SQ_SP_HEAP_SIZE		ULL(0x800000)
158434454a2SArd Biesheuvel 
159434454a2SArd Biesheuvel #define PLAT_SQ_SP_IMAGE_RW_MMAP	MAP_REGION2(PLAT_SQ_SP_HEAP_BASE, \
160434454a2SArd Biesheuvel 						    PLAT_SQ_SP_HEAP_BASE, \
161434454a2SArd Biesheuvel 						    (PLAT_SQ_SP_HEAP_SIZE + \
162434454a2SArd Biesheuvel 						     PLAT_SP_IMAGE_STACK_SIZE), \
163434454a2SArd Biesheuvel 						    MT_RW_DATA | MT_SECURE | \
164434454a2SArd Biesheuvel 						    MT_USER, PAGE_SIZE)
165434454a2SArd Biesheuvel 
166434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_BASE		(PLAT_SP_IMAGE_STACK_BASE + \
167434454a2SArd Biesheuvel 					 PLAT_SP_IMAGE_STACK_SIZE)
168434454a2SArd Biesheuvel #define PLAT_SQ_SP_PRIV_SIZE		ULL(0x40000)
169434454a2SArd Biesheuvel 
170434454a2SArd Biesheuvel #define PLAT_SP_PRI			0x20
171434454a2SArd Biesheuvel #define PLAT_PRI_BITS			2
172434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_0		ULL(0)
173434454a2SArd Biesheuvel #define PLAT_SPM_COOKIE_1		ULL(0)
174434454a2SArd Biesheuvel 
175434454a2SArd Biesheuvel /* Total number of memory regions with distinct properties */
176434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_NUM_MEM_REGIONS	6
177434454a2SArd Biesheuvel 
178434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MMAP_REGIONS	30
179434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_MAX_XLAT_TABLES	20
180434454a2SArd Biesheuvel #define PLAT_SP_IMAGE_XLAT_SECTION_NAME	"sp_xlat_table"
1810922e481SMasahisa Kojima #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME	"sp_xlat_table"
182434454a2SArd Biesheuvel 
183434454a2SArd Biesheuvel #define PLAT_SQ_UART1_BASE		PLAT_SQ_BOOT_UART_BASE
184434454a2SArd Biesheuvel #define PLAT_SQ_UART1_SIZE		ULL(0x1000)
185434454a2SArd Biesheuvel #define PLAT_SQ_UART1_MMAP		MAP_REGION_FLAT(PLAT_SQ_UART1_BASE, \
186434454a2SArd Biesheuvel 							PLAT_SQ_UART1_SIZE, \
187434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
188434454a2SArd Biesheuvel 							MT_NS | MT_PRIVILEGED)
189434454a2SArd Biesheuvel 
190434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_BASE		0x50000000
191434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_SIZE		ULL(0x8000000)
192434454a2SArd Biesheuvel #define PLAT_SQ_PERIPH_MMAP		MAP_REGION_FLAT(PLAT_SQ_PERIPH_BASE, \
193434454a2SArd Biesheuvel 							PLAT_SQ_PERIPH_SIZE, \
194434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
195434454a2SArd Biesheuvel 							MT_NS | MT_USER)
196434454a2SArd Biesheuvel 
197434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_BASE		0x08000000
198434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_SIZE		ULL(0x8000000)
199434454a2SArd Biesheuvel #define PLAT_SQ_FLASH_MMAP		MAP_REGION_FLAT(PLAT_SQ_FLASH_BASE, \
200434454a2SArd Biesheuvel 							PLAT_SQ_FLASH_SIZE, \
201434454a2SArd Biesheuvel 							MT_DEVICE | MT_RW | \
202434454a2SArd Biesheuvel 							MT_NS | MT_USER)
203434454a2SArd Biesheuvel 
2041083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */
205