* [PATCH 1/2] watchdog: dw_wdt: do not register restart handler
@ 2024-05-27 9:50 Sascha Hauer
2024-05-27 9:50 ` [PATCH 2/2] watchdog: fix watchdog restart handler when autoping is enabled Sascha Hauer
2024-05-28 8:58 ` [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-27 9:50 UTC (permalink / raw)
To: Barebox List
The designware watchdog driver doesn't have a special reset function,
instead it only uses the regular watchdog to reset the SoC. Since
0ed7bb09f2ef7b ("watchdog: add option to provide fall-back restart handler")
the watchdog core provides the same functionality, so just drop the
restart functionality from the driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/dw_wdt.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 178e0a29f1..398bbfe05f 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -16,7 +16,6 @@
#include <init.h>
#include <io.h>
#include <of.h>
-#include <restart.h>
#include <watchdog.h>
#include <linux/clk.h>
#include <linux/err.h>
@@ -37,7 +36,6 @@
struct dw_wdt {
void __iomem *regs;
- struct restart_handler restart;
struct watchdog wdd;
struct reset_control *rst;
unsigned int rate;
@@ -115,19 +113,6 @@ static int dw_wdt_set_timeout(struct watchdog *wdd, unsigned int top_s)
return 0;
}
-static void __noreturn dw_wdt_restart_handle(struct restart_handler *rst)
-{
- struct dw_wdt *dw_wdt;
-
- dw_wdt = container_of(rst, struct dw_wdt, restart);
-
- dw_wdt->wdd.set_timeout(&dw_wdt->wdd, -1);
-
- mdelay(1000);
-
- hang();
-}
-
static int dw_wdt_drv_probe(struct device *dev)
{
struct watchdog *wdd;
@@ -173,13 +158,6 @@ static int dw_wdt_drv_probe(struct device *dev)
if (ret)
goto out_disable_clk;
- dw_wdt->restart.name = "dw_wdt";
- dw_wdt->restart.restart = dw_wdt_restart_handle;
-
- ret = restart_handler_register(&dw_wdt->restart);
- if (ret)
- dev_warn(dev, "cannot register restart handler\n");
-
if (dw_wdt->rst)
reset_control_deassert(dw_wdt->rst);
else
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] watchdog: fix watchdog restart handler when autoping is enabled
2024-05-27 9:50 [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
@ 2024-05-27 9:50 ` Sascha Hauer
2024-05-28 8:58 ` [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-27 9:50 UTC (permalink / raw)
To: Barebox List
When the watchdog autoping feature is enabled it will ping the watchdog
every 0.5s. This becomes a problem when the fallback restart handler is
called to reset the CPU. It will then set the watchdog to trigger in one
second and waits for CPU reset using mdelay(). During the mdelay() the
autoping poller will continue to feed the watchdog, so we never actually
reset the CPU.
Use mdelay_non_interruptible() instead so that no poller can run in the
background.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/wd_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index f39a8f4522..42cbd7b72c 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -178,7 +178,8 @@ static void __noreturn watchdog_restart_handle(struct restart_handler *this)
ret = watchdog_set_timeout(wd, 1);
BUG_ON(ret);
- mdelay(2000);
+
+ mdelay_non_interruptible(2000);
pr_emerg("Watchdog failed to reset the machine\n");
hang();
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] watchdog: dw_wdt: do not register restart handler
2024-05-27 9:50 [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
2024-05-27 9:50 ` [PATCH 2/2] watchdog: fix watchdog restart handler when autoping is enabled Sascha Hauer
@ 2024-05-28 8:58 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-28 8:58 UTC (permalink / raw)
To: Barebox List, Sascha Hauer
On Mon, 27 May 2024 11:50:56 +0200, Sascha Hauer wrote:
> The designware watchdog driver doesn't have a special reset function,
> instead it only uses the regular watchdog to reset the SoC. Since
> 0ed7bb09f2ef7b ("watchdog: add option to provide fall-back restart handler")
> the watchdog core provides the same functionality, so just drop the
> restart functionality from the driver.
>
>
> [...]
Applied, thanks!
[1/2] watchdog: dw_wdt: do not register restart handler
https://git.pengutronix.de/cgit/barebox/commit/?id=421ac5c9ec21 (link may not be stable)
[2/2] watchdog: fix watchdog restart handler when autoping is enabled
https://git.pengutronix.de/cgit/barebox/commit/?id=77a000225df4 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-28 8:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-27 9:50 [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
2024-05-27 9:50 ` [PATCH 2/2] watchdog: fix watchdog restart handler when autoping is enabled Sascha Hauer
2024-05-28 8:58 ` [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox