From a132ebfe17cd3dadb313cc4a0f86a473450bddeb Mon Sep 17 00:00:00 2001 From: David Leach Date: Mon, 9 Jun 2025 12:21:54 -0500 Subject: [PATCH] drivers: watchdog: Add enableWait setting for wdt_mcux_imx_wdog When WDT_OPT_PAUSE_IN_SLEEP option is passed in set enableWait flag in addition to the enableStop. Fixes #86437 Signed-off-by: David Leach --- drivers/watchdog/wdt_mcux_imx_wdog.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/wdt_mcux_imx_wdog.c b/drivers/watchdog/wdt_mcux_imx_wdog.c index 99a6cea0a70..79115fb383f 100644 --- a/drivers/watchdog/wdt_mcux_imx_wdog.c +++ b/drivers/watchdog/wdt_mcux_imx_wdog.c @@ -41,14 +41,27 @@ static int mcux_wdog_setup(const struct device *dev, uint8_t options) return -EINVAL; } + /* + * WDT_OPT_PAUSE_IN_SLEEP is a bit tricky because depending on + * the frequency the platform is running at and the wdog timeout + * value relative to the sleep time, the system may wakeup enough + * to keep system time accurate enough on timer rollovers. During + * this time, the wdog will start ticking again so you can + * possibly still have the wdog expire. + * + */ + data->wdog_config.workMode.enableWait = + (options & WDT_OPT_PAUSE_IN_SLEEP) == 0U; + data->wdog_config.workMode.enableStop = (options & WDT_OPT_PAUSE_IN_SLEEP) == 0U; data->wdog_config.workMode.enableDebug = (options & WDT_OPT_PAUSE_HALTED_BY_DBG) == 0U; + LOG_DBG("Setup the watchdog: options: %d", options); + WDOG_Init(base, &data->wdog_config); - LOG_DBG("Setup the watchdog"); return 0; }