summaryrefslogtreecommitdiff
path: root/drivers/sysreset
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-11-04 10:31:17 +0100
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-12-26 06:49:14 +0100
commit88c4cbedfb2f0a41830b662fe2e5797a95af508f (patch)
tree3a784a47941144283a3bb26a63a40068e989a686 /drivers/sysreset
parent2b18d95d91c8d52a1971f93202c6b8212fa4f27e (diff)
downloadu-boot-88c4cbedfb2f0a41830b662fe2e5797a95af508f.tar.gz
u-boot-88c4cbedfb2f0a41830b662fe2e5797a95af508f.tar.bz2
u-boot-88c4cbedfb2f0a41830b662fe2e5797a95af508f.zip
sysreset: watchdog: watchdog cannot power off
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>
Diffstat (limited to 'drivers/sysreset')
-rw-r--r--drivers/sysreset/sysreset_watchdog.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/sysreset/sysreset_watchdog.c b/drivers/sysreset/sysreset_watchdog.c
index 35efcac59d..8a659ee9b9 100644
--- a/drivers/sysreset/sysreset_watchdog.c
+++ b/drivers/sysreset/sysreset_watchdog.c
@@ -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;
}