1a65fadfbSGavin Liu /* 2a65fadfbSGavin Liu * Copyright (c) 2024, Mediatek Inc. All rights reserved. 3a65fadfbSGavin Liu * 4a65fadfbSGavin Liu * SPDX-License-Identifier: BSD-3-Clause 5a65fadfbSGavin Liu */ 6a65fadfbSGavin Liu 7a65fadfbSGavin Liu #ifndef PLATFORM_DEF_H 8a65fadfbSGavin Liu #define PLATFORM_DEF_H 9a65fadfbSGavin Liu 10a65fadfbSGavin Liu #include <arch.h> 11a65fadfbSGavin Liu #include <plat/common/common_def.h> 12a65fadfbSGavin Liu 13a65fadfbSGavin Liu #include <arch_def.h> 14a65fadfbSGavin Liu 15a65fadfbSGavin Liu #define PLAT_PRIMARY_CPU (0x0) 16a65fadfbSGavin Liu 17a65fadfbSGavin Liu #define MT_GIC_BASE (0x0C400000) 18a65fadfbSGavin Liu #define MCUCFG_BASE (0x0C000000) 19a65fadfbSGavin Liu #define MCUCFG_REG_SIZE (0x50000) 20a65fadfbSGavin Liu #define IO_PHYS (0x10000000) 21a65fadfbSGavin Liu 22a65fadfbSGavin Liu /* Aggregate of all devices for MMU mapping */ 23a65fadfbSGavin Liu #define MTK_DEV_RNG1_BASE (IO_PHYS) 24a65fadfbSGavin Liu #define MTK_DEV_RNG1_SIZE (0x10000000) 25a65fadfbSGavin Liu 26a65fadfbSGavin Liu #define TOPCKGEN_BASE (IO_PHYS) 27a65fadfbSGavin Liu 28a65fadfbSGavin Liu /******************************************************************************* 29a65fadfbSGavin Liu * AUDIO related constants 30a65fadfbSGavin Liu ******************************************************************************/ 31a65fadfbSGavin Liu #define AUDIO_BASE (IO_PHYS + 0x0a110000) 32a65fadfbSGavin Liu 33a65fadfbSGavin Liu /******************************************************************************* 340781f780SKarl Li * APUSYS related constants 350781f780SKarl Li ******************************************************************************/ 360781f780SKarl Li #define APUSYS_BASE (IO_PHYS + 0x09000000) 375e5c57d5SKarl Li #define APU_MD32_SYSCTRL (IO_PHYS + 0x09001000) 385e5c57d5SKarl Li #define APU_MD32_WDT (IO_PHYS + 0x09002000) 395e5c57d5SKarl Li #define APU_LOGTOP (IO_PHYS + 0x09024000) 40*f31932b4SKarl Li #define APUSYS_CTRL_DAPC_RCX_BASE (IO_PHYS + 0x09030000) 415e5c57d5SKarl Li #define APU_REVISER (IO_PHYS + 0x0903C000) 42e534d4f6SKarl Li #define APU_RCX_UPRV_TCU (IO_PHYS + 0x09060000) 43e534d4f6SKarl Li #define APU_RCX_EXTM_TCU (IO_PHYS + 0x09061000) 44e534d4f6SKarl Li #define APU_CMU_TOP (IO_PHYS + 0x09067000) 450781f780SKarl Li #define APUSYS_CE_BASE (IO_PHYS + 0x090B0000) 465e5c57d5SKarl Li #define APU_ARE_REG_BASE (IO_PHYS + 0x090B0000) 47e534d4f6SKarl Li #define APU_RCX_VCORE_CONFIG (IO_PHYS + 0x090E0000) 4883f836c9SKarl Li #define APU_AO_CTRL (IO_PHYS + 0x090F2000) 499059a375SKarl Li #define APU_SEC_CON (IO_PHYS + 0x090F5000) 5031a0b877SKarl Li #define APUSYS_CTRL_DAPC_AO_BASE (IO_PHYS + 0x090FC000) 510781f780SKarl Li 520781f780SKarl Li #define APU_MBOX0 (0x4C200000) 535e5c57d5SKarl Li #define APU_MD32_TCM (0x4D000000) 540781f780SKarl Li 555e5c57d5SKarl Li #define APU_MD32_TCM_SZ (0x50000) 5683f836c9SKarl Li #define APU_MBOX0_SZ (0x100000) 5783f836c9SKarl Li #define APU_INFRA_BASE (0x1002C000) 5883f836c9SKarl Li #define APU_INFRA_SZ (0x1000) 5983f836c9SKarl Li 605e5c57d5SKarl Li #define APU_RESERVE_MEMORY (0x95000000) 615e5c57d5SKarl Li #define APU_SEC_INFO_OFFSET (0x100000) 625e5c57d5SKarl Li #define APU_RESERVE_SIZE (0x1400000) 635e5c57d5SKarl Li 640781f780SKarl Li /******************************************************************************* 65a65fadfbSGavin Liu * SPM related constants 66a65fadfbSGavin Liu ******************************************************************************/ 67a65fadfbSGavin Liu #define SPM_BASE (IO_PHYS + 0x0C004000) 68a65fadfbSGavin Liu 69a65fadfbSGavin Liu /******************************************************************************* 704cb9f2a5SCathy Xu * GPIO related constants 714cb9f2a5SCathy Xu ******************************************************************************/ 724cb9f2a5SCathy Xu #define GPIO_BASE (IO_PHYS + 0x0002D000) 734cb9f2a5SCathy Xu #define RGU_BASE (IO_PHYS + 0x0C00B000) 744cb9f2a5SCathy Xu #define DRM_BASE (IO_PHYS + 0x0000D000) 754cb9f2a5SCathy Xu #define IOCFG_RT_BASE (IO_PHYS + 0x02000000) 764cb9f2a5SCathy Xu #define IOCFG_RM1_BASE (IO_PHYS + 0x02020000) 774cb9f2a5SCathy Xu #define IOCFG_RM2_BASE (IO_PHYS + 0x02040000) 784cb9f2a5SCathy Xu #define IOCFG_RB_BASE (IO_PHYS + 0x02060000) 794cb9f2a5SCathy Xu #define IOCFG_BM1_BASE (IO_PHYS + 0x02820000) 804cb9f2a5SCathy Xu #define IOCFG_BM2_BASE (IO_PHYS + 0x02840000) 814cb9f2a5SCathy Xu #define IOCFG_BM3_BASE (IO_PHYS + 0x02860000) 824cb9f2a5SCathy Xu #define IOCFG_LT_BASE (IO_PHYS + 0x03000000) 834cb9f2a5SCathy Xu #define IOCFG_LM1_BASE (IO_PHYS + 0x03020000) 844cb9f2a5SCathy Xu #define IOCFG_LM2_BASE (IO_PHYS + 0x03040000) 854cb9f2a5SCathy Xu #define IOCFG_LB1_BASE (IO_PHYS + 0x030f0000) 864cb9f2a5SCathy Xu #define IOCFG_LB2_BASE (IO_PHYS + 0x03110000) 874cb9f2a5SCathy Xu #define IOCFG_TM1_BASE (IO_PHYS + 0x03800000) 884cb9f2a5SCathy Xu #define IOCFG_TM2_BASE (IO_PHYS + 0x03820000) 894cb9f2a5SCathy Xu #define IOCFG_TM3_BASE (IO_PHYS + 0x03860000) 904cb9f2a5SCathy Xu 914cb9f2a5SCathy Xu /******************************************************************************* 92a65fadfbSGavin Liu * UART related constants 93a65fadfbSGavin Liu ******************************************************************************/ 94a65fadfbSGavin Liu #define UART0_BASE (IO_PHYS + 0x06000000) 95a65fadfbSGavin Liu #define UART_BAUDRATE (115200) 96a65fadfbSGavin Liu 97a65fadfbSGavin Liu /******************************************************************************* 98a65fadfbSGavin Liu * Infra IOMMU related constants 99a65fadfbSGavin Liu ******************************************************************************/ 100a65fadfbSGavin Liu #define INFRACFG_AO_BASE (IO_PHYS + 0x00001000) 101a65fadfbSGavin Liu #define INFRACFG_AO_MEM_BASE (IO_PHYS + 0x00404000) 102a65fadfbSGavin Liu #define PERICFG_AO_BASE (IO_PHYS + 0x06630000) 103a65fadfbSGavin Liu #define PERICFG_AO_REG_SIZE (0x1000) 104a65fadfbSGavin Liu 105a65fadfbSGavin Liu /******************************************************************************* 106a65fadfbSGavin Liu * GIC-600 & interrupt handling related constants 107a65fadfbSGavin Liu ******************************************************************************/ 108a65fadfbSGavin Liu /* Base MTK_platform compatible GIC memory map */ 109a65fadfbSGavin Liu #define BASE_GICD_BASE (MT_GIC_BASE) 110a65fadfbSGavin Liu #define MT_GIC_RDIST_BASE (MT_GIC_BASE + 0x40000) 111a65fadfbSGavin Liu #define MTK_GIC_REG_SIZE 0x400000 112a65fadfbSGavin Liu 113a65fadfbSGavin Liu /******************************************************************************* 114a65fadfbSGavin Liu * MM IOMMU & SMI related constants 115a65fadfbSGavin Liu ******************************************************************************/ 116a65fadfbSGavin Liu #define SMI_LARB_0_BASE (IO_PHYS + 0x0c022000) 117a65fadfbSGavin Liu #define SMI_LARB_1_BASE (IO_PHYS + 0x0c023000) 118a65fadfbSGavin Liu #define SMI_LARB_2_BASE (IO_PHYS + 0x0c102000) 119a65fadfbSGavin Liu #define SMI_LARB_3_BASE (IO_PHYS + 0x0c103000) 120a65fadfbSGavin Liu #define SMI_LARB_4_BASE (IO_PHYS + 0x04013000) 121a65fadfbSGavin Liu #define SMI_LARB_5_BASE (IO_PHYS + 0x04f02000) 122a65fadfbSGavin Liu #define SMI_LARB_6_BASE (IO_PHYS + 0x04f03000) 123a65fadfbSGavin Liu #define SMI_LARB_7_BASE (IO_PHYS + 0x04e04000) 124a65fadfbSGavin Liu #define SMI_LARB_9_BASE (IO_PHYS + 0x05001000) 125a65fadfbSGavin Liu #define SMI_LARB_10_BASE (IO_PHYS + 0x05120000) 126a65fadfbSGavin Liu #define SMI_LARB_11A_BASE (IO_PHYS + 0x05230000) 127a65fadfbSGavin Liu #define SMI_LARB_11B_BASE (IO_PHYS + 0x05530000) 128a65fadfbSGavin Liu #define SMI_LARB_11C_BASE (IO_PHYS + 0x05630000) 129a65fadfbSGavin Liu #define SMI_LARB_12_BASE (IO_PHYS + 0x05340000) 130a65fadfbSGavin Liu #define SMI_LARB_13_BASE (IO_PHYS + 0x06001000) 131a65fadfbSGavin Liu #define SMI_LARB_14_BASE (IO_PHYS + 0x06002000) 132a65fadfbSGavin Liu #define SMI_LARB_15_BASE (IO_PHYS + 0x05140000) 133a65fadfbSGavin Liu #define SMI_LARB_16A_BASE (IO_PHYS + 0x06008000) 134a65fadfbSGavin Liu #define SMI_LARB_16B_BASE (IO_PHYS + 0x0600a000) 135a65fadfbSGavin Liu #define SMI_LARB_17A_BASE (IO_PHYS + 0x06009000) 136a65fadfbSGavin Liu #define SMI_LARB_17B_BASE (IO_PHYS + 0x0600b000) 137a65fadfbSGavin Liu #define SMI_LARB_19_BASE (IO_PHYS + 0x0a010000) 138a65fadfbSGavin Liu #define SMI_LARB_21_BASE (IO_PHYS + 0x0802e000) 139a65fadfbSGavin Liu #define SMI_LARB_23_BASE (IO_PHYS + 0x0800d000) 140a65fadfbSGavin Liu #define SMI_LARB_27_BASE (IO_PHYS + 0x07201000) 141a65fadfbSGavin Liu #define SMI_LARB_28_BASE (IO_PHYS + 0x00000000) 142a65fadfbSGavin Liu #define SMI_LARB_REG_RNG_SIZE (0x1000) 143a65fadfbSGavin Liu 144a65fadfbSGavin Liu /******************************************************************************* 145a65fadfbSGavin Liu * APMIXEDSYS related constants 146a65fadfbSGavin Liu ******************************************************************************/ 147a65fadfbSGavin Liu #define APMIXEDSYS (IO_PHYS + 0x0000C000) 148a65fadfbSGavin Liu 149a65fadfbSGavin Liu /******************************************************************************* 150a65fadfbSGavin Liu * VPPSYS related constants 151a65fadfbSGavin Liu ******************************************************************************/ 152a65fadfbSGavin Liu #define VPPSYS0_BASE (IO_PHYS + 0x04000000) 153a65fadfbSGavin Liu #define VPPSYS1_BASE (IO_PHYS + 0x04f00000) 154a65fadfbSGavin Liu 155a65fadfbSGavin Liu /******************************************************************************* 156a65fadfbSGavin Liu * VDOSYS related constants 157a65fadfbSGavin Liu ******************************************************************************/ 158a65fadfbSGavin Liu #define VDOSYS0_BASE (IO_PHYS + 0x0C01D000) 159a65fadfbSGavin Liu #define VDOSYS1_BASE (IO_PHYS + 0x0C100000) 160a65fadfbSGavin Liu 161a65fadfbSGavin Liu /******************************************************************************* 1623e43d1d3SMac Shen * DP related constants 1633e43d1d3SMac Shen ******************************************************************************/ 1643e43d1d3SMac Shen #define EDP_SEC_BASE (IO_PHYS + 0x2EC50000) 1653e43d1d3SMac Shen #define DP_SEC_BASE (IO_PHYS + 0x2EC10000) 1663e43d1d3SMac Shen #define EDP_SEC_SIZE (0x1000) 1673e43d1d3SMac Shen #define DP_SEC_SIZE (0x1000) 1683e43d1d3SMac Shen 1693e43d1d3SMac Shen /******************************************************************************* 170a65fadfbSGavin Liu * EMI MPU related constants 171a65fadfbSGavin Liu *******************************************************************************/ 172a65fadfbSGavin Liu #define EMI_MPU_BASE (IO_PHYS + 0x00428000) 173a65fadfbSGavin Liu #define SUB_EMI_MPU_BASE (IO_PHYS + 0x00528000) 174a65fadfbSGavin Liu 175a65fadfbSGavin Liu /******************************************************************************* 176a65fadfbSGavin Liu * System counter frequency related constants 177a65fadfbSGavin Liu ******************************************************************************/ 178a65fadfbSGavin Liu #define SYS_COUNTER_FREQ_IN_HZ (13000000) 179a65fadfbSGavin Liu #define SYS_COUNTER_FREQ_IN_MHZ (13) 180a65fadfbSGavin Liu 181a65fadfbSGavin Liu /******************************************************************************* 182a65fadfbSGavin Liu * Generic platform constants 183a65fadfbSGavin Liu ******************************************************************************/ 184a65fadfbSGavin Liu #define PLATFORM_STACK_SIZE (0x800) 185a65fadfbSGavin Liu #define SOC_CHIP_ID U(0x8196) 186a65fadfbSGavin Liu 187a65fadfbSGavin Liu /******************************************************************************* 188a65fadfbSGavin Liu * Platform memory map related constants 189a65fadfbSGavin Liu ******************************************************************************/ 190a65fadfbSGavin Liu #define TZRAM_BASE (0x94600000) 191a65fadfbSGavin Liu #define TZRAM_SIZE (0x00200000) 192a65fadfbSGavin Liu 193a65fadfbSGavin Liu /******************************************************************************* 194a65fadfbSGavin Liu * BL31 specific defines. 195a65fadfbSGavin Liu ******************************************************************************/ 196a65fadfbSGavin Liu /* 197a65fadfbSGavin Liu * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if 198a65fadfbSGavin Liu * present). BL31_BASE is calculated using the current BL3-1 debug size plus a 199a65fadfbSGavin Liu * little space for growth. 200a65fadfbSGavin Liu */ 201a65fadfbSGavin Liu #define BL31_BASE (TZRAM_BASE + 0x1000) 202a65fadfbSGavin Liu #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE) 203a65fadfbSGavin Liu 204a65fadfbSGavin Liu /******************************************************************************* 205a65fadfbSGavin Liu * Platform specific page table and MMU setup constants 206a65fadfbSGavin Liu ******************************************************************************/ 207a65fadfbSGavin Liu #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 39) 208a65fadfbSGavin Liu #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 39) 209a65fadfbSGavin Liu #define MAX_XLAT_TABLES (128) 210a65fadfbSGavin Liu #define MAX_MMAP_REGIONS (512) 211a65fadfbSGavin Liu 212a65fadfbSGavin Liu /******************************************************************************* 213a65fadfbSGavin Liu * CPU PM definitions 214a65fadfbSGavin Liu *******************************************************************************/ 215a65fadfbSGavin Liu #define PLAT_CPU_PM_B_BUCK_ISO_ID (6) 216a65fadfbSGavin Liu #define PLAT_CPU_PM_ILDO_ID (6) 217a65fadfbSGavin Liu #define CPU_IDLE_SRAM_BASE (0x11B000) 218a65fadfbSGavin Liu #define CPU_IDLE_SRAM_SIZE (0x1000) 219a65fadfbSGavin Liu 220a65fadfbSGavin Liu /******************************************************************************* 221a65fadfbSGavin Liu * SYSTIMER related definitions 222a65fadfbSGavin Liu ******************************************************************************/ 223a65fadfbSGavin Liu #define SYSTIMER_BASE (0x1C400000) 224a65fadfbSGavin Liu 225a65fadfbSGavin Liu #endif /* PLATFORM_DEF_H */ 226