Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "A. Sverdlin" <alexander.sverdlin@siemens.com>,
	linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Judith Mendez <jm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
	Tero Kristo <t-kristo@ti.com>
Subject: Re: [PATCH] watchdog: rti: Fix off-by-one in heartbeat recovery
Date: Tue, 26 Nov 2024 07:32:48 -0800	[thread overview]
Message-ID: <5500eecd-2dd9-46cc-a7d8-dfd004cd00a8@roeck-us.net> (raw)
In-Reply-To: <20241126073646.126752-1-alexander.sverdlin@siemens.com>

On 11/25/24 23:36, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> According to AM62x TRM WDT period is (RTIDWDPRLD + 1) * (2^13) / RTICLK1,
> Fix the heartbeat recovery. In practice this doesn't affect rounded
> heatbeat in seconds, but it does correct 4% of error in milliseconds,
> for, say, default 60s heartbeat. This affects last_ping calculation.
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>

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

> ---
>   drivers/watchdog/rti_wdt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index 563d842014dfb..0416e54b17edb 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -273,7 +273,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
>   
>   		set_bit(WDOG_HW_RUNNING, &wdd->status);
>   		time_left_ms = rti_wdt_get_timeleft_ms(wdd);
> -		heartbeat_ms = readl(wdt->base + RTIDWDPRLD);
> +		/* AM62x TRM: texp = (RTIDWDPRLD + 1) * (2^13) / RTICLK1 */
> +		heartbeat_ms = readl(wdt->base + RTIDWDPRLD) + 1;
>   		heartbeat_ms <<= WDT_PRELOAD_SHIFT;
>   		heartbeat_ms *= 1000;
>   		do_div(heartbeat_ms, wdt->freq);


      reply	other threads:[~2024-11-26 15:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26  7:36 [PATCH] watchdog: rti: Fix off-by-one in heartbeat recovery A. Sverdlin
2024-11-26 15:32 ` Guenter Roeck [this message]

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=5500eecd-2dd9-46cc-a7d8-dfd004cd00a8@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alexander.sverdlin@siemens.com \
    --cc=jm@ti.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=t-kristo@ti.com \
    --cc=vigneshr@ti.com \
    --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