mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 17:14:21 +00:00
feat(st): add early console in BL2
Add an early UART console to ease debug before UART is fully configured. This is done under flag STM32MP_EARLY_CONSOLE in the first STM32MP1 platform function called (bl2_el3_early_platform_setup()). It uses the parameters defined for crash console: STM32MP_DEBUG_USART* macros. Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: Id6be62368723a0499e97bbf56fb52c166fcbdfad
This commit is contained in:
parent
99026cff47
commit
c768b2b22f
4 changed files with 41 additions and 12 deletions
|
@ -62,6 +62,14 @@ uintptr_t get_uart_address(uint32_t instance_nb);
|
|||
/* Setup the UART console */
|
||||
int stm32mp_uart_console_setup(void);
|
||||
|
||||
#if STM32MP_EARLY_CONSOLE
|
||||
void stm32mp_setup_early_console(void);
|
||||
#else
|
||||
static inline void stm32mp_setup_early_console(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Platform util functions for the GPIO driver
|
||||
* @bank: Target GPIO bank ID as per DT bindings
|
||||
|
|
|
@ -205,10 +205,27 @@ static void reset_uart(uint32_t reset)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void set_console(uintptr_t base, uint32_t clk_rate)
|
||||
{
|
||||
unsigned int console_flags;
|
||||
|
||||
if (console_stm32_register(base, clk_rate,
|
||||
STM32MP_UART_BAUDRATE, &console) == 0) {
|
||||
panic();
|
||||
}
|
||||
|
||||
console_flags = CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH |
|
||||
CONSOLE_FLAG_TRANSLATE_CRLF;
|
||||
#if !defined(IMAGE_BL2) && defined(DEBUG)
|
||||
console_flags |= CONSOLE_FLAG_RUNTIME;
|
||||
#endif
|
||||
|
||||
console_set_scope(&console, console_flags);
|
||||
}
|
||||
|
||||
int stm32mp_uart_console_setup(void)
|
||||
{
|
||||
struct dt_node_info dt_uart_info;
|
||||
unsigned int console_flags;
|
||||
uint32_t clk_rate = 0U;
|
||||
int result;
|
||||
uint32_t boot_itf __unused;
|
||||
|
@ -249,21 +266,19 @@ int stm32mp_uart_console_setup(void)
|
|||
clk_rate = clk_get_rate((unsigned long)dt_uart_info.clock);
|
||||
#endif
|
||||
|
||||
if (console_stm32_register(dt_uart_info.base, clk_rate,
|
||||
STM32MP_UART_BAUDRATE, &console) == 0) {
|
||||
panic();
|
||||
}
|
||||
|
||||
console_flags = CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH |
|
||||
CONSOLE_FLAG_TRANSLATE_CRLF;
|
||||
#if !defined(IMAGE_BL2) && defined(DEBUG)
|
||||
console_flags |= CONSOLE_FLAG_RUNTIME;
|
||||
#endif
|
||||
console_set_scope(&console, console_flags);
|
||||
set_console(dt_uart_info.base, clk_rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if STM32MP_EARLY_CONSOLE
|
||||
void stm32mp_setup_early_console(void)
|
||||
{
|
||||
plat_crash_console_init();
|
||||
set_console(STM32MP_DEBUG_USART_BASE, STM32MP_DEBUG_USART_CLK_FRQ);
|
||||
}
|
||||
#endif /* STM32MP_EARLY_CONSOLE */
|
||||
|
||||
/*****************************************************************************
|
||||
* plat_is_smccc_feature_available() - This function checks whether SMCCC
|
||||
* feature is availabile for platform.
|
||||
|
|
|
@ -139,6 +139,8 @@ void bl2_el3_early_platform_setup(u_register_t arg0,
|
|||
u_register_t arg2 __unused,
|
||||
u_register_t arg3 __unused)
|
||||
{
|
||||
stm32mp_setup_early_console();
|
||||
|
||||
stm32mp_save_boot_ctx_address(arg0);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ ARM_WITH_NEON := yes
|
|||
BL2_AT_EL3 := 1
|
||||
USE_COHERENT_MEM := 0
|
||||
|
||||
STM32MP_EARLY_CONSOLE ?= 0
|
||||
|
||||
# Allow TF-A to concatenate BL2 & BL32 binaries in a single file,
|
||||
# share DTB file between BL2 and BL32
|
||||
# If it is set to 0, then FIP is used
|
||||
|
@ -157,6 +159,7 @@ $(eval $(call assert_booleans,\
|
|||
PLAT_XLAT_TABLES_DYNAMIC \
|
||||
STM32MP_DDR_32BIT_INTERFACE \
|
||||
STM32MP_DDR_DUAL_AXI_PORT \
|
||||
STM32MP_EARLY_CONSOLE \
|
||||
STM32MP_EMMC \
|
||||
STM32MP_EMMC_BOOT \
|
||||
STM32MP_RAW_NAND \
|
||||
|
@ -183,6 +186,7 @@ $(eval $(call add_defines,\
|
|||
STM32_TF_VERSION \
|
||||
STM32MP_DDR_32BIT_INTERFACE \
|
||||
STM32MP_DDR_DUAL_AXI_PORT \
|
||||
STM32MP_EARLY_CONSOLE \
|
||||
STM32MP_EMMC \
|
||||
STM32MP_EMMC_BOOT \
|
||||
STM32MP_RAW_NAND \
|
||||
|
|
Loading…
Add table
Reference in a new issue