| Varun Wadekar | 4d0dcc8 | 2020-06-25 19:39:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <utils_def.h> |
| 9 | |
| 10 | /******************************************************************************* |
| 11 | * Platform definitions used by common code |
| 12 | ******************************************************************************/ |
| 13 | |
| 14 | #ifndef PLATFORM_DEF_H |
| 15 | #define PLATFORM_DEF_H |
| 16 | |
| 17 | /******************************************************************************* |
| 18 | * Platform binary types for linking |
| 19 | ******************************************************************************/ |
| 20 | #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" |
| 21 | #define PLATFORM_LINKER_ARCH aarch64 |
| 22 | |
| 23 | /******************************************************************************* |
| 24 | * Tegra DRAM memory base address |
| 25 | ******************************************************************************/ |
| 26 | #define DRAM_BASE U(0x80000000) |
| 27 | #define DRAM_END U(0xB0000000) |
| 28 | #define DRAM_SIZE (DRAM_END - DRAM_BASE) |
| 29 | |
| 30 | /******************************************************************************* |
| 31 | * Run-time address of the TFTF image. |
| 32 | * It has to match the location where the Trusted Firmware-A loads the BL33 |
| 33 | * image. |
| 34 | ******************************************************************************/ |
| 35 | #define TFTF_BASE 0x80080000 |
| 36 | |
| 37 | /******************************************************************************* |
| 38 | * Generic platform constants |
| 39 | ******************************************************************************/ |
| 40 | |
| 41 | /* Translation table constants */ |
| 42 | #define MAX_XLAT_TABLES 10 |
| 43 | #define MAX_MMAP_REGIONS 15 |
| 44 | |
| 45 | /* stack memory available to each CPU */ |
| 46 | #define PLATFORM_STACK_SIZE 0x1400 |
| 47 | #define PCPU_DV_MEM_STACK_SIZE 0x100 |
| 48 | |
| 49 | /* total number of system nodes implemented by the platform */ |
| 50 | #define PLATFORM_SYSTEM_COUNT 1 |
| 51 | |
| 52 | /* total number of clusters implemented by the platform */ |
| 53 | #define PLATFORM_CLUSTER_COUNT 1 |
| 54 | #define PLATFORM_CORES_PER_CLUSTER 4 |
| 55 | |
| 56 | /* total number of CPUs implemented by the platform across all clusters */ |
| 57 | #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER_COUNT * \ |
| 58 | PLATFORM_CORES_PER_CLUSTER) |
| 59 | |
| 60 | /* total number of nodes in the affinity hierarchy at all affinity levels */ |
| 61 | #define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \ |
| 62 | PLATFORM_CLUSTER_COUNT + \ |
| 63 | PLATFORM_CORE_COUNT) |
| 64 | |
| 65 | /* |
| 66 | * maximum number of affinity levels in the system that the platform |
| 67 | * implements |
| 68 | */ |
| 69 | #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2 |
| 70 | #define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL |
| 71 | |
| 72 | /* |
| 73 | * Defines the maximum number of power states at a power domain level for the |
| 74 | * platform. |
| 75 | */ |
| 76 | #define PLAT_MAX_PWR_STATES_PER_LVL 2 |
| 77 | |
| 78 | /* |
| 79 | * Defines the offset of the last Shared Peripheral Interrupt supported by the |
| 80 | * TF-A Tests on this platform. SPI numbers are mapped onto GIC interrupt IDs, |
| 81 | * starting from interrupt ID 32. This offset ID corresponds to the last SPI |
| 82 | * number, to which 32 must be added to get the corresponding last GIC IRQ ID. |
| 83 | */ |
| 84 | #define PLAT_MAX_SPI_OFFSET_ID 280 |
| 85 | |
| 86 | /* Local state bit width for each level in the state-ID field of power state */ |
| 87 | #define PLAT_LOCAL_PSTATE_WIDTH 4 |
| 88 | |
| 89 | /* |
| 90 | * We want to run without support for non-volatile memory and hence using a |
| 91 | * portion of DRAM as workaround. |
| 92 | */ |
| 93 | #define TFTF_NVM_OFFSET 0x0F900000 |
| 94 | #define TFTF_NVM_SIZE 0x00100000 |
| 95 | |
| 96 | /* |
| 97 | * Times (in ms) used by test code for completion of different events. |
| 98 | * Suspend entry time for debug build is high due to the time taken |
| 99 | * by the VERBOSE/INFO prints. The value considers the worst case scenario |
| 100 | * where all CPUs are going and coming out of suspend continuously. |
| 101 | */ |
| 102 | #define PLAT_SUSPEND_ENTRY_TIME 500 |
| 103 | #define PLAT_SUSPEND_ENTRY_EXIT_TIME 1000 |
| 104 | |
| Varun Wadekar | 4d0dcc8 | 2020-06-25 19:39:27 -0700 | [diff] [blame] | 105 | /******************************************************************************* |
| 106 | * Per-CPU Hypervisor Timer Interrupt ID |
| 107 | ******************************************************************************/ |
| 108 | #define IRQ_PCPU_HP_TIMER 26 |
| 109 | |
| 110 | /******************************************************************************* |
| 111 | * IRQ value for Tegra RTC |
| 112 | ******************************************************************************/ |
| 113 | #define TEGRA_RTC_IRQ U(34) |
| Anthony Zhou | c2d5a91 | 2022-04-22 20:07:15 +0800 | [diff] [blame] | 114 | #define IRQ_TWDOG_INTID TEGRA_RTC_IRQ |
| Varun Wadekar | 4d0dcc8 | 2020-06-25 19:39:27 -0700 | [diff] [blame] | 115 | |
| 116 | /******************************************************************************* |
| 117 | * Platform specific page table and MMU setup constants |
| 118 | ******************************************************************************/ |
| 119 | #define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 40) |
| 120 | #define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 40) |
| 121 | |
| 122 | /******************************************************************************* |
| 123 | * Used to align variables on the biggest cache line size in the platform. |
| 124 | * This is known only to the platform as it might have a combination of |
| 125 | * integrated and external caches. |
| 126 | ******************************************************************************/ |
| 127 | #define CACHE_WRITEBACK_SHIFT 6 |
| 128 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 129 | |
| 130 | /******************************************************************************* |
| 131 | * Platform console related constants |
| 132 | ******************************************************************************/ |
| 133 | #define TEGRA_CONSOLE_BAUDRATE U(115200) |
| 134 | #define TEGRA_CONSOLE_CLKRATE U(408000000) |
| 135 | |
| 136 | /******************************************************************************* |
| 137 | * Platform MMIO devices |
| 138 | ******************************************************************************/ |
| 139 | #define TEGRA_GICD_BASE U(0x50041000) |
| 140 | #define TEGRA_GICC_BASE U(0x50042000) |
| 141 | #define TEGRA_TIMERS_BASE U(0x60005000) |
| 142 | #define TEGRA_TMRUS_BASE U(0x60005010) |
| 143 | #define TEGRA_TMR0_BASE U(0x60005088) |
| 144 | #define TEGRA_WDT0_BASE U(0x60005100) |
| 145 | #define TEGRA_UARTA_BASE U(0x70006000) |
| 146 | #define TEGRA_RTC_BASE U(0x7000e000) |
| 147 | #define SYS_CNT_BASE1 TEGRA_TMRUS_BASE |
| 148 | |
| 149 | #ifndef __ASSEMBLER__ |
| 150 | |
| 151 | /* |
| 152 | * Platform functions |
| 153 | */ |
| 154 | void tegra_pwr_mgmt_setup(void); |
| 155 | void tegra_set_rtc_as_wakeup_source(void); |
| 156 | |
| 157 | #endif /* __ASSEMBLER__ */ |
| 158 | |
| 159 | #endif /* PLATFORM_DEF_H */ |