summaryrefslogtreecommitdiff
path: root/drivers/watchdog/wdt-uclass.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-03-09 16:26:56 +0300
committerStefan Roese <sr@denx.de>2021-04-06 11:47:32 +0300
commit830d29ac37216df0946afad5ab454b081062bc2e (patch)
treeb5481287aea0880d6e1f647bf9ede0b9da6c8b93 /drivers/watchdog/wdt-uclass.c
parent25e20e347ed83d3629d65a7c5a6c376bacc1db0d (diff)
downloadu-boot-830d29ac37216df0946afad5ab454b081062bc2e.tar.xz
watchdog: Allow to use CONFIG_WDT without starting watchdog
In some cases it is useful to compile support for U-Boot command 'wdt' without starting HW watchdog in early U-Boot phase. For example when the user want to start the watchdog only on demand by some boot script. This change adds a new compile option WATCHDOG_AUTOSTART to control whether U-Boot should automatically start the watchdog during init phase or not. This option is enabled by default as it was the default behavior prior introducing this new change. When compiling U-Boot users can decide to turn this option off. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/watchdog/wdt-uclass.c')
-rw-r--r--drivers/watchdog/wdt-uclass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 7500b3ed90..0603ffbd36 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -51,6 +51,11 @@ int initr_watchdog(void)
4 * reset_period) / 4;
}
+ if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) {
+ printf("WDT: Not starting\n");
+ return 0;
+ }
+
ret = wdt_start(gd->watchdog_dev, timeout * 1000, 0);
if (ret != 0) {
printf("WDT: Failed to start\n");