xref: /rk3399_ARM-atf/plat/mediatek/mt8186/include/platform_def.h (revision 635e6b108e773daf37c00f46e6fbb1cae4e78f96)
127132f13SRex-BC Chen /*
227132f13SRex-BC Chen  * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
37ac6a76cSjason-ch chen  * Copyright (c) 2021, MediaTek Inc. All rights reserved.
427132f13SRex-BC Chen  *
527132f13SRex-BC Chen  * SPDX-License-Identifier: BSD-3-Clause
627132f13SRex-BC Chen  */
727132f13SRex-BC Chen 
827132f13SRex-BC Chen #ifndef PLATFORM_DEF_H
927132f13SRex-BC Chen #define PLATFORM_DEF_H
1027132f13SRex-BC Chen 
117ac6a76cSjason-ch chen #define PLAT_PRIMARY_CPU	(0x0)
1227132f13SRex-BC Chen 
1327132f13SRex-BC Chen #define MT_GIC_BASE		(0x0C000000)
1427132f13SRex-BC Chen #define MCUCFG_BASE		(0x0C530000)
1527132f13SRex-BC Chen #define IO_PHYS			(0x10000000)
1627132f13SRex-BC Chen 
1727132f13SRex-BC Chen /* Aggregate of all devices for MMU mapping */
1827132f13SRex-BC Chen #define MTK_DEV_RNG0_BASE	IO_PHYS
197ac6a76cSjason-ch chen #define MTK_DEV_RNG0_SIZE	(0x10000000)
2027132f13SRex-BC Chen #define MTK_DEV_RNG2_BASE	MT_GIC_BASE
217ac6a76cSjason-ch chen #define MTK_DEV_RNG2_SIZE	(0x600000)
227ac6a76cSjason-ch chen #define MTK_MCDI_SRAM_BASE	(0x11B000)
237ac6a76cSjason-ch chen #define MTK_MCDI_SRAM_MAP_SIZE  (0x1000)
2427132f13SRex-BC Chen 
257ac6a76cSjason-ch chen #define TOPCKGEN_BASE           (IO_PHYS + 0x00000000)
267ac6a76cSjason-ch chen #define INFRACFG_AO_BASE        (IO_PHYS + 0x00001000)
271da57e54SGarmin.Chang #define SPM_BASE		(IO_PHYS + 0x00006000)
287ac6a76cSjason-ch chen #define APMIXEDSYS              (IO_PHYS + 0x0000C000)
297ac6a76cSjason-ch chen #define SSPM_MBOX_BASE          (IO_PHYS + 0x00480000)
307ac6a76cSjason-ch chen #define PERICFG_AO_BASE         (IO_PHYS + 0x01003000)
317ac6a76cSjason-ch chen #define VPPSYS0_BASE            (IO_PHYS + 0x04000000)
327ac6a76cSjason-ch chen #define VPPSYS1_BASE            (IO_PHYS + 0x04f00000)
337ac6a76cSjason-ch chen #define VDOSYS0_BASE            (IO_PHYS + 0x0C01A000)
347ac6a76cSjason-ch chen #define VDOSYS1_BASE            (IO_PHYS + 0x0C100000)
351da57e54SGarmin.Chang 
36af5a0c40SGuodong Liu /*******************************************************************************
37af5a0c40SGuodong Liu  * GPIO related constants
38af5a0c40SGuodong Liu  ******************************************************************************/
397ac6a76cSjason-ch chen #define TOPCKGEN_BASE		(IO_PHYS + 0x00000000)
407ac6a76cSjason-ch chen #define INFRACFG_AO_BASE	(IO_PHYS + 0x00001000)
41af5a0c40SGuodong Liu #define GPIO_BASE		(IO_PHYS + 0x00005000)
427ac6a76cSjason-ch chen #define SPM_BASE		(IO_PHYS + 0x00006000)
43af5a0c40SGuodong Liu #define IOCFG_LT_BASE		(IO_PHYS + 0x00002000)
44af5a0c40SGuodong Liu #define IOCFG_LM_BASE		(IO_PHYS + 0x00002200)
45af5a0c40SGuodong Liu #define IOCFG_LB_BASE		(IO_PHYS + 0x00002400)
46af5a0c40SGuodong Liu #define IOCFG_BL_BASE		(IO_PHYS + 0x00002600)
47af5a0c40SGuodong Liu #define IOCFG_RB_BASE		(IO_PHYS + 0x00002A00)
48af5a0c40SGuodong Liu #define IOCFG_RT_BASE		(IO_PHYS + 0x00002C00)
497ac6a76cSjason-ch chen #define APMIXEDSYS		(IO_PHYS + 0x0000C000)
50*635e6b10Sjason-ch chen #define DVFSRC_BASE		(IO_PHYS + 0x00012000)
517ac6a76cSjason-ch chen #define MMSYS_BASE		(IO_PHYS + 0x04000000)
527ac6a76cSjason-ch chen #define MDPSYS_BASE		(IO_PHYS + 0x0B000000)
5327132f13SRex-BC Chen 
5427132f13SRex-BC Chen /*******************************************************************************
5527132f13SRex-BC Chen  * UART related constants
5627132f13SRex-BC Chen  ******************************************************************************/
5727132f13SRex-BC Chen #define UART0_BASE		(IO_PHYS + 0x01002000)
587ac6a76cSjason-ch chen #define UART1_BASE		(IO_PHYS + 0x01003000)
5927132f13SRex-BC Chen 
607ac6a76cSjason-ch chen #define UART_BAUDRATE		(115200)
6127132f13SRex-BC Chen 
6227132f13SRex-BC Chen /*******************************************************************************
635bc88ec6SJames Lo  * PWRAP related constants
645bc88ec6SJames Lo  ******************************************************************************/
655bc88ec6SJames Lo #define PMIC_WRAP_BASE		(IO_PHYS + 0x0000D000)
665bc88ec6SJames Lo 
675bc88ec6SJames Lo /*******************************************************************************
681b17e34cSPenny Jan  * EMI MPU related constants
691b17e34cSPenny Jan  ******************************************************************************/
701b17e34cSPenny Jan #define EMI_MPU_BASE		(IO_PHYS + 0x0021B000)
711b17e34cSPenny Jan 
721b17e34cSPenny Jan /*******************************************************************************
73206f125cSChristine Zhu  * GIC-600 & interrupt handling related constants
74206f125cSChristine Zhu  ******************************************************************************/
75206f125cSChristine Zhu /* Base MTK_platform compatible GIC memory map */
76206f125cSChristine Zhu #define BASE_GICD_BASE		MT_GIC_BASE
77206f125cSChristine Zhu #define MT_GIC_RDIST_BASE	(MT_GIC_BASE + 0x40000)
78206f125cSChristine Zhu 
79109b91e3SZhengnan Chen #define SYS_CIRQ_BASE		(IO_PHYS + 0x204000)
807ac6a76cSjason-ch chen #define CIRQ_REG_NUM		(11)
817ac6a76cSjason-ch chen #define CIRQ_IRQ_NUM		(326)
827ac6a76cSjason-ch chen #define CIRQ_SPI_START		(64)
837ac6a76cSjason-ch chen #define MD_WDT_IRQ_BIT_ID	(107)
84206f125cSChristine Zhu /*******************************************************************************
8527132f13SRex-BC Chen  * System counter frequency related constants
8627132f13SRex-BC Chen  ******************************************************************************/
877ac6a76cSjason-ch chen #define SYS_COUNTER_FREQ_IN_TICKS	(13000000)
887ac6a76cSjason-ch chen #define SYS_COUNTER_FREQ_IN_MHZ		(13)
8927132f13SRex-BC Chen 
9027132f13SRex-BC Chen /*******************************************************************************
9127132f13SRex-BC Chen  * Platform binary types for linking
9227132f13SRex-BC Chen  ******************************************************************************/
9327132f13SRex-BC Chen #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
9427132f13SRex-BC Chen #define PLATFORM_LINKER_ARCH		aarch64
9527132f13SRex-BC Chen 
9627132f13SRex-BC Chen /*******************************************************************************
9727132f13SRex-BC Chen  * Generic platform constants
9827132f13SRex-BC Chen  ******************************************************************************/
9927132f13SRex-BC Chen #define PLATFORM_STACK_SIZE		0x800
10027132f13SRex-BC Chen 
10127132f13SRex-BC Chen #define FIRMWARE_WELCOME_STR		"Booting Trusted Firmware\n"
10227132f13SRex-BC Chen 
10327132f13SRex-BC Chen #define PLAT_MAX_PWR_LVL		U(3)
10427132f13SRex-BC Chen #define PLAT_MAX_RET_STATE		U(1)
10527132f13SRex-BC Chen #define PLAT_MAX_OFF_STATE		U(9)
10627132f13SRex-BC Chen 
10727132f13SRex-BC Chen #define PLATFORM_SYSTEM_COUNT		U(1)
10827132f13SRex-BC Chen #define PLATFORM_MCUSYS_COUNT		U(1)
10927132f13SRex-BC Chen #define PLATFORM_CLUSTER_COUNT		U(1)
11027132f13SRex-BC Chen #define PLATFORM_CLUSTER0_CORE_COUNT	U(8)
11127132f13SRex-BC Chen #define PLATFORM_CLUSTER1_CORE_COUNT	U(0)
11227132f13SRex-BC Chen 
11327132f13SRex-BC Chen #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER0_CORE_COUNT)
11427132f13SRex-BC Chen #define PLATFORM_MAX_CPUS_PER_CLUSTER	U(8)
11527132f13SRex-BC Chen 
11627132f13SRex-BC Chen #define SOC_CHIP_ID			U(0x8186)
11727132f13SRex-BC Chen 
11827132f13SRex-BC Chen /*******************************************************************************
11927132f13SRex-BC Chen  * Platform memory map related constants
12027132f13SRex-BC Chen  ******************************************************************************/
1217ac6a76cSjason-ch chen #define TZRAM_BASE			(0x54600000)
1227ac6a76cSjason-ch chen #define TZRAM_SIZE			(0x00030000)
12327132f13SRex-BC Chen 
12427132f13SRex-BC Chen /*******************************************************************************
12527132f13SRex-BC Chen  * BL31 specific defines.
12627132f13SRex-BC Chen  ******************************************************************************/
12727132f13SRex-BC Chen /*
12827132f13SRex-BC Chen  * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
12927132f13SRex-BC Chen  * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
13027132f13SRex-BC Chen  * little space for growth.
13127132f13SRex-BC Chen  */
13227132f13SRex-BC Chen #define BL31_BASE			(TZRAM_BASE + 0x1000)
13327132f13SRex-BC Chen #define BL31_LIMIT			(TZRAM_BASE + TZRAM_SIZE)
13427132f13SRex-BC Chen 
13527132f13SRex-BC Chen /*******************************************************************************
13627132f13SRex-BC Chen  * Platform specific page table and MMU setup constants
13727132f13SRex-BC Chen  ******************************************************************************/
13827132f13SRex-BC Chen #define PLAT_PHY_ADDR_SPACE_SIZE	(1ULL << 32)
13927132f13SRex-BC Chen #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ULL << 32)
1407ac6a76cSjason-ch chen #define MAX_XLAT_TABLES			(16)
1417ac6a76cSjason-ch chen #define MAX_MMAP_REGIONS		(16)
14227132f13SRex-BC Chen 
14327132f13SRex-BC Chen /*******************************************************************************
14427132f13SRex-BC Chen  * Declarations and constants to access the mailboxes safely. Each mailbox is
14527132f13SRex-BC Chen  * aligned on the biggest cache line size in the platform. This is known only
14627132f13SRex-BC Chen  * to the platform as it might have a combination of integrated and external
14727132f13SRex-BC Chen  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
14827132f13SRex-BC Chen  * line at any cache level. They could belong to different cpus/clusters &
14927132f13SRex-BC Chen  * get written while being protected by different locks causing corruption of
15027132f13SRex-BC Chen  * a valid mailbox address.
15127132f13SRex-BC Chen  ******************************************************************************/
1527ac6a76cSjason-ch chen #define CACHE_WRITEBACK_SHIFT		(6)
1537ac6a76cSjason-ch chen #define CACHE_WRITEBACK_GRANULE		BIT(CACHE_WRITEBACK_SHIFT)
15427132f13SRex-BC Chen #endif /* PLATFORM_DEF_H */
155