blob: 7d85059914dae3f50ac97fb387e31691223b18b0 [file] [log] [blame]
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03001/*
2 * Copyright (C) 2018 Marvell International Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 * https://spdx.org/licenses
6 */
7
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00008#ifndef PLATFORM_DEF_H
9#define PLATFORM_DEF_H
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030010
Julius Werner53456fc2019-07-09 13:49:11 -070011#ifndef __ASSEMBLER__
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030012#include <stdio.h>
Julius Werner53456fc2019-07-09 13:49:11 -070013#endif /* __ASSEMBLER__ */
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030014
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000015#include <common/interrupt_props.h>
16#include <drivers/arm/gic_common.h>
17
18#include <board_marvell_def.h>
19#include <mvebu_def.h>
20
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030021/*
22 * Most platform porting definitions provided by included headers
23 */
24
25/*
26 * DRAM Memory layout:
27 * +-----------------------+
28 * : :
29 * : Linux :
30 * 0x04X00000-->+-----------------------+
31 * | BL3-3(u-boot) |>>}>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
32 * |-----------------------| } |
33 * | BL3-[0,1, 2] | }---------------------------------> |
34 * |-----------------------| } || |
35 * | BL2 | }->FIP (loaded by || |
36 * |-----------------------| } BootROM to DRAM) || |
37 * | FIP_TOC | } || |
38 * 0x04120000-->|-----------------------| || |
39 * | BL1 (RO) | || |
40 * 0x04100000-->+-----------------------+ || |
41 * : : || |
42 * : Trusted SRAM section : \/ |
43 * 0x04040000-->+-----------------------+ Replaced by BL2 +----------------+ |
44 * | BL1 (RW) | <<<<<<<<<<<<<<<< | BL3-1 NOBITS | |
45 * 0x04037000-->|-----------------------| <<<<<<<<<<<<<<<< |----------------| |
46 * | | <<<<<<<<<<<<<<<< | BL3-1 PROGBITS | |
47 * 0x04023000-->|-----------------------| +----------------+ |
48 * | BL2 | |
49 * |-----------------------| |
50 * | | |
51 * 0x04001000-->|-----------------------| |
52 * | Shared | |
53 * 0x04000000-->+-----------------------+ |
54 * : : |
55 * : Linux : |
56 * : : |
57 * |-----------------------| |
58 * | | U-Boot(BL3-3) Loaded by BL2 |
59 * | U-Boot | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
60 * 0x00000000-->+-----------------------+
61 *
62 * Trusted SRAM section 0x4000000..0x4200000:
63 * ----------------------------------------
64 * SRAM_BASE = 0x4001000
65 * BL2_BASE = 0x4006000
66 * BL2_LIMIT = BL31_BASE
67 * BL31_BASE = 0x4023000 = (64MB + 256KB - 0x1D000)
68 * BL31_PROGBITS_LIMIT = BL1_RW_BASE
69 * BL1_RW_BASE = 0x4037000 = (64MB + 256KB - 0x9000)
70 * BL1_RW_LIMIT = BL31_LIMIT = 0x4040000
71 *
72 *
73 * PLAT_MARVELL_FIP_BASE = 0x4120000
74 */
75
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030076#define PLAT_MARVELL_SRAM_BASE 0xFFE1C048
77#define PLAT_MARVELL_SRAM_END 0xFFE78000
78
79#define PLAT_MARVELL_ATF_BASE 0x4000000
80#define PLAT_MARVELL_ATF_LOAD_ADDR (PLAT_MARVELL_ATF_BASE + \
81 0x100000)
82
83#define PLAT_MARVELL_FIP_BASE (PLAT_MARVELL_ATF_LOAD_ADDR + \
84 0x20000)
85#define PLAT_MARVELL_FIP_MAX_SIZE 0x4000000
86
87#define PLAT_MARVELL_NORTHB_COUNT 1
88
Deepika Bhavnanibd01be62019-12-13 10:50:07 -060089#define PLAT_MARVELL_CLUSTER_COUNT U(2)
90#define PLAT_MARVELL_CLUSTER_CORE_COUNT U(2)
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030091
92#define PLAT_MARVELL_CORE_COUNT (PLAT_MARVELL_CLUSTER_COUNT * \
93 PLAT_MARVELL_CLUSTER_CORE_COUNT)
94
Stefan Chulski44dad222019-06-24 19:13:38 +030095#define PLAT_MAX_CPUS_PER_CLUSTER PLAT_MARVELL_CLUSTER_CORE_COUNT
96
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +020097/* Part of DRAM that is used as Trusted ROM */
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030098#define PLAT_MARVELL_TRUSTED_ROM_BASE PLAT_MARVELL_ATF_LOAD_ADDR
Marcin Wojtasd2a19cc2020-06-19 17:51:08 +020099/* 4 MB for FIP image */
100#define PLAT_MARVELL_TRUSTED_ROM_SIZE 0x00400000
Konstantin Porotchkin28503262019-04-15 16:32:59 +0300101/* Reserve 12MB for SCP (Secure PayLoad) Trusted RAM
102 * OP-TEE 4MB SHMEM follows this region
Konstantin Porotchkinb5fa64a2019-04-15 16:25:59 +0300103 */
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +0200104#define PLAT_MARVELL_TRUSTED_RAM_BASE 0x04400000
Konstantin Porotchkinb5fa64a2019-04-15 16:25:59 +0300105#define PLAT_MARVELL_TRUSTED_RAM_SIZE 0x00C00000 /* 12 MB DRAM */
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +0200106
Konstantin Porotchkin28503262019-04-15 16:32:59 +0300107#define PLAT_MARVELL_LLC_SRAM_BASE 0x05400000
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +0200108#define PLAT_MARVELL_LLC_SRAM_SIZE 0x00100000 /* 1 MB SRAM */
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300109
110/*
111 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
112 * plus a little space for growth.
113 */
114#define PLAT_MARVELL_MAX_BL1_RW_SIZE 0xA000
115
116/*
117 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
118 * little space for growth.
119 */
120#define PLAT_MARVELL_MAX_BL2_SIZE 0xF000
121
122/*
123 * PLAT_ARM_MAX_BL31_SIZE is calculated using the current BL31 debug size plus a
124 * little space for growth.
125 */
126#define PLAT_MARVEL_MAX_BL31_SIZE 0x5D000
127
128#define PLAT_MARVELL_CPU_ENTRY_ADDR BL1_RO_BASE
129
130/* GIC related definitions */
131#define PLAT_MARVELL_GICD_BASE (MVEBU_REGS_BASE + MVEBU_GICD_BASE)
132#define PLAT_MARVELL_GICC_BASE (MVEBU_REGS_BASE + MVEBU_GICC_BASE)
133
134#define PLAT_MARVELL_G0_IRQ_PROPS(grp) \
135 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
136 GIC_INTR_CFG_LEVEL), \
137 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
Marcin Wojtas0c60c2f2018-03-21 09:59:59 +0100138 GIC_INTR_CFG_LEVEL), \
139 INTR_PROP_DESC(MARVELL_IRQ_PIC0, GIC_HIGHEST_SEC_PRIORITY, grp, \
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300140 GIC_INTR_CFG_LEVEL)
141
142#define PLAT_MARVELL_G1S_IRQ_PROPS(grp) \
143 INTR_PROP_DESC(MARVELL_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, \
144 grp, GIC_INTR_CFG_LEVEL), \
145 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
146 GIC_INTR_CFG_LEVEL), \
147 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
148 GIC_INTR_CFG_LEVEL), \
149 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
150 GIC_INTR_CFG_LEVEL), \
151 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
152 GIC_INTR_CFG_LEVEL), \
153 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
154 GIC_INTR_CFG_LEVEL), \
155 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
156 GIC_INTR_CFG_LEVEL)
157
158#define PLAT_MARVELL_SHARED_RAM_CACHED 1
159
160/*
161 * Load address of BL3-3 for this platform port
162 */
163#define PLAT_MARVELL_NS_IMAGE_OFFSET 0x0
164
165/* System Reference Clock*/
166#define PLAT_REF_CLK_IN_HZ COUNTER_FREQUENCY
167
168/*
169 * PL011 related constants
170 */
171#define PLAT_MARVELL_BOOT_UART_BASE (MVEBU_REGS_BASE + 0x512000)
172#define PLAT_MARVELL_BOOT_UART_CLK_IN_HZ 200000000
173
174#define PLAT_MARVELL_CRASH_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
175#define PLAT_MARVELL_CRASH_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
176
177#define PLAT_MARVELL_BL31_RUN_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
178#define PLAT_MARVELL_BL31_RUN_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
179
180/* Recovery image enable */
181#define PLAT_RECOVERY_IMAGE_ENABLE 0
182
183/* Required platform porting definitions */
184#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
185
186/* System timer related constants */
187#define PLAT_MARVELL_NSTIMER_FRAME_ID 1
188
189/* Mailbox base address (note the lower memory space
190 * is reserved for BLE data)
191 */
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +0200192#define PLAT_MARVELL_MAILBOX_BASE (MARVELL_SHARED_RAM_BASE \
193 + 0x400)
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300194#define PLAT_MARVELL_MAILBOX_SIZE 0x100
195#define PLAT_MARVELL_MAILBOX_MAGIC_NUM 0x6D72766C /* mrvl */
196
197/* Securities */
198#define IRQ_SEC_OS_TICK_INT MARVELL_IRQ_SEC_PHY_TIMER
199
Marcin Wojtas0c60c2f2018-03-21 09:59:59 +0100200#define MVEBU_PMU_IRQ_WA
201
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000202#endif /* PLATFORM_DEF_H */