From: Srinivas Goud <srinivas.goud@xxxxxxxxxx> Add support for setting up timeout via kernel module parameter or read timeout-sec via device tree. Signed-off-by: Srinivas Goud <srinivas.goud@xxxxxxxxxx> Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx> --- 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