[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1579181217-31127-9-git-send-email-srinivas.neeli@xilinx.com>
Date: Thu, 16 Jan 2020 18:56:56 +0530
From: Srinivas Neeli <srinivas.neeli@...inx.com>
To: linux@...ck-us.net, michal.simek@...inx.com,
shubhrajyoti.datta@...inx.com, sgoud@...inx.com
Cc: wim@...ux-watchdog.org, linux-watchdog@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
git@...inx.com
Subject: [PATCH 8/9] watchdog: of_xilinx_wdt: Wire setting up timeout via module parameter/DT
From: Srinivas Goud <srinivas.goud@...inx.com>
Add support for setting up timeout via kernel module parameter or read
timeout-sec via device tree.
Signed-off-by: Srinivas Goud <srinivas.goud@...inx.com>
Signed-off-by: Michal Simek <michal.simek@...inx.com>
---
drivers/watchdog/of_xilinx_wdt.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index d2c389d9eaa7..375289e3bed2 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -18,6 +18,7 @@
#include <linux/of_device.h>
#include <linux/of_address.h>
+#define XWT_WWDT_DEFAULT_TIMEOUT 10
#define XWT_WWDT_MIN_TIMEOUT 1
#define XWT_WWDT_MAX_TIMEOUT 80
@@ -55,6 +56,13 @@
#define WATCHDOG_NAME "Xilinx Watchdog"
+static int wdt_timeout;
+
+module_param(wdt_timeout, int, 0644);
+MODULE_PARM_DESC(wdt_timeout,
+ "Watchdog time in seconds. (default="
+ __MODULE_STRING(XWT_WWDT_DEFAULT_TIMEOUT) ")");
+
/**
* enum xwdt_ip_type - WDT IP type.
*
@@ -416,6 +424,15 @@ static int xwdt_probe(struct platform_device *pdev)
xilinx_wdt_wdd->timeout =
2 * ((1 << xdev->wdt_interval) /
pfreq);
+ } else {
+ xilinx_wdt_wdd->timeout = XWT_WWDT_DEFAULT_TIMEOUT;
+ xilinx_wdt_wdd->min_timeout = XWT_WWDT_MIN_TIMEOUT;
+ xilinx_wdt_wdd->max_timeout = XWT_WWDT_MAX_TIMEOUT;
+
+ rc = watchdog_init_timeout(xilinx_wdt_wdd,
+ wdt_timeout, &pdev->dev);
+ if (rc)
+ dev_warn(&pdev->dev, "unable to set timeout value\n");
}
spin_lock_init(&xdev->spinlock);
--
2.7.4
Powered by blists - more mailing lists