xref: /rk3399_ARM-atf/plat/rockchip/rk3328/include/platform_def.h (revision 713403cb4d36a68afdb37eb87623555bb41ed33c)
10d5ec955Stony.xie /*
2c6ee020eSHeiko Stuebner  * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
30d5ec955Stony.xie  *
4c3e70be1Sdp-arm  * SPDX-License-Identifier: BSD-3-Clause
50d5ec955Stony.xie  */
60d5ec955Stony.xie 
71083b2b3SAntonio Nino Diaz #ifndef PLATFORM_DEF_H
81083b2b3SAntonio Nino Diaz #define PLATFORM_DEF_H
90d5ec955Stony.xie 
100d5ec955Stony.xie #include <arch.h>
1109d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h>
1209d40e0eSAntonio Nino Diaz 
130d5ec955Stony.xie #include <rk3328_def.h>
140d5ec955Stony.xie 
150d5ec955Stony.xie /*******************************************************************************
160d5ec955Stony.xie  * Platform binary types for linking
170d5ec955Stony.xie  ******************************************************************************/
180d5ec955Stony.xie #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
190d5ec955Stony.xie #define PLATFORM_LINKER_ARCH		aarch64
200d5ec955Stony.xie 
210d5ec955Stony.xie /*******************************************************************************
220d5ec955Stony.xie  * Generic platform constants
230d5ec955Stony.xie  ******************************************************************************/
240d5ec955Stony.xie 
250d5ec955Stony.xie /* Size of cacheable stacks */
262d6f1f01SAntonio Nino Diaz #if defined(IMAGE_BL1)
270d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x440
28e8a87acdSRoberto Vargas #elif defined(IMAGE_BL2)
290d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x400
30e8a87acdSRoberto Vargas #elif defined(IMAGE_BL31)
310d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x800
32e8a87acdSRoberto Vargas #elif defined(IMAGE_BL32)
330d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x440
340d5ec955Stony.xie #endif
350d5ec955Stony.xie 
360d5ec955Stony.xie #define FIRMWARE_WELCOME_STR		"Booting Trusted Firmware\n"
370d5ec955Stony.xie 
380d5ec955Stony.xie #define PLATFORM_MAX_AFFLVL		MPIDR_AFFLVL2
390d5ec955Stony.xie #define PLATFORM_SYSTEM_COUNT		1
40*ed7a5636SDeepika Bhavnani #define PLATFORM_CLUSTER_COUNT		U(1)
41*ed7a5636SDeepika Bhavnani #define PLATFORM_CLUSTER0_CORE_COUNT	U(4)
42*ed7a5636SDeepika Bhavnani #define PLATFORM_CLUSTER1_CORE_COUNT	U(0)
430d5ec955Stony.xie #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER1_CORE_COUNT +	\
440d5ec955Stony.xie 					 PLATFORM_CLUSTER0_CORE_COUNT)
450d5ec955Stony.xie 
460d5ec955Stony.xie #define PLATFORM_NUM_AFFS		(PLATFORM_SYSTEM_COUNT +	\
470d5ec955Stony.xie 					 PLATFORM_CLUSTER_COUNT +	\
480d5ec955Stony.xie 					 PLATFORM_CORE_COUNT)
490d5ec955Stony.xie 
500d5ec955Stony.xie #define PLAT_MAX_PWR_LVL		MPIDR_AFFLVL2
510d5ec955Stony.xie 
520d5ec955Stony.xie #define PLAT_RK_CLST_TO_CPUID_SHIFT	6
530d5ec955Stony.xie 
540d5ec955Stony.xie /*
550d5ec955Stony.xie  * This macro defines the deepest retention state possible. A higher state
560d5ec955Stony.xie  * id will represent an invalid or a power down state.
570d5ec955Stony.xie  */
581083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE		U(1)
590d5ec955Stony.xie 
600d5ec955Stony.xie /*
610d5ec955Stony.xie  * This macro defines the deepest power down states possible. Any state ID
620d5ec955Stony.xie  * higher than this is invalid.
630d5ec955Stony.xie  */
641083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE		U(2)
650d5ec955Stony.xie 
660d5ec955Stony.xie /*******************************************************************************
670d5ec955Stony.xie  * Platform memory map related constants
680d5ec955Stony.xie  ******************************************************************************/
69c6ee020eSHeiko Stuebner /* TF text, ro, rw, Size: 1MB */
700d5ec955Stony.xie #define TZRAM_BASE		(0x0)
71c6ee020eSHeiko Stuebner #define TZRAM_SIZE		(0x100000)
720d5ec955Stony.xie 
730d5ec955Stony.xie /*******************************************************************************
740d5ec955Stony.xie  * BL31 specific defines.
750d5ec955Stony.xie  ******************************************************************************/
760d5ec955Stony.xie /*
770d5ec955Stony.xie  * Put BL3-1 at the top of the Trusted RAM
780d5ec955Stony.xie  */
790aad563cSKever Yang #define BL31_BASE		(TZRAM_BASE + 0x40000)
800d5ec955Stony.xie #define BL31_LIMIT		(TZRAM_BASE + TZRAM_SIZE)
810d5ec955Stony.xie 
820d5ec955Stony.xie /*******************************************************************************
830d5ec955Stony.xie  * Platform specific page table and MMU setup constants
840d5ec955Stony.xie  ******************************************************************************/
852d6f1f01SAntonio Nino Diaz #define PLAT_VIRT_ADDR_SPACE_SIZE   (1ULL << 32)
862d6f1f01SAntonio Nino Diaz #define PLAT_PHY_ADDR_SPACE_SIZE    (1ULL << 32)
870d5ec955Stony.xie #define MAX_XLAT_TABLES		9
880d5ec955Stony.xie #define MAX_MMAP_REGIONS	33
890d5ec955Stony.xie 
900d5ec955Stony.xie /*******************************************************************************
910d5ec955Stony.xie  * Declarations and constants to access the mailboxes safely. Each mailbox is
920d5ec955Stony.xie  * aligned on the biggest cache line size in the platform. This is known only
930d5ec955Stony.xie  * to the platform as it might have a combination of integrated and external
940d5ec955Stony.xie  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
950d5ec955Stony.xie  * line at any cache level. They could belong to different cpus/clusters &
960d5ec955Stony.xie  * get written while being protected by different locks causing corruption of
970d5ec955Stony.xie  * a valid mailbox address.
980d5ec955Stony.xie  ******************************************************************************/
990d5ec955Stony.xie #define CACHE_WRITEBACK_SHIFT	6
1000d5ec955Stony.xie #define CACHE_WRITEBACK_GRANULE	(1 << CACHE_WRITEBACK_SHIFT)
1010d5ec955Stony.xie 
1020d5ec955Stony.xie /*
1030d5ec955Stony.xie  * Define GICD and GICC and GICR base
1040d5ec955Stony.xie  */
1050d5ec955Stony.xie #define PLAT_RK_GICD_BASE	RK3328_GICD_BASE
1060d5ec955Stony.xie #define PLAT_RK_GICC_BASE	RK3328_GICC_BASE
1070d5ec955Stony.xie 
1080957b9b2SChristoph Müllner #define PLAT_RK_UART_BASE	UART2_BASE
1090d5ec955Stony.xie #define PLAT_RK_UART_CLOCK	RK3328_UART_CLOCK
1100d5ec955Stony.xie #define PLAT_RK_UART_BAUDRATE	RK3328_BAUDRATE
1110d5ec955Stony.xie 
1120d5ec955Stony.xie #define PLAT_RK_PRIMARY_CPU	0x0
1130d5ec955Stony.xie 
114bc5c3007SLin Huang #define PSRAM_DO_DDR_RESUME	0
11584597b57SLin Huang #define PSRAM_CHECK_WAKEUP_CPU	0
116bc5c3007SLin Huang 
1171083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */
118