xref: /rk3399_ARM-atf/plat/rockchip/rk3328/include/platform_def.h (revision 2d6f1f01b141775a192e36d120073f67b7b378c2)
10d5ec955Stony.xie /*
21083b2b3SAntonio Nino Diaz  * Copyright (c) 2017-2018, 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>
110d5ec955Stony.xie #include <common_def.h>
120d5ec955Stony.xie #include <rk3328_def.h>
130d5ec955Stony.xie 
140d5ec955Stony.xie /*******************************************************************************
150d5ec955Stony.xie  * Platform binary types for linking
160d5ec955Stony.xie  ******************************************************************************/
170d5ec955Stony.xie #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
180d5ec955Stony.xie #define PLATFORM_LINKER_ARCH		aarch64
190d5ec955Stony.xie 
200d5ec955Stony.xie /*******************************************************************************
210d5ec955Stony.xie  * Generic platform constants
220d5ec955Stony.xie  ******************************************************************************/
230d5ec955Stony.xie 
240d5ec955Stony.xie /* Size of cacheable stacks */
25*2d6f1f01SAntonio Nino Diaz #if defined(IMAGE_BL1)
260d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x440
27e8a87acdSRoberto Vargas #elif defined(IMAGE_BL2)
280d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x400
29e8a87acdSRoberto Vargas #elif defined(IMAGE_BL31)
300d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x800
31e8a87acdSRoberto Vargas #elif defined(IMAGE_BL32)
320d5ec955Stony.xie #define PLATFORM_STACK_SIZE 0x440
330d5ec955Stony.xie #endif
340d5ec955Stony.xie 
350d5ec955Stony.xie #define FIRMWARE_WELCOME_STR		"Booting Trusted Firmware\n"
360d5ec955Stony.xie 
370d5ec955Stony.xie #define PLATFORM_MAX_AFFLVL		MPIDR_AFFLVL2
380d5ec955Stony.xie #define PLATFORM_SYSTEM_COUNT		1
390d5ec955Stony.xie #define PLATFORM_CLUSTER_COUNT		1
400d5ec955Stony.xie #define PLATFORM_CLUSTER0_CORE_COUNT	4
410d5ec955Stony.xie #define PLATFORM_CLUSTER1_CORE_COUNT	0
420d5ec955Stony.xie #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER1_CORE_COUNT +	\
430d5ec955Stony.xie 					 PLATFORM_CLUSTER0_CORE_COUNT)
440d5ec955Stony.xie 
450d5ec955Stony.xie #define PLATFORM_NUM_AFFS		(PLATFORM_SYSTEM_COUNT +	\
460d5ec955Stony.xie 					 PLATFORM_CLUSTER_COUNT +	\
470d5ec955Stony.xie 					 PLATFORM_CORE_COUNT)
480d5ec955Stony.xie 
490d5ec955Stony.xie #define PLAT_MAX_PWR_LVL		MPIDR_AFFLVL2
500d5ec955Stony.xie 
510d5ec955Stony.xie #define PLAT_RK_CLST_TO_CPUID_SHIFT	6
520d5ec955Stony.xie 
530d5ec955Stony.xie /*
540d5ec955Stony.xie  * This macro defines the deepest retention state possible. A higher state
550d5ec955Stony.xie  * id will represent an invalid or a power down state.
560d5ec955Stony.xie  */
571083b2b3SAntonio Nino Diaz #define PLAT_MAX_RET_STATE		U(1)
580d5ec955Stony.xie 
590d5ec955Stony.xie /*
600d5ec955Stony.xie  * This macro defines the deepest power down states possible. Any state ID
610d5ec955Stony.xie  * higher than this is invalid.
620d5ec955Stony.xie  */
631083b2b3SAntonio Nino Diaz #define PLAT_MAX_OFF_STATE		U(2)
640d5ec955Stony.xie 
650d5ec955Stony.xie /*******************************************************************************
660d5ec955Stony.xie  * Platform memory map related constants
670d5ec955Stony.xie  ******************************************************************************/
680d5ec955Stony.xie /* TF txet, ro, rw, Size: 512KB */
690d5ec955Stony.xie #define TZRAM_BASE		(0x0)
700d5ec955Stony.xie #define TZRAM_SIZE		(0x80000)
710d5ec955Stony.xie 
720d5ec955Stony.xie /*******************************************************************************
730d5ec955Stony.xie  * BL31 specific defines.
740d5ec955Stony.xie  ******************************************************************************/
750d5ec955Stony.xie /*
760d5ec955Stony.xie  * Put BL3-1 at the top of the Trusted RAM
770d5ec955Stony.xie  */
780d5ec955Stony.xie #define BL31_BASE		(TZRAM_BASE + 0x10000)
790d5ec955Stony.xie #define BL31_LIMIT		(TZRAM_BASE + TZRAM_SIZE)
800d5ec955Stony.xie 
810d5ec955Stony.xie /*******************************************************************************
820d5ec955Stony.xie  * Platform specific page table and MMU setup constants
830d5ec955Stony.xie  ******************************************************************************/
84*2d6f1f01SAntonio Nino Diaz #define PLAT_VIRT_ADDR_SPACE_SIZE   (1ULL << 32)
85*2d6f1f01SAntonio Nino Diaz #define PLAT_PHY_ADDR_SPACE_SIZE    (1ULL << 32)
860d5ec955Stony.xie #define MAX_XLAT_TABLES		9
870d5ec955Stony.xie #define MAX_MMAP_REGIONS	33
880d5ec955Stony.xie 
890d5ec955Stony.xie /*******************************************************************************
900d5ec955Stony.xie  * Declarations and constants to access the mailboxes safely. Each mailbox is
910d5ec955Stony.xie  * aligned on the biggest cache line size in the platform. This is known only
920d5ec955Stony.xie  * to the platform as it might have a combination of integrated and external
930d5ec955Stony.xie  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
940d5ec955Stony.xie  * line at any cache level. They could belong to different cpus/clusters &
950d5ec955Stony.xie  * get written while being protected by different locks causing corruption of
960d5ec955Stony.xie  * a valid mailbox address.
970d5ec955Stony.xie  ******************************************************************************/
980d5ec955Stony.xie #define CACHE_WRITEBACK_SHIFT	6
990d5ec955Stony.xie #define CACHE_WRITEBACK_GRANULE	(1 << CACHE_WRITEBACK_SHIFT)
1000d5ec955Stony.xie 
1010d5ec955Stony.xie /*
1020d5ec955Stony.xie  * Define GICD and GICC and GICR base
1030d5ec955Stony.xie  */
1040d5ec955Stony.xie #define PLAT_RK_GICD_BASE	RK3328_GICD_BASE
1050d5ec955Stony.xie #define PLAT_RK_GICC_BASE	RK3328_GICC_BASE
1060d5ec955Stony.xie 
1070d5ec955Stony.xie #define PLAT_RK_UART_BASE	RK3328_UART2_BASE
1080d5ec955Stony.xie #define PLAT_RK_UART_CLOCK	RK3328_UART_CLOCK
1090d5ec955Stony.xie #define PLAT_RK_UART_BAUDRATE	RK3328_BAUDRATE
1100d5ec955Stony.xie 
1110d5ec955Stony.xie #define PLAT_RK_PRIMARY_CPU	0x0
1120d5ec955Stony.xie 
113bc5c3007SLin Huang #define PSRAM_DO_DDR_RESUME	0
11484597b57SLin Huang #define PSRAM_CHECK_WAKEUP_CPU	0
115bc5c3007SLin Huang 
1161083b2b3SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */
117