[00/10] Intel Keem Bay WDT bug fixes

Message ID 20210512084724.14634-1-shruthi.sanil@intel.com
Headers show
Series
  • Intel Keem Bay WDT bug fixes
Related show

Message

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

The series of patches include the below bug fixes
in the Intel Keem Bay watchdog timer driver:

Patch 1/10:
- 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.

Patch 2/10:
- Upadate WDT pretimeout for every update in timeout
  The pre-timeout value to be programmed to the register has to be
  calculated and updated for every change in the timeout value.
  Else the threshold time wouldn't be calculated to its
  corresponding timeout.

Patch 3/10:
- Update pretimeout to 0 in the TH ISR
  The pretimeout has to be updated to 0 during the ISR of the
  ThresHold interrupt. Else the TH interrupt would be triggerred for
  every tick until the timeout.

Patch 4/10:
- Clear either the TO or TH interrupt bit
  During the interrupt service routine of the TimeOut interrupt and
  the ThresHold interrupt, the respective interrupt clear bit
  have to be cleared and not both.

Patch 5/10:
- Remove timeout update in the WDT start function
  Removed set timeout from the start WDT function. There is a function
  defined to set the timeout. Hence no need to set the timeout again in
  start function as the timeout would have been already updated
  before calling the start/enable.

Patch 6/10:
- Removed timeout update in the TO ISR
  In the TO ISR removed updating the Timeout value because
  its not serving any purpose as the timer would have already expired
  and the system would be rebooting.

Patch 7/10:
- Update the check in keembay_wdt_resume()
  Corrected the typo in the function keembay_wdt_resume, we need to
  enable the WDT if it is disabled/not active.

Patch 8/10:
- MACRO for WDT enable and disable values
  Introduced MACRO's for WDT enable and disable values for better readability

Patch 9/10:
- WDT SMC handler MACRO name update
  Updated the WDT SMC handler MACRO name to make it clear that its
  a ARM SMC handler that helps in clearing the WDT interrupt bit.

Patch 10/10:
- Typo corrections and other blank operations
  Corrected typos, aligned the tabs and added new lines
  wherever required for better readability

Shruthi Sanil (10):
  watchdog: keembay: Update WDT pre-timeout during the initialization
  watchdog: keembay: Upadate WDT pretimeout for every update in timeout
  watchdog: keembay: Update pretimeout to zero in the TH ISR
  watchdog: keembay: Clear either the TO or TH interrupt bit
  watchdog: keembay: Remove timeout update in the WDT start function
  watchdog: keembay: Removed timeout update in the TO ISR
  watchdog: keembay: Update the check in keembay_wdt_resume()
  watchdog: keembay: MACRO for WDT enable and disable values
  watchdog: keembay: WDT SMC handler MACRO name update
  watchdog: keembay: Typo corrections and other blank operations

 drivers/watchdog/keembay_wdt.c | 36 ++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 13 deletions(-)


base-commit: 88b06399c9c766c283e070b022b5ceafa4f63f19

Comments

Sanil, Shruthi May 13, 2021, 5:32 a.m. | #1
> -----Original Message-----

> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck

> Sent: Wednesday, May 12, 2021 7:32 PM

> To: Sanil, Shruthi <shruthi.sanil@intel.com>

> Cc: wim@linux-watchdog.org; linux-watchdog@vger.kernel.org; linux-

> kernel@vger.kernel.org; andriy.shevchenko@linux.intel.com;

> kris.pan@linux.intel.com; mgross@linux.intel.com; Thokala, Srikanth

> <srikanth.thokala@intel.com>; Raja Subramanian, Lakshmi Bai

> <lakshmi.bai.raja.subramanian@intel.com>; Sangannavar, Mallikarjunappa

> <mallikarjunappa.sangannavar@intel.com>

> Subject: Re: [PATCH 07/10] watchdog: keembay: Update the check in

> keembay_wdt_resume()

> 

> On Wed, May 12, 2021 at 02:17:21PM +0530, shruthi.sanil@intel.com wrote:

> > From: Shruthi Sanil <shruthi.sanil@intel.com>

> >

> > Corrected the typo in the function keembay_wdt_resume, we need to

> > enable the WDT if it is disabled/not active.

> >

> > 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 | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/drivers/watchdog/keembay_wdt.c

> > b/drivers/watchdog/keembay_wdt.c index dd192b8dff55..10896415f8c7

> > 100644

> > --- a/drivers/watchdog/keembay_wdt.c

> > +++ b/drivers/watchdog/keembay_wdt.c

> > @@ -260,7 +260,7 @@ static int __maybe_unused

> > keembay_wdt_resume(struct device *dev)  {

> >  	struct keembay_wdt *wdt = dev_get_drvdata(dev);

> >

> > -	if (watchdog_active(&wdt->wdd))

> > +	if (!watchdog_active(&wdt->wdd))

> 

> Have you tested this ? "watchdog_active" refers to the watchdog core state.

> Your code now keeps the watchdog stopped after resume if it was running

> before, and starts it if it wasn't. Please run through a suspend/resume cycle

> with watchdog disabled and see what happens.

> 

> Guenter


I had understood it wrongly. I was assuming that watchdog_active refers to the actual state of the HW. Hence I made that change.
But since watchdog_active refers to the state of the core, the change that I have done is incorrect. Hence I'll drop this patch.

Thanks
Shruthi

> 

> >  		return keembay_wdt_start(&wdt->wdd);

> >

> >  	return 0;

> > --

> > 2.17.1

> >