Files
BPI-CM9-Linux/build/patch/u-boot/u-boot-genio/0023-watchdog-mtk_wdt-Correct-maximum-timeout-from-15-to-.patch

45 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Nicolas F. R. A. Prado" <[email protected]>
Date: Wed, 14 May 2025 17:48:48 -0400
Subject: watchdog: mtk_wdt: Correct maximum timeout from 15 to 31 seconds
According to the MT8365 datasheet, the WDT_LENGTH field contains 11, not
10, bits and therefore the maximum count is 2047 which translates to
just over 31 seconds of maximum watchdog timeout. Fix the clamping
accordingly to allow double of the current watchdog timeout range.
The new maximum watchdog timeout has been test on the Genio 350 EVK
board.
Signed-off-by: Nicolas F. R. A. Prado <[email protected]>
---
drivers/watchdog/mtk_wdt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 111111111111..222222222222 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -86,15 +86,15 @@ static void mtk_wdt_set_timeout(struct udevice *dev, u64 timeout_ms)
* We want the ceiling after dividing timeout_ms by 15.625 ms
* We add 15624 prior to the divide to implement the ceiling
* We prevent over-flow by clamping the timeout_ms value here
- * as the maximum WDT_LENGTH counts is 1023 -> 15.984375 sec
+ * as the maximum WDT_LENGTH counts is 2047 -> 31.984375 sec
* We also enforce a minimum of 1 count
* Many watchdog peripherals have a self-imposed count of 1
* that is added to the register counts.
* The MediaTek docs lack details to know if this is the case here.
* So we enforce a minimum of 1 to guarantee operation.
*/
- if (timeout_ms > 15984)
- timeout_ms = 15984;
+ if (timeout_ms > 31984)
+ timeout_ms = 31984;
timeout_us = timeout_ms * 1000;
timeout_cc = (15624 + timeout_us) / 15625;
--
Armbian