blob: ec1c9036c71c2c22cf4ba7d3482fc41f774c4217 [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
95/* DRAM[2MB..66MB] is used as Trusted ROM */
96#define PLAT_MARVELL_TRUSTED_ROM_BASE PLAT_MARVELL_ATF_LOAD_ADDR
97/* 64 MB TODO: reduce this to minimum needed according to fip image size */
98#define PLAT_MARVELL_TRUSTED_ROM_SIZE 0x04000000
99/* Reserve 16M for SCP (Secure PayLoad) Trusted DRAM */
100#define PLAT_MARVELL_TRUSTED_DRAM_BASE 0x04400000
101#define PLAT_MARVELL_TRUSTED_DRAM_SIZE 0x01000000 /* 16 MB */
102
103/*
104 * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
105 * plus a little space for growth.
106 */
107#define PLAT_MARVELL_MAX_BL1_RW_SIZE 0xA000
108
109/*
110 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
111 * little space for growth.
112 */
113#define PLAT_MARVELL_MAX_BL2_SIZE 0xF000
114
115/*
116 * PLAT_ARM_MAX_BL31_SIZE is calculated using the current BL31 debug size plus a
117 * little space for growth.
118 */
119#define PLAT_MARVEL_MAX_BL31_SIZE 0x5D000
120
121#define PLAT_MARVELL_CPU_ENTRY_ADDR BL1_RO_BASE
122
123/* GIC related definitions */
124#define PLAT_MARVELL_GICD_BASE (MVEBU_REGS_BASE + MVEBU_GICD_BASE)
125#define PLAT_MARVELL_GICC_BASE (MVEBU_REGS_BASE + MVEBU_GICC_BASE)
126
127#define PLAT_MARVELL_G0_IRQ_PROPS(grp) \
128 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, grp, \
129 GIC_INTR_CFG_LEVEL), \
130 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, grp, \
Marcin Wojtas0c60c2f2018-03-21 09:59:59 +0100131 GIC_INTR_CFG_LEVEL), \
132 INTR_PROP_DESC(MARVELL_IRQ_PIC0, GIC_HIGHEST_SEC_PRIORITY, grp, \
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300133 GIC_INTR_CFG_LEVEL)
134
135#define PLAT_MARVELL_G1S_IRQ_PROPS(grp) \
136 INTR_PROP_DESC(MARVELL_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, \
137 grp, GIC_INTR_CFG_LEVEL), \
138 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, grp, \
139 GIC_INTR_CFG_LEVEL), \
140 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, grp, \
141 GIC_INTR_CFG_LEVEL), \
142 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, grp, \
143 GIC_INTR_CFG_LEVEL), \
144 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, grp, \
145 GIC_INTR_CFG_LEVEL), \
146 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, grp, \
147 GIC_INTR_CFG_LEVEL), \
148 INTR_PROP_DESC(MARVELL_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, grp, \
149 GIC_INTR_CFG_LEVEL)
150
151#define PLAT_MARVELL_SHARED_RAM_CACHED 1
152
153/*
154 * Load address of BL3-3 for this platform port
155 */
156#define PLAT_MARVELL_NS_IMAGE_OFFSET 0x0
157
158/* System Reference Clock*/
159#define PLAT_REF_CLK_IN_HZ COUNTER_FREQUENCY
160
161/*
162 * PL011 related constants
163 */
164#define PLAT_MARVELL_BOOT_UART_BASE (MVEBU_REGS_BASE + 0x512000)
165#define PLAT_MARVELL_BOOT_UART_CLK_IN_HZ 200000000
166
167#define PLAT_MARVELL_CRASH_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
168#define PLAT_MARVELL_CRASH_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
169
170#define PLAT_MARVELL_BL31_RUN_UART_BASE PLAT_MARVELL_BOOT_UART_BASE
171#define PLAT_MARVELL_BL31_RUN_UART_CLK_IN_HZ PLAT_MARVELL_BOOT_UART_CLK_IN_HZ
172
173/* Recovery image enable */
174#define PLAT_RECOVERY_IMAGE_ENABLE 0
175
176/* Required platform porting definitions */
177#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1
178
179/* System timer related constants */
180#define PLAT_MARVELL_NSTIMER_FRAME_ID 1
181
182/* Mailbox base address (note the lower memory space
183 * is reserved for BLE data)
184 */
185#define PLAT_MARVELL_MAILBOX_BASE (MARVELL_TRUSTED_SRAM_BASE \
186 + 0x400)
187#define PLAT_MARVELL_MAILBOX_SIZE 0x100
188#define PLAT_MARVELL_MAILBOX_MAGIC_NUM 0x6D72766C /* mrvl */
189
190/* Securities */
191#define IRQ_SEC_OS_TICK_INT MARVELL_IRQ_SEC_PHY_TIMER
192
193#define TRUSTED_DRAM_BASE PLAT_MARVELL_TRUSTED_DRAM_BASE
194#define TRUSTED_DRAM_SIZE PLAT_MARVELL_TRUSTED_DRAM_SIZE
195
Konstantin Porotchkind973c032018-10-02 17:45:15 +0300196#ifdef BL32
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300197#define BL32_BASE TRUSTED_DRAM_BASE
Konstantin Porotchkind973c032018-10-02 17:45:15 +0300198#define BL32_LIMIT TRUSTED_DRAM_SIZE
199#endif
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300200
Marcin Wojtas0c60c2f2018-03-21 09:59:59 +0100201#define MVEBU_PMU_IRQ_WA
202
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000203#endif /* PLATFORM_DEF_H */