lkml.org 
[lkml]   [2017]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] watchdog: aspeed: Retain watchdog enabled state
Date
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.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
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)
return -EINVAL;
config = ofdid->data;

- wdt->ctrl = WDT_CTRL_1MHZ_CLK;
+ wdt->ctrl |= readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE;
+ wdt->ctrl |= WDT_CTRL_1MHZ_CLK;

/*
* Control reset on a per-device basis to ensure the
@@ -243,11 +244,11 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
if (of_property_read_bool(np, "aspeed,external-signal"))
wdt->ctrl |= WDT_CTRL_WDT_EXT;

- writel(wdt->ctrl, wdt->base + WDT_CTRL);
-
- if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
+ if (wdt->ctrl & WDT_CTRL_ENABLE) {
aspeed_wdt_start(&wdt->wdd);
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
+ } else {
+ writel(wdt->ctrl, wdt->base + WDT_CTRL);
}

if (of_device_is_compatible(np, "aspeed,ast2500-wdt")) {
--
2.11.0
\
 
 \ /
  Last update: 2017-09-18 07:52    [W:0.086 / U:14.132 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site