127132f13SRex-BC Chen /* 227132f13SRex-BC Chen * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. 327132f13SRex-BC Chen * 427132f13SRex-BC Chen * SPDX-License-Identifier: BSD-3-Clause 527132f13SRex-BC Chen */ 627132f13SRex-BC Chen 727132f13SRex-BC Chen #ifndef PLATFORM_DEF_H 827132f13SRex-BC Chen #define PLATFORM_DEF_H 927132f13SRex-BC Chen 1027132f13SRex-BC Chen #define PLAT_PRIMARY_CPU 0x0 1127132f13SRex-BC Chen 1227132f13SRex-BC Chen #define MT_GIC_BASE (0x0C000000) 1327132f13SRex-BC Chen #define MCUCFG_BASE (0x0C530000) 1427132f13SRex-BC Chen #define IO_PHYS (0x10000000) 1527132f13SRex-BC Chen 1627132f13SRex-BC Chen /* Aggregate of all devices for MMU mapping */ 1727132f13SRex-BC Chen #define MTK_DEV_RNG0_BASE IO_PHYS 1827132f13SRex-BC Chen #define MTK_DEV_RNG0_SIZE 0x400000 1927132f13SRex-BC Chen #define MTK_DEV_RNG1_BASE (IO_PHYS + 0x1000000) 2027132f13SRex-BC Chen #define MTK_DEV_RNG1_SIZE 0xa110000 2127132f13SRex-BC Chen #define MTK_DEV_RNG2_BASE MT_GIC_BASE 2227132f13SRex-BC Chen #define MTK_DEV_RNG2_SIZE 0x600000 2327132f13SRex-BC Chen 24*af5a0c40SGuodong Liu /******************************************************************************* 25*af5a0c40SGuodong Liu * GPIO related constants 26*af5a0c40SGuodong Liu ******************************************************************************/ 27*af5a0c40SGuodong Liu #define GPIO_BASE (IO_PHYS + 0x00005000) 28*af5a0c40SGuodong Liu #define IOCFG_LT_BASE (IO_PHYS + 0x00002000) 29*af5a0c40SGuodong Liu #define IOCFG_LM_BASE (IO_PHYS + 0x00002200) 30*af5a0c40SGuodong Liu #define IOCFG_LB_BASE (IO_PHYS + 0x00002400) 31*af5a0c40SGuodong Liu #define IOCFG_BL_BASE (IO_PHYS + 0x00002600) 32*af5a0c40SGuodong Liu #define IOCFG_RB_BASE (IO_PHYS + 0x00002A00) 33*af5a0c40SGuodong Liu #define IOCFG_RT_BASE (IO_PHYS + 0x00002C00) 3427132f13SRex-BC Chen 3527132f13SRex-BC Chen /******************************************************************************* 3627132f13SRex-BC Chen * UART related constants 3727132f13SRex-BC Chen ******************************************************************************/ 3827132f13SRex-BC Chen #define UART0_BASE (IO_PHYS + 0x01002000) 3927132f13SRex-BC Chen 4027132f13SRex-BC Chen #define UART_BAUDRATE 115200 4127132f13SRex-BC Chen 4227132f13SRex-BC Chen /******************************************************************************* 435bc88ec6SJames Lo * PWRAP related constants 445bc88ec6SJames Lo ******************************************************************************/ 455bc88ec6SJames Lo #define PMIC_WRAP_BASE (IO_PHYS + 0x0000D000) 465bc88ec6SJames Lo 475bc88ec6SJames Lo /******************************************************************************* 481b17e34cSPenny Jan * EMI MPU related constants 491b17e34cSPenny Jan ******************************************************************************/ 501b17e34cSPenny Jan #define EMI_MPU_BASE (IO_PHYS + 0x0021B000) 511b17e34cSPenny Jan 521b17e34cSPenny Jan /******************************************************************************* 53206f125cSChristine Zhu * GIC-600 & interrupt handling related constants 54206f125cSChristine Zhu ******************************************************************************/ 55206f125cSChristine Zhu /* Base MTK_platform compatible GIC memory map */ 56206f125cSChristine Zhu #define BASE_GICD_BASE MT_GIC_BASE 57206f125cSChristine Zhu #define MT_GIC_RDIST_BASE (MT_GIC_BASE + 0x40000) 58206f125cSChristine Zhu 59109b91e3SZhengnan Chen #define SYS_CIRQ_BASE (IO_PHYS + 0x204000) 60109b91e3SZhengnan Chen #define CIRQ_REG_NUM 11 61109b91e3SZhengnan Chen #define CIRQ_IRQ_NUM 326 62109b91e3SZhengnan Chen #define CIRQ_SPI_START 64 63109b91e3SZhengnan Chen #define MD_WDT_IRQ_BIT_ID 107 64206f125cSChristine Zhu /******************************************************************************* 6527132f13SRex-BC Chen * System counter frequency related constants 6627132f13SRex-BC Chen ******************************************************************************/ 6727132f13SRex-BC Chen #define SYS_COUNTER_FREQ_IN_TICKS 13000000 6827132f13SRex-BC Chen #define SYS_COUNTER_FREQ_IN_MHZ 13 6927132f13SRex-BC Chen 7027132f13SRex-BC Chen /******************************************************************************* 7127132f13SRex-BC Chen * Platform binary types for linking 7227132f13SRex-BC Chen ******************************************************************************/ 7327132f13SRex-BC Chen #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" 7427132f13SRex-BC Chen #define PLATFORM_LINKER_ARCH aarch64 7527132f13SRex-BC Chen 7627132f13SRex-BC Chen /******************************************************************************* 7727132f13SRex-BC Chen * Generic platform constants 7827132f13SRex-BC Chen ******************************************************************************/ 7927132f13SRex-BC Chen #define PLATFORM_STACK_SIZE 0x800 8027132f13SRex-BC Chen 8127132f13SRex-BC Chen #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" 8227132f13SRex-BC Chen 8327132f13SRex-BC Chen #define PLAT_MAX_PWR_LVL U(3) 8427132f13SRex-BC Chen #define PLAT_MAX_RET_STATE U(1) 8527132f13SRex-BC Chen #define PLAT_MAX_OFF_STATE U(9) 8627132f13SRex-BC Chen 8727132f13SRex-BC Chen #define PLATFORM_SYSTEM_COUNT U(1) 8827132f13SRex-BC Chen #define PLATFORM_MCUSYS_COUNT U(1) 8927132f13SRex-BC Chen #define PLATFORM_CLUSTER_COUNT U(1) 9027132f13SRex-BC Chen #define PLATFORM_CLUSTER0_CORE_COUNT U(8) 9127132f13SRex-BC Chen #define PLATFORM_CLUSTER1_CORE_COUNT U(0) 9227132f13SRex-BC Chen 9327132f13SRex-BC Chen #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT) 9427132f13SRex-BC Chen #define PLATFORM_MAX_CPUS_PER_CLUSTER U(8) 9527132f13SRex-BC Chen 9627132f13SRex-BC Chen #define SOC_CHIP_ID U(0x8186) 9727132f13SRex-BC Chen 9827132f13SRex-BC Chen /******************************************************************************* 9927132f13SRex-BC Chen * Platform memory map related constants 10027132f13SRex-BC Chen ******************************************************************************/ 10127132f13SRex-BC Chen #define TZRAM_BASE 0x54600000 10227132f13SRex-BC Chen #define TZRAM_SIZE 0x00030000 10327132f13SRex-BC Chen 10427132f13SRex-BC Chen /******************************************************************************* 10527132f13SRex-BC Chen * BL31 specific defines. 10627132f13SRex-BC Chen ******************************************************************************/ 10727132f13SRex-BC Chen /* 10827132f13SRex-BC Chen * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if 10927132f13SRex-BC Chen * present). BL31_BASE is calculated using the current BL3-1 debug size plus a 11027132f13SRex-BC Chen * little space for growth. 11127132f13SRex-BC Chen */ 11227132f13SRex-BC Chen #define BL31_BASE (TZRAM_BASE + 0x1000) 11327132f13SRex-BC Chen #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE) 11427132f13SRex-BC Chen 11527132f13SRex-BC Chen /******************************************************************************* 11627132f13SRex-BC Chen * Platform specific page table and MMU setup constants 11727132f13SRex-BC Chen ******************************************************************************/ 11827132f13SRex-BC Chen #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) 11927132f13SRex-BC Chen #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) 12027132f13SRex-BC Chen #define MAX_XLAT_TABLES 16 12127132f13SRex-BC Chen #define MAX_MMAP_REGIONS 16 12227132f13SRex-BC Chen 12327132f13SRex-BC Chen /******************************************************************************* 12427132f13SRex-BC Chen * Declarations and constants to access the mailboxes safely. Each mailbox is 12527132f13SRex-BC Chen * aligned on the biggest cache line size in the platform. This is known only 12627132f13SRex-BC Chen * to the platform as it might have a combination of integrated and external 12727132f13SRex-BC Chen * caches. Such alignment ensures that two maiboxes do not sit on the same cache 12827132f13SRex-BC Chen * line at any cache level. They could belong to different cpus/clusters & 12927132f13SRex-BC Chen * get written while being protected by different locks causing corruption of 13027132f13SRex-BC Chen * a valid mailbox address. 13127132f13SRex-BC Chen ******************************************************************************/ 13227132f13SRex-BC Chen #define CACHE_WRITEBACK_SHIFT 6 13327132f13SRex-BC Chen #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 13427132f13SRex-BC Chen #endif /* PLATFORM_DEF_H */ 135