From b2b1677503972c55aff0a839b5c53ed5163d2250 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Tue, 9 Jan 2024 08:30:58 +0100 Subject: [PATCH] [nrf fromtree] boot: zephyr: moonlight watchdogs adding WATCHDOG_FEED support for WDT30 and WDT31 Signed-off-by: Mateusz Michalek (cherry picked from commit c3a72e9daf8f94a7c3b0dc91cc19e2bb15b7110a) Signed-off-by: Andrzej Puzdrowski --- boot/zephyr/Kconfig | 3 +++ .../include/mcuboot_config/mcuboot_config.h | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index 8472294d3..f69790e74 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -1,5 +1,6 @@ # Copyright (c) 2017-2020 Linaro Limited # Copyright (c) 2020 Arm Limited +# Copyright (c) 2023 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 # @@ -651,6 +652,8 @@ config BOOT_WATCHDOG_FEED imply NRFX_WDT if SOC_FAMILY_NRF imply NRFX_WDT0 if SOC_FAMILY_NRF imply NRFX_WDT1 if SOC_FAMILY_NRF + imply NRFX_WDT30 if SOC_FAMILY_NRF + imply NRFX_WDT31 if SOC_FAMILY_NRF help Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is used to feed watchdog while doing time consuming operations. diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h index 0cf2e6060..375088741 100644 --- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h +++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h @@ -324,9 +324,21 @@ #elif defined(CONFIG_NRFX_WDT0) #define MCUBOOT_WATCHDOG_FEED() \ FEED_WDT_INST(0); -#else /* defined(CONFIG_NRFX_WDT0) && defined(CONFIG_NRFX_WDT1) */ +#elif defined(CONFIG_NRFX_WDT30) && defined(CONFIG_NRFX_WDT31) +#define MCUBOOT_WATCHDOG_FEED() \ + do { \ + FEED_WDT_INST(30); \ + FEED_WDT_INST(31); \ + } while (0) +#elif defined(CONFIG_NRFX_WDT30) +#define MCUBOOT_WATCHDOG_FEED() \ + FEED_WDT_INST(30); +#elif defined(CONFIG_NRFX_WDT31) +#define MCUBOOT_WATCHDOG_FEED() \ + FEED_WDT_INST(31); +#else #error "No NRFX WDT instances enabled" -#endif /* defined(CONFIG_NRFX_WDT0) && defined(CONFIG_NRFX_WDT1) */ +#endif #elif DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) /* CONFIG_NRFX_WDT */ #include