* [PATCH 1/4] watchdog: dw_wdt: Write counter restart register
@ 2021-06-10 13:06 Sascha Hauer
2021-06-10 13:06 ` [PATCH 2/4] watchdog: dw_wdt: Detect if running initially Sascha Hauer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2021-06-10 13:06 UTC (permalink / raw)
To: Barebox List
At least some variants of the dwc watchdog controllers need the
value 0x76 written to the counter restart register to actually
take the value written to the Timeout range register. Happened
on Rockchip RK3568, without this the watchdog immediately resets
the system.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/dw_wdt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 17771c7126..bc5d4a889a 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -111,6 +111,9 @@ static int dw_wdt_set_timeout(struct watchdog *wdd, unsigned int top_s)
writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
+ writel(WDOG_COUNTER_RESTART_KICK_VALUE,
+ dw_wdt->regs + WDOG_COUNTER_RESTART_REG_OFFSET);
+
dw_wdt_start(wdd);
return 0;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/4] watchdog: dw_wdt: Detect if running initially
2021-06-10 13:06 [PATCH 1/4] watchdog: dw_wdt: Write counter restart register Sascha Hauer
@ 2021-06-10 13:06 ` Sascha Hauer
2021-06-10 13:06 ` [PATCH 3/4] watchdog: dw_wdt: set maximum timeout Sascha Hauer
2021-06-10 13:06 ` [PATCH 4/4] watchdog: dw_wdt: denote message to debug level Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2021-06-10 13:06 UTC (permalink / raw)
To: Barebox List
Let the watchdog core know if the watchdog is currently running or not.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/dw_wdt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index bc5d4a889a..bc5af810ea 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -164,6 +164,9 @@ static int dw_wdt_drv_probe(struct device_d *dev)
wdd->hwdev = dev;
wdd->set_timeout = dw_wdt_set_timeout;
+ wdd->running = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET) &
+ WDOG_CONTROL_REG_WDT_EN_MASK ? WDOG_HW_RUNNING : WDOG_HW_NOT_RUNNING;
+
dw_wdt->rate = clk_get_rate(clk);
if (dw_wdt->rate == 0)
return -EINVAL;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] watchdog: dw_wdt: set maximum timeout
2021-06-10 13:06 [PATCH 1/4] watchdog: dw_wdt: Write counter restart register Sascha Hauer
2021-06-10 13:06 ` [PATCH 2/4] watchdog: dw_wdt: Detect if running initially Sascha Hauer
@ 2021-06-10 13:06 ` Sascha Hauer
2021-06-10 13:06 ` [PATCH 4/4] watchdog: dw_wdt: denote message to debug level Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2021-06-10 13:06 UTC (permalink / raw)
To: Barebox List
Communicate the maximum possible timeout to the watchdog core.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/dw_wdt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index bc5af810ea..e23d9cc225 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -159,18 +159,19 @@ static int dw_wdt_drv_probe(struct device_d *dev)
if (IS_ERR(dw_wdt->rst))
return PTR_ERR(dw_wdt->rst);
+ dw_wdt->rate = clk_get_rate(clk);
+ if (dw_wdt->rate == 0)
+ return -EINVAL;
+
wdd = &dw_wdt->wdd;
wdd->name = "dw_wdt";
wdd->hwdev = dev;
wdd->set_timeout = dw_wdt_set_timeout;
+ wdd->timeout_max = dw_wdt_top_in_seconds(dw_wdt, DW_WDT_MAX_TOP);
wdd->running = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET) &
WDOG_CONTROL_REG_WDT_EN_MASK ? WDOG_HW_RUNNING : WDOG_HW_NOT_RUNNING;
- dw_wdt->rate = clk_get_rate(clk);
- if (dw_wdt->rate == 0)
- return -EINVAL;
-
ret = watchdog_register(wdd);
if (ret)
goto out_disable_clk;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] watchdog: dw_wdt: denote message to debug level
2021-06-10 13:06 [PATCH 1/4] watchdog: dw_wdt: Write counter restart register Sascha Hauer
2021-06-10 13:06 ` [PATCH 2/4] watchdog: dw_wdt: Detect if running initially Sascha Hauer
2021-06-10 13:06 ` [PATCH 3/4] watchdog: dw_wdt: set maximum timeout Sascha Hauer
@ 2021-06-10 13:06 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2021-06-10 13:06 UTC (permalink / raw)
To: Barebox List
dw_wdt may be unstoppable once started when no reset line is available.
This behaviour is quite common for different watchdogs, it is not worth
issuing a warning.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/dw_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index e23d9cc225..70d6f0cced 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -186,7 +186,7 @@ static int dw_wdt_drv_probe(struct device_d *dev)
if (dw_wdt->rst)
reset_control_deassert(dw_wdt->rst);
else
- dev_warn(dev, "No reset lines. Will not be able to stop once started.\n");
+ dev_dbg(dev, "No reset lines. Will not be able to stop once started.\n");
return 0;
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-10 13:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 13:06 [PATCH 1/4] watchdog: dw_wdt: Write counter restart register Sascha Hauer
2021-06-10 13:06 ` [PATCH 2/4] watchdog: dw_wdt: Detect if running initially Sascha Hauer
2021-06-10 13:06 ` [PATCH 3/4] watchdog: dw_wdt: set maximum timeout Sascha Hauer
2021-06-10 13:06 ` [PATCH 4/4] watchdog: dw_wdt: denote message to debug level Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox