Commit 29353816 authored by Shruthi Sanil's avatar Shruthi Sanil Committed by Wim Van Sebroeck

watchdog: keembay: Update WDT pre-timeout during the initialization

The pretimeout register has a default reset value. Hence
when a smaller WDT timeout is set which would be lesser than the
default pretimeout, the system behaves abnormally, starts
triggering the pretimeout interrupt even when the WDT is
not enabled, most of the times leading to system crash.
Hence an update in the pre-timeout is also required for the
default timeout that is being configured.

Fixes: fa0f8d51 ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarKris Pan <kris.pan@intel.com>
Signed-off-by: default avatarShruthi Sanil <shruthi.sanil@intel.com>
Link: https://lore.kernel.org/r/20210517174953.19404-2-shruthi.sanil@intel.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent c4681547
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define WDT_LOAD_MAX U32_MAX #define WDT_LOAD_MAX U32_MAX
#define WDT_LOAD_MIN 1 #define WDT_LOAD_MIN 1
#define WDT_TIMEOUT 5 #define WDT_TIMEOUT 5
#define WDT_PRETIMEOUT 4
static unsigned int timeout = WDT_TIMEOUT; static unsigned int timeout = WDT_TIMEOUT;
module_param(timeout, int, 0); module_param(timeout, int, 0);
...@@ -224,11 +225,13 @@ static int keembay_wdt_probe(struct platform_device *pdev) ...@@ -224,11 +225,13 @@ static int keembay_wdt_probe(struct platform_device *pdev)
wdt->wdd.min_timeout = WDT_LOAD_MIN; wdt->wdd.min_timeout = WDT_LOAD_MIN;
wdt->wdd.max_timeout = WDT_LOAD_MAX / wdt->rate; wdt->wdd.max_timeout = WDT_LOAD_MAX / wdt->rate;
wdt->wdd.timeout = WDT_TIMEOUT; wdt->wdd.timeout = WDT_TIMEOUT;
wdt->wdd.pretimeout = WDT_PRETIMEOUT;
watchdog_set_drvdata(&wdt->wdd, wdt); watchdog_set_drvdata(&wdt->wdd, wdt);
watchdog_set_nowayout(&wdt->wdd, nowayout); watchdog_set_nowayout(&wdt->wdd, nowayout);
watchdog_init_timeout(&wdt->wdd, timeout, dev); watchdog_init_timeout(&wdt->wdd, timeout, dev);
keembay_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout); keembay_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout);
keembay_wdt_set_pretimeout(&wdt->wdd, wdt->wdd.pretimeout);
ret = devm_watchdog_register_device(dev, &wdt->wdd); ret = devm_watchdog_register_device(dev, &wdt->wdd);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment