blob: e6660d407b268e9b4915490a3023b4fd40da8886 [file] [log] [blame]
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +03001/*
Deepika Bhavnanibd01be62019-12-13 10:50:07 -06002 * Copyright (C) 2016-2019 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
73#define PLAT_MARVELL_ATF_BASE 0x4000000
74#define PLAT_MARVELL_ATF_LOAD_ADDR \
75 (PLAT_MARVELL_ATF_BASE + 0x100000)
76
77#define PLAT_MARVELL_FIP_BASE \
78 (PLAT_MARVELL_ATF_LOAD_ADDR + 0x20000)
79#define PLAT_MARVELL_FIP_MAX_SIZE 0x4000000
80
Deepika Bhavnanibd01be62019-12-13 10:50:07 -060081#define PLAT_MARVELL_CLUSTER_CORE_COUNT U(2)
Konstantin Porotchkine7be6e22018-10-08 16:53:09 +030082/* DRAM[2MB..66MB] is used as Trusted ROM */
83#define PLAT_MARVELL_TRUSTED_ROM_BASE PLAT_MARVELL_ATF_LOAD_ADDR
84/* 64 MB TODO: reduce this to minimum needed according to fip image size*/
85#define PLAT_MARVELL_TRUSTED_ROM_SIZE 0x04000000
86/* Reserve 16M for SCP (Secure PayLoad) Trusted DRAM */
87#define PLAT_MARVELL_TRUSTED_DRAM_BASE 0x04400000
88#define PLAT_MARVELL_TRUSTED_DRAM_SIZE 0x01000000 /* 16 MB */
89
90/*
91 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
92 * plus a little space for growth.
93 */
94#define PLAT_MARVELL_MAX_BL1_RW_SIZE 0xA000
95
96/*
97 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
98 * little space for growth.
99 */
100#define PLAT_MARVELL_MAX_BL2_SIZE 0xF000
101
102/*
103 * PLAT_ARM_MAX_BL31_SIZE is calculated using the current BL31 debug size plus a
104 * little space for growth.
105 */
106#define PLAT_MARVEL_MAX_BL31_SIZE 0x5D000
107
108#define PLAT_MARVELL_CPU_ENTRY_ADDR BL1_RO_BASE
109
110/* GIC related definitions */
111#define PLAT_MARVELL_GICD_BASE (MVEBU_REGS_BASE + MVEBU_GICD_BASE)
112#define PLAT_MARVELL_GICR_BASE (MVEBU_REGS_BASE + MVEBU_GICR_BASE)
113#define PLAT_MARVELL_GICC_BASE (MVEBU_REGS_BASE + MVEBU_GICC_BASE)
114
115#define PLAT_MARVELL_G0_IRQ_PROPS(grp) \
116 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
117 GIC_INTR_CFG_LEVEL), \
118 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
119 GIC_INTR_CFG_LEVEL)
120
121#define PLAT_MARVELL_G1S_IRQ_PROPS(grp) \
122 INTR_PROP_DESC(MARVELL_IRQ_SEC_PHY_TIMER, \
123 GIC_HIGHEST_SEC_PRIORITY, grp, GIC_INTR_CFG_LEVEL), \
124 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
125 GIC_INTR_CFG_LEVEL), \
126 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
127 GIC_INTR_CFG_LEVEL), \
128 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
129 GIC_INTR_CFG_LEVEL), \
130 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
131 GIC_INTR_CFG_LEVEL), \
132 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
133 GIC_INTR_CFG_LEVEL), \
134 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
135 GIC_INTR_CFG_LEVEL)
136
137
138#define PLAT_MARVELL_SHARED_RAM_CACHED 1
139
140/* CCI related constants */
141#define PLAT_MARVELL_CCI_BASE (MVEBU_REGS_BASE + MVEBU_CCI_BASE)
142#define PLAT_MARVELL_CCI_CLUSTER0_SL_IFACE_IX 3
143#define PLAT_MARVELL_CCI_CLUSTER1_SL_IFACE_IX 4
144
145/*
146 * Load address of BL3-3 for this platform port
147 */
148#define PLAT_MARVELL_NS_IMAGE_OFFSET 0x0
149
150/* System Reference Clock*/
151#define PLAT_REF_CLK_IN_HZ COUNTER_FREQUENCY
152
153/*
154 * PL011 related constants
155 */
156#define PLAT_MARVELL_BOOT_UART_BASE (MVEBU_REGS_BASE + 0x12000)
157#define PLAT_MARVELL_BOOT_UART_CLK_IN_HZ 25804800
158
159#define PLAT_MARVELL_CRASH_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
160#define PLAT_MARVELL_CRASH_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
161
162#define PLAT_MARVELL_BL31_RUN_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
163#define PLAT_MARVELL_BL31_RUN_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
164
165/* Required platform porting definitions */
166#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
167
168/* System timer related constants */
169#define PLAT_MARVELL_NSTIMER_FRAME_ID 1
170
171/* Mailbox base address */
172#define PLAT_MARVELL_MAILBOX_BASE \
173 (MARVELL_TRUSTED_SRAM_BASE + 0x400)
174#define PLAT_MARVELL_MAILBOX_SIZE 0x100
175#define PLAT_MARVELL_MAILBOX_MAGIC_NUM 0x6D72766C /* mrvl */
176
177/* DRAM CS memory map registers related constants */
178#define MVEBU_CS_MMAP_LOW(cs_num) \
179 (MVEBU_CS_MMAP_REG_BASE + (cs_num) * 0x8)
180#define MVEBU_CS_MMAP_ENABLE 0x1
181#define MVEBU_CS_MMAP_AREA_LEN_OFFS 16
182#define MVEBU_CS_MMAP_AREA_LEN_MASK \
183 (0x1f << MVEBU_CS_MMAP_AREA_LEN_OFFS)
184#define MVEBU_CS_MMAP_START_ADDR_LOW_OFFS 23
185#define MVEBU_CS_MMAP_START_ADDR_LOW_MASK \
186 (0x1ff << MVEBU_CS_MMAP_START_ADDR_LOW_OFFS)
187
188#define MVEBU_CS_MMAP_HIGH(cs_num) \
189 (MVEBU_CS_MMAP_REG_BASE + 0x4 + (cs_num) * 0x8)
190
191/* DRAM max CS number */
192#define MVEBU_MAX_CS_MMAP_NUM (2)
193
194/* CPU decoder window related constants */
195#define CPU_DEC_WIN_CTRL_REG(win_num) \
196 (MVEBU_CPU_DEC_WIN_REG_BASE + (win_num) * 0x10)
197#define CPU_DEC_CR_WIN_ENABLE 0x1
198#define CPU_DEC_CR_WIN_TARGET_OFFS 4
199#define CPU_DEC_CR_WIN_TARGET_MASK \
200 (0xf << CPU_DEC_CR_WIN_TARGET_OFFS)
201
202#define CPU_DEC_WIN_SIZE_REG(win_num) \
203 (MVEBU_CPU_DEC_WIN_REG_BASE + 0x4 + (win_num) * 0x10)
204#define CPU_DEC_CR_WIN_SIZE_OFFS 0
205#define CPU_DEC_CR_WIN_SIZE_MASK \
206 (0xffff << CPU_DEC_CR_WIN_SIZE_OFFS)
207#define CPU_DEC_CR_WIN_SIZE_ALIGNMENT 0x10000
208
209#define CPU_DEC_WIN_BASE_REG(win_num) \
210 (MVEBU_CPU_DEC_WIN_REG_BASE + 0x8 + (win_num) * 0x10)
211#define CPU_DEC_BR_BASE_OFFS 0
212#define CPU_DEC_BR_BASE_MASK \
213 (0xffff << CPU_DEC_BR_BASE_OFFS)
214
215#define CPU_DEC_REMAP_LOW_REG(win_num) \
216 (MVEBU_CPU_DEC_WIN_REG_BASE + 0xC + (win_num) * 0x10)
217#define CPU_DEC_RLR_REMAP_LOW_OFFS 0
218#define CPU_DEC_RLR_REMAP_LOW_MASK \
219 (0xffff << CPU_DEC_BR_BASE_OFFS)
220
221/* Securities */
222#define IRQ_SEC_OS_TICK_INT MARVELL_IRQ_SEC_PHY_TIMER
223
224#define TRUSTED_DRAM_BASE PLAT_MARVELL_TRUSTED_DRAM_BASE
225#define TRUSTED_DRAM_SIZE PLAT_MARVELL_TRUSTED_DRAM_SIZE
226
227#ifdef BL32
228#define BL32_BASE TRUSTED_DRAM_BASE
229#define BL32_LIMIT TRUSTED_DRAM_SIZE
230#endif
231
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000232#endif /* PLATFORM_DEF_H */