From 9e52d45fdf619561e0a7a833b77aaacc947a4dfd Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Wed, 5 Jan 2022 18:02:46 +0100 Subject: [PATCH] fix(st): manage UART clock and reset only in BL2 As the UART is already initialized, no need to check for UART clock or reset in next BL. An issue can appear if the next BL device tree (e.g HW_CONFIG) doesn't use the same clocks or resets (like SCMI ones). Signed-off-by: Yann Gautier Change-Id: I044ef2386abe2d3dba5a53c3685440d64ca50a4f --- plat/st/common/stm32mp_common.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plat/st/common/stm32mp_common.c b/plat/st/common/stm32mp_common.c index 918c28989..fb8e08ebd 100644 --- a/plat/st/common/stm32mp_common.c +++ b/plat/st/common/stm32mp_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -160,7 +160,7 @@ int stm32mp_uart_console_setup(void) { struct dt_node_info dt_uart_info; unsigned int console_flags; - uint32_t clk_rate; + uint32_t clk_rate = 0U; int result; uint32_t boot_itf __unused; uint32_t boot_instance __unused; @@ -168,11 +168,16 @@ int stm32mp_uart_console_setup(void) result = dt_get_stdout_uart_info(&dt_uart_info); if ((result <= 0) || - (dt_uart_info.status == DT_DISABLED) || - (dt_uart_info.clock < 0) || + (dt_uart_info.status == DT_DISABLED)) { + return -ENODEV; + } + +#if defined(IMAGE_BL2) + if ((dt_uart_info.clock < 0) || (dt_uart_info.reset < 0)) { return -ENODEV; } +#endif #if STM32MP_UART_PROGRAMMER || !defined(IMAGE_BL2) stm32_get_boot_interface(&boot_itf, &boot_instance); @@ -187,15 +192,13 @@ int stm32mp_uart_console_setup(void) if (dt_set_stdout_pinctrl() != 0) { return -ENODEV; } -#endif clk_enable((unsigned long)dt_uart_info.clock); -#if defined(IMAGE_BL2) reset_uart((uint32_t)dt_uart_info.reset); -#endif 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) { -- 2.39.5