Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <common/tbbr/tbbr_img_def.h> |
| 11 | #include <lib/utils_def.h> |
| 12 | #include <lib/xlat_tables/xlat_tables_defs.h> |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 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__ |
| 29 | enum 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 | */ |
Yann Gautier | 9d135e4 | 2018-07-16 19:36:06 +0200 | [diff] [blame] | 74 | #if defined(IMAGE_BL2) |
| 75 | #define MAX_MMAP_REGIONS 11 |
| 76 | #endif |
| 77 | #if defined(IMAGE_BL32) |
| 78 | #define MAX_MMAP_REGIONS 6 |
| 79 | #endif |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 80 | |
| 81 | /* DTB initialization value */ |
| 82 | #define STM32MP1_DTB_SIZE U(0x00004000) /* 16Ko for DTB */ |
| 83 | |
| 84 | #define STM32MP1_DTB_BASE (STM32MP1_BL2_BASE - \ |
| 85 | STM32MP1_DTB_SIZE) |
| 86 | |
| 87 | #define STM32MP1_BL33_BASE (STM32MP1_DDR_BASE + U(0x100000)) |
| 88 | |
| 89 | /******************************************************************************* |
| 90 | * STM32MP1 device/io map related constants (used for MMU) |
| 91 | ******************************************************************************/ |
| 92 | #define STM32MP1_DEVICE1_BASE U(0x40000000) |
| 93 | #define STM32MP1_DEVICE1_SIZE U(0x40000000) |
| 94 | |
| 95 | #define STM32MP1_DEVICE2_BASE U(0x80000000) |
| 96 | #define STM32MP1_DEVICE2_SIZE U(0x40000000) |
| 97 | |
| 98 | /******************************************************************************* |
| 99 | * STM32MP1 RCC |
| 100 | ******************************************************************************/ |
| 101 | #define RCC_BASE U(0x50000000) |
| 102 | |
| 103 | /******************************************************************************* |
| 104 | * STM32MP1 PWR |
| 105 | ******************************************************************************/ |
| 106 | #define PWR_BASE U(0x50001000) |
| 107 | |
| 108 | /******************************************************************************* |
| 109 | * STM32MP1 UART |
| 110 | ******************************************************************************/ |
| 111 | #define USART1_BASE U(0x5C000000) |
| 112 | #define USART2_BASE U(0x4000E000) |
| 113 | #define USART3_BASE U(0x4000F000) |
| 114 | #define UART4_BASE U(0x40010000) |
| 115 | #define UART5_BASE U(0x40011000) |
| 116 | #define USART6_BASE U(0x44003000) |
| 117 | #define UART7_BASE U(0x40018000) |
| 118 | #define UART8_BASE U(0x40019000) |
| 119 | #define STM32MP1_DEBUG_USART_BASE UART4_BASE |
| 120 | #define STM32MP1_UART_BAUDRATE 115200 |
| 121 | |
| 122 | /******************************************************************************* |
| 123 | * STM32MP1 GIC-400 |
| 124 | ******************************************************************************/ |
| 125 | #define STM32MP1_GICD_BASE U(0xA0021000) |
| 126 | #define STM32MP1_GICC_BASE U(0xA0022000) |
| 127 | #define STM32MP1_GICH_BASE U(0xA0024000) |
| 128 | #define STM32MP1_GICV_BASE U(0xA0026000) |
| 129 | |
| 130 | /******************************************************************************* |
| 131 | * STM32MP1 TZC (TZ400) |
| 132 | ******************************************************************************/ |
| 133 | #define STM32MP1_TZC_BASE U(0x5C006000) |
| 134 | |
| 135 | #define STM32MP1_TZC_A7_ID U(0) |
| 136 | #define STM32MP1_TZC_LCD_ID U(3) |
| 137 | #define STM32MP1_TZC_GPU_ID U(4) |
| 138 | #define STM32MP1_TZC_MDMA_ID U(5) |
| 139 | #define STM32MP1_TZC_DMA_ID U(6) |
| 140 | #define STM32MP1_TZC_USB_HOST_ID U(7) |
| 141 | #define STM32MP1_TZC_USB_OTG_ID U(8) |
| 142 | #define STM32MP1_TZC_SDMMC_ID U(9) |
| 143 | #define STM32MP1_TZC_ETH_ID U(10) |
| 144 | #define STM32MP1_TZC_DAP_ID U(15) |
| 145 | |
| 146 | #define STM32MP1_MEMORY_NS 0 |
| 147 | #define STM32MP1_MEMORY_SECURE 1 |
| 148 | |
| 149 | #define STM32MP1_FILTER_BIT_ALL 3 |
| 150 | |
| 151 | /******************************************************************************* |
| 152 | * STM32MP1 SDMMC |
| 153 | ******************************************************************************/ |
| 154 | #define STM32MP1_SDMMC1_BASE U(0x58005000) |
| 155 | #define STM32MP1_SDMMC2_BASE U(0x58007000) |
| 156 | #define STM32MP1_SDMMC3_BASE U(0x48004000) |
| 157 | |
Yann Gautier | 5380b0d | 2018-10-15 09:36:04 +0200 | [diff] [blame] | 158 | #define STM32MP1_MMC_INIT_FREQ 400000 /*400 KHz*/ |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 159 | #define STM32MP1_SD_NORMAL_SPEED_MAX_FREQ 25000000 /*25 MHz*/ |
| 160 | #define STM32MP1_SD_HIGH_SPEED_MAX_FREQ 50000000 /*50 MHz*/ |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 161 | #define STM32MP1_EMMC_NORMAL_SPEED_MAX_FREQ 26000000 /*26 MHz*/ |
| 162 | #define STM32MP1_EMMC_HIGH_SPEED_MAX_FREQ 52000000 /*52 MHz*/ |
| 163 | |
| 164 | /******************************************************************************* |
Yann Gautier | 4193466 | 2018-07-20 11:36:05 +0200 | [diff] [blame] | 165 | * STM32MP1 TAMP |
| 166 | ******************************************************************************/ |
| 167 | #define TAMP_BASE U(0x5C00A000) |
| 168 | #define TAMP_BKP_REGISTER_BASE (TAMP_BASE + U(0x100)) |
| 169 | |
| 170 | #if !(defined(__LINKER__) || defined(__ASSEMBLY__)) |
| 171 | static inline uint32_t tamp_bkpr(uint32_t idx) |
| 172 | { |
| 173 | return TAMP_BKP_REGISTER_BASE + (idx << 2); |
| 174 | } |
| 175 | #endif |
| 176 | |
| 177 | /******************************************************************************* |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 178 | * STM32MP1 DDRCTRL |
| 179 | ******************************************************************************/ |
| 180 | #define DDRCTRL_BASE U(0x5A003000) |
| 181 | |
| 182 | /******************************************************************************* |
| 183 | * STM32MP1 DDRPHYC |
| 184 | ******************************************************************************/ |
| 185 | #define DDRPHYC_BASE U(0x5A004000) |
| 186 | |
| 187 | /******************************************************************************* |
| 188 | * STM32MP1 I2C4 |
| 189 | ******************************************************************************/ |
| 190 | #define I2C4_BASE U(0x5C002000) |
| 191 | |
| 192 | #endif /* STM32MP1_DEF_H */ |