提交 f7781b06 编写于 作者: G Guenter Roeck 提交者: Wim Van Sebroeck

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: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 17b20833
...@@ -273,14 +273,20 @@ static int sp5100_tco_setupdevice(struct device *dev, ...@@ -273,14 +273,20 @@ static int sp5100_tco_setupdevice(struct device *dev,
/* Setup the watchdog timer */ /* Setup the watchdog timer */
tco_timer_enable(); tco_timer_enable();
/* Check that the watchdog action is set to reset the system */
val = readl(SP5100_WDT_CONTROL(tco->tcobase)); 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 * Save WatchDogFired status, because WatchDogFired flag is
* cleared here. * cleared here.
*/ */
if (val & SP5100_WDT_FIRED) if (val & SP5100_WDT_FIRED)
wdd->bootstatus = WDIOF_CARDRESET; wdd->bootstatus = WDIOF_CARDRESET;
/* Set watchdog action to reset the system */
val &= ~SP5100_WDT_ACTION_RESET; val &= ~SP5100_WDT_ACTION_RESET;
writel(val, SP5100_WDT_CONTROL(tco->tcobase)); writel(val, SP5100_WDT_CONTROL(tco->tcobase));
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define SP5100_WDT_START_STOP_BIT BIT(0) #define SP5100_WDT_START_STOP_BIT BIT(0)
#define SP5100_WDT_FIRED BIT(1) #define SP5100_WDT_FIRED BIT(1)
#define SP5100_WDT_ACTION_RESET BIT(2) #define SP5100_WDT_ACTION_RESET BIT(2)
#define SP5100_WDT_DISABLED BIT(3)
#define SP5100_WDT_TRIGGER_BIT BIT(7) #define SP5100_WDT_TRIGGER_BIT BIT(7)
#define SP5100_PM_IOPORTS_SIZE 0x02 #define SP5100_PM_IOPORTS_SIZE 0x02
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册