* [PATCH] watchdog: sp805: fix restart handler
@ 2020-03-27 16:24 Michael Walle
2020-03-27 20:42 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2020-03-27 16:24 UTC (permalink / raw)
To: linux-kernel, linux-watchdog
Cc: Jongsung Kim, Guenter Roeck, Wim Van Sebroeck, Michael Walle
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>
---
drivers/watchdog/sp805_wdt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 53e04926a7b2..190d26e2e75f 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -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;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: sp805: fix restart handler
2020-03-27 16:24 [PATCH] watchdog: sp805: fix restart handler Michael Walle
@ 2020-03-27 20:42 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-03-27 20:42 UTC (permalink / raw)
To: Michael Walle, linux-kernel, linux-watchdog
Cc: Jongsung Kim, Wim Van Sebroeck
On 3/27/20 9:24 AM, Michael Walle wrote:
> 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>
> ---
> drivers/watchdog/sp805_wdt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> index 53e04926a7b2..190d26e2e75f 100644
> --- a/drivers/watchdog/sp805_wdt.c
> +++ b/drivers/watchdog/sp805_wdt.c
> @@ -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;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-27 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 16:24 [PATCH] watchdog: sp805: fix restart handler Michael Walle
2020-03-27 20:42 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).