All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: tegra: Stop watchdog first if restarting
@ 2015-11-10  0:11 ` Andrew Chew
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Chew @ 2015-11-10  0:11 UTC (permalink / raw)
  To: linux-watchdog
  Cc: linux-tegra, linux-kernel, abrestic, treding, swarren, jimmzhang,
	linux, wim, Andrew Chew

If we need to restart the watchdog due to someone changing the timeout
interval, stop the watchdog before restarting it.  Otherwise, the new
timeout doesn't seem to take.

Signed-off-by: Andrew Chew <achew@nvidia.com>
---
 drivers/watchdog/tegra_wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
index 7f97cdd..9ec5760 100644
--- a/drivers/watchdog/tegra_wdt.c
+++ b/drivers/watchdog/tegra_wdt.c
@@ -140,8 +140,10 @@ static int tegra_wdt_set_timeout(struct watchdog_device *wdd,
 {
 	wdd->timeout = timeout;
 
-	if (watchdog_active(wdd))
+	if (watchdog_active(wdd)) {
+		tegra_wdt_stop(wdd);
 		return tegra_wdt_start(wdd);
+	}
 
 	return 0;
 }
-- 
2.1.4

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

* [PATCH] watchdog: tegra: Stop watchdog first if restarting
@ 2015-11-10  0:11 ` Andrew Chew
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Chew @ 2015-11-10  0:11 UTC (permalink / raw)
  To: linux-watchdog
  Cc: linux-tegra, linux-kernel, abrestic, treding, swarren, jimmzhang,
	linux, wim, Andrew Chew

If we need to restart the watchdog due to someone changing the timeout
interval, stop the watchdog before restarting it.  Otherwise, the new
timeout doesn't seem to take.

Signed-off-by: Andrew Chew <achew@nvidia.com>
---
 drivers/watchdog/tegra_wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
index 7f97cdd..9ec5760 100644
--- a/drivers/watchdog/tegra_wdt.c
+++ b/drivers/watchdog/tegra_wdt.c
@@ -140,8 +140,10 @@ static int tegra_wdt_set_timeout(struct watchdog_device *wdd,
 {
 	wdd->timeout = timeout;
 
-	if (watchdog_active(wdd))
+	if (watchdog_active(wdd)) {
+		tegra_wdt_stop(wdd);
 		return tegra_wdt_start(wdd);
+	}
 
 	return 0;
 }
-- 
2.1.4


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

* Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting
  2015-11-10  0:11 ` Andrew Chew
@ 2015-11-13 19:52     ` Guenter Roeck
  -1 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-11-13 19:52 UTC (permalink / raw)
  To: Andrew Chew, linux-watchdog-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	abrestic-F7+t8E8rja9g9hUCZPvPmw, treding-DDmLM1+adcrQT0dZR+AlfA,
	swarren-DDmLM1+adcrQT0dZR+AlfA, jimmzhang-DDmLM1+adcrQT0dZR+AlfA,
	wim-IQzOog9fTRqzQB+pC5nmwQ

On 11/09/2015 04:11 PM, Andrew Chew wrote:
> If we need to restart the watchdog due to someone changing the timeout
> interval, stop the watchdog before restarting it.  Otherwise, the new
> timeout doesn't seem to take.
>
> Signed-off-by: Andrew Chew <achew-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

Some feedback from the maintainers would be helpful, though,
especially if there is some other means to change the timeout
without stopping the watchdog.

Guenter

> ---
>   drivers/watchdog/tegra_wdt.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
> index 7f97cdd..9ec5760 100644
> --- a/drivers/watchdog/tegra_wdt.c
> +++ b/drivers/watchdog/tegra_wdt.c
> @@ -140,8 +140,10 @@ static int tegra_wdt_set_timeout(struct watchdog_device *wdd,
>   {
>   	wdd->timeout = timeout;
>
> -	if (watchdog_active(wdd))
> +	if (watchdog_active(wdd)) {
> +		tegra_wdt_stop(wdd);
>   		return tegra_wdt_start(wdd);
> +	}
>
>   	return 0;
>   }
>

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

* Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting
@ 2015-11-13 19:52     ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-11-13 19:52 UTC (permalink / raw)
  To: Andrew Chew, linux-watchdog
  Cc: linux-tegra, linux-kernel, abrestic, treding, swarren, jimmzhang, wim

On 11/09/2015 04:11 PM, Andrew Chew wrote:
> If we need to restart the watchdog due to someone changing the timeout
> interval, stop the watchdog before restarting it.  Otherwise, the new
> timeout doesn't seem to take.
>
> Signed-off-by: Andrew Chew <achew@nvidia.com>

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

Some feedback from the maintainers would be helpful, though,
especially if there is some other means to change the timeout
without stopping the watchdog.

Guenter

> ---
>   drivers/watchdog/tegra_wdt.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
> index 7f97cdd..9ec5760 100644
> --- a/drivers/watchdog/tegra_wdt.c
> +++ b/drivers/watchdog/tegra_wdt.c
> @@ -140,8 +140,10 @@ static int tegra_wdt_set_timeout(struct watchdog_device *wdd,
>   {
>   	wdd->timeout = timeout;
>
> -	if (watchdog_active(wdd))
> +	if (watchdog_active(wdd)) {
> +		tegra_wdt_stop(wdd);
>   		return tegra_wdt_start(wdd);
> +	}
>
>   	return 0;
>   }
>


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

* Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting
  2015-11-13 19:52     ` Guenter Roeck
@ 2015-11-16 10:48         ` Thierry Reding
  -1 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-11-16 10:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Andrew Chew, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	abrestic-F7+t8E8rja9g9hUCZPvPmw, swarren-DDmLM1+adcrQT0dZR+AlfA,
	jimmzhang-DDmLM1+adcrQT0dZR+AlfA, wim-IQzOog9fTRqzQB+pC5nmwQ

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

On Fri, Nov 13, 2015 at 11:52:30AM -0800, Guenter Roeck wrote:
> On 11/09/2015 04:11 PM, Andrew Chew wrote:
> >If we need to restart the watchdog due to someone changing the timeout
> >interval, stop the watchdog before restarting it.  Otherwise, the new
> >timeout doesn't seem to take.
> >
> >Signed-off-by: Andrew Chew <achew-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
> 
> Some feedback from the maintainers would be helpful, though,
> especially if there is some other means to change the timeout
> without stopping the watchdog.

I don't think there is. The TIMER_WDT<w>_COMMAND_0 register has this
description:

	"The StartCounter bit enables watchdog counter operation, loads
	the watchdog counter, starts the watchdog timer to count down,
	resets the expiration count to 0, and clears all flags. Also
	used as restart.
	
	..."

The way I read this is that the watchdog period (the field that the
wdd->timeout value gets written to) is latched when the StartCounter
bit transitions from 0 to 1. So this change looks correct to me:

Reviewed-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Andrew, it might be worthwhile to file an internal bug report to see if
we can get the TRM updated with a more explicit programming sequence or
at least get confirmation from one of the hardware designers whether or
not this is the correct sequence when changing the period.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting
@ 2015-11-16 10:48         ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-11-16 10:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Andrew Chew, linux-watchdog, linux-tegra, linux-kernel, abrestic,
	swarren, jimmzhang, wim

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

On Fri, Nov 13, 2015 at 11:52:30AM -0800, Guenter Roeck wrote:
> On 11/09/2015 04:11 PM, Andrew Chew wrote:
> >If we need to restart the watchdog due to someone changing the timeout
> >interval, stop the watchdog before restarting it.  Otherwise, the new
> >timeout doesn't seem to take.
> >
> >Signed-off-by: Andrew Chew <achew@nvidia.com>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> Some feedback from the maintainers would be helpful, though,
> especially if there is some other means to change the timeout
> without stopping the watchdog.

I don't think there is. The TIMER_WDT<w>_COMMAND_0 register has this
description:

	"The StartCounter bit enables watchdog counter operation, loads
	the watchdog counter, starts the watchdog timer to count down,
	resets the expiration count to 0, and clears all flags. Also
	used as restart.
	
	..."

The way I read this is that the watchdog period (the field that the
wdd->timeout value gets written to) is latched when the StartCounter
bit transitions from 0 to 1. So this change looks correct to me:

Reviewed-by: Thierry Reding <treding@nvidia.com>

Andrew, it might be worthwhile to file an internal bug report to see if
we can get the TRM updated with a more explicit programming sequence or
at least get confirmation from one of the hardware designers whether or
not this is the correct sequence when changing the period.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-11-16 10:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  0:11 [PATCH] watchdog: tegra: Stop watchdog first if restarting Andrew Chew
2015-11-10  0:11 ` Andrew Chew
     [not found] ` <1447114298-5516-1-git-send-email-achew-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-11-13 19:52   ` Guenter Roeck
2015-11-13 19:52     ` Guenter Roeck
     [not found]     ` <56463F7E.8040008-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2015-11-16 10:48       ` Thierry Reding
2015-11-16 10:48         ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.