diff options
author | Jongsung Kim <neidhard.kim@lge.com> | 2018-05-04 15:05:03 +0900 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2018-05-21 21:24:41 +0200 |
commit | 6c5c0d48b686cca0d3bbd23f66e871323deffd67 (patch) | |
tree | 12e302aefe256f80b95669ec166229e01507b592 /drivers/watchdog | |
parent | 665f94423a74759a2b6daf6a5c827e6e9cd8a3a2 (diff) | |
download | linux-6c5c0d48b686cca0d3bbd23f66e871323deffd67.tar.bz2 |
watchdog: sp805: add restart handler
Add restart handler for SP805 watchdog so that the driver can be
used to reboot the system.
Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/sp805_wdt.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 03805bc5d67a..9849db0743a7 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -121,6 +121,18 @@ static unsigned int wdt_timeleft(struct watchdog_device *wdd) return div_u64(load, rate); } +static int +wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd) +{ + struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); + + writel_relaxed(0, wdt->base + WDTCONTROL); + writel_relaxed(0, wdt->base + WDTLOAD); + writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); + + return 0; +} + static int wdt_config(struct watchdog_device *wdd, bool ping) { struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); @@ -197,6 +209,7 @@ static const struct watchdog_ops wdt_ops = { .ping = wdt_ping, .set_timeout = wdt_setload, .get_timeleft = wdt_timeleft, + .restart = wdt_restart, }; static int @@ -230,6 +243,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&wdt->lock); watchdog_set_nowayout(&wdt->wdd, nowayout); watchdog_set_drvdata(&wdt->wdd, wdt); + watchdog_set_restart_priority(&wdt->wdd, 128); wdt_setload(&wdt->wdd, DEFAULT_TIMEOUT); ret = watchdog_register_device(&wdt->wdd); |