]> Git Repo - linux.git/commitdiff
watchdog: sp805: fix restart handler
authorMichael Walle <[email protected]>
Fri, 27 Mar 2020 16:24:50 +0000 (17:24 +0100)
committerWim Van Sebroeck <[email protected]>
Wed, 8 Apr 2020 09:18:38 +0000 (11:18 +0200)
The restart handler is missing two things, first, the registers
has to be unlocked and second there is no synchronization for the
write_relaxed() calls.

This was tested on a custom board with the NXP LS1028A SoC.

Fixes: 6c5c0d48b686c ("watchdog: sp805: add restart handler")
Signed-off-by: Michael Walle <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
drivers/watchdog/sp805_wdt.c

index 53e04926a7b2d3ffb6748278550cbd845a34f3ea..190d26e2e75f9e7a8c5bf2fd35fe4c202d9380f3 100644 (file)
@@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd)
 {
        struct sp805_wdt *wdt = watchdog_get_drvdata(wdd);
 
+       writel_relaxed(UNLOCK, wdt->base + WDTLOCK);
        writel_relaxed(0, wdt->base + WDTCONTROL);
        writel_relaxed(0, wdt->base + WDTLOAD);
        writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL);
 
+       /* Flush posted writes. */
+       readl_relaxed(wdt->base + WDTLOCK);
+
        return 0;
 }
 
This page took 0.044307 seconds and 4 git commands to generate.