From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>, Fu Wei <fu.wei@linaro.org>,
Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>,
Al Stone <al.stone@linaro.org>, Timur Tabi <timur@codeaurora.org>,
Aaron Plattner <aplattner@nvidia.com>,
linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback
Date: Thu, 3 Dec 2026 17:30:07 +0000 [thread overview]
Message-ID: <20261203173039.1142495-5-lee@kernel.org> (raw)
In-Reply-To: <20261203173039.1142495-1-lee@kernel.org>
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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
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
next prev parent reply other threads:[~2026-12-03 17:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
2026-12-03 18:31 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 2/6] watchdog: dw_wdt: Guard shared IRQ handler during system suspend and resume Lee Jones
2026-12-03 19:00 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe Lee Jones
2026-12-04 1:02 ` Guenter Roeck
2026-12-03 17:30 ` Lee Jones [this message]
2026-12-04 1:03 ` [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback Guenter Roeck
2026-12-03 17:30 ` [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Lee Jones
2026-12-03 19:45 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation Lee Jones
2026-12-04 1:04 ` Guenter Roeck
2026-12-04 1:08 ` [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203173039.1142495-5-lee@kernel.org \
--to=lee@kernel.org \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=al.stone@linaro.org \
--cc=aplattner@nvidia.com \
--cc=fu.wei@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=stable@vger.kernel.org \
--cc=timur@codeaurora.org \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.