Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: sp805: fix restart handler

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 <michael@walle.cc>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200327162450.28506-1-michael@walle.cc
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Michael Walle and committed by
Wim Van Sebroeck
ea104a9e 2d63908b

+4
+4
drivers/watchdog/sp805_wdt.c
··· 137 137 { 138 138 struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); 139 139 140 + writel_relaxed(UNLOCK, wdt->base + WDTLOCK); 140 141 writel_relaxed(0, wdt->base + WDTCONTROL); 141 142 writel_relaxed(0, wdt->base + WDTLOAD); 142 143 writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); 144 + 145 + /* Flush posted writes. */ 146 + readl_relaxed(wdt->base + WDTLOCK); 143 147 144 148 return 0; 145 149 }