[PATCH] watchdog: sbsa_gwdt: Limit the MediaTek WS0 race workaround to revision 0
From: Zexin Wang
Date: Wed Nov 04 2026 - 03:37:30 EST
The WS0 race workaround is currently enabled for all MediaTek SBSA
Generic Watchdog revisions in single-stage mode. However, only
revision 0 is affected by the race condition.
Read the revision field from W_IIDR and enable the workaround only for
MediaTek watchdogs with revision 0 in single-stage mode. This avoids
unnecessarily restricting the minimum timeout and adjusting the
keepalive interval on unaffected revisions.
Signed-off-by: Zexin Wang <ot_zexin.wang@xxxxxxxxxxxx>
---
drivers/watchdog/sbsa_gwdt.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 3c5bfd8641c6..eb79c8049f95 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -71,12 +71,16 @@
#define SBSA_GWDT_WCS_WS0 BIT(1)
#define SBSA_GWDT_WCS_WS1 BIT(2)
-#define SBSA_GWDT_VERSION_MASK GENMASK(3, 0)
-#define SBSA_GWDT_VERSION_SHIFT 16
+#define SBSA_GWDT_VERSION_MASK GENMASK(3, 0)
+#define SBSA_GWDT_VERSION_SHIFT 16
-#define SBSA_GWDT_IMPL_MASK GENMASK(11, 0)
-#define SBSA_GWDT_IMPL_SHIFT 0
-#define SBSA_GWDT_IMPL_MEDIATEK 0x426
+#define SBSA_GWDT_REVISION_MASK GENMASK(3, 0)
+#define SBSA_GWDT_REVISION_SHIFT 12
+#define SBSA_GWDT_REV_RACE_WA 0x0
+
+#define SBSA_GWDT_IMPL_MASK GENMASK(11, 0)
+#define SBSA_GWDT_IMPL_SHIFT 0
+#define SBSA_GWDT_IMPL_MEDIATEK 0x426
/**
* struct sbsa_gwdt - Internal representation of the SBSA GWDT
@@ -238,15 +242,17 @@ static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)
static void sbsa_gwdt_get_version(struct watchdog_device *wdd)
{
struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd);
- int iidr, ver, impl;
+ int iidr, ver, rev, impl;
iidr = readl(gwdt->control_base + SBSA_GWDT_W_IIDR);
ver = (iidr >> SBSA_GWDT_VERSION_SHIFT) & SBSA_GWDT_VERSION_MASK;
+ rev = (iidr >> SBSA_GWDT_REVISION_SHIFT) & SBSA_GWDT_REVISION_MASK;
impl = (iidr >> SBSA_GWDT_IMPL_SHIFT) & SBSA_GWDT_IMPL_MASK;
gwdt->version = ver;
gwdt->need_ws0_race_workaround =
- !action && (impl == SBSA_GWDT_IMPL_MEDIATEK);
+ !action && (impl == SBSA_GWDT_IMPL_MEDIATEK) &&
+ (rev == SBSA_GWDT_REV_RACE_WA);
}
static int sbsa_gwdt_start(struct watchdog_device *wdd)
--
2.45.2