Skip to content

Commit 266da53

Browse files
Mathieu OthaceheWim Van Sebroeck
authored andcommitted
watchdog: sama5d4: readout initial state
Readout the AT91_WDT_MR bit at probe so that it becomes possible to get the pre-userspace handler working. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230819084726.11037-1-othacehe@gnu.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent cf38e76 commit 266da53

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/watchdog/sama5d4_wdt.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
254254
struct sama5d4_wdt *wdt;
255255
void __iomem *regs;
256256
u32 irq = 0;
257+
u32 reg;
257258
int ret;
258259

259260
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
@@ -304,6 +305,12 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
304305

305306
watchdog_init_timeout(wdd, wdt_timeout, dev);
306307

308+
reg = wdt_read(wdt, AT91_WDT_MR);
309+
if (!(reg & AT91_WDT_WDDIS)) {
310+
wdt->mr &= ~AT91_WDT_WDDIS;
311+
set_bit(WDOG_HW_RUNNING, &wdd->status);
312+
}
313+
307314
ret = sama5d4_wdt_init(wdt);
308315
if (ret)
309316
return ret;

0 commit comments

Comments
 (0)