xref: /rk3399_ARM-atf/plat/mediatek/mt8186/include/platform_def.h (revision 2a2b51d8f76e2acdabb431e928beb90e0a30c87c)
127132f13SRex-BC Chen /*
2*2a2b51d8SYidi Lin  * Copyright (c) 2021-2022, ARM Limited and Contributors. All rights reserved.
3*2a2b51d8SYidi Lin  * Copyright (c) 2021-2022, 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)
29*2a2b51d8SYidi Lin #define SSPM_MCDI_SHARE_SRAM    (IO_PHYS + 0x00420000)
30*2a2b51d8SYidi Lin #define SSPM_CFGREG_BASE        (IO_PHYS + 0x00440000)  /* SSPM view: 0x30040000 */
317ac6a76cSjason-ch chen #define SSPM_MBOX_BASE          (IO_PHYS + 0x00480000)
327ac6a76cSjason-ch chen #define PERICFG_AO_BASE         (IO_PHYS + 0x01003000)
337ac6a76cSjason-ch chen #define VPPSYS0_BASE            (IO_PHYS + 0x04000000)
347ac6a76cSjason-ch chen #define VPPSYS1_BASE            (IO_PHYS + 0x04f00000)
357ac6a76cSjason-ch chen #define VDOSYS0_BASE            (IO_PHYS + 0x0C01A000)
367ac6a76cSjason-ch chen #define VDOSYS1_BASE            (IO_PHYS + 0x0C100000)
371da57e54SGarmin.Chang 
38af5a0c40SGuodong Liu /*******************************************************************************
39af5a0c40SGuodong Liu  * GPIO related constants
40af5a0c40SGuodong Liu  ******************************************************************************/
417ac6a76cSjason-ch chen #define TOPCKGEN_BASE		(IO_PHYS + 0x00000000)
427ac6a76cSjason-ch chen #define INFRACFG_AO_BASE	(IO_PHYS + 0x00001000)
43af5a0c40SGuodong Liu #define GPIO_BASE		(IO_PHYS + 0x00005000)
447ac6a76cSjason-ch chen #define SPM_BASE		(IO_PHYS + 0x00006000)
45af5a0c40SGuodong Liu #define IOCFG_LT_BASE		(IO_PHYS + 0x00002000)
46af5a0c40SGuodong Liu #define IOCFG_LM_BASE		(IO_PHYS + 0x00002200)
47af5a0c40SGuodong Liu #define IOCFG_LB_BASE		(IO_PHYS + 0x00002400)
48af5a0c40SGuodong Liu #define IOCFG_BL_BASE		(IO_PHYS + 0x00002600)
49af5a0c40SGuodong Liu #define IOCFG_RB_BASE		(IO_PHYS + 0x00002A00)
50af5a0c40SGuodong Liu #define IOCFG_RT_BASE		(IO_PHYS + 0x00002C00)
517ac6a76cSjason-ch chen #define APMIXEDSYS		(IO_PHYS + 0x0000C000)
52635e6b10Sjason-ch chen #define DVFSRC_BASE		(IO_PHYS + 0x00012000)
537ac6a76cSjason-ch chen #define MMSYS_BASE		(IO_PHYS + 0x04000000)
547ac6a76cSjason-ch chen #define MDPSYS_BASE		(IO_PHYS + 0x0B000000)
5527132f13SRex-BC Chen 
5627132f13SRex-BC Chen /*******************************************************************************
5727132f13SRex-BC Chen  * UART related constants
5827132f13SRex-BC Chen  ******************************************************************************/
5927132f13SRex-BC Chen #define UART0_BASE		(IO_PHYS + 0x01002000)
607ac6a76cSjason-ch chen #define UART1_BASE		(IO_PHYS + 0x01003000)
6127132f13SRex-BC Chen 
627ac6a76cSjason-ch chen #define UART_BAUDRATE		(115200)
6327132f13SRex-BC Chen 
6427132f13SRex-BC Chen /*******************************************************************************
655bc88ec6SJames Lo  * PWRAP related constants
665bc88ec6SJames Lo  ******************************************************************************/
675bc88ec6SJames Lo #define PMIC_WRAP_BASE		(IO_PHYS + 0x0000D000)
685bc88ec6SJames Lo 
695bc88ec6SJames Lo /*******************************************************************************
701b17e34cSPenny Jan  * EMI MPU related constants
711b17e34cSPenny Jan  ******************************************************************************/
721b17e34cSPenny Jan #define EMI_MPU_BASE		(IO_PHYS + 0x0021B000)
731b17e34cSPenny Jan 
741b17e34cSPenny Jan /*******************************************************************************
75206f125cSChristine Zhu  * GIC-600 & interrupt handling related constants
76206f125cSChristine Zhu  ******************************************************************************/
77206f125cSChristine Zhu /* Base MTK_platform compatible GIC memory map */
78206f125cSChristine Zhu #define BASE_GICD_BASE		MT_GIC_BASE
79206f125cSChristine Zhu #define MT_GIC_RDIST_BASE	(MT_GIC_BASE + 0x40000)
80206f125cSChristine Zhu 
81109b91e3SZhengnan Chen #define SYS_CIRQ_BASE		(IO_PHYS + 0x204000)
827ac6a76cSjason-ch chen #define CIRQ_REG_NUM		(11)
837ac6a76cSjason-ch chen #define CIRQ_IRQ_NUM		(326)
847ac6a76cSjason-ch chen #define CIRQ_SPI_START		(64)
857ac6a76cSjason-ch chen #define MD_WDT_IRQ_BIT_ID	(107)
86206f125cSChristine Zhu /*******************************************************************************
8727132f13SRex-BC Chen  * System counter frequency related constants
8827132f13SRex-BC Chen  ******************************************************************************/
897ac6a76cSjason-ch chen #define SYS_COUNTER_FREQ_IN_TICKS	(13000000)
907ac6a76cSjason-ch chen #define SYS_COUNTER_FREQ_IN_MHZ		(13)
9127132f13SRex-BC Chen 
9227132f13SRex-BC Chen /*******************************************************************************
9327132f13SRex-BC Chen  * Platform binary types for linking
9427132f13SRex-BC Chen  ******************************************************************************/
9527132f13SRex-BC Chen #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
9627132f13SRex-BC Chen #define PLATFORM_LINKER_ARCH		aarch64
9727132f13SRex-BC Chen 
9827132f13SRex-BC Chen /*******************************************************************************
9927132f13SRex-BC Chen  * Generic platform constants
10027132f13SRex-BC Chen  ******************************************************************************/
10127132f13SRex-BC Chen #define PLATFORM_STACK_SIZE		0x800
10227132f13SRex-BC Chen 
10327132f13SRex-BC Chen #define FIRMWARE_WELCOME_STR		"Booting Trusted Firmware\n"
10427132f13SRex-BC Chen 
10527132f13SRex-BC Chen #define PLAT_MAX_PWR_LVL		U(3)
10627132f13SRex-BC Chen #define PLAT_MAX_RET_STATE		U(1)
10727132f13SRex-BC Chen #define PLAT_MAX_OFF_STATE		U(9)
10827132f13SRex-BC Chen 
10927132f13SRex-BC Chen #define PLATFORM_SYSTEM_COUNT		U(1)
11027132f13SRex-BC Chen #define PLATFORM_MCUSYS_COUNT		U(1)
11127132f13SRex-BC Chen #define PLATFORM_CLUSTER_COUNT		U(1)
11227132f13SRex-BC Chen #define PLATFORM_CLUSTER0_CORE_COUNT	U(8)
11327132f13SRex-BC Chen #define PLATFORM_CLUSTER1_CORE_COUNT	U(0)
11427132f13SRex-BC Chen 
11527132f13SRex-BC Chen #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER0_CORE_COUNT)
11627132f13SRex-BC Chen #define PLATFORM_MAX_CPUS_PER_CLUSTER	U(8)
11727132f13SRex-BC Chen 
11827132f13SRex-BC Chen #define SOC_CHIP_ID			U(0x8186)
11927132f13SRex-BC Chen 
12027132f13SRex-BC Chen /*******************************************************************************
12127132f13SRex-BC Chen  * Platform memory map related constants
12227132f13SRex-BC Chen  ******************************************************************************/
1237ac6a76cSjason-ch chen #define TZRAM_BASE			(0x54600000)
1247ac6a76cSjason-ch chen #define TZRAM_SIZE			(0x00030000)
12527132f13SRex-BC Chen 
12627132f13SRex-BC Chen /*******************************************************************************
12727132f13SRex-BC Chen  * BL31 specific defines.
12827132f13SRex-BC Chen  ******************************************************************************/
12927132f13SRex-BC Chen /*
13027132f13SRex-BC Chen  * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
13127132f13SRex-BC Chen  * present). BL31_BASE is calculated using the current BL3-1 debug size plus a
13227132f13SRex-BC Chen  * little space for growth.
13327132f13SRex-BC Chen  */
13427132f13SRex-BC Chen #define BL31_BASE			(TZRAM_BASE + 0x1000)
13527132f13SRex-BC Chen #define BL31_LIMIT			(TZRAM_BASE + TZRAM_SIZE)
13627132f13SRex-BC Chen 
13727132f13SRex-BC Chen /*******************************************************************************
13827132f13SRex-BC Chen  * Platform specific page table and MMU setup constants
13927132f13SRex-BC Chen  ******************************************************************************/
14027132f13SRex-BC Chen #define PLAT_PHY_ADDR_SPACE_SIZE	(1ULL << 32)
14127132f13SRex-BC Chen #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ULL << 32)
1427ac6a76cSjason-ch chen #define MAX_XLAT_TABLES			(16)
1437ac6a76cSjason-ch chen #define MAX_MMAP_REGIONS		(16)
14427132f13SRex-BC Chen 
14527132f13SRex-BC Chen /*******************************************************************************
14627132f13SRex-BC Chen  * Declarations and constants to access the mailboxes safely. Each mailbox is
14727132f13SRex-BC Chen  * aligned on the biggest cache line size in the platform. This is known only
14827132f13SRex-BC Chen  * to the platform as it might have a combination of integrated and external
14927132f13SRex-BC Chen  * caches. Such alignment ensures that two maiboxes do not sit on the same cache
15027132f13SRex-BC Chen  * line at any cache level. They could belong to different cpus/clusters &
15127132f13SRex-BC Chen  * get written while being protected by different locks causing corruption of
15227132f13SRex-BC Chen  * a valid mailbox address.
15327132f13SRex-BC Chen  ******************************************************************************/
1547ac6a76cSjason-ch chen #define CACHE_WRITEBACK_SHIFT		(6)
1557ac6a76cSjason-ch chen #define CACHE_WRITEBACK_GRANULE		BIT(CACHE_WRITEBACK_SHIFT)
15627132f13SRex-BC Chen #endif /* PLATFORM_DEF_H */
157