watchdog: rti: drop hack manipulating WDT clock rate
authorAlexander Sverdlin <alexander.sverdlin@siemens.com>
Thu, 21 Nov 2024 08:03:25 +0000 (09:03 +0100)
committerStefan Roese <sr@denx.de>
Tue, 7 Jan 2025 09:29:58 +0000 (10:29 +0100)
The hack itself seems to be copied from Linux rti_wdt.c, but the WDT reset
principle is different in U-Boot. While Linux relies on correct frequencies
and timers and doesn't check the actual WDT counter value U-Boot driver
seems to be more robust: it does compare RTIDWDCNTR vs RTIDWDPRLD.

Now the root cause of the original motivation to manipulate the clock rate
is said to be understood and fixed in Linux commit cae58516534e
("watchdog: rti_wdt: Set min_hw_heartbeat_ms to accommodate a safety margin")
which simultaneously removed the hack itself.

While is fix part of the mentioned patch is neither applicable nor requried
for the U-Boot driver just drop the hack setting WDT clock rate to 90% of
the real rate. This has a nice effect that the WDT timeout is now as
requested and not 10% shorter.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/watchdog/rti_wdt.c

index 320c5ca..7b38726 100644 (file)
@@ -187,14 +187,6 @@ static int rti_wdt_probe(struct udevice *dev)
 
        priv->clk_hz = clk_get_rate(&clk);
 
-       /*
-        * If watchdog is running at 32k clock, it is not accurate.
-        * Adjust frequency down in this case so that it does not expire
-        * earlier than expected.
-        */
-       if (priv->clk_hz < 32768)
-               priv->clk_hz = priv->clk_hz * 9 / 10;
-
        return 0;
 }