Skip to content

Commit 6a569e2

Browse files
ccpalexWim Van Sebroeck
authored andcommitted
watchdog: rti: Fix off-by-one in heartbeat recovery
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 9d89551 commit 6a569e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/watchdog/rti_wdt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ static int rti_wdt_probe(struct platform_device *pdev)
273273

274274
set_bit(WDOG_HW_RUNNING, &wdd->status);
275275
time_left_ms = rti_wdt_get_timeleft_ms(wdd);
276-
heartbeat_ms = readl(wdt->base + RTIDWDPRLD);
276+
/* AM62x TRM: texp = (RTIDWDPRLD + 1) * (2^13) / RTICLK1 */
277+
heartbeat_ms = readl(wdt->base + RTIDWDPRLD) + 1;
277278
heartbeat_ms <<= WDT_PRELOAD_SHIFT;
278279
heartbeat_ms *= 1000;
279280
do_div(heartbeat_ms, wdt->freq);

0 commit comments

Comments
 (0)