From ce3ca1e8953794e23433a6d88bd99e0fff5478fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 23 Oct 2023 11:41:38 +0200 Subject: [PATCH] bootloader: bl_boot: Fix disabling of UARTs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 56d117d442c9148c75c621359e22283ffd7caef0 ("bootloader: bl_boot: update UART Kconfigs"). - add missing `CONFIG_` prefixes to `HAS_HW_NRF_*` symbols - remove invalid entries that refer to non-existing peripherals (UART1 and UART2) - move `#ifdef CONFIG_UART_NRFX` to the function, where it is actually needed (`CONFIG_UART_NRFX_UART` and `CONFIG_UART_NRFX_UARTE` imply `CONFIG_UART_NRFX`, as they cannot be defined otherwise, so there is no need for that additional `#ifdef` in inclusions). Signed-off-by: Andrzej Głąbek --- subsys/bootloader/bl_boot/bl_boot.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/subsys/bootloader/bl_boot/bl_boot.c b/subsys/bootloader/bl_boot/bl_boot.c index f2f49023c882..fc2365439f9f 100644 --- a/subsys/bootloader/bl_boot/bl_boot.c +++ b/subsys/bootloader/bl_boot/bl_boot.c @@ -10,32 +10,29 @@ #include #include #include -#ifdef CONFIG_UART_NRFX #ifdef CONFIG_UART_NRFX_UART #include #endif -#if CONFIG_UART_NRFX_UARTE +#ifdef CONFIG_UART_NRFX_UARTE #include #endif -#endif static void uninit_used_peripherals(void) { -#if defined(HAS_HW_NRF_UART0) +#ifdef CONFIG_UART_NRFX +#if defined(CONFIG_HAS_HW_NRF_UART0) nrf_uart_disable(NRF_UART0); -#elif defined(HAS_HW_NRF_UARTE0) +#elif defined(CONFIG_HAS_HW_NRF_UARTE0) nrf_uarte_disable(NRF_UARTE0); #endif -#if defined(HAS_HW_NRF_UART1) - nrf_uart_disable(NRF_UART1); -#elif defined(HAS_HW_NRF_UARTE1) +#if defined(CONFIG_HAS_HW_NRF_UARTE1) nrf_uarte_disable(NRF_UARTE1); #endif -#if defined(HAS_HW_NRF_UART2) - nrf_uart_disable(NRF_UART2); -#elif defined(HAS_HW_NRF_UARTE2) +#if defined(CONFIG_HAS_HW_NRF_UARTE2) nrf_uarte_disable(NRF_UARTE2); #endif +#endif /* CONFIG_UART_NRFX */ + nrf_clock_int_disable(NRF_CLOCK, 0xFFFFFFFF); }