blob: 81a383a72951a9b85c90b7010d2af0f9a0082708 [file] [log] [blame]
Nishanth Menon0192f892016-10-14 01:13:34 +00001/*
2 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef PLATFORM_DEF_H
8#define PLATFORM_DEF_H
Nishanth Menon0192f892016-10-14 01:13:34 +00009
10#include <arch.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011#include <plat/common/common_def.h>
12
Nishanth Menon0192f892016-10-14 01:13:34 +000013#include <board_def.h>
Nishanth Menon0192f892016-10-14 01:13:34 +000014
15/*******************************************************************************
16 * Generic platform constants
17 ******************************************************************************/
18
19/* Size of cacheable stack */
20#if IMAGE_BL31
21#define PLATFORM_STACK_SIZE 0x800
22#else
23#define PLATFORM_STACK_SIZE 0x1000
24#endif
25
Benjamin Fairf807a342016-10-18 14:32:06 -050026#define PLATFORM_SYSTEM_COUNT 1
27#define PLATFORM_CORE_COUNT (K3_CLUSTER0_CORE_COUNT + \
28 K3_CLUSTER1_CORE_COUNT + \
29 K3_CLUSTER2_CORE_COUNT + \
30 K3_CLUSTER3_CORE_COUNT)
31
Andrew F. Davisb208ae32019-03-27 09:37:10 -050032#define PLATFORM_CLUSTER_COUNT ((K3_CLUSTER0_CORE_COUNT != 0) + \
33 (K3_CLUSTER1_CORE_COUNT != 0) + \
34 (K3_CLUSTER2_CORE_COUNT != 0) + \
35 (K3_CLUSTER3_CORE_COUNT != 0))
Benjamin Fairf807a342016-10-18 14:32:06 -050036
Andrew F. Davis34d8b682018-06-25 12:10:53 -050037#define PLAT_NUM_PWR_DOMAINS (PLATFORM_SYSTEM_COUNT + \
38 PLATFORM_CLUSTER_COUNT + \
Nishanth Menon0192f892016-10-14 01:13:34 +000039 PLATFORM_CORE_COUNT)
Andrew F. Davis34d8b682018-06-25 12:10:53 -050040#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2
Nishanth Menon0192f892016-10-14 01:13:34 +000041
42/*******************************************************************************
43 * Memory layout constants
44 ******************************************************************************/
45
46/*
47 * ARM-TF lives in SRAM, partition it here
Andrew F. Davis9b9ac452019-01-22 14:00:16 -060048 *
Nishanth Menon0192f892016-10-14 01:13:34 +000049 * BL3-1 specific defines.
50 *
Andrew F. Davis9b9ac452019-01-22 14:00:16 -060051 * Put BL3-1 at the base of the Trusted SRAM.
Nishanth Menon0192f892016-10-14 01:13:34 +000052 */
53#define BL31_BASE SEC_SRAM_BASE
Andrew F. Davis9b9ac452019-01-22 14:00:16 -060054#define BL31_SIZE SEC_SRAM_SIZE
Nishanth Menon0192f892016-10-14 01:13:34 +000055#define BL31_LIMIT (BL31_BASE + BL31_SIZE)
Nishanth Menon0192f892016-10-14 01:13:34 +000056
57/*
Nishanth Menon3ed1b282016-10-14 01:13:45 +000058 * Defines the maximum number of translation tables that are allocated by the
59 * translation table library code. To minimize the amount of runtime memory
60 * used, choose the smallest value needed to map the required virtual addresses
61 * for each BL stage.
62 */
Nishanth Menon3a9ba662021-03-26 00:34:17 -050063#if USE_COHERENT_MEM
64#define MAX_XLAT_TABLES 10
65#else
66#define MAX_XLAT_TABLES 9
67#endif
Nishanth Menon3ed1b282016-10-14 01:13:45 +000068
69/*
70 * Defines the maximum number of regions that are allocated by the translation
71 * table library code. A region consists of physical base address, virtual base
72 * address, size and attributes (Device/Memory, RO/RW, Secure/Non-Secure), as
73 * defined in the `mmap_region_t` structure. The platform defines the regions
74 * that should be mapped. Then, the translation table library will create the
75 * corresponding tables and descriptors at runtime. To minimize the amount of
76 * runtime memory used, choose the smallest value needed to register the
77 * required regions for each BL stage.
78 */
Andrew F. Davis537d3ff2018-05-04 19:06:08 +000079#define MAX_MMAP_REGIONS 11
Nishanth Menon3ed1b282016-10-14 01:13:45 +000080
81/*
82 * Defines the total size of the address space in bytes. For example, for a 32
83 * bit address space, this value should be `(1ull << 32)`.
84 */
85#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32)
86#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32)
87
88/*
Nishanth Menon0192f892016-10-14 01:13:34 +000089 * Some data must be aligned on the biggest cache line size in the platform.
90 * This is known only to the platform as it might have a combination of
91 * integrated and external caches.
92 */
93#define CACHE_WRITEBACK_SHIFT 6
94#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
95
Nishanth Menonce976042016-10-14 01:13:44 +000096/* Platform default console definitions */
Andrew F. Davis42c277b2019-01-22 13:36:48 -060097#ifndef K3_USART_BASE
Jan Kiszkab99c0782020-05-20 07:35:48 +020098#define K3_USART_BASE (0x02800000 + 0x10000 * K3_USART)
Nishanth Menonce976042016-10-14 01:13:44 +000099#endif
100
101/* USART has a default size for address space */
102#define K3_USART_SIZE 0x1000
103
104#ifndef K3_USART_CLK_SPEED
105#define K3_USART_CLK_SPEED 48000000
106#endif
107
Nishanth Menonce976042016-10-14 01:13:44 +0000108/* Crash console defaults */
Andrew F. Davis42c277b2019-01-22 13:36:48 -0600109#define CRASH_CONSOLE_BASE K3_USART_BASE
Nishanth Menonce976042016-10-14 01:13:44 +0000110#define CRASH_CONSOLE_CLK K3_USART_CLK_SPEED
111#define CRASH_CONSOLE_BAUD_RATE K3_USART_BAUD
112
Nishanth Menon1f0b51b2016-10-14 01:13:48 +0000113/* Timer frequency */
114#ifndef SYS_COUNTER_FREQ_IN_TICKS
115#define SYS_COUNTER_FREQ_IN_TICKS 200000000
116#endif
117
Nishanth Menonf97ad372016-10-14 01:13:49 +0000118/* Interrupt numbers */
119#define ARM_IRQ_SEC_PHY_TIMER 29
120
121#define ARM_IRQ_SEC_SGI_0 8
122#define ARM_IRQ_SEC_SGI_1 9
123#define ARM_IRQ_SEC_SGI_2 10
124#define ARM_IRQ_SEC_SGI_3 11
125#define ARM_IRQ_SEC_SGI_4 12
126#define ARM_IRQ_SEC_SGI_5 13
127#define ARM_IRQ_SEC_SGI_6 14
128#define ARM_IRQ_SEC_SGI_7 15
129
130/*
131 * Define properties of Group 1 Secure and Group 0 interrupts as per GICv3
132 * terminology. On a GICv2 system or mode, the lists will be merged and treated
133 * as Group 0 interrupts.
134 */
135#define PLAT_ARM_G1S_IRQ_PROPS(grp) \
136 INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, grp, \
137 GIC_INTR_CFG_LEVEL), \
138 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
139 GIC_INTR_CFG_EDGE), \
140 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
141 GIC_INTR_CFG_EDGE), \
142 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
143 GIC_INTR_CFG_EDGE), \
144 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
145 GIC_INTR_CFG_EDGE), \
146 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
147 GIC_INTR_CFG_EDGE), \
148 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
149 GIC_INTR_CFG_EDGE)
150
151#define PLAT_ARM_G0_IRQ_PROPS(grp) \
152 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
153 GIC_INTR_CFG_EDGE), \
154 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
155 GIC_INTR_CFG_EDGE)
156
Nishanth Menon651ff1a2020-12-10 20:51:51 -0600157
158#define K3_GTC_BASE 0x00A90000
159/* We just need 20 byte offset, but simpler to just remap the 64K page in */
160#define K3_GTC_SIZE 0x10000
161#define K3_GTC_CNTCR_OFFSET 0x00
162#define K3_GTC_CNTCR_EN_MASK 0x01
163#define K3_GTC_CNTCR_HDBG_MASK 0x02
164#define K3_GTC_CNTFID0_OFFSET 0x20
165
Andrew F. Davis75ad53f2019-01-22 12:39:31 -0600166#define K3_GIC_BASE 0x01800000
167#define K3_GIC_SIZE 0x200000
Nishanth Menonf97ad372016-10-14 01:13:49 +0000168
Nishanth Menond32de842020-12-10 18:39:41 -0600169#if !K3_SEC_PROXY_LITE
Andrew F. Davis537d3ff2018-05-04 19:06:08 +0000170#define SEC_PROXY_DATA_BASE 0x32C00000
171#define SEC_PROXY_DATA_SIZE 0x80000
172#define SEC_PROXY_SCFG_BASE 0x32800000
173#define SEC_PROXY_SCFG_SIZE 0x80000
174#define SEC_PROXY_RT_BASE 0x32400000
175#define SEC_PROXY_RT_SIZE 0x80000
Nishanth Menond32de842020-12-10 18:39:41 -0600176#else
177#define SEC_PROXY_DATA_BASE 0x4D000000
178#define SEC_PROXY_DATA_SIZE 0x80000
179#define SEC_PROXY_SCFG_BASE 0x4A400000
180#define SEC_PROXY_SCFG_SIZE 0x80000
181#define SEC_PROXY_RT_BASE 0x4A600000
182#define SEC_PROXY_RT_SIZE 0x80000
183#endif /* K3_SEC_PROXY_LITE */
Andrew F. Davis537d3ff2018-05-04 19:06:08 +0000184
185#define SEC_PROXY_TIMEOUT_US 1000000
186#define SEC_PROXY_MAX_MESSAGE_SIZE 56
187
Andrew F. Davisa513b2a2018-05-04 19:06:09 +0000188#define TI_SCI_HOST_ID 10
189#define TI_SCI_MAX_MESSAGE_SIZE 52
190
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000191#endif /* PLATFORM_DEF_H */