]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
watchdog: xilinx_wwdt: Calculate max_hw_heartbeat_ms using clock frequency
authorHarini T <harini.t@amd.com>
Fri, 13 Sep 2024 11:32:30 +0000 (17:02 +0530)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Mon, 4 Nov 2024 12:12:59 +0000 (13:12 +0100)
commit006778844c2c132c28cfa90e3570560351e01b9a
treea919458889f0871ce2b80621f3ea8940e658232f
parentdaa814d784ac034c62ab3fb0ef83daeafef527e2
watchdog: xilinx_wwdt: Calculate max_hw_heartbeat_ms using clock frequency

In the current implementation, the value of max_hw_heartbeat_ms is set
to the timeout period expressed in milliseconds and fails to verify if
the close window percentage exceeds the maximum value that the hardware
supports.

1. Calculate max_hw_heartbeat_ms based on input clock frequency.
2. Update frequency check to require a minimum frequency of 1Mhz.
3. Limit the close and open window percent to hardware supported value
to avoid truncation.
4. If the user input timeout exceeds the maximum timeout supported, use
only open window and the framework supports the higher timeouts.

Fixes: 12984cea1b8c ("watchdog: xilinx_wwdt: Add Versal window watchdog support")
Signed-off-by: Harini T <harini.t@amd.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240913113230.1939373-1-harini.t@amd.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/xilinx_wwdt.c