summaryrefslogtreecommitdiff
path: root/drivers/watchdog/wdt-uclass.c
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2021-11-04 06:55:14 +0300
committerStefan Roese <sr@denx.de>2021-11-04 10:57:19 +0300
commita8f63d18bbb0a3e1456ac833e748d68f0ea1eece (patch)
tree982a721594127f1ddf473b18fd76da2f76c34220 /drivers/watchdog/wdt-uclass.c
parent5544a0114258ec4eba2a361fc975e91c419b227e (diff)
downloadu-boot-a8f63d18bbb0a3e1456ac833e748d68f0ea1eece.tar.xz
watchdog: Automatically register device with sysreset
Add an option to automatically register watchdog devices with the wdt_reboot driver for use with sysreset. This allows sysreset to be a drop-in replacement for platform-specific watchdog reset code, without needing any device tree changes. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/watchdog/wdt-uclass.c')
-rw-r--r--drivers/watchdog/wdt-uclass.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 7570710c4d..6d0f473867 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -10,6 +10,7 @@
#include <errno.h>
#include <hang.h>
#include <log.h>
+#include <sysreset.h>
#include <time.h>
#include <wdt.h>
#include <asm/global_data.h>
@@ -44,6 +45,13 @@ static void init_watchdog_dev(struct udevice *dev)
priv = dev_get_uclass_priv(dev);
+ if (IS_ENABLED(CONFIG_SYSRESET_WATCHDOG_AUTO)) {
+ ret = sysreset_register_wdt(dev);
+ if (ret)
+ printf("WDT: Failed to register %s for sysreset\n",
+ dev->name);
+ }
+
if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART)) {
printf("WDT: Not starting %s\n", dev->name);
return;