Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Stefan Wahren <wahrenst@gmx.net>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com,
	Phil Elwell <phil@raspberrypi.com>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
Date: Mon, 13 Nov 2023 06:31:12 -0800	[thread overview]
Message-ID: <cce852fd-618c-44f5-aa86-1cd33bd97351@roeck-us.net> (raw)
In-Reply-To: <20231112173251.4827-1-wahrenst@gmx.net>

On Sun, Nov 12, 2023 at 06:32:51PM +0100, Stefan Wahren wrote:
> Users report about the unexpected behavior for setting timeouts above
> 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl
> WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations.
> But looking at the code shows that max_timeout based on the
> register value PM_WDOG_TIME_SET, which is the maximum.
> 
> Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat
> in watchdog core") the watchdog core is able to handle this problem.
> 
> This fix has been tested with watchdog-test from selftests.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374
> Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

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

> ---
>  drivers/watchdog/bcm2835_wdt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
> index 7a855289ff5e..bb001c5d7f17 100644
> --- a/drivers/watchdog/bcm2835_wdt.c
> +++ b/drivers/watchdog/bcm2835_wdt.c
> @@ -42,6 +42,7 @@
> 
>  #define SECS_TO_WDOG_TICKS(x) ((x) << 16)
>  #define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
> +#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)
> 
>  struct bcm2835_wdt {
>  	void __iomem		*base;
> @@ -140,7 +141,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
>  	.info =		&bcm2835_wdt_info,
>  	.ops =		&bcm2835_wdt_ops,
>  	.min_timeout =	1,
> -	.max_timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
> +	.max_hw_heartbeat_ms =	WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
>  	.timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
>  };
> 
> --
> 2.34.1
> 

  reply	other threads:[~2023-11-13 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 17:32 [PATCH] watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling Stefan Wahren
2023-11-13 14:31 ` Guenter Roeck [this message]
2023-11-30 11:57   ` Stefan Wahren
2023-12-17 15:34     ` Wim Van Sebroeck
2023-11-13 16:33 ` Florian Fainelli

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=cce852fd-618c-44f5-aa86-1cd33bd97351@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=wahrenst@gmx.net \
    --cc=wim@linux-watchdog.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox