@@ -18,6 +18,8 @@
#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
+#define TWD_WDOG_RESETSTAT_MASK 0x1
+
#include <linux/ioport.h>
struct twd_local_timer {
@@ -151,6 +151,7 @@ static int mpcore_wdt_set_heartbeat(struct watchdog_device *wdd, unsigned int t)
static const struct watchdog_info mpcore_wdt_info = {
.options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING |
+ WDIOF_CARDRESET |
WDIOF_MAGICCLOSE,
.identity = "MPcore Watchdog",
};
@@ -216,6 +217,9 @@ static int mpcore_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdt);
watchdog_set_drvdata(&wdt->wdd, wdt);
+ wdt->wdd.bootstatus = (readl_relaxed(wdt->base + TWD_WDOG_RESETSTAT) &
+ TWD_WDOG_RESETSTAT_MASK) ? WDIOF_CARDRESET : 0;
+
mpcore_wdt_stop(&wdt->wdd);
ret = watchdog_register_device(&wdt->wdd);
mpcore watchdog can give last boot status, whether we got a watchdog reset or not, via bit 0 of TWD_WDOG_RESETSTAT register. This patch adds support to return correct status if WDIOC_GETBOOTSTATUS cmd is called with ioctl. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- arch/arm/include/asm/smp_twd.h | 2 ++ drivers/watchdog/mpcore_wdt.c | 4 ++++ 2 files changed, 6 insertions(+)