summaryrefslogtreecommitdiff
path: root/drivers/watchdog/sp5100_tco.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2017-12-24 13:04:16 -0800
committerWim Van Sebroeck <wim@iguana.be>2018-01-21 12:56:37 +0100
commitf7781b067522aa269213e8025c80cbed1868d349 (patch)
tree0490b61bdc2f6786ef8bee43f1e9b05154309952 /drivers/watchdog/sp5100_tco.c
parent17b20833ff427e285e36e4ce6e5dc8b0046fa0a4 (diff)
watchdog: sp5100-tco: Abort if watchdog is disabled by hardware
If the watchdog control register indicates that the watchdog hardware is disabled even after we tried to enable it, there is no point to instantiate the driver. Cc: Zoltán Böszörményi <zboszor@pr.hu> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/sp5100_tco.c')
-rw-r--r--drivers/watchdog/sp5100_tco.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
index bb6c4608c1c0..23246cb40598 100644
--- a/drivers/watchdog/sp5100_tco.c
+++ b/drivers/watchdog/sp5100_tco.c
@@ -273,14 +273,20 @@ static int sp5100_tco_setupdevice(struct device *dev,
/* Setup the watchdog timer */
tco_timer_enable();
- /* Check that the watchdog action is set to reset the system */
val = readl(SP5100_WDT_CONTROL(tco->tcobase));
+ if (val & SP5100_WDT_DISABLED) {
+ dev_err(dev, "Watchdog hardware is disabled\n");
+ ret = -ENODEV;
+ goto unreg_region;
+ }
+
/*
* Save WatchDogFired status, because WatchDogFired flag is
* cleared here.
*/
if (val & SP5100_WDT_FIRED)
wdd->bootstatus = WDIOF_CARDRESET;
+ /* Set watchdog action to reset the system */
val &= ~SP5100_WDT_ACTION_RESET;
writel(val, SP5100_WDT_CONTROL(tco->tcobase));