On 07/15/2016 01:15 AM, Rasmus Villemoes wrote:
You don't need to set this bit here unless the watchdog can not be stopped.
+static bool bcm2835_wdt_is_running(struct bcm2835_wdt *wdt)
+{
+ uint32_t cur;
+
+ cur = readl(wdt->base + PM_RSTC);
+
+ return !!(cur & PM_RSTC_WRCFG_FULL_RESET);
+}
+
static int bcm2835_wdt_start(struct watchdog_device *wdog)
{
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
@@ -70,6 +79,7 @@ static int bcm2835_wdt_start(struct watchdog_device
*wdog)
PM_RSTC_WRCFG_FULL_RESET, wdt->base + PM_RSTC);
spin_unlock_irqrestore(&wdt->lock, flags);
+ set_bit(WDOG_HW_RUNNING, &wdog->status);
return 0;
}
@@ -79,6 +89,7 @@ static int bcm2835_wdt_stop(struct watchdog_device
*wdog)
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
+ clear_bit(WDOG_HW_RUNNING, &wdog->status);
... and since you clear the bit, it can be stopped. Both setting and
resetting the bit
is therefore not necessary.