Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266097 > unrolled thread

[PATCH] watchdog: tegra: Stop watchdog first if restarting

Started byAndrew Chew <achew@nvidia.com>
First post2015-11-10 01:20 +0100
Last post2015-11-16 11:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] watchdog: tegra: Stop watchdog first if restarting Andrew Chew <achew@nvidia.com> - 2015-11-10 01:20 +0100
    Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting Guenter Roeck <linux@roeck-us.net> - 2015-11-13 21:00 +0100
      Re: [PATCH] watchdog: tegra: Stop watchdog first if restarting Thierry Reding <treding@nvidia.com> - 2015-11-16 11:50 +0100

#1266097 — [PATCH] watchdog: tegra: Stop watchdog first if restarting

FromAndrew Chew <achew@nvidia.com>
Date2015-11-10 01:20 +0100
Subject[PATCH] watchdog: tegra: Stop watchdog first if restarting
Message-ID<qt4Pg-61O-1@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1269186

FromGuenter Roeck <linux@roeck-us.net>
Date2015-11-13 21:00 +0100
Message-ID<qusFQ-2eI-31@gated-at.bofh.it>
In reply to#1266097
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;
>   }
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1269989

FromThierry Reding <treding@nvidia.com>
Date2015-11-16 11:50 +0100
Message-ID<qvpwd-6co-13@gated-at.bofh.it>
In reply to#1269186

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web