180d37c28SDeepak Pandey /* 2*0f37ae13STamas Ban * Copyright (c) 2018-2024, Arm Limited. All rights reserved. 380d37c28SDeepak Pandey * 480d37c28SDeepak Pandey * SPDX-License-Identifier: BSD-3-Clause 580d37c28SDeepak Pandey */ 680d37c28SDeepak Pandey 7c3cf06f1SAntonio Nino Diaz #ifndef PLATFORM_DEF_H 8c3cf06f1SAntonio Nino Diaz #define PLATFORM_DEF_H 980d37c28SDeepak Pandey 10bd9344f6SAntonio Nino Diaz #include <plat/arm/board/common/v2m_def.h> 11bd9344f6SAntonio Nino Diaz #include <plat/arm/common/arm_def.h> 12bd9344f6SAntonio Nino Diaz #include <plat/arm/css/common/css_def.h> 1380d37c28SDeepak Pandey 14a15f38cfSDeepak Pandey /* UART related constants */ 15a15f38cfSDeepak Pandey #define PLAT_ARM_BOOT_UART_BASE 0x2A400000 16a15f38cfSDeepak Pandey #define PLAT_ARM_BOOT_UART_CLK_IN_HZ 50000000 17a15f38cfSDeepak Pandey 184a81e91fSHimanshu Sharma /* IOFPGA UART0 */ 194a81e91fSHimanshu Sharma #define PLAT_ARM_RUN_UART_BASE 0x1C090000 204a81e91fSHimanshu Sharma #define PLAT_ARM_RUN_UART_CLK_IN_HZ 24000000 21a15f38cfSDeepak Pandey 220d28096cSUsama Arif #define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE 230d28096cSUsama Arif #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ 24a15f38cfSDeepak Pandey 2549d64e5dSSami Mujawar #define PLAT_ARM_DRAM2_BASE ULL(0x8080000000) 26de8bc83eSManoj Kumar #define PLAT_ARM_DRAM2_SIZE ULL(0xF80000000) 27de8bc83eSManoj Kumar 28fe2b37f6Ssah01 #define MAX_IO_DEVICES U(3) 29fe2b37f6Ssah01 #define MAX_IO_HANDLES U(4) 30fe2b37f6Ssah01 31fe2b37f6Ssah01 #define PLAT_ARM_FLASH_IMAGE_BASE 0x18200000 32fe2b37f6Ssah01 #define PLAT_ARM_FLASH_IMAGE_MAX_SIZE 0x00800000 33fe2b37f6Ssah01 34fe2b37f6Ssah01 #define PLAT_ARM_NVM_BASE 0x18200000 35fe2b37f6Ssah01 #define PLAT_ARM_NVM_SIZE 0x00800000 36fe2b37f6Ssah01 37fe2b37f6Ssah01 #if defined NS_BL1U_BASE 38fe2b37f6Ssah01 # undef NS_BL1U_BASE 39fe2b37f6Ssah01 # define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + UL(0x00800000)) 40fe2b37f6Ssah01 #endif 41fe2b37f6Ssah01 42fe2b37f6Ssah01 /* Non-volatile counters */ 43fe2b37f6Ssah01 #define SOC_TRUSTED_NVCTR_BASE 0x7fe70000 44fe2b37f6Ssah01 #define TFW_NVCTR_BASE (SOC_TRUSTED_NVCTR_BASE) 45fe2b37f6Ssah01 #define TFW_NVCTR_SIZE U(4) 46fe2b37f6Ssah01 #define NTFW_CTR_BASE (SOC_TRUSTED_NVCTR_BASE + 0x0004) 47fe2b37f6Ssah01 #define NTFW_CTR_SIZE U(4) 48fe2b37f6Ssah01 49f91a8e4cSManish Pandey /* N1SDP remote chip at 4 TB offset */ 50f91a8e4cSManish Pandey #define PLAT_ARM_REMOTE_CHIP_OFFSET (ULL(1) << 42) 51f91a8e4cSManish Pandey 52f91a8e4cSManish Pandey #define N1SDP_REMOTE_DRAM1_BASE ARM_DRAM1_BASE + \ 53f91a8e4cSManish Pandey PLAT_ARM_REMOTE_CHIP_OFFSET 54f91a8e4cSManish Pandey #define N1SDP_REMOTE_DRAM1_SIZE ARM_DRAM1_SIZE 55f91a8e4cSManish Pandey 56f91a8e4cSManish Pandey #define N1SDP_REMOTE_DRAM2_BASE PLAT_ARM_DRAM2_BASE + \ 57f91a8e4cSManish Pandey PLAT_ARM_REMOTE_CHIP_OFFSET 58f91a8e4cSManish Pandey #define N1SDP_REMOTE_DRAM2_SIZE PLAT_ARM_DRAM2_SIZE 59f91a8e4cSManish Pandey 60de8bc83eSManoj Kumar /* 61de8bc83eSManoj Kumar * N1SDP platform supports RDIMMs with ECC capability. To use the ECC 62de8bc83eSManoj Kumar * capability, the entire DDR memory space has to be zeroed out before 63f91a8e4cSManish Pandey * enabling the ECC bits in DMC620. To access the complete DDR memory 64f91a8e4cSManish Pandey * along with remote chip's DDR memory, which is at 4 TB offset, physical 65f91a8e4cSManish Pandey * and virtual address space limits are extended to 43-bits. 66de8bc83eSManoj Kumar */ 67402b3cf8SJulius Werner #ifdef __aarch64__ 68f91a8e4cSManish Pandey #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 43) 69f91a8e4cSManish Pandey #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 43) 70de8bc83eSManoj Kumar #else 71de8bc83eSManoj Kumar #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) 72de8bc83eSManoj Kumar #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) 73de8bc83eSManoj Kumar #endif 74a15f38cfSDeepak Pandey 7580d37c28SDeepak Pandey #if CSS_USE_SCMI_SDS_DRIVER 7680d37c28SDeepak Pandey #define N1SDP_SCMI_PAYLOAD_BASE 0x45400000 77*0f37ae13STamas Ban /* 78*0f37ae13STamas Ban * Index of SDS region used in the communication with SCP 79*0f37ae13STamas Ban */ 80*0f37ae13STamas Ban #define SDS_SCP_AP_REGION_ID U(0) 8180d37c28SDeepak Pandey #else 8280d37c28SDeepak Pandey #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE 0x45400000 8380d37c28SDeepak Pandey #endif 8480d37c28SDeepak Pandey 85fe2b37f6Ssah01 /* 86fe2b37f6Ssah01 * Trusted SRAM in N1SDP is 512 KB but only the bottom 384 KB 87fe2b37f6Ssah01 * is used for trusted board boot flow. The top 128 KB is used 88fe2b37f6Ssah01 * to load AP-BL1 image. 89fe2b37f6Ssah01 */ 90fe2b37f6Ssah01 #define PLAT_ARM_TRUSTED_SRAM_SIZE 0x00060000 /* 384 KB */ 91fe2b37f6Ssah01 92fe2b37f6Ssah01 /* 93fe2b37f6Ssah01 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size 94fe2b37f6Ssah01 * plus a little space for growth. 95fe2b37f6Ssah01 */ 969090fe00SVishnu Banavath #define PLAT_ARM_MAX_BL1_RW_SIZE 0xC000 97fe2b37f6Ssah01 98fe2b37f6Ssah01 /* 99fe2b37f6Ssah01 * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page 100fe2b37f6Ssah01 */ 101fe2b37f6Ssah01 102fe2b37f6Ssah01 #if USE_ROMLIB 103fe2b37f6Ssah01 # define PLAT_ARM_MAX_ROMLIB_RW_SIZE 0x1000 104fe2b37f6Ssah01 # define PLAT_ARM_MAX_ROMLIB_RO_SIZE 0xe000 105fe2b37f6Ssah01 #else 106fe2b37f6Ssah01 # define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0) 107fe2b37f6Ssah01 # define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0) 108fe2b37f6Ssah01 #endif 109fe2b37f6Ssah01 110fe2b37f6Ssah01 /* 111fe2b37f6Ssah01 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a 112fe2b37f6Ssah01 * little space for growth. 113fe2b37f6Ssah01 */ 114fe2b37f6Ssah01 #if TRUSTED_BOARD_BOOT 1159090fe00SVishnu Banavath # define PLAT_ARM_MAX_BL2_SIZE 0x22000 116fe2b37f6Ssah01 #else 117fe2b37f6Ssah01 # define PLAT_ARM_MAX_BL2_SIZE 0x14000 118fe2b37f6Ssah01 #endif 119fe2b37f6Ssah01 1209090fe00SVishnu Banavath #define PLAT_ARM_MAX_BL31_SIZE UL(0x40000) 1219090fe00SVishnu Banavath 1229090fe00SVishnu Banavath #define PLAT_ARM_SPMC_BASE U(0x08000000) 1239090fe00SVishnu Banavath #define PLAT_ARM_SPMC_SIZE UL(0x02000000) /* 32 MB */ 1249090fe00SVishnu Banavath 12580d37c28SDeepak Pandey 12680d37c28SDeepak Pandey /******************************************************************************* 12780d37c28SDeepak Pandey * N1SDP topology related constants 12880d37c28SDeepak Pandey ******************************************************************************/ 129f91a8e4cSManish Pandey #define N1SDP_MAX_CPUS_PER_CLUSTER U(2) 130f91a8e4cSManish Pandey #define PLAT_ARM_CLUSTER_COUNT U(2) 131f91a8e4cSManish Pandey #define PLAT_N1SDP_CHIP_COUNT U(2) 132f91a8e4cSManish Pandey #define N1SDP_MAX_CLUSTERS_PER_CHIP U(2) 133f91a8e4cSManish Pandey #define N1SDP_MAX_PE_PER_CPU U(1) 13480d37c28SDeepak Pandey 135f91a8e4cSManish Pandey #define PLATFORM_CORE_COUNT (PLAT_N1SDP_CHIP_COUNT * \ 136f91a8e4cSManish Pandey PLAT_ARM_CLUSTER_COUNT * \ 13780d37c28SDeepak Pandey N1SDP_MAX_CPUS_PER_CLUSTER * \ 13880d37c28SDeepak Pandey N1SDP_MAX_PE_PER_CPU) 13980d37c28SDeepak Pandey 140eff2f444SChandni Cherukuri /* System power domain level */ 141f91a8e4cSManish Pandey #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL3 14280d37c28SDeepak Pandey 14380d37c28SDeepak Pandey /* 14480d37c28SDeepak Pandey * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the 14580d37c28SDeepak Pandey * plat_arm_mmap array defined for each BL stage. 14680d37c28SDeepak Pandey */ 14780d37c28SDeepak Pandey 148fe2b37f6Ssah01 #ifdef IMAGE_BL1 149fe2b37f6Ssah01 # define PLAT_ARM_MMAP_ENTRIES U(6) 150fe2b37f6Ssah01 # define MAX_XLAT_TABLES U(5) 151fe2b37f6Ssah01 #endif 152fe2b37f6Ssah01 153fe2b37f6Ssah01 #ifdef IMAGE_BL2 154fe2b37f6Ssah01 # define PLAT_ARM_MMAP_ENTRIES U(11) 155fe2b37f6Ssah01 # define MAX_XLAT_TABLES U(10) 156fe2b37f6Ssah01 #endif 157fe2b37f6Ssah01 158fe2b37f6Ssah01 #ifdef IMAGE_BL31 159fe2b37f6Ssah01 # define PLAT_ARM_MMAP_ENTRIES U(12) 160fe2b37f6Ssah01 # define MAX_XLAT_TABLES U(12) 161fe2b37f6Ssah01 #endif 162fe2b37f6Ssah01 163fe2b37f6Ssah01 /* 164fe2b37f6Ssah01 * Size of cacheable stacks 165fe2b37f6Ssah01 */ 166fe2b37f6Ssah01 #if defined(IMAGE_BL1) 167fe2b37f6Ssah01 # if TRUSTED_BOARD_BOOT 168fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x1000 169fe2b37f6Ssah01 # else 170fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x440 171fe2b37f6Ssah01 # endif 172fe2b37f6Ssah01 #elif defined(IMAGE_BL2) 173fe2b37f6Ssah01 # if TRUSTED_BOARD_BOOT 174fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x1000 175fe2b37f6Ssah01 # else 17680d37c28SDeepak Pandey # define PLATFORM_STACK_SIZE 0x400 177fe2b37f6Ssah01 # endif 178fe2b37f6Ssah01 #elif defined(IMAGE_BL2U) 179fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x400 180fe2b37f6Ssah01 #elif defined(IMAGE_BL31) 181fe2b37f6Ssah01 # if SPM_MM 182fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x500 183fe2b37f6Ssah01 # else 184fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x400 185fe2b37f6Ssah01 # endif 186fe2b37f6Ssah01 #elif defined(IMAGE_BL32) 187fe2b37f6Ssah01 # define PLATFORM_STACK_SIZE 0x440 188fe2b37f6Ssah01 #endif 18980d37c28SDeepak Pandey 19080d37c28SDeepak Pandey #define PLAT_ARM_NSTIMER_FRAME_ID 0 19180d37c28SDeepak Pandey #define PLAT_CSS_MHU_BASE 0x45000000 192f91a8e4cSManish Pandey #define PLAT_MAX_PWR_LVL 2 19380d37c28SDeepak Pandey 1947b0c95abSWerner Lewis /* Interrupt handling constants */ 1957b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU1_EVENT_Q_SEC U(257) 1967b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU1_CMD_SYNC_SEC U(258) 1977b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU1_GLOBAL U(259) 1987b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU2_EVENT_Q_SEC U(264) 1997b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU2_CMD_SYNC_SEC U(265) 2007b0c95abSWerner Lewis #define N1SDP_IRQ_MMU_TCU2_GLOBAL U(266) 2017b0c95abSWerner Lewis #define N1SDP_IRQ_CLUSTER0_MHU U(349) 2027b0c95abSWerner Lewis #define N1SDP_IRQ_CLUSTER1_MHU U(351) 2037b0c95abSWerner Lewis #define N1SDP_IRQ_P0_REFCLK U(412) 2047b0c95abSWerner Lewis #define N1SDP_IRQ_P1_REFCLK U(413) 20580d37c28SDeepak Pandey 2067b0c95abSWerner Lewis #define PLAT_ARM_G1S_IRQ_PROPS(grp) \ 2077b0c95abSWerner Lewis ARM_G1S_IRQ_PROPS(grp), \ 2087b0c95abSWerner Lewis INTR_PROP_DESC(CSS_IRQ_MHU, \ 2097b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2107b0c95abSWerner Lewis INTR_PROP_DESC(CSS_IRQ_TZ_WDOG, \ 2117b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2127b0c95abSWerner Lewis INTR_PROP_DESC(CSS_IRQ_SEC_SYS_TIMER, \ 2137b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2147b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_EVENT_Q_SEC, \ 2157b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2167b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_CMD_SYNC_SEC, \ 2177b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2187b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU1_GLOBAL, \ 2197b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2207b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_EVENT_Q_SEC, \ 2217b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2227b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_CMD_SYNC_SEC, \ 2237b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2247b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_MMU_TCU2_GLOBAL, \ 2257b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2267b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_CLUSTER0_MHU, \ 2277b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2287b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_CLUSTER1_MHU, \ 2297b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2307b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_P0_REFCLK, \ 2317b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \ 2327b0c95abSWerner Lewis INTR_PROP_DESC(N1SDP_IRQ_P1_REFCLK, \ 2337b0c95abSWerner Lewis GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL) 2347b0c95abSWerner Lewis 23580d37c28SDeepak Pandey #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp) 23680d37c28SDeepak Pandey 23780d37c28SDeepak Pandey 238f91a8e4cSManish Pandey #define N1SDP_DEVICE_BASE ULL(0x08000000) 239f91a8e4cSManish Pandey #define N1SDP_DEVICE_SIZE ULL(0x48000000) 240f91a8e4cSManish Pandey #define N1SDP_REMOTE_DEVICE_BASE N1SDP_DEVICE_BASE + \ 241f91a8e4cSManish Pandey PLAT_ARM_REMOTE_CHIP_OFFSET 242f91a8e4cSManish Pandey #define N1SDP_REMOTE_DEVICE_SIZE N1SDP_DEVICE_SIZE 243f91a8e4cSManish Pandey 244fe2b37f6Ssah01 /* Real base is 0x0. Changed to load BL1 at this address */ 245fe2b37f6Ssah01 # define PLAT_ARM_TRUSTED_ROM_BASE 0x04060000 246fe2b37f6Ssah01 # define PLAT_ARM_TRUSTED_ROM_SIZE 0x00020000 /* 128KB */ 247fe2b37f6Ssah01 24880d37c28SDeepak Pandey #define N1SDP_MAP_DEVICE MAP_REGION_FLAT( \ 24980d37c28SDeepak Pandey N1SDP_DEVICE_BASE, \ 25080d37c28SDeepak Pandey N1SDP_DEVICE_SIZE, \ 25180d37c28SDeepak Pandey MT_DEVICE | MT_RW | MT_SECURE) 25280d37c28SDeepak Pandey 253de8bc83eSManoj Kumar #define ARM_MAP_DRAM1 MAP_REGION_FLAT( \ 254de8bc83eSManoj Kumar ARM_DRAM1_BASE, \ 255de8bc83eSManoj Kumar ARM_DRAM1_SIZE, \ 256de8bc83eSManoj Kumar MT_MEMORY | MT_RW | MT_NS) 257de8bc83eSManoj Kumar 258f91a8e4cSManish Pandey #define N1SDP_MAP_REMOTE_DEVICE MAP_REGION_FLAT( \ 259f91a8e4cSManish Pandey N1SDP_REMOTE_DEVICE_BASE, \ 260f91a8e4cSManish Pandey N1SDP_REMOTE_DEVICE_SIZE, \ 261f91a8e4cSManish Pandey MT_DEVICE | MT_RW | MT_SECURE) 262f91a8e4cSManish Pandey 263f91a8e4cSManish Pandey #define N1SDP_MAP_REMOTE_DRAM1 MAP_REGION_FLAT( \ 264f91a8e4cSManish Pandey N1SDP_REMOTE_DRAM1_BASE, \ 265f91a8e4cSManish Pandey N1SDP_REMOTE_DRAM1_SIZE, \ 266f91a8e4cSManish Pandey MT_MEMORY | MT_RW | MT_NS) 267f91a8e4cSManish Pandey 268f91a8e4cSManish Pandey #define N1SDP_MAP_REMOTE_DRAM2 MAP_REGION_FLAT( \ 269f91a8e4cSManish Pandey N1SDP_REMOTE_DRAM2_BASE, \ 270f91a8e4cSManish Pandey N1SDP_REMOTE_DRAM2_SIZE, \ 271f91a8e4cSManish Pandey MT_MEMORY | MT_RW | MT_NS) 272f91a8e4cSManish Pandey 27380d37c28SDeepak Pandey /* GIC related constants */ 27480d37c28SDeepak Pandey #define PLAT_ARM_GICD_BASE 0x30000000 27580d37c28SDeepak Pandey #define PLAT_ARM_GICC_BASE 0x2C000000 27680d37c28SDeepak Pandey #define PLAT_ARM_GICR_BASE 0x300C0000 27780d37c28SDeepak Pandey 27880d37c28SDeepak Pandey /* Platform ID address */ 27980d37c28SDeepak Pandey #define SSC_VERSION (SSC_REG_BASE + SSC_VERSION_OFFSET) 280c3cf06f1SAntonio Nino Diaz 281b0c97dafSAditya Angadi /* Secure Watchdog Constants */ 282b0c97dafSAditya Angadi #define SBSA_SECURE_WDOG_BASE UL(0x2A480000) 283b0c97dafSAditya Angadi #define SBSA_SECURE_WDOG_TIMEOUT UL(100) 284b0c97dafSAditya Angadi 28531e703f9SAditya Angadi /* Number of SCMI channels on the platform */ 28631e703f9SAditya Angadi #define PLAT_ARM_SCMI_CHANNEL_COUNT U(1) 28731e703f9SAditya Angadi 288c3cf06f1SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 289