blob: 0b46bc5c28da1183b0f32cb35ba2954cda9e220d [file] [log] [blame]
Yann Gautier4b0c72a2018-07-16 10:54:09 +02001/*
2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef STM32MP1_DEF_H
8#define STM32MP1_DEF_H
9
10#include <tbbr_img_def.h>
11#include <utils_def.h>
12#include <xlat_tables_defs.h>
13
14/*******************************************************************************
15 * STM32MP1 memory map related constants
16 ******************************************************************************/
17
18#define STM32MP1_SRAM_BASE U(0x2FFC0000)
19#define STM32MP1_SRAM_SIZE U(0x00040000)
20
21/* DDR configuration */
22#define STM32MP1_DDR_BASE U(0xC0000000)
23#define STM32MP1_DDR_SIZE_DFLT U(0x20000000) /* 512 MB */
24#define STM32MP1_DDR_MAX_SIZE U(0x40000000) /* Max 1GB */
25#define STM32MP1_DDR_SPEED_DFLT 528
26
27/* DDR power initializations */
28#ifndef __ASSEMBLY__
29enum ddr_type {
30 STM32MP_DDR3,
31 STM32MP_LPDDR2,
32};
33#endif
34
35/* Section used inside TF binaries */
36#define STM32MP1_PARAM_LOAD_SIZE U(0x00002400) /* 9 Ko for param */
37/* 256 Octets reserved for header */
38#define STM32MP1_HEADER_SIZE U(0x00000100)
39
40#define STM32MP1_BINARY_BASE (STM32MP1_SRAM_BASE + \
41 STM32MP1_PARAM_LOAD_SIZE + \
42 STM32MP1_HEADER_SIZE)
43
44#define STM32MP1_BINARY_SIZE (STM32MP1_SRAM_SIZE - \
45 (STM32MP1_PARAM_LOAD_SIZE + \
46 STM32MP1_HEADER_SIZE))
47
48#if STACK_PROTECTOR_ENABLED
49#define STM32MP1_BL32_SIZE U(0x00012000) /* 72 Ko for BL32 */
50#else
51#define STM32MP1_BL32_SIZE U(0x00011000) /* 68 Ko for BL32 */
52#endif
53
54#define STM32MP1_BL32_BASE (STM32MP1_SRAM_BASE + \
55 STM32MP1_SRAM_SIZE - \
56 STM32MP1_BL32_SIZE)
57
58#if STACK_PROTECTOR_ENABLED
59#define STM32MP1_BL2_SIZE U(0x00015000) /* 84 Ko for BL2 */
60#else
61#define STM32MP1_BL2_SIZE U(0x00013000) /* 76 Ko for BL2 */
62#endif
63
64#define STM32MP1_BL2_BASE (STM32MP1_BL32_BASE - \
65 STM32MP1_BL2_SIZE)
66
67/* BL2 and BL32/sp_min require 5 tables */
68#define MAX_XLAT_TABLES 5
69
70/*
71 * MAX_MMAP_REGIONS is usually:
72 * BL stm32mp1_mmap size + mmap regions in *_plat_arch_setup
73 */
74#define MAX_MMAP_REGIONS 11
75
76/* DTB initialization value */
77#define STM32MP1_DTB_SIZE U(0x00004000) /* 16Ko for DTB */
78
79#define STM32MP1_DTB_BASE (STM32MP1_BL2_BASE - \
80 STM32MP1_DTB_SIZE)
81
82#define STM32MP1_BL33_BASE (STM32MP1_DDR_BASE + U(0x100000))
83
84/*******************************************************************************
85 * STM32MP1 device/io map related constants (used for MMU)
86 ******************************************************************************/
87#define STM32MP1_DEVICE1_BASE U(0x40000000)
88#define STM32MP1_DEVICE1_SIZE U(0x40000000)
89
90#define STM32MP1_DEVICE2_BASE U(0x80000000)
91#define STM32MP1_DEVICE2_SIZE U(0x40000000)
92
93/*******************************************************************************
94 * STM32MP1 RCC
95 ******************************************************************************/
96#define RCC_BASE U(0x50000000)
97
98/*******************************************************************************
99 * STM32MP1 PWR
100 ******************************************************************************/
101#define PWR_BASE U(0x50001000)
102
103/*******************************************************************************
104 * STM32MP1 UART
105 ******************************************************************************/
106#define USART1_BASE U(0x5C000000)
107#define USART2_BASE U(0x4000E000)
108#define USART3_BASE U(0x4000F000)
109#define UART4_BASE U(0x40010000)
110#define UART5_BASE U(0x40011000)
111#define USART6_BASE U(0x44003000)
112#define UART7_BASE U(0x40018000)
113#define UART8_BASE U(0x40019000)
114#define STM32MP1_DEBUG_USART_BASE UART4_BASE
115#define STM32MP1_UART_BAUDRATE 115200
116
117/*******************************************************************************
118 * STM32MP1 GIC-400
119 ******************************************************************************/
120#define STM32MP1_GICD_BASE U(0xA0021000)
121#define STM32MP1_GICC_BASE U(0xA0022000)
122#define STM32MP1_GICH_BASE U(0xA0024000)
123#define STM32MP1_GICV_BASE U(0xA0026000)
124
125/*******************************************************************************
126 * STM32MP1 TZC (TZ400)
127 ******************************************************************************/
128#define STM32MP1_TZC_BASE U(0x5C006000)
129
130#define STM32MP1_TZC_A7_ID U(0)
131#define STM32MP1_TZC_LCD_ID U(3)
132#define STM32MP1_TZC_GPU_ID U(4)
133#define STM32MP1_TZC_MDMA_ID U(5)
134#define STM32MP1_TZC_DMA_ID U(6)
135#define STM32MP1_TZC_USB_HOST_ID U(7)
136#define STM32MP1_TZC_USB_OTG_ID U(8)
137#define STM32MP1_TZC_SDMMC_ID U(9)
138#define STM32MP1_TZC_ETH_ID U(10)
139#define STM32MP1_TZC_DAP_ID U(15)
140
141#define STM32MP1_MEMORY_NS 0
142#define STM32MP1_MEMORY_SECURE 1
143
144#define STM32MP1_FILTER_BIT_ALL 3
145
146/*******************************************************************************
147 * STM32MP1 SDMMC
148 ******************************************************************************/
149#define STM32MP1_SDMMC1_BASE U(0x58005000)
150#define STM32MP1_SDMMC2_BASE U(0x58007000)
151#define STM32MP1_SDMMC3_BASE U(0x48004000)
152
153#define STM32MP1_SD_INIT_FREQ 400000 /*400 KHz*/
154#define STM32MP1_SD_NORMAL_SPEED_MAX_FREQ 25000000 /*25 MHz*/
155#define STM32MP1_SD_HIGH_SPEED_MAX_FREQ 50000000 /*50 MHz*/
156#define STM32MP1_EMMC_INIT_FREQ STM32MP1_SD_INIT_FREQ
157#define STM32MP1_EMMC_NORMAL_SPEED_MAX_FREQ 26000000 /*26 MHz*/
158#define STM32MP1_EMMC_HIGH_SPEED_MAX_FREQ 52000000 /*52 MHz*/
159
160/*******************************************************************************
161 * STM32MP1 DDRCTRL
162 ******************************************************************************/
163#define DDRCTRL_BASE U(0x5A003000)
164
165/*******************************************************************************
166 * STM32MP1 DDRPHYC
167 ******************************************************************************/
168#define DDRPHYC_BASE U(0x5A004000)
169
170/*******************************************************************************
171 * STM32MP1 I2C4
172 ******************************************************************************/
173#define I2C4_BASE U(0x5C002000)
174
175#endif /* STM32MP1_DEF_H */