2 * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
7 #ifndef __PLATFORM_DEF_H__
8 #define __PLATFORM_DEF_H__
10 /* Following two defines needed to makes use of shared PMC driver code */
15 #include <common_def.h>
16 #include <tbbr_img_def.h>
17 #include <bcm_map_part.h>
18 #include <bcm_mem_reserve.h>
20 #define PLAT_ARM_NS_IMAGE_BASE 0x0
22 #define PLATFORM_STACK_SIZE 0x1000
24 #define PLATFORM_MAX_CPUS_PER_CLUSTER 4
25 #define PLATFORM_CLUSTER_COUNT 1
26 #define PLATFORM_CLUSTER0_CORE_COUNT PLATFORM_MAX_CPUS_PER_CLUSTER
27 #define PLATFORM_CLUSTER1_CORE_COUNT 0
28 #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT + \
29 PLATFORM_CLUSTER1_CORE_COUNT)
31 #define BRCM_PRIMARY_CPU 0
33 #define PLAT_NUM_PWR_DOMAINS (PLATFORM_CLUSTER_COUNT + \
35 #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
37 #define PLAT_MAX_RET_STATE 1
38 #define PLAT_MAX_OFF_STATE 2
40 /* Local power state for power domains in Run state. */
41 #define PLAT_LOCAL_STATE_RUN 0
42 /* Local power state for retention. Valid only for CPU power domains */
43 #define PLAT_LOCAL_STATE_RET 1
45 * Local power state for OFF/power-down. Valid for CPU and cluster power
48 #define PLAT_LOCAL_STATE_OFF 2
51 * Macros used to parse state information from State-ID if it is using the
52 * recommended encoding for State-ID.
54 #define PLAT_LOCAL_PSTATE_WIDTH 4
55 #define PLAT_LOCAL_PSTATE_MASK ((1 << PLAT_LOCAL_PSTATE_WIDTH) - 1)
58 * Some data must be aligned on the biggest cache line size in the platform.
59 * This is known only to the platform as it might have a combination of
60 * integrated and external caches.
62 #define CACHE_WRITEBACK_SHIFT 6
63 #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
67 * BL3-1 specific defines.
69 * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the
70 * current BL3-1 debug size plus a little space for growth.
72 #define BL31_BASE (CFG_ATF_AREA_ADDR)
73 #define BL31_LIMIT (CFG_ATF_AREA_ADDR + CFG_ATF_AREA_SIZE)
76 #define PLAT_ARM_NS_IMAGE_OFFSET (0x0)
77 #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
78 #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
81 * BL3-2 specific defines.
85 #define BL32_BASE BL31_BASE
86 #define BL32_SIZE CFG_ATF_AREA_SIZE
87 #define BL32_LIMIT BL31_LIMIT
88 #define BL322_BASE (CFG_OPTEE_AREA_ADDR)
90 #define BL32_BASE (CFG_OPTEE_AREA_ADDR)
91 #define BL32_SIZE (CFG_OPTEE_AREA_SIZE)
92 #define BL32_LIMIT (CFG_OPTEE_AREA_ADDR + CFG_OPTEE_AREA_SIZE)
95 #define ADDR_SPACE_SIZE (1ull << 32)
96 #define MAX_MMAP_REGIONS 10
97 #define MAX_XLAT_TABLES 16
98 #define MAX_IO_DEVICES 3
99 #define MAX_IO_HANDLES 4
101 #if defined BOOTLUT_PHYS_BASE
103 #define BOOTLUT_BASE BOOTLUT_PHYS_BASE
105 #define BOOTLUT_BASE 0xffff0000
108 #if !defined(BOOTLUT_SIZE)
109 #define BOOTLUT_SIZE 0x1000
112 #if defined (BIUCFG_BASE)
114 #define BIUCFG_BASE (BIUCFG_PHYS_BASE + BIUCFG_OFFSET)
115 #elif defined (BIUCTRL_BASE)
117 #define BIUCTRL_BASE (URB_PHYS_BASE + URB_BIUCTRL_OFFSET)
118 #define BIUCTRL_SIZE URB_SIZE
121 #if defined (B15_CTRL_BASE)
123 #define B15_CTRL_BASE B15_CTRL_PHYS_BASE
124 #define B15_CTRL_SIZE 0x3000
128 #if defined (PLATFORM_FLAVOR_63158) || defined (PLATFORM_FLAVOR_63178) || defined (PLATFORM_FLAVOR_47622) || defined (PLATFORM_FLAVOR_6878) || defined (PLATFORM_FLAVOR_63146) || defined (PLATFORM_FLAVOR_4912) || defined (PLATFORM_FLAVOR_6756)
129 #define UART0_BASE 0xff812000
130 #elif defined (PLATFORM_FLAVOR_6858) || defined (PLATFORM_FLAVOR_6856) || defined (PLATFORM_FLAVOR_4908) || defined (PLATFORM_FLAVOR_6846)
131 #define UART0_BASE 0xff800000
132 #elif defined (PLATFORM_FLAVOR_63138) || defined (PLATFORM_FLAVOR_63148)
133 #define TIMR_BASE PERF_PHYS_BASE
134 #define TIMR_SIZE 0x10000
135 #define TIMR_OFFSET 0x80
138 /* 63138 and 63148 do not support PL011 UART.
139 UART is needed only for debug print.
140 For now, just use JTAG to debug these platforms.
142 #define UART0_BASE 0x0
144 #define UART0_SIZE 0x1000
145 #define UART0_CLK_IN_HZ (50 * 1000 * 1000)
149 #if defined (PMC_OFFSET)
150 #define PMC_BASE (PMC_PHYS_BASE + PMC_OFFSET)
152 #define PMC_BASE (PMC_PHYS_BASE)
155 #if defined(PROC_MON_BASE)
157 #if defined(PROC_MON_PHYS_BASE)
158 #define PROC_MON_BASE (PROC_MON_PHYS_BASE)
160 #define PROC_MON_BASE (PMC_PHYS_BASE + PROC_MON_OFFSET)
165 #define PMC_SIZE 0x00200000
167 #define PLAT_BCM_CRASH_UART_BASE UART0_BASE
168 #define PLAT_BCM_CRASH_UART_CLK_IN_HZ UART0_CLK_IN_HZ
169 #define PLAT_BCM_CONSOLE_BAUDRATE 115200
171 #define PLAT_ARM_CRASH_UART_BASE PLAT_BCM_CRASH_UART_BASE
172 #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_BCM_CRASH_UART_CLK_IN_HZ
173 #define ARM_CONSOLE_BAUDRATE PLAT_BCM_CONSOLE_BAUDRATE
175 #define DEVICE0_BASE 0x08000000
176 #define DEVICE0_SIZE 0x00021000
177 #define DEVICE1_BASE 0x09000000
178 #define DEVICE1_SIZE 0x00011000
181 #if defined(WDTIMR0_BASE)
183 #define WDTIMR0_BASE (PERF_PHYS_BASE+WDTIMR0_OFFSET)
184 #define WDTIMR_BASE (PERF_PHYS_BASE)
185 #define WDTIMR_SIZE 0x4000
189 * GIC related constants
195 #if defined (PLATFORM_FLAVOR_63138) || defined (PLATFORM_FLAVOR_63148)
196 #define GICD_BASE GICD_PHYS_BASE
197 #define GICC_BASE GICC_PHYS_BASE
198 #if defined (PLATFORM_FLAVOR_63138)
199 #define SCU_BASE SCU_PHYS_BASE
202 #define GICD_BASE (GIC_PHYS_BASE + GICD_OFFSET)
203 #define GICC_BASE (GIC_PHYS_BASE + GICC_OFFSET)
209 #define BRCM_IRQ_SEC_SGI_0 8
210 #define BRCM_IRQ_SEC_SGI_1 9
211 #define BRCM_IRQ_SEC_SGI_2 10
212 #define BRCM_IRQ_SEC_SGI_3 11
213 #define BRCM_IRQ_SEC_SGI_4 12
214 #define BRCM_IRQ_SEC_SGI_5 13
215 #define BRCM_IRQ_SEC_SGI_6 14
216 #define BRCM_IRQ_SEC_SGI_7 15
218 #if defined (PLATFORM_FLAVOR_63138)
219 #define PL310_BASE 0x8001D000
220 #define PL310_MAP_SIZE 0x00002000
223 #define SCU_BASE 0x8001E000
224 #define SCU_ERRATA744369 0x30
226 #define BIT32(nr) (1 << (nr))
230 #define PL310_LINE_SIZE 32
231 #define PL310_8_WAYS 8
234 #define PL310_CTRL 0x100
235 #define PL310_AUX_CTRL 0x104
236 #define PL310_TAG_RAM_CTRL 0x108
237 #define PL310_DATA_RAM_CTRL 0x10C
239 #define PL310_SYNC 0x730
240 #define PL310_INV_BY_WAY 0x77C
241 #define PL310_CLEAN_BY_WAY 0x7BC
242 #define PL310_FLUSH_BY_WAY 0x7FC
243 #define PL310_INV_BY_PA 0x770
244 #define PL310_CLEAN_BY_PA 0x7B0
245 #define PL310_FLUSH_BY_PA 0x7F0
246 #define PL310_FLUSH_BY_INDEXWAY 0x7F8
248 #define PL310_DCACHE_LOCKDOWN_BASE 0x900
249 #define PL310_ICACHE_LOCKDOWN_BASE 0x904
251 #define PL310_ADDR_FILT_START 0xC00
252 #define PL310_ADDR_FILT_END 0xC04
254 #define PL310_DEBUG_CTRL 0xF40
255 #define PL310_PREFETCH_CTRL 0xF60
256 #define PL310_POWER_CTRL 0xF80
258 #define PL310_CTRL_ENABLE_BIT BIT32(0)
259 #define PL310_AUX_16WAY_BIT BIT32(16)
262 * PL310 TAG RAM Control Register
264 * bit[10:8]:1 - 2 cycle of write accesses latency
265 * bit[6:4]:1 - 2 cycle of read accesses latency
266 * bit[2:0]:1 - 2 cycle of setup latency
268 #ifndef PL310_TAG_RAM_CTRL_INIT
269 #define PL310_TAG_RAM_CTRL_INIT 0x00000111
273 * PL310 DATA RAM Control Register
275 * bit[10:8]:2 - 3 cycle of write accesses latency
276 * bit[6:4]:2 - 3 cycle of read accesses latency
277 * bit[2:0]:2 - 3 cycle of setup latency
279 #ifndef PL310_DATA_RAM_CTRL_INIT
280 #define PL310_DATA_RAM_CTRL_INIT 0x00000111
284 * PL310 Auxiliary Control Register
286 * I/Dcache prefetch enabled (bit29:28=2b11)
287 * NS can access interrupts (bit27=1)
288 * NS can lockown cache lines (bit26=1)
289 * Pseudo-random replacement policy (bit25=0)
290 * Force write allocated (default)
291 * Shared attribute internally ignored (bit22=1, bit13=0)
292 * Parity disabled (bit21=0)
293 * Event monitor disabled (bit20=0)
294 * Platform fmavor specific way config (dual / quad):
295 * - 64kb way size (bit19:17=3b011)
296 * - 16-way associciativity (bit16=1)
297 * Platform fmavor specific way config (dual lite / solo):
298 * - 32kb way size (bit19:17=3b010)
299 * - no 16-way associciativity (bit16=0)
300 * Store buffer device limitation enabled (bit11=1)
301 * Cacheable accesses have high prio (bit10=0)
302 * Full Line Zero (FLZ) disabled (bit0=0)
305 #define PL310_AUX_CTRL_INIT 0x4e450001
308 * PL310 Prefetch Control Register
310 * Double linefill disabled (bit30=0)
311 * I/D prefetch enabled (bit29:28=2b11)
312 * Prefetch drop enabled (bit24=1)
313 * Incr double linefill disable (bit23=0)
314 * Prefetch offset = 7 (bit4:0)
316 #define PL310_PREFETCH_CTRL_INIT 0x31000007
319 * PL310 Power Register
321 * Dynamic clock gating enabled
322 * Standby mode enabled
324 #define PL310_POWER_CTRL_INIT 0x00000003
326 #define GICC_CTLR_OFFSET 0x0
327 #define GICC_PMR_OFFSET 0x4
328 #define GICD_CTLR_OFFSET 0x0
329 #define GICD_TYPER_OFFSET 0x4
330 #define GICD_IGROUPR0_OFFSET 0x80
337 #define SYS_COUNTER_FREQ_IN_TICKS (50 * 1000 * 1000)
339 #endif /* __PLATFORM_DEF_H__ */