11841c533SNishanth Menon /* 21841c533SNishanth Menon * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. 31841c533SNishanth Menon * 41841c533SNishanth Menon * SPDX-License-Identifier: BSD-3-Clause 51841c533SNishanth Menon */ 61841c533SNishanth Menon 7c3cf06f1SAntonio Nino Diaz #ifndef PLATFORM_DEF_H 8c3cf06f1SAntonio Nino Diaz #define PLATFORM_DEF_H 91841c533SNishanth Menon 101841c533SNishanth Menon #include <arch.h> 11*09d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h> 12*09d40e0eSAntonio Nino Diaz 131841c533SNishanth Menon #include <board_def.h> 141841c533SNishanth Menon 151841c533SNishanth Menon /******************************************************************************* 161841c533SNishanth Menon * Generic platform constants 171841c533SNishanth Menon ******************************************************************************/ 181841c533SNishanth Menon 191841c533SNishanth Menon /* Size of cacheable stack */ 201841c533SNishanth Menon #if IMAGE_BL31 211841c533SNishanth Menon #define PLATFORM_STACK_SIZE 0x800 221841c533SNishanth Menon #else 231841c533SNishanth Menon #define PLATFORM_STACK_SIZE 0x1000 241841c533SNishanth Menon #endif 251841c533SNishanth Menon 2689574715SBenjamin Fair #define PLATFORM_SYSTEM_COUNT 1 2789574715SBenjamin Fair #define PLATFORM_CORE_COUNT (K3_CLUSTER0_CORE_COUNT + \ 2889574715SBenjamin Fair K3_CLUSTER1_CORE_COUNT + \ 2989574715SBenjamin Fair K3_CLUSTER2_CORE_COUNT + \ 3089574715SBenjamin Fair K3_CLUSTER3_CORE_COUNT) 3189574715SBenjamin Fair 3289574715SBenjamin Fair #define PLATFORM_CLUSTER_COUNT ((K3_CLUSTER0_MSMC_PORT != UNUSED) + \ 3389574715SBenjamin Fair (K3_CLUSTER1_MSMC_PORT != UNUSED) + \ 3489574715SBenjamin Fair (K3_CLUSTER2_MSMC_PORT != UNUSED) + \ 3589574715SBenjamin Fair (K3_CLUSTER3_MSMC_PORT != UNUSED)) 3689574715SBenjamin Fair 3789574715SBenjamin Fair #define UNUSED -1 3889574715SBenjamin Fair 3989574715SBenjamin Fair #if !defined(K3_CLUSTER1_CORE_COUNT) || !defined(K3_CLUSTER1_MSMC_PORT) 4089574715SBenjamin Fair #define K3_CLUSTER1_CORE_COUNT 0 4189574715SBenjamin Fair #define K3_CLUSTER1_MSMC_PORT UNUSED 4289574715SBenjamin Fair #endif 4389574715SBenjamin Fair 4489574715SBenjamin Fair #if !defined(K3_CLUSTER2_CORE_COUNT) || !defined(K3_CLUSTER2_MSMC_PORT) 4589574715SBenjamin Fair #define K3_CLUSTER2_CORE_COUNT 0 4689574715SBenjamin Fair #define K3_CLUSTER2_MSMC_PORT UNUSED 4789574715SBenjamin Fair #endif 4889574715SBenjamin Fair 4989574715SBenjamin Fair #if !defined(K3_CLUSTER3_CORE_COUNT) || !defined(K3_CLUSTER3_MSMC_PORT) 5089574715SBenjamin Fair #define K3_CLUSTER3_CORE_COUNT 0 5189574715SBenjamin Fair #define K3_CLUSTER3_MSMC_PORT UNUSED 5289574715SBenjamin Fair #endif 5389574715SBenjamin Fair 5489574715SBenjamin Fair #if K3_CLUSTER0_MSMC_PORT == UNUSED 5589574715SBenjamin Fair #error "ARM cluster 0 must be used" 5689574715SBenjamin Fair #endif 5789574715SBenjamin Fair 5889574715SBenjamin Fair #if ((K3_CLUSTER1_MSMC_PORT == UNUSED) && (K3_CLUSTER1_CORE_COUNT != 0)) || \ 5989574715SBenjamin Fair ((K3_CLUSTER2_MSMC_PORT == UNUSED) && (K3_CLUSTER2_CORE_COUNT != 0)) || \ 6089574715SBenjamin Fair ((K3_CLUSTER3_MSMC_PORT == UNUSED) && (K3_CLUSTER3_CORE_COUNT != 0)) 6189574715SBenjamin Fair #error "Unused ports must have 0 ARM cores" 6289574715SBenjamin Fair #endif 6389574715SBenjamin Fair 6489574715SBenjamin Fair #define PLATFORM_CLUSTER_OFFSET K3_CLUSTER0_MSMC_PORT 6589574715SBenjamin Fair 6679a1a849SAndrew F. Davis #define PLAT_NUM_PWR_DOMAINS (PLATFORM_SYSTEM_COUNT + \ 6779a1a849SAndrew F. Davis PLATFORM_CLUSTER_COUNT + \ 681841c533SNishanth Menon PLATFORM_CORE_COUNT) 6979a1a849SAndrew F. Davis #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2 701841c533SNishanth Menon 711841c533SNishanth Menon /******************************************************************************* 721841c533SNishanth Menon * Memory layout constants 731841c533SNishanth Menon ******************************************************************************/ 741841c533SNishanth Menon 751841c533SNishanth Menon /* 761841c533SNishanth Menon * ARM-TF lives in SRAM, partition it here 771841c533SNishanth Menon */ 781841c533SNishanth Menon 791841c533SNishanth Menon #define SHARED_RAM_BASE BL31_LIMIT 801841c533SNishanth Menon #define SHARED_RAM_SIZE 0x00001000 811841c533SNishanth Menon 821841c533SNishanth Menon /* 831841c533SNishanth Menon * BL3-1 specific defines. 841841c533SNishanth Menon * 851841c533SNishanth Menon * Put BL3-1 at the base of the Trusted SRAM, before SHARED_RAM. 861841c533SNishanth Menon */ 871841c533SNishanth Menon #define BL31_BASE SEC_SRAM_BASE 881841c533SNishanth Menon #define BL31_SIZE (SEC_SRAM_SIZE - SHARED_RAM_SIZE) 891841c533SNishanth Menon #define BL31_LIMIT (BL31_BASE + BL31_SIZE) 901841c533SNishanth Menon #define BL31_PROGBITS_LIMIT BL31_LIMIT 911841c533SNishanth Menon 921841c533SNishanth Menon /* 93e67bfcf3SNishanth Menon * Defines the maximum number of translation tables that are allocated by the 94e67bfcf3SNishanth Menon * translation table library code. To minimize the amount of runtime memory 95e67bfcf3SNishanth Menon * used, choose the smallest value needed to map the required virtual addresses 96e67bfcf3SNishanth Menon * for each BL stage. 97e67bfcf3SNishanth Menon */ 98e67bfcf3SNishanth Menon #define MAX_XLAT_TABLES 8 99e67bfcf3SNishanth Menon 100e67bfcf3SNishanth Menon /* 101e67bfcf3SNishanth Menon * Defines the maximum number of regions that are allocated by the translation 102e67bfcf3SNishanth Menon * table library code. A region consists of physical base address, virtual base 103e67bfcf3SNishanth Menon * address, size and attributes (Device/Memory, RO/RW, Secure/Non-Secure), as 104e67bfcf3SNishanth Menon * defined in the `mmap_region_t` structure. The platform defines the regions 105e67bfcf3SNishanth Menon * that should be mapped. Then, the translation table library will create the 106e67bfcf3SNishanth Menon * corresponding tables and descriptors at runtime. To minimize the amount of 107e67bfcf3SNishanth Menon * runtime memory used, choose the smallest value needed to register the 108e67bfcf3SNishanth Menon * required regions for each BL stage. 109e67bfcf3SNishanth Menon */ 110d76fdd33SAndrew F. Davis #define MAX_MMAP_REGIONS 11 111e67bfcf3SNishanth Menon 112e67bfcf3SNishanth Menon /* 113e67bfcf3SNishanth Menon * Defines the total size of the address space in bytes. For example, for a 32 114e67bfcf3SNishanth Menon * bit address space, this value should be `(1ull << 32)`. 115e67bfcf3SNishanth Menon */ 116e67bfcf3SNishanth Menon #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32) 117e67bfcf3SNishanth Menon #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32) 118e67bfcf3SNishanth Menon 119e67bfcf3SNishanth Menon /* 1201841c533SNishanth Menon * Some data must be aligned on the biggest cache line size in the platform. 1211841c533SNishanth Menon * This is known only to the platform as it might have a combination of 1221841c533SNishanth Menon * integrated and external caches. 1231841c533SNishanth Menon */ 1241841c533SNishanth Menon #define CACHE_WRITEBACK_SHIFT 6 1251841c533SNishanth Menon #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 1261841c533SNishanth Menon 127fff6ffcaSNishanth Menon /* Platform default console definitions */ 128fff6ffcaSNishanth Menon #ifndef K3_USART_BASE_ADDRESS 129fff6ffcaSNishanth Menon #define K3_USART_BASE_ADDRESS 0x02800000 130fff6ffcaSNishanth Menon #endif 131fff6ffcaSNishanth Menon 132fff6ffcaSNishanth Menon /* USART has a default size for address space */ 133fff6ffcaSNishanth Menon #define K3_USART_SIZE 0x1000 134fff6ffcaSNishanth Menon 135fff6ffcaSNishanth Menon #ifndef K3_USART_CLK_SPEED 136fff6ffcaSNishanth Menon #define K3_USART_CLK_SPEED 48000000 137fff6ffcaSNishanth Menon #endif 138fff6ffcaSNishanth Menon 139fff6ffcaSNishanth Menon #ifndef K3_USART_BAUD 140fff6ffcaSNishanth Menon #define K3_USART_BAUD 115200 141fff6ffcaSNishanth Menon #endif 142fff6ffcaSNishanth Menon 143fff6ffcaSNishanth Menon /* Crash console defaults */ 144fff6ffcaSNishanth Menon #define CRASH_CONSOLE_BASE K3_USART_BASE_ADDRESS 145fff6ffcaSNishanth Menon #define CRASH_CONSOLE_CLK K3_USART_CLK_SPEED 146fff6ffcaSNishanth Menon #define CRASH_CONSOLE_BAUD_RATE K3_USART_BAUD 147fff6ffcaSNishanth Menon 148e9cb89cfSNishanth Menon /* Timer frequency */ 149e9cb89cfSNishanth Menon #ifndef SYS_COUNTER_FREQ_IN_TICKS 150e9cb89cfSNishanth Menon #define SYS_COUNTER_FREQ_IN_TICKS 200000000 151e9cb89cfSNishanth Menon #endif 152e9cb89cfSNishanth Menon 15374e8cf48SNishanth Menon /* Interrupt numbers */ 15474e8cf48SNishanth Menon #define ARM_IRQ_SEC_PHY_TIMER 29 15574e8cf48SNishanth Menon 15674e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_0 8 15774e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_1 9 15874e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_2 10 15974e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_3 11 16074e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_4 12 16174e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_5 13 16274e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_6 14 16374e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_7 15 16474e8cf48SNishanth Menon 16574e8cf48SNishanth Menon /* 16674e8cf48SNishanth Menon * Define properties of Group 1 Secure and Group 0 interrupts as per GICv3 16774e8cf48SNishanth Menon * terminology. On a GICv2 system or mode, the lists will be merged and treated 16874e8cf48SNishanth Menon * as Group 0 interrupts. 16974e8cf48SNishanth Menon */ 17074e8cf48SNishanth Menon #define PLAT_ARM_G1S_IRQ_PROPS(grp) \ 17174e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \ 17274e8cf48SNishanth Menon GIC_INTR_CFG_LEVEL), \ 17374e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \ 17474e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 17574e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \ 17674e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 17774e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \ 17874e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 17974e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \ 18074e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 18174e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \ 18274e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 18374e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \ 18474e8cf48SNishanth Menon GIC_INTR_CFG_EDGE) 18574e8cf48SNishanth Menon 18674e8cf48SNishanth Menon #define PLAT_ARM_G0_IRQ_PROPS(grp) \ 18774e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \ 18874e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 18974e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \ 19074e8cf48SNishanth Menon GIC_INTR_CFG_EDGE) 19174e8cf48SNishanth Menon 19274e8cf48SNishanth Menon #define K3_GICD_BASE 0x01800000 19374e8cf48SNishanth Menon #define K3_GICD_SIZE 0x10000 19474e8cf48SNishanth Menon #define K3_GICR_BASE 0x01880000 19574e8cf48SNishanth Menon #define K3_GICR_SIZE 0x100000 19674e8cf48SNishanth Menon 197d76fdd33SAndrew F. Davis #define SEC_PROXY_DATA_BASE 0x32C00000 198d76fdd33SAndrew F. Davis #define SEC_PROXY_DATA_SIZE 0x80000 199d76fdd33SAndrew F. Davis #define SEC_PROXY_SCFG_BASE 0x32800000 200d76fdd33SAndrew F. Davis #define SEC_PROXY_SCFG_SIZE 0x80000 201d76fdd33SAndrew F. Davis #define SEC_PROXY_RT_BASE 0x32400000 202d76fdd33SAndrew F. Davis #define SEC_PROXY_RT_SIZE 0x80000 203d76fdd33SAndrew F. Davis 204d76fdd33SAndrew F. Davis #define SEC_PROXY_TIMEOUT_US 1000000 205d76fdd33SAndrew F. Davis #define SEC_PROXY_MAX_MESSAGE_SIZE 56 206d76fdd33SAndrew F. Davis 207b5c2e1c4SAndrew F. Davis #define TI_SCI_HOST_ID 10 208b5c2e1c4SAndrew F. Davis #define TI_SCI_MAX_MESSAGE_SIZE 52 209b5c2e1c4SAndrew F. Davis 210c3cf06f1SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 211