From: Guenter Roeck <linux@roeck-us.net>
To: Romain Izard <romain.izard.pro@gmail.com>,
linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Wim Van Sebroeck <wim@iguana.be>
Cc: Wenyou Yang <wenyou.yang@atmel.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Re: [PATCH v1] watchdog: sama5d4_wdt: Reset delay on start
Date: Thu, 3 Mar 2016 04:10:15 -0800 [thread overview]
Message-ID: <56D829A7.1020201@roeck-us.net> (raw)
In-Reply-To: <1457000979-15717-1-git-send-email-romain.izard.pro@gmail.com>
On 03/03/2016 02:29 AM, Romain Izard wrote:
> If the internal counter is not refreshed when the watchdog is started
> for the first time, the watchdog will trigger very rapidly. For example,
> opening /dev/watchdog without writing in it will immediately trigger a
> reboot, instead of waiting for the delay to expire.
>
> To avoid this problem, reload the timer on opening the watchdog device.
>
> Command: "while sleep 5; do echo 1; done > /dev/watchdog"
> Before: system reset
> After: the watchdog runs correctly
>
> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Subject might better read "ping watchdog on start" or similar.
Does the watchdog have to be pinged before it is enabled ?
I am a bit concerned that there may still be a 125 uS window
during which the system could restart.
Thanks,
Guenter
> ---
> drivers/watchdog/sama5d4_wdt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
> index a49634cdc1cc..e162fe140ae1 100644
> --- a/drivers/watchdog/sama5d4_wdt.c
> +++ b/drivers/watchdog/sama5d4_wdt.c
> @@ -15,6 +15,7 @@
> #include <linux/platform_device.h>
> #include <linux/reboot.h>
> #include <linux/watchdog.h>
> +#include <linux/delay.h>
>
> #include "at91sam9_wdt.h"
>
> @@ -58,6 +59,8 @@ static int sama5d4_wdt_start(struct watchdog_device *wdd)
> reg = wdt_read(wdt, AT91_WDT_MR);
> reg &= ~AT91_WDT_WDDIS;
> wdt_write(wdt, AT91_WDT_MR, reg);
> + udelay(125); /* > 4 cycles at 32,768 Hz */
> + wdt_write(wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
>
> return 0;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1] watchdog: sama5d4_wdt: Reset delay on start
Date: Thu, 3 Mar 2016 04:10:15 -0800 [thread overview]
Message-ID: <56D829A7.1020201@roeck-us.net> (raw)
In-Reply-To: <1457000979-15717-1-git-send-email-romain.izard.pro@gmail.com>
On 03/03/2016 02:29 AM, Romain Izard wrote:
> If the internal counter is not refreshed when the watchdog is started
> for the first time, the watchdog will trigger very rapidly. For example,
> opening /dev/watchdog without writing in it will immediately trigger a
> reboot, instead of waiting for the delay to expire.
>
> To avoid this problem, reload the timer on opening the watchdog device.
>
> Command: "while sleep 5; do echo 1; done > /dev/watchdog"
> Before: system reset
> After: the watchdog runs correctly
>
> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Subject might better read "ping watchdog on start" or similar.
Does the watchdog have to be pinged before it is enabled ?
I am a bit concerned that there may still be a 125 uS window
during which the system could restart.
Thanks,
Guenter
> ---
> drivers/watchdog/sama5d4_wdt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
> index a49634cdc1cc..e162fe140ae1 100644
> --- a/drivers/watchdog/sama5d4_wdt.c
> +++ b/drivers/watchdog/sama5d4_wdt.c
> @@ -15,6 +15,7 @@
> #include <linux/platform_device.h>
> #include <linux/reboot.h>
> #include <linux/watchdog.h>
> +#include <linux/delay.h>
>
> #include "at91sam9_wdt.h"
>
> @@ -58,6 +59,8 @@ static int sama5d4_wdt_start(struct watchdog_device *wdd)
> reg = wdt_read(wdt, AT91_WDT_MR);
> reg &= ~AT91_WDT_WDDIS;
> wdt_write(wdt, AT91_WDT_MR, reg);
> + udelay(125); /* > 4 cycles at 32,768 Hz */
> + wdt_write(wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
>
> return 0;
> }
>
next prev parent reply other threads:[~2016-03-03 12:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 10:29 [PATCH v1] watchdog: sama5d4_wdt: Reset delay on start Romain Izard
2016-03-03 10:29 ` Romain Izard
2016-03-03 12:10 ` Guenter Roeck [this message]
2016-03-03 12:10 ` Guenter Roeck
2016-03-03 12:53 ` Romain Izard
2016-03-03 12:53 ` Romain Izard
2016-03-03 19:02 ` Guenter Roeck
2016-03-03 19:02 ` Guenter Roeck
2016-03-04 1:35 ` Yang, Wenyou
2016-03-04 1:35 ` Yang, Wenyou
2016-03-04 5:23 ` Guenter Roeck
2016-03-04 5:23 ` Guenter Roeck
2016-03-04 9:06 ` Romain Izard
2016-03-04 9:06 ` Romain Izard
2016-03-04 13:09 ` Guenter Roeck
2016-03-04 13:09 ` Guenter Roeck
2016-03-04 13:26 ` Romain Izard
2016-03-04 13:26 ` Romain Izard
2016-03-04 13:56 ` Guenter Roeck
2016-03-04 13:56 ` Guenter Roeck
2016-03-04 14:59 ` Lothar Waßmann
2016-03-04 14:59 ` Lothar Waßmann
2016-03-04 15:26 ` Romain Izard
2016-03-04 15:26 ` Romain Izard
2016-03-04 15:56 ` Lothar Waßmann
2016-03-04 15:56 ` Lothar Waßmann
2016-03-04 15:56 ` Lothar Waßmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56D829A7.1020201@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=romain.izard.pro@gmail.com \
--cc=wenyou.yang@atmel.com \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.