[01/10] watchdog: keembay: Update WDT pre-timeout during the initialization
diff mbox series

Message ID 20210512084724.14634-2-shruthi.sanil@intel.com
State New, archived
Headers show
Series
  • Intel Keem Bay WDT bug fixes
Related show

Commit Message

Sanil, Shruthi May 12, 2021, 8:47 a.m. UTC
From: Shruthi Sanil <shruthi.sanil@intel.com>

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: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kris Pan <kris.pan@intel.com>
Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>
---
 drivers/watchdog/keembay_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Guenter Roeck May 12, 2021, 1:58 p.m. UTC | #1
On Wed, May 12, 2021 at 02:17:15PM +0530, shruthi.sanil@intel.com wrote:
> From: Shruthi Sanil <shruthi.sanil@intel.com>
> 
> 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: fa0f8d51e90d ("watchdog: Add watchdog driver for Intel Keembay Soc")
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Kris Pan <kris.pan@intel.com>
> Signed-off-by: Shruthi Sanil <shruthi.sanil@intel.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/keembay_wdt.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
> index 547d3fea33ff..f2f5c9fae29c 100644
> --- a/drivers/watchdog/keembay_wdt.c
> +++ b/drivers/watchdog/keembay_wdt.c
> @@ -29,6 +29,7 @@
>  #define WDT_LOAD_MAX		U32_MAX
>  #define WDT_LOAD_MIN		1
>  #define WDT_TIMEOUT		5
> +#define WDT_PRETIMEOUT		4
>  
>  static unsigned int timeout = WDT_TIMEOUT;
>  module_param(timeout, int, 0);
> @@ -224,11 +225,13 @@ static int keembay_wdt_probe(struct platform_device *pdev)
>  	wdt->wdd.min_timeout	= WDT_LOAD_MIN;
>  	wdt->wdd.max_timeout	= WDT_LOAD_MAX / wdt->rate;
>  	wdt->wdd.timeout	= WDT_TIMEOUT;
> +	wdt->wdd.pretimeout	= WDT_PRETIMEOUT;
>  
>  	watchdog_set_drvdata(&wdt->wdd, wdt);
>  	watchdog_set_nowayout(&wdt->wdd, nowayout);
>  	watchdog_init_timeout(&wdt->wdd, timeout, dev);
>  	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);
>  	if (ret)
> -- 
> 2.17.1
>

Patch
diff mbox series

diff --git a/drivers/watchdog/keembay_wdt.c b/drivers/watchdog/keembay_wdt.c
index 547d3fea33ff..f2f5c9fae29c 100644
--- a/drivers/watchdog/keembay_wdt.c
+++ b/drivers/watchdog/keembay_wdt.c
@@ -29,6 +29,7 @@ 
 #define WDT_LOAD_MAX		U32_MAX
 #define WDT_LOAD_MIN		1
 #define WDT_TIMEOUT		5
+#define WDT_PRETIMEOUT		4
 
 static unsigned int timeout = WDT_TIMEOUT;
 module_param(timeout, int, 0);
@@ -224,11 +225,13 @@  static int keembay_wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout	= WDT_LOAD_MIN;
 	wdt->wdd.max_timeout	= WDT_LOAD_MAX / wdt->rate;
 	wdt->wdd.timeout	= WDT_TIMEOUT;
+	wdt->wdd.pretimeout	= WDT_PRETIMEOUT;
 
 	watchdog_set_drvdata(&wdt->wdd, wdt);
 	watchdog_set_nowayout(&wdt->wdd, nowayout);
 	watchdog_init_timeout(&wdt->wdd, timeout, dev);
 	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);
 	if (ret)