Thread (33 messages) 33 messages, 3 authors, 2025-08-04

Re: [PATCH v2 7/9] watchdog: rzv2h: Set min_timeout based on max_hw_heartbeat_ms

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Date: 2025-08-01 11:06:05
Also in: linux-renesas-soc, linux-watchdog, lkml

Hi Wolfram,

Thank you for the review.

On Fri, Aug 1, 2025 at 5:10 AM Wolfram Sang
[off-list ref] wrote:
On Tue, Jul 29, 2025 at 04:59:13PM +0100, Prabhakar wrote:
quoted
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Update the watchdog minimum timeout value to be derived from
`max_hw_heartbeat_ms` using `DIV_ROUND_UP()` to ensure a valid and
consistent minimum timeout in seconds.
I don't understand this change. Why is the _minimum_ timeout based on
the _maximum_ heartbeat?
The reason for deriving min_timeout from max_hw_heartbeat_ms is to
ensure the minimum watchdog period (in seconds) is compatible with the
underlying hardware.

max_hw_heartbeat_ms is calculated as:
max_hw_heartbeat_ms = (1000 * 16384 * cks_div) / clk_rate;

This value varies by SoC:
 RZ/T2H: cks_div = 8192, clk ≈ 62.5 MHz -> max_hw_heartbeat_ms ~ 2147ms
 RZ/V2H: cks_div = 256, clk ≈ 240 MHz -> max_hw_heartbeat_ms ~ 174ms

Since min_timeout is in seconds, setting it to:
min_timeout = DIV_ROUND_UP(max_hw_heartbeat_ms, 1000);

ensures:
The minimum timeout period is never less than what the hardware can support.
- For T2H, this results in a min_timeout of 3s (2147ms -> 3s).
- For V2H, it’s just 1s (174ms -> 1s).

Cheers,
Prabhakar
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help