blob: 76ebd609205f5059db36cf2eabed3b170caee114 [file] [log] [blame]
Varun Wadekardbf8a2f2020-06-23 08:13:57 -07001/*
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 0x80600000
36
37/*******************************************************************************
38 * Generic platform constants
39 ******************************************************************************/
40
41/* Translation table constants */
42#define MAX_XLAT_TABLES 20
43#define MAX_MMAP_REGIONS 20
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 2
54#define PLATFORM_CORES_CLUSTER0 2
55#define PLATFORM_CORES_CLUSTER1 4
56
57/* total number of CPUs implemented by the platform across all clusters */
58#define PLATFORM_CORE_COUNT (PLATFORM_CORES_CLUSTER0 + \
59 PLATFORM_CORES_CLUSTER1)
60
61/* total number of nodes in the affinity hierarchy at all affinity levels */
62#define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
63 PLATFORM_CLUSTER_COUNT + \
64 PLATFORM_CORE_COUNT)
65
66/*
67 * maximum number of affinity levels in the system that the platform
68 * implements
69 */
70#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
71#define PLAT_MAX_PWR_LEVEL PLATFORM_MAX_AFFLVL
72
73/*
74 * Defines the maximum number of power states at a power domain level for the
75 * platform.
76 */
77#define PLAT_MAX_PWR_STATES_PER_LVL 2
78
79/*
80 * Defines the offset of the last Shared Peripheral Interrupt supported by the
81 * TF-A Tests on this platform. SPI numbers are mapped onto GIC interrupt IDs,
82 * starting from interrupt ID 32. This offset ID corresponds to the last SPI
83 * number, to which 32 must be added to get the corresponding last GIC IRQ ID.
84 */
85#define PLAT_MAX_SPI_OFFSET_ID 280
86
87/* Local state bit width for each level in the state-ID field of power state */
88#define PLAT_LOCAL_PSTATE_WIDTH 4
89
90/*
91 * We want to run without support for non-volatile memory and hence using a
92 * portion of DRAM as workaround.
93 */
94#define TFTF_NVM_OFFSET 0x0FA00000
95#define TFTF_NVM_SIZE 0x10000000
96
97/*
98 * Times (in ms) used by test code for completion of different events.
99 * Suspend entry time for debug build is high due to the time taken
100 * by the VERBOSE/INFO prints. The value considers the worst case scenario
101 * where all CPUs are going and coming out of suspend continuously.
102 */
103#define PLAT_SUSPEND_ENTRY_TIME 500
104#define PLAT_SUSPEND_ENTRY_EXIT_TIME 1000
105
106/*******************************************************************************
Varun Wadekardbf8a2f2020-06-23 08:13:57 -0700107 * Per-CPU Hypervisor Timer Interrupt ID
108 ******************************************************************************/
109#define IRQ_PCPU_HP_TIMER 26
110
111/*******************************************************************************
anzhou79a4eaa2020-07-14 22:30:54 +0800112 * IRQ value for Tegra Timer0
113 ******************************************************************************/
114#define TEGRA_RTC_IRQ U(42)
Anthony Zhouc2d5a912022-04-22 20:07:15 +0800115#define IRQ_TWDOG_INTID TEGRA_RTC_IRQ
anzhou79a4eaa2020-07-14 22:30:54 +0800116
117/*******************************************************************************
Varun Wadekardbf8a2f2020-06-23 08:13:57 -0700118 * Platform specific page table and MMU setup constants
119 ******************************************************************************/
120#define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 40)
121#define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 40)
122
123/*******************************************************************************
124 * Used to align variables on the biggest cache line size in the platform.
125 * This is known only to the platform as it might have a combination of
126 * integrated and external caches.
127 ******************************************************************************/
128#define CACHE_WRITEBACK_SHIFT 6
129#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
130
131/*******************************************************************************
132 * Platform console related constants
133 ******************************************************************************/
134#define TEGRA_CONSOLE_BAUDRATE U(115200)
135#define TEGRA_CONSOLE_CLKRATE U(408000000)
136
137/*******************************************************************************
138 * Platform MMIO devices
139 ******************************************************************************/
140#define TEGRA_MC_BASE U(0x02C10000)
141#define TEGRA_TMR0_BASE U(0x03020000)
142#define TEGRA_WDT0_BASE U(0x030c0000)
143#define TEGRA_UARTA_BASE U(0x03100000)
144#define TEGRA_GICD_BASE U(0x03881000)
145#define TEGRA_GICC_BASE U(0x03882000)
146#define TEGRA_RTC_BASE U(0x0C2A0000)
147#define TEGRA_TMRUS_BASE U(0x0C2E0000)
148#define SYS_CNT_BASE1 TEGRA_TMRUS_BASE
149#define TEGRA_AOWAKE_BASE U(0x0C370000)
150#define TEGRA_SCRATCH_BASE U(0x0C390000)
151#define TEGRA_SMMU0_BASE U(0x12000000)
152
153#ifndef __ASSEMBLER__
154
155/*
156 * Platform functions
157 */
158void tegra_pwr_mgmt_setup(void);
159void tegra_set_rtc_as_wakeup_source(void);
160
161#endif /* __ASSEMBLER__ */
162
163#endif /* PLATFORM_DEF_H */