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> 1109d40e0eSAntonio Nino Diaz #include <plat/common/common_def.h> 1209d40e0eSAntonio 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 32a82bf5adSAndrew F. Davis #define PLATFORM_CLUSTER_COUNT ((K3_CLUSTER0_CORE_COUNT != 0) + \ 33a82bf5adSAndrew F. Davis (K3_CLUSTER1_CORE_COUNT != 0) + \ 34a82bf5adSAndrew F. Davis (K3_CLUSTER2_CORE_COUNT != 0) + \ 35a82bf5adSAndrew F. Davis (K3_CLUSTER3_CORE_COUNT != 0)) 3689574715SBenjamin Fair 3779a1a849SAndrew F. Davis #define PLAT_NUM_PWR_DOMAINS (PLATFORM_SYSTEM_COUNT + \ 3879a1a849SAndrew F. Davis PLATFORM_CLUSTER_COUNT + \ 391841c533SNishanth Menon PLATFORM_CORE_COUNT) 4079a1a849SAndrew F. Davis #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2 411841c533SNishanth Menon 421841c533SNishanth Menon /******************************************************************************* 431841c533SNishanth Menon * Memory layout constants 441841c533SNishanth Menon ******************************************************************************/ 451841c533SNishanth Menon 461841c533SNishanth Menon /* 471841c533SNishanth Menon * ARM-TF lives in SRAM, partition it here 4832e29fcbSAndrew F. Davis * 491841c533SNishanth Menon * BL3-1 specific defines. 501841c533SNishanth Menon * 5132e29fcbSAndrew F. Davis * Put BL3-1 at the base of the Trusted SRAM. 521841c533SNishanth Menon */ 531841c533SNishanth Menon #define BL31_BASE SEC_SRAM_BASE 5432e29fcbSAndrew F. Davis #define BL31_SIZE SEC_SRAM_SIZE 551841c533SNishanth Menon #define BL31_LIMIT (BL31_BASE + BL31_SIZE) 561841c533SNishanth Menon 571841c533SNishanth Menon /* 58e67bfcf3SNishanth Menon * Defines the maximum number of translation tables that are allocated by the 59e67bfcf3SNishanth Menon * translation table library code. To minimize the amount of runtime memory 60e67bfcf3SNishanth Menon * used, choose the smallest value needed to map the required virtual addresses 61e67bfcf3SNishanth Menon * for each BL stage. 62e67bfcf3SNishanth Menon */ 63e67bfcf3SNishanth Menon #define MAX_XLAT_TABLES 8 64e67bfcf3SNishanth Menon 65e67bfcf3SNishanth Menon /* 66e67bfcf3SNishanth Menon * Defines the maximum number of regions that are allocated by the translation 67e67bfcf3SNishanth Menon * table library code. A region consists of physical base address, virtual base 68e67bfcf3SNishanth Menon * address, size and attributes (Device/Memory, RO/RW, Secure/Non-Secure), as 69e67bfcf3SNishanth Menon * defined in the `mmap_region_t` structure. The platform defines the regions 70e67bfcf3SNishanth Menon * that should be mapped. Then, the translation table library will create the 71e67bfcf3SNishanth Menon * corresponding tables and descriptors at runtime. To minimize the amount of 72e67bfcf3SNishanth Menon * runtime memory used, choose the smallest value needed to register the 73e67bfcf3SNishanth Menon * required regions for each BL stage. 74e67bfcf3SNishanth Menon */ 75d76fdd33SAndrew F. Davis #define MAX_MMAP_REGIONS 11 76e67bfcf3SNishanth Menon 77e67bfcf3SNishanth Menon /* 78e67bfcf3SNishanth Menon * Defines the total size of the address space in bytes. For example, for a 32 79e67bfcf3SNishanth Menon * bit address space, this value should be `(1ull << 32)`. 80e67bfcf3SNishanth Menon */ 81e67bfcf3SNishanth Menon #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32) 82e67bfcf3SNishanth Menon #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32) 83e67bfcf3SNishanth Menon 84e67bfcf3SNishanth Menon /* 851841c533SNishanth Menon * Some data must be aligned on the biggest cache line size in the platform. 861841c533SNishanth Menon * This is known only to the platform as it might have a combination of 871841c533SNishanth Menon * integrated and external caches. 881841c533SNishanth Menon */ 891841c533SNishanth Menon #define CACHE_WRITEBACK_SHIFT 6 901841c533SNishanth Menon #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) 911841c533SNishanth Menon 92fff6ffcaSNishanth Menon /* Platform default console definitions */ 93a481f8b8SAndrew F. Davis #ifndef K3_USART_BASE 945621fe25SJan Kiszka #define K3_USART_BASE (0x02800000 + 0x10000 * K3_USART) 95fff6ffcaSNishanth Menon #endif 96fff6ffcaSNishanth Menon 97fff6ffcaSNishanth Menon /* USART has a default size for address space */ 98fff6ffcaSNishanth Menon #define K3_USART_SIZE 0x1000 99fff6ffcaSNishanth Menon 100fff6ffcaSNishanth Menon #ifndef K3_USART_CLK_SPEED 101fff6ffcaSNishanth Menon #define K3_USART_CLK_SPEED 48000000 102fff6ffcaSNishanth Menon #endif 103fff6ffcaSNishanth Menon 104fff6ffcaSNishanth Menon /* Crash console defaults */ 105a481f8b8SAndrew F. Davis #define CRASH_CONSOLE_BASE K3_USART_BASE 106fff6ffcaSNishanth Menon #define CRASH_CONSOLE_CLK K3_USART_CLK_SPEED 107fff6ffcaSNishanth Menon #define CRASH_CONSOLE_BAUD_RATE K3_USART_BAUD 108fff6ffcaSNishanth Menon 109e9cb89cfSNishanth Menon /* Timer frequency */ 110e9cb89cfSNishanth Menon #ifndef SYS_COUNTER_FREQ_IN_TICKS 111e9cb89cfSNishanth Menon #define SYS_COUNTER_FREQ_IN_TICKS 200000000 112e9cb89cfSNishanth Menon #endif 113e9cb89cfSNishanth Menon 11474e8cf48SNishanth Menon /* Interrupt numbers */ 11574e8cf48SNishanth Menon #define ARM_IRQ_SEC_PHY_TIMER 29 11674e8cf48SNishanth Menon 11774e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_0 8 11874e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_1 9 11974e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_2 10 12074e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_3 11 12174e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_4 12 12274e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_5 13 12374e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_6 14 12474e8cf48SNishanth Menon #define ARM_IRQ_SEC_SGI_7 15 12574e8cf48SNishanth Menon 12674e8cf48SNishanth Menon /* 12774e8cf48SNishanth Menon * Define properties of Group 1 Secure and Group 0 interrupts as per GICv3 12874e8cf48SNishanth Menon * terminology. On a GICv2 system or mode, the lists will be merged and treated 12974e8cf48SNishanth Menon * as Group 0 interrupts. 13074e8cf48SNishanth Menon */ 13174e8cf48SNishanth Menon #define PLAT_ARM_G1S_IRQ_PROPS(grp) \ 13274e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \ 13374e8cf48SNishanth Menon GIC_INTR_CFG_LEVEL), \ 13474e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \ 13574e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 13674e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \ 13774e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 13874e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \ 13974e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 14074e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \ 14174e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 14274e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \ 14374e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 14474e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \ 14574e8cf48SNishanth Menon GIC_INTR_CFG_EDGE) 14674e8cf48SNishanth Menon 14774e8cf48SNishanth Menon #define PLAT_ARM_G0_IRQ_PROPS(grp) \ 14874e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \ 14974e8cf48SNishanth Menon GIC_INTR_CFG_EDGE), \ 15074e8cf48SNishanth Menon INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \ 15174e8cf48SNishanth Menon GIC_INTR_CFG_EDGE) 15274e8cf48SNishanth Menon 1536a22d9eaSNishanth Menon 1546a22d9eaSNishanth Menon #define K3_GTC_BASE 0x00A90000 1556a22d9eaSNishanth Menon /* We just need 20 byte offset, but simpler to just remap the 64K page in */ 1566a22d9eaSNishanth Menon #define K3_GTC_SIZE 0x10000 1576a22d9eaSNishanth Menon #define K3_GTC_CNTCR_OFFSET 0x00 1586a22d9eaSNishanth Menon #define K3_GTC_CNTCR_EN_MASK 0x01 1596a22d9eaSNishanth Menon #define K3_GTC_CNTCR_HDBG_MASK 0x02 1606a22d9eaSNishanth Menon #define K3_GTC_CNTFID0_OFFSET 0x20 1616a22d9eaSNishanth Menon 162b5443284SAndrew F. Davis #define K3_GIC_BASE 0x01800000 163b5443284SAndrew F. Davis #define K3_GIC_SIZE 0x200000 16474e8cf48SNishanth Menon 165*7f323eb2SNishanth Menon #if !K3_SEC_PROXY_LITE 166d76fdd33SAndrew F. Davis #define SEC_PROXY_DATA_BASE 0x32C00000 167d76fdd33SAndrew F. Davis #define SEC_PROXY_DATA_SIZE 0x80000 168d76fdd33SAndrew F. Davis #define SEC_PROXY_SCFG_BASE 0x32800000 169d76fdd33SAndrew F. Davis #define SEC_PROXY_SCFG_SIZE 0x80000 170d76fdd33SAndrew F. Davis #define SEC_PROXY_RT_BASE 0x32400000 171d76fdd33SAndrew F. Davis #define SEC_PROXY_RT_SIZE 0x80000 172*7f323eb2SNishanth Menon #else 173*7f323eb2SNishanth Menon #define SEC_PROXY_DATA_BASE 0x4D000000 174*7f323eb2SNishanth Menon #define SEC_PROXY_DATA_SIZE 0x80000 175*7f323eb2SNishanth Menon #define SEC_PROXY_SCFG_BASE 0x4A400000 176*7f323eb2SNishanth Menon #define SEC_PROXY_SCFG_SIZE 0x80000 177*7f323eb2SNishanth Menon #define SEC_PROXY_RT_BASE 0x4A600000 178*7f323eb2SNishanth Menon #define SEC_PROXY_RT_SIZE 0x80000 179*7f323eb2SNishanth Menon #endif /* K3_SEC_PROXY_LITE */ 180d76fdd33SAndrew F. Davis 181d76fdd33SAndrew F. Davis #define SEC_PROXY_TIMEOUT_US 1000000 182d76fdd33SAndrew F. Davis #define SEC_PROXY_MAX_MESSAGE_SIZE 56 183d76fdd33SAndrew F. Davis 184b5c2e1c4SAndrew F. Davis #define TI_SCI_HOST_ID 10 185b5c2e1c4SAndrew F. Davis #define TI_SCI_MAX_MESSAGE_SIZE 52 186b5c2e1c4SAndrew F. Davis 187c3cf06f1SAntonio Nino Diaz #endif /* PLATFORM_DEF_H */ 188