linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: da9062: do not ping the hw during stop()
@ 2020-01-20  9:17 Marco Felsch
  2020-01-25 23:11 ` Guenter Roeck
  2020-01-28 10:13 ` Adam Thomson
  0 siblings, 2 replies; 3+ messages in thread
From: Marco Felsch @ 2020-01-20  9:17 UTC (permalink / raw)
  To: support.opensource, linux, stwiss.opensource, Adam.Thomson.Opensource
  Cc: linux-watchdog, linux-kernel, kernel

The da9062 hw has a minimum ping cool down phase of at least 200ms. The
driver takes that into account by setting the min_hw_heartbeat_ms to
300ms and the core guarantees that the hw limit is observed for the
ping() calls. But the core can't guarantees the required minimum ping
cool down phase if a stop() command is send immediately after the ping()
command. So it is not allowed to ping the watchdog within the stop()
command as the driver do. Remove the ping can be done without doubts
because the watchdog gets disabled anyway and a (re)start reset the
watchdog counter too.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/watchdog/da9062_wdt.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index 77b6b5336067..0ad15d55071c 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -97,13 +97,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
 	struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
 	int ret;
 
-	ret = da9062_reset_watchdog_timer(wdt);
-	if (ret) {
-		dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n",
-			ret);
-		return ret;
-	}
-
 	ret = regmap_update_bits(wdt->hw->regmap,
 				 DA9062AA_CONTROL_D,
 				 DA9062AA_TWDSCALE_MASK,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] watchdog: da9062: do not ping the hw during stop()
  2020-01-20  9:17 [PATCH] watchdog: da9062: do not ping the hw during stop() Marco Felsch
@ 2020-01-25 23:11 ` Guenter Roeck
  2020-01-28 10:13 ` Adam Thomson
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2020-01-25 23:11 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, stwiss.opensource, Adam.Thomson.Opensource,
	linux-watchdog, linux-kernel, kernel

On Mon, Jan 20, 2020 at 10:17:29AM +0100, Marco Felsch wrote:
> The da9062 hw has a minimum ping cool down phase of at least 200ms. The
> driver takes that into account by setting the min_hw_heartbeat_ms to
> 300ms and the core guarantees that the hw limit is observed for the
> ping() calls. But the core can't guarantees the required minimum ping

guarantee

> cool down phase if a stop() command is send immediately after the ping()
> command. So it is not allowed to ping the watchdog within the stop()
> command as the driver do. Remove the ping can be done without doubts

does

> because the watchdog gets disabled anyway and a (re)start reset the

resets

> watchdog counter too.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

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

> ---
>  drivers/watchdog/da9062_wdt.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index 77b6b5336067..0ad15d55071c 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -97,13 +97,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
>  	struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
>  	int ret;
>  
> -	ret = da9062_reset_watchdog_timer(wdt);
> -	if (ret) {
> -		dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n",
> -			ret);
> -		return ret;
> -	}
> -
>  	ret = regmap_update_bits(wdt->hw->regmap,
>  				 DA9062AA_CONTROL_D,
>  				 DA9062AA_TWDSCALE_MASK,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] watchdog: da9062: do not ping the hw during stop()
  2020-01-20  9:17 [PATCH] watchdog: da9062: do not ping the hw during stop() Marco Felsch
  2020-01-25 23:11 ` Guenter Roeck
@ 2020-01-28 10:13 ` Adam Thomson
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2020-01-28 10:13 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, linux, Steve Twiss, Adam Thomson
  Cc: linux-watchdog, linux-kernel, kernel

On 20 January 2020 09:17, Marco Felsch wrote:

> The da9062 hw has a minimum ping cool down phase of at least 200ms. The
> driver takes that into account by setting the min_hw_heartbeat_ms to
> 300ms and the core guarantees that the hw limit is observed for the
> ping() calls. But the core can't guarantees the required minimum ping
> cool down phase if a stop() command is send immediately after the ping()
> command. So it is not allowed to ping the watchdog within the stop()
> command as the driver do. Remove the ping can be done without doubts
> because the watchdog gets disabled anyway and a (re)start reset the
> watchdog counter too.
> 

Good spot. Thanks for this. Am wondering if this might also be an issue for
da9062_wdt_set_timeout() which calls down to
da9062_wdt_update_timeout_register() which in turn pings the watchdog first
before disabling it and then setting the new timeout value. I think it makes
sense to remove the ping from da9062_wdt_update_timeout_register() as well to
avoid any possible issues where a ping() is called and then immediately after
there's a call to adjust the timeout. If you can double check my hypothesis
that would be good though.

> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/watchdog/da9062_wdt.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index 77b6b5336067..0ad15d55071c 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -97,13 +97,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
>  	struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
>  	int ret;
> 
> -	ret = da9062_reset_watchdog_timer(wdt);
> -	if (ret) {
> -		dev_err(wdt->hw->dev, "Failed to ping the watchdog (err =
> %d)\n",
> -			ret);
> -		return ret;
> -	}
> -
>  	ret = regmap_update_bits(wdt->hw->regmap,
>  				 DA9062AA_CONTROL_D,
>  				 DA9062AA_TWDSCALE_MASK,
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-28 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20  9:17 [PATCH] watchdog: da9062: do not ping the hw during stop() Marco Felsch
2020-01-25 23:11 ` Guenter Roeck
2020-01-28 10:13 ` Adam Thomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).