Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] watchdog: make DesignWare watchdog allow users to set bigger timeout value
@ 2019-11-21  8:21 Wang, Peng 1. (NSB - CN/Hangzhou)
  2019-11-21  9:56 ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Wang, Peng 1. (NSB - CN/Hangzhou) @ 2019-11-21  8:21 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: wim, linux-watchdog, linux-kernel

From d21d084122d08816454a1e338f0946a9da1f81e3 Mon Sep 17 00:00:00 2001
From: Peng Wang <peng.1.wang@nokia-sbell.com>
Date: Wed, 20 Nov 2019 15:12:59 +0800
Subject: [PATCH] watchdog: make DesignWare watchdog allow users to set bigger
 timeout value

watchdog_dev.c provides means to allow users to set bigger timeout value
than HW can support, make DesignWare watchdog align with this.

Signed-off-by: Peng Wang <peng.1.wang@nokia-sbell.com>
---
 drivers/watchdog/dw_wdt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index fef7c61..f1a431c 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -114,7 +114,15 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s)
 	writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
 	       dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
 
-	wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+	/*
+	 * In case users set bigger timeout value than HW can support,
+	 * kernel(watchdog_dev.c) helps to feed watchdog before 
+	 * wdd->timeout
+	 */
+	if ( top_s * 1000 <= wdd->max_hw_heartbeat_ms )
+		wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+	else
+		wdd->timeout = top_s;
 
 	return 0;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH] watchdog: make DesignWare watchdog allow users to set bigger timeout value
@ 2019-11-20 10:07 Wang, Peng 1. (NSB - CN/Hangzhou)
  2019-11-20 17:15 ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Wang, Peng 1. (NSB - CN/Hangzhou) @ 2019-11-20 10:07 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel

From 1d051b7c081083751dc0bab97d3ab9efbba0f4a7 Mon Sep 17 00:00:00 2001
From: Peng Wang <peng.1.wang@nokia-sbell.com>
Date: Wed, 20 Nov 2019 15:12:59 +0800
Subject: [PATCH] watchdog: make DesignWare watchdog allow users to set bigger
 timeout value

watchdog_dev.c provides means to allow users to set bigger timeout value
than HW can support, make DesignWare watchdog align with this.

Signed-off-by: Peng Wang <peng.1.wang@nokia-sbell.com>
---
 drivers/watchdog/dw_wdt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index fef7c61..8911e5e 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -113,8 +113,15 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s)
 	 */
 	writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
 	       dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
-
-	wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+    
+    /*
+     * In case users set bigger timeout value than HW can support,
+     * kernel(watchdog_dev.c) helps to feed watchdog before 
+     * wdd->timeout
+     */
+    if ( wdd->timeout * 1000 <= wdd->max_hw_heartbeat_ms ) {
+	    wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
+    }
 
 	return 0;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21  8:21 [PATCH] watchdog: make DesignWare watchdog allow users to set bigger timeout value Wang, Peng 1. (NSB - CN/Hangzhou)
2019-11-21  9:56 ` Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2019-11-20 10:07 Wang, Peng 1. (NSB - CN/Hangzhou)
2019-11-20 17:15 ` Guenter Roeck
2019-11-21  1:29   ` Wang, Peng 1. (NSB - CN/Hangzhou)
2019-11-21  3:40     ` Guenter Roeck
2019-11-21  8:07       ` Wang, Peng 1. (NSB - CN/Hangzhou)
2019-11-21  9:45         ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git