]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sysreset: watchdog: watchdog cannot power off
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 4 Nov 2021 09:31:17 +0000 (10:31 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 26 Dec 2021 05:49:14 +0000 (06:49 +0100)
The watchdog system reset driver can reboot the device but it cannot power
it off. If power off is requested, the driver should not reset the system
but leave powering off to one of the other system reset drivers.

As power cycling is typically not a feature of a watchdog driver the reset
types SYSRESET_POWER and SYSRESET_POWER_OFF shall both be excluded.

Fixes: 17a0c14164dc ("dm: sysreset: add watchdog-reboot driver")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/sysreset/sysreset_watchdog.c

index 35efcac59dda973387d3d92c7d06439b75ae25df..8a659ee9b972f4bb6084d7429e113647a447b7db 100644 (file)
@@ -20,9 +20,16 @@ static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
        struct wdt_reboot_plat *plat = dev_get_plat(dev);
        int ret;
 
-       ret = wdt_expire_now(plat->wdt, 0);
-       if (ret)
-               return ret;
+       switch (type) {
+       case SYSRESET_COLD:
+       case SYSRESET_WARM:
+               ret = wdt_expire_now(plat->wdt, 0);
+               if (ret)
+                       return ret;
+               break;
+       default:
+               return -ENOSYS;
+       }
 
        return -EINPROGRESS;
 }