Browse Source
Configure the first steps for STM32MP2 BL2 platform boot: - Save boot context address for later use - Configure BL2 MMU - Load and use BL2 DT - Reset backup domain - Initialize clocks - Configure UART for console - Print some info about board and reset reason - Setup storage (only SD-card for the moment) The platform boot stops at BL2 image load, as bl2_mem_params_descs[] is still empty. Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: If6127cfbf77825a03afe8d65ba47c8c0661de496pull/2005/merge
Yann Gautier
6 months ago
8 changed files with 390 additions and 14 deletions
@ -0,0 +1,47 @@ |
|||
/*
|
|||
* Copyright (c) 2024, STMicroelectronics - All Rights Reserved |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#ifndef PLAT_TBBR_IMG_DEF_H |
|||
#define PLAT_TBBR_IMG_DEF_H |
|||
|
|||
#include <export/common/tbbr/tbbr_img_def_exp.h> |
|||
|
|||
/* Undef the existing values */ |
|||
#undef BKUP_FWU_METADATA_IMAGE_ID |
|||
#undef FWU_METADATA_IMAGE_ID |
|||
#undef FW_CONFIG_ID |
|||
#undef ENC_IMAGE_ID |
|||
#undef GPT_IMAGE_ID |
|||
#undef NT_FW_CONFIG_ID |
|||
#undef SOC_FW_CONFIG_ID |
|||
#undef TB_FW_CONFIG_ID |
|||
#undef HW_CONFIG_ID |
|||
#undef TRUSTED_BOOT_FW_CERT_ID |
|||
#undef SOC_FW_CONTENT_CERT_ID |
|||
#undef BL32_EXTRA1_IMAGE_ID |
|||
#undef TOS_FW_CONFIG_ID |
|||
|
|||
/* Define the STM32MP2 used ID */ |
|||
#define FW_CONFIG_ID U(1) |
|||
#define HW_CONFIG_ID U(2) |
|||
#define ENC_IMAGE_ID U(6) |
|||
#define BL32_EXTRA1_IMAGE_ID U(8) |
|||
#define FWU_METADATA_IMAGE_ID U(12) |
|||
#define BKUP_FWU_METADATA_IMAGE_ID U(13) |
|||
#define TOS_FW_CONFIG_ID U(16) |
|||
#define NT_FW_CONFIG_ID U(18) |
|||
#define SOC_FW_CONFIG_ID U(19) |
|||
#define TB_FW_CONFIG_ID U(20) |
|||
#define TRUSTED_BOOT_FW_CERT_ID U(21) |
|||
#define SOC_FW_CONTENT_CERT_ID U(23) |
|||
#define STM32MP_CONFIG_CERT_ID U(24) |
|||
#define GPT_IMAGE_ID U(25) |
|||
|
|||
/* Increase the MAX_NUMBER_IDS to match the authentication pool required */ |
|||
#define MAX_NUMBER_IDS U(26) |
|||
|
|||
#endif /* PLAT_TBBR_IMG_DEF_H */ |
|||
|
@ -0,0 +1,81 @@ |
|||
/*
|
|||
* Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <assert.h> |
|||
|
|||
#include <lib/xlat_tables/xlat_tables_v2.h> |
|||
|
|||
#include <platform_def.h> |
|||
|
|||
#define BKPR_BOOT_MODE 96U |
|||
|
|||
#define MAP_SYSRAM MAP_REGION_FLAT(STM32MP_SYSRAM_BASE, \ |
|||
STM32MP_SYSRAM_SIZE, \ |
|||
MT_MEMORY | \ |
|||
MT_RW | \ |
|||
MT_SECURE | \ |
|||
MT_EXECUTE_NEVER) |
|||
|
|||
#define MAP_DEVICE MAP_REGION_FLAT(STM32MP_DEVICE_BASE, \ |
|||
STM32MP_DEVICE_SIZE, \ |
|||
MT_DEVICE | \ |
|||
MT_RW | \ |
|||
MT_SECURE | \ |
|||
MT_EXECUTE_NEVER) |
|||
|
|||
#if defined(IMAGE_BL2) |
|||
static const mmap_region_t stm32mp2_mmap[] = { |
|||
MAP_SYSRAM, |
|||
MAP_DEVICE, |
|||
{0} |
|||
}; |
|||
#endif |
|||
|
|||
void configure_mmu(void) |
|||
{ |
|||
mmap_add(stm32mp2_mmap); |
|||
init_xlat_tables(); |
|||
|
|||
enable_mmu_el3(0); |
|||
} |
|||
|
|||
uintptr_t stm32_get_gpio_bank_base(unsigned int bank) |
|||
{ |
|||
if (bank == GPIO_BANK_Z) { |
|||
return GPIOZ_BASE; |
|||
} |
|||
|
|||
assert(bank <= GPIO_BANK_K); |
|||
|
|||
return GPIOA_BASE + (bank * GPIO_BANK_OFFSET); |
|||
} |
|||
|
|||
uint32_t stm32_get_gpio_bank_offset(unsigned int bank) |
|||
{ |
|||
if (bank == GPIO_BANK_Z) { |
|||
return 0; |
|||
} |
|||
|
|||
assert(bank <= GPIO_BANK_K); |
|||
|
|||
return bank * GPIO_BANK_OFFSET; |
|||
} |
|||
|
|||
unsigned long stm32_get_gpio_bank_clock(unsigned int bank) |
|||
{ |
|||
if (bank == GPIO_BANK_Z) { |
|||
return CK_BUS_GPIOZ; |
|||
} |
|||
|
|||
assert(bank <= GPIO_BANK_K); |
|||
|
|||
return CK_BUS_GPIOA + (bank - GPIO_BANK_A); |
|||
} |
|||
|
|||
uintptr_t stm32_get_bkpr_boot_mode_addr(void) |
|||
{ |
|||
return tamp_bkpr(BKPR_BOOT_MODE); |
|||
} |
Loading…
Reference in new issue