Thread (14 messages) 14 messages, 3 authors, 2017-09-20

[PATCH 1/4] watchdog: aspeed: Retain watchdog enabled state

From: Andrew Jeffery <hidden>
Date: 2017-09-19 02:31:06
Also in: linux-watchdog, lkml, openbmc

On Mon, 2017-09-18 at 06:25 -0700, Guenter Roeck wrote:
On 09/17/2017 10:49 PM, Andrew Jeffery wrote:
quoted
An unintended post-condition of probe() is that the watchdog is
disabled. Rework probe() such that we retain the value of the "enabled"
bit from the control register, and take the appropriate actions with
respect to the watchdog core if so. Otherwise, just configure the
watchdog as directed.
quoted
quoted
Signed-off-by: Andrew Jeffery <redacted>
---
  drivers/watchdog/aspeed_wdt.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index 79cc766cd30f..99bc6fbd8852 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -221,7 +221,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
quoted
quoted
  		return -EINVAL;
  	config = ofdid->data;
  
quoted
quoted
-	wdt->ctrl = WDT_CTRL_1MHZ_CLK;
+	wdt->ctrl |= readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE;
+	wdt->ctrl |= WDT_CTRL_1MHZ_CLK;
  
quoted
quoted
  	/*
  	 * Control reset on a per-device basis to ensure the
@@ -243,11 +244,11 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
quoted
quoted
  	if (of_property_read_bool(np, "aspeed,external-signal"))
  		wdt->ctrl |= WDT_CTRL_WDT_EXT;
  
quoted
quoted
-	writel(wdt->ctrl, wdt->base + WDT_CTRL);
-
quoted
quoted
-	if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE)  {
+	if (wdt->ctrl & WDT_CTRL_ENABLE) {
  		aspeed_wdt_start(&wdt->wdd);
Why call the start function in this case ?
... Good question. It was already there so I didn't touch it. I expect
it can be dropped - I'll look into it.
quoted
quoted
quoted
quoted
quoted
  		set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); > +	} else {
+		writel(wdt->ctrl, wdt->base + WDT_CTRL);
  	}
  
quoted
quoted
  	if (of_device_is_compatible(np, "aspeed,ast2500-wdt")) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20170919/d8e14082/attachment.sig>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help