blob: e07e98685b83758d7e0e9be1d9cbc51eca8c6f21 [file] [log] [blame]
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +03001/*
Marek Behún5fd234e2021-01-07 21:52:44 +01002 * Copyright (C) 2016-2021 Marvell International Ltd.
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +03003 *
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 Porotchkine7be6e22018-10-08 16:53:09 +030010
Julius Werner53456fc2019-07-09 13:49:11 -070011#ifndef __ASSEMBLER__
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030012#include <stdio.h>
Julius Werner53456fc2019-07-09 13:49:11 -070013#endif /* __ASSEMBLER__ */
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030014
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000015#include <board_marvell_def.h>
16#include <mvebu_def.h>
17
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030018/*
19 * Most platform porting definitions provided by included headers
20 */
21
22/*
23 * DRAM Memory layout:
24 * +-----------------------+
25 * : :
26 * : Linux :
27 * 0x04X00000-->+-----------------------+
28 * | BL3-3(u-boot) |>>}>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
29 * |-----------------------| } |
30 * | BL3-[0,1, 2] | }---------------------------------> |
31 * |-----------------------| } || |
32 * | BL2 | }->FIP (loaded by || |
33 * |-----------------------| } BootROM to DRAM) || |
34 * | FIP_TOC | } || |
35 * 0x04120000-->|-----------------------| || |
36 * | BL1 (RO) | || |
37 * 0x04100000-->+-----------------------+ || |
38 * : : || |
39 * : Trusted SRAM section : \/ |
40 * 0x04040000-->+-----------------------+ Replaced by BL2 +----------------+ |
41 * | BL1 (RW) | <<<<<<<<<<<<<<<< | BL3-1 NOBITS | |
42 * 0x04037000-->|-----------------------| <<<<<<<<<<<<<<<< |----------------| |
43 * | | <<<<<<<<<<<<<<<< | BL3-1 PROGBITS | |
44 * 0x04023000-->|-----------------------| +----------------+ |
45 * | BL2 | |
46 * |-----------------------| |
47 * | | |
48 * 0x04001000-->|-----------------------| |
49 * | Shared | |
50 * 0x04000000-->+-----------------------+ |
51 * : : |
52 * : Linux : |
53 * : : |
54 * |-----------------------| |
55 * | | U-Boot(BL3-3) Loaded by BL2 |
56 * | U-Boot | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
57 * 0x00000000-->+-----------------------+
58 *
59 * Trusted SRAM section 0x4000000..0x4200000:
60 * ----------------------------------------
61 * SRAM_BASE = 0x4001000
62 * BL2_BASE = 0x4006000
63 * BL2_LIMIT = BL31_BASE
64 * BL31_BASE = 0x4023000 = (64MB + 256KB - 0x1D000)
65 * BL31_PROGBITS_LIMIT = BL1_RW_BASE
66 * BL1_RW_BASE = 0x4037000 = (64MB + 256KB - 0x9000)
67 * BL1_RW_LIMIT = BL31_LIMIT = 0x4040000
68 *
69 *
70 * PLAT_MARVELL_FIP_BASE = 0x4120000
71 */
72
Konstantin Porotchkina3ae7fa2019-08-27 16:21:10 +030073/*
74 * Since BL33 is loaded by BL2 (and validated by BL31) to DRAM offset 0,
75 * it is allowed to load/copy images to 'NULL' pointers
76 */
77#if defined(IMAGE_BL2) || defined(IMAGE_BL31)
78#define PLAT_ALLOW_ZERO_ADDR_COPY
79#endif
80
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030081#define PLAT_MARVELL_ATF_BASE 0x4000000
82#define PLAT_MARVELL_ATF_LOAD_ADDR \
83 (PLAT_MARVELL_ATF_BASE + 0x100000)
84
85#define PLAT_MARVELL_FIP_BASE \
86 (PLAT_MARVELL_ATF_LOAD_ADDR + 0x20000)
87#define PLAT_MARVELL_FIP_MAX_SIZE 0x4000000
88
Deepika Bhavnanibd01be62019-12-13 10:50:07 -060089#define PLAT_MARVELL_CLUSTER_CORE_COUNT U(2)
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030090/* DRAM[2MB..66MB] is used as Trusted ROM */
91#define PLAT_MARVELL_TRUSTED_ROM_BASE PLAT_MARVELL_ATF_LOAD_ADDR
Marcin Wojtasd2a19cc2020-06-19 17:51:08 +020092/* 4 MB for FIP image */
93#define PLAT_MARVELL_TRUSTED_ROM_SIZE 0x00400000
Konstantin Porotchkinb5fa64a2019-04-15 16:25:59 +030094/* Reserve 12M for SCP (Secure PayLoad) Trusted RAM
95 * OP-TEE SHMEM follows this region
96 */
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +020097#define PLAT_MARVELL_TRUSTED_RAM_BASE 0x04400000
Konstantin Porotchkinb5fa64a2019-04-15 16:25:59 +030098#define PLAT_MARVELL_TRUSTED_RAM_SIZE 0x00C00000 /* 12 MB DRAM */
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030099
100/*
101 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
102 * plus a little space for growth.
103 */
104#define PLAT_MARVELL_MAX_BL1_RW_SIZE 0xA000
105
106/*
107 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
108 * little space for growth.
109 */
110#define PLAT_MARVELL_MAX_BL2_SIZE 0xF000
111
112/*
113 * PLAT_ARM_MAX_BL31_SIZE is calculated using the current BL31 debug size plus a
114 * little space for growth.
115 */
116#define PLAT_MARVEL_MAX_BL31_SIZE 0x5D000
117
118#define PLAT_MARVELL_CPU_ENTRY_ADDR BL1_RO_BASE
119
120/* GIC related definitions */
121#define PLAT_MARVELL_GICD_BASE (MVEBU_REGS_BASE + MVEBU_GICD_BASE)
122#define PLAT_MARVELL_GICR_BASE (MVEBU_REGS_BASE + MVEBU_GICR_BASE)
123#define PLAT_MARVELL_GICC_BASE (MVEBU_REGS_BASE + MVEBU_GICC_BASE)
124
125#define PLAT_MARVELL_G0_IRQ_PROPS(grp) \
126 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
127 GIC_INTR_CFG_LEVEL), \
128 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
129 GIC_INTR_CFG_LEVEL)
130
131#define PLAT_MARVELL_G1S_IRQ_PROPS(grp) \
132 INTR_PROP_DESC(MARVELL_IRQ_SEC_PHY_TIMER, \
133 GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
134 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
135 GIC_INTR_CFG_LEVEL), \
136 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
137 GIC_INTR_CFG_LEVEL), \
138 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
139 GIC_INTR_CFG_LEVEL), \
140 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
141 GIC_INTR_CFG_LEVEL), \
142 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
143 GIC_INTR_CFG_LEVEL), \
144 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
145 GIC_INTR_CFG_LEVEL)
146
147
148#define PLAT_MARVELL_SHARED_RAM_CACHED 1
149
150/* CCI related constants */
Marek Behún5fd234e2021-01-07 21:52:44 +0100151#define PLAT_MARVELL_CCI_BASE MVEBU_CCI_BASE
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +0300152#define PLAT_MARVELL_CCI_CLUSTER0_SL_IFACE_IX 3
153#define PLAT_MARVELL_CCI_CLUSTER1_SL_IFACE_IX 4
154
155/*
156 * Load address of BL3-3 for this platform port
157 */
158#define PLAT_MARVELL_NS_IMAGE_OFFSET 0x0
159
160/* System Reference Clock*/
161#define PLAT_REF_CLK_IN_HZ COUNTER_FREQUENCY
162
163/*
164 * PL011 related constants
165 */
166#define PLAT_MARVELL_BOOT_UART_BASE (MVEBU_REGS_BASE + 0x12000)
Pali Rohár2666c1e2021-05-13 14:53:44 +0200167#define PLAT_MARVELL_BOOT_UART_CLK_IN_HZ 25000000
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +0300168
169#define PLAT_MARVELL_CRASH_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
170#define PLAT_MARVELL_CRASH_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
171
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +0300172/* Required platform porting definitions */
173#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
174
175/* System timer related constants */
176#define PLAT_MARVELL_NSTIMER_FRAME_ID 1
177
178/* Mailbox base address */
Konstantin Porotchkin5f8630b2020-06-19 17:48:48 +0200179#define PLAT_MARVELL_MAILBOX_BASE (MARVELL_SHARED_RAM_BASE + 0x400)
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +0300180#define PLAT_MARVELL_MAILBOX_SIZE 0x100
181#define PLAT_MARVELL_MAILBOX_MAGIC_NUM 0x6D72766C /* mrvl */
182
183/* DRAM CS memory map registers related constants */
184#define MVEBU_CS_MMAP_LOW(cs_num) \
185 (MVEBU_CS_MMAP_REG_BASE + (cs_num) * 0x8)
186#define MVEBU_CS_MMAP_ENABLE 0x1
187#define MVEBU_CS_MMAP_AREA_LEN_OFFS 16
188#define MVEBU_CS_MMAP_AREA_LEN_MASK \
189 (0x1f << MVEBU_CS_MMAP_AREA_LEN_OFFS)
190#define MVEBU_CS_MMAP_START_ADDR_LOW_OFFS 23
191#define MVEBU_CS_MMAP_START_ADDR_LOW_MASK \
192 (0x1ff << MVEBU_CS_MMAP_START_ADDR_LOW_OFFS)
193
194#define MVEBU_CS_MMAP_HIGH(cs_num) \
195 (MVEBU_CS_MMAP_REG_BASE + 0x4 + (cs_num) * 0x8)
196
197/* DRAM max CS number */
198#define MVEBU_MAX_CS_MMAP_NUM (2)
199
200/* CPU decoder window related constants */
201#define CPU_DEC_WIN_CTRL_REG(win_num) \
202 (MVEBU_CPU_DEC_WIN_REG_BASE + (win_num) * 0x10)
203#define CPU_DEC_CR_WIN_ENABLE 0x1
204#define CPU_DEC_CR_WIN_TARGET_OFFS 4
205#define CPU_DEC_CR_WIN_TARGET_MASK \
206 (0xf << CPU_DEC_CR_WIN_TARGET_OFFS)
207
208#define CPU_DEC_WIN_SIZE_REG(win_num) \
209 (MVEBU_CPU_DEC_WIN_REG_BASE + 0x4 + (win_num) * 0x10)
210#define CPU_DEC_CR_WIN_SIZE_OFFS 0
211#define CPU_DEC_CR_WIN_SIZE_MASK \
212 (0xffff << CPU_DEC_CR_WIN_SIZE_OFFS)
213#define CPU_DEC_CR_WIN_SIZE_ALIGNMENT 0x10000
214
215#define CPU_DEC_WIN_BASE_REG(win_num) \
216 (MVEBU_CPU_DEC_WIN_REG_BASE + 0x8 + (win_num) * 0x10)
217#define CPU_DEC_BR_BASE_OFFS 0
218#define CPU_DEC_BR_BASE_MASK \
219 (0xffff << CPU_DEC_BR_BASE_OFFS)
220
221#define CPU_DEC_REMAP_LOW_REG(win_num) \
222 (MVEBU_CPU_DEC_WIN_REG_BASE + 0xC + (win_num) * 0x10)
223#define CPU_DEC_RLR_REMAP_LOW_OFFS 0
224#define CPU_DEC_RLR_REMAP_LOW_MASK \
225 (0xffff << CPU_DEC_BR_BASE_OFFS)
226
Marek Behún5fd234e2021-01-07 21:52:44 +0100227#define CPU_DEC_CCI_BASE_REG (MVEBU_CPU_DEC_WIN_REG_BASE + 0xe0)
228
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +0300229/* Securities */
230#define IRQ_SEC_OS_TICK_INT MARVELL_IRQ_SEC_PHY_TIMER
231
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000232#endif /* PLATFORM_DEF_H */