[PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback
From: Lee Jones
Date: Thu Dec 03 2026 - 12:31:25 EST
sbsa_gwdt_probe() calls sbsa_gwdt_get_version() and applies the
MediaTek WS0 race workaround before attempting to request the WS0
interrupt. If platform_get_irq() or devm_request_irq() fails and the
driver falls back to single-stage mode (action = 0), neither
need_ws0_race_workaround nor wdd->min_timeout is updated, leaving
MediaTek rev 0 hardware without the workaround.
Move sbsa_gwdt_get_version(), max_hw_heartbeat_ms initialisation, and the
need_ws0_race_workaround check after the IRQ setup block.
Fixes: 48defdf6b083 ("watchdog: sbsa: Adjust keepalive timeout to avoid MediaTek WS0 race condition")
Closes: https://sashiko.dev/#/bug/linux-01e7e345-bbe4-47e2-a2be-00d65eb15869
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/watchdog/sbsa_gwdt.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 537c48b883b3..82ffeeadb871 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -340,20 +340,6 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
wdd->timeout = DEFAULT_TIMEOUT;
watchdog_set_drvdata(wdd, gwdt);
watchdog_set_nowayout(wdd, nowayout);
- sbsa_gwdt_get_version(wdd);
- if (gwdt->version == 0)
- wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000;
- else
- wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000;
-
- if (gwdt->need_ws0_race_workaround) {
- /*
- * A timeout of 3 seconds means that WOR will be set to 1.5
- * seconds and the heartbeat will be scheduled every 2.5
- * seconds.
- */
- wdd->min_timeout = 3;
- }
status = readl(cf_base + SBSA_GWDT_WCS);
if (status & SBSA_GWDT_WCS_WS1) {
@@ -384,6 +370,22 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
if (!action)
dev_warn(dev, "falling back to single stage mode.\n");
}
+
+ sbsa_gwdt_get_version(wdd);
+ if (gwdt->version == 0)
+ wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000;
+ else
+ wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000;
+
+ if (gwdt->need_ws0_race_workaround) {
+ /*
+ * A timeout of 3 seconds means that WOR will be set to 1.5
+ * seconds and the heartbeat will be scheduled every 2.5
+ * seconds.
+ */
+ wdd->min_timeout = 3;
+ }
+
/*
* In the single stage mode, The first signal (WS0) is ignored,
* the timeout is (WOR * 2), so the maximum timeout should be doubled.
--
2.56.1.911.g883d8bcb20-goog