From ea69dcdc737d8b48fec769042922914e988153ef Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 13 Sep 2022 13:55:43 +0200 Subject: [PATCH] feat(st-uart): manage STM32MP_RECONFIGURE_CONSOLE If the flag STM32MP_RECONFIGURE_CONSOLE is set in BL32, the UART init should be skipped if the UART clock is set to zero. This will be used when configuring the default console, after an early console has been configured. Signed-off-by: Yann Gautier Change-Id: Icbc640c7bdd6342f9c3ec1586a0d0c64127b18b8 --- drivers/st/uart/aarch32/stm32_console.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/st/uart/aarch32/stm32_console.S b/drivers/st/uart/aarch32/stm32_console.S index e467f0987..e3e0e67d3 100644 --- a/drivers/st/uart/aarch32/stm32_console.S +++ b/drivers/st/uart/aarch32/stm32_console.S @@ -46,10 +46,16 @@ func console_stm32_core_init cmp r0, #0 beq core_init_fail #if !defined(IMAGE_BL2) +#if STM32MP_RECONFIGURE_CONSOLE + /* UART clock rate is set to 0 in BL32, skip init in that case */ + cmp r1, #0 + beq 1f +#else /* STM32MP_RECONFIGURE_CONSOLE */ /* Skip UART initialization if it is already enabled */ ldr r3, [r0, #USART_CR1] ands r3, r3, #USART_CR1_UE bne 1f +#endif /* STM32MP_RECONFIGURE_CONSOLE */ #endif /* IMAGE_BL2 */ /* Check baud rate and uart clock for sanity */ cmp r1, #0 -- 2.39.5