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 18*0fe7ae9cSRex-BC Chen #define MTK_DEV_RNG0_SIZE 0x10000000 1927132f13SRex-BC Chen #define MTK_DEV_RNG2_BASE MT_GIC_BASE 2027132f13SRex-BC Chen #define MTK_DEV_RNG2_SIZE 0x600000 2127132f13SRex-BC Chen 22af5a0c40SGuodong Liu /******************************************************************************* 23af5a0c40SGuodong Liu * GPIO related constants 24af5a0c40SGuodong Liu ******************************************************************************/ 25af5a0c40SGuodong Liu #define GPIO_BASE (IO_PHYS + 0x00005000) 26af5a0c40SGuodong Liu #define IOCFG_LT_BASE (IO_PHYS + 0x00002000) 27af5a0c40SGuodong Liu #define IOCFG_LM_BASE (IO_PHYS + 0x00002200) 28af5a0c40SGuodong Liu #define IOCFG_LB_BASE (IO_PHYS + 0x00002400) 29af5a0c40SGuodong Liu #define IOCFG_BL_BASE (IO_PHYS + 0x00002600) 30af5a0c40SGuodong Liu #define IOCFG_RB_BASE (IO_PHYS + 0x00002A00) 31af5a0c40SGuodong Liu #define IOCFG_RT_BASE (IO_PHYS + 0x00002C00) 3227132f13SRex-BC Chen 3327132f13SRex-BC Chen /******************************************************************************* 3427132f13SRex-BC Chen * UART related constants 3527132f13SRex-BC Chen ******************************************************************************/ 3627132f13SRex-BC Chen #define UART0_BASE (IO_PHYS + 0x01002000) 3727132f13SRex-BC Chen 3827132f13SRex-BC Chen #define UART_BAUDRATE 115200 3927132f13SRex-BC Chen 4027132f13SRex-BC Chen /******************************************************************************* 415bc88ec6SJames Lo * PWRAP related constants 425bc88ec6SJames Lo ******************************************************************************/ 435bc88ec6SJames Lo #define PMIC_WRAP_BASE (IO_PHYS + 0x0000D000) 445bc88ec6SJames Lo 455bc88ec6SJames Lo /******************************************************************************* 461b17e34cSPenny Jan * EMI MPU related constants 471b17e34cSPenny Jan ******************************************************************************/ 481b17e34cSPenny Jan #define EMI_MPU_BASE (IO_PHYS + 0x0021B000) 491b17e34cSPenny Jan 501b17e34cSPenny Jan /******************************************************************************* 51206f125cSChristine Zhu * GIC-600 & interrupt handling related constants 52206f125cSChristine Zhu ******************************************************************************/ 53206f125cSChristine Zhu /* Base MTK_platform compatible GIC memory map */ 54206f125cSChristine Zhu #define BASE_GICD_BASE MT_GIC_BASE 55206f125cSChristine Zhu #define MT_GIC_RDIST_BASE (MT_GIC_BASE + 0x40000) 56206f125cSChristine Zhu 57109b91e3SZhengnan Chen #define SYS_CIRQ_BASE (IO_PHYS + 0x204000) 58109b91e3SZhengnan Chen #define CIRQ_REG_NUM 11 59109b91e3SZhengnan Chen #define CIRQ_IRQ_NUM 326 60109b91e3SZhengnan Chen #define CIRQ_SPI_START 64 61109b91e3SZhengnan Chen #define MD_WDT_IRQ_BIT_ID 107 62206f125cSChristine Zhu /******************************************************************************* 6327132f13SRex-BC Chen * System counter frequency related constants 6427132f13SRex-BC Chen ******************************************************************************/ 6527132f13SRex-BC Chen #define SYS_COUNTER_FREQ_IN_TICKS 13000000 6627132f13SRex-BC Chen #define SYS_COUNTER_FREQ_IN_MHZ 13 6727132f13SRex-BC Chen 6827132f13SRex-BC Chen /******************************************************************************* 6927132f13SRex-BC Chen * Platform binary types for linking 7027132f13SRex-BC Chen ******************************************************************************/ 7127132f13SRex-BC Chen #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" 7227132f13SRex-BC Chen #define PLATFORM_LINKER_ARCH aarch64 7327132f13SRex-BC Chen 7427132f13SRex-BC Chen /******************************************************************************* 7527132f13SRex-BC Chen * Generic platform constants 7627132f13SRex-BC Chen ******************************************************************************/ 7727132f13SRex-BC Chen #define PLATFORM_STACK_SIZE 0x800 7827132f13SRex-BC Chen 7927132f13SRex-BC Chen #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" 8027132f13SRex-BC Chen 8127132f13SRex-BC Chen #define PLAT_MAX_PWR_LVL U(3) 8227132f13SRex-BC Chen #define PLAT_MAX_RET_STATE U(1) 8327132f13SRex-BC Chen #define PLAT_MAX_OFF_STATE U(9) 8427132f13SRex-BC Chen 8527132f13SRex-BC Chen #define PLATFORM_SYSTEM_COUNT U(1) 8627132f13SRex-BC Chen #define PLATFORM_MCUSYS_COUNT U(1) 8727132f13SRex-BC Chen #define PLATFORM_CLUSTER_COUNT U(1) 8827132f13SRex-BC Chen #define PLATFORM_CLUSTER0_CORE_COUNT U(8) 8927132f13SRex-BC Chen #define PLATFORM_CLUSTER1_CORE_COUNT U(0) 9027132f13SRex-BC Chen 9127132f13SRex-BC Chen #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT) 9227132f13SRex-BC Chen #define PLATFORM_MAX_CPUS_PER_CLUSTER U(8) 9327132f13SRex-BC Chen 9427132f13SRex-BC Chen #define SOC_CHIP_ID U(0x8186) 9527132f13SRex-BC Chen 9627132f13SRex-BC Chen /******************************************************************************* 9727132f13SRex-BC Chen * Platform memory map related constants 9827132f13SRex-BC Chen ******************************************************************************/ 9927132f13SRex-BC Chen #define TZRAM_BASE 0x54600000 10027132f13SRex-BC Chen #define TZRAM_SIZE 0x00030000 10127132f13SRex-BC Chen 10227132f13SRex-BC Chen /******************************************************************************* 10327132f13SRex-BC Chen * BL31 specific defines. 10427132f13SRex-BC Chen ******************************************************************************/ 10527132f13SRex-BC Chen /* 10627132f13SRex-BC Chen * Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if 10727132f13SRex-BC Chen * present). BL31_BASE is calculated using the current BL3-1 debug size plus a 10827132f13SRex-BC Chen * little space for growth. 10927132f13SRex-BC Chen */ 11027132f13SRex-BC Chen #define BL31_BASE (TZRAM_BASE + 0x1000) 11127132f13SRex-BC Chen #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE) 11227132f13SRex-BC Chen 11327132f13SRex-BC Chen /******************************************************************************* 11427132f13SRex-BC Chen * Platform specific page table and MMU setup constants 11527132f13SRex-BC Chen ******************************************************************************/ 11627132f13SRex-BC Chen #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) 11727132f13SRex-BC Chen #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) 11827132f13SRex-BC Chen #define MAX_XLAT_TABLES 16 11927132f13SRex-BC Chen #define MAX_MMAP_REGIONS 16 12027132f13SRex-BC Chen 12127132f13SRex-BC Chen /******************************************************************************* 12227132f13SRex-BC Chen * Declarations and constants to access the mailboxes safely. Each mailbox is 12327132f13SRex-BC Chen * aligned on the biggest cache line size in the platform. This is known only 12427132f13SRex-BC Chen * to the platform as it might have a combination of integrated and external 12527132f13SRex-BC Chen * caches. Such alignment ensures that two maiboxes do not sit on the same cache 12627132f13SRex-BC Chen * line at any cache level. They could belong to different cpus/clusters & 12727132f13SRex-BC Chen * get written while being protected by different locks causing corruption of 12827132f13SRex-BC Chen * a valid mailbox address. 12927132f13SRex-BC Chen ******************************************************************************/ 13027132f13SRex-BC Chen #define CACHE_WRITEBACK_SHIFT 6 13127132f13SRex-BC Chen #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 13227132f13SRex-BC Chen #endif /* PLATFORM_DEF_H */ 133