From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319076; b=ie/OtoGRMddGbem8BCj+vhOtQkmvLmMpd+kJas8dn6uryT+GqgoL+N2jZsnaRou2LRuw rA5l7fKnfd8oM7r61CHAkTbwX+DB1YT62VmdBftK+8nNpuuNCpjauQp3kZeW2sCwo4iFa qTSoSaoVYv/H59h2zNjGVi91PXS06Z3muyCKJRGa4qz877H7x8cbw50GuMiTP+LKK9pVm 9p6teChXPCp6IQnvBl4s+xbAAjw+u6jQU2dkiEYoRmqKy9GTUVSkEyDcIznrqOdZDkqmL 5tZXiCkdj+NB2veagtSEEqv7y/0N1RS4hSkGM1Cm4crKzXxgxyJ8b6dSNwjjdid5LxA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319076; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=i84lU1AFDyq1keFOXZm/bHtZc/soMuBnrIrZNZvSqok=; b=RR5L/Vau/TorrS8Z7bsjkUosfqLrBW/WAhKKp+aageZ1IknUNqPN7JrfYcFwGJ6inmPG fGWsc7GO3f8DsxctMiPxvFKKGsX+o44L6bU+0HL+243LCBLLUQCCYJ17NMdnUzU5KZzHv u6OKpgLpGBubgaAv9XvyJoFo/4OlPJFEF21I81tjXv5ueBSMLRyst9u/+eQZZv8S1vd1Y sCRelhqXex+E5zJOQfRdKqaZhJbmwC+0GnT9xF7Pj6sAsEn+0kNiA4pA7GH8c0mH09JeR dVLfSbt/IfJ4pibRRcQG5IJ+LKP98Kz1PeTv8OBs2dq/nOwZOrO2hidakUJvUl0rq1A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dwmGxdHs; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08E92606A336; Thu, 3 Dec 2026 17:31:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dwmGxdHs Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1AE21F00893; Thu, 3 Dec 2026 17:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796319075; bh=i84lU1AFDyq1keFOXZm/bHtZc/soMuBnrIrZNZvSqok=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dwmGxdHsvVLuJ/laLlgv2APaQgY7GxOucnfF37TvMoUIemsC5skyB+H9hbivnqJV8 NLMpxMCVhk+vhSm8oD3qBqoT+wohydl27HH2+thSzqo3z1MebLOPuI5wxfsvjt0s5K gmPFAmujtSOz+SdRJVBGRzF6HEQF0F2OzMPCYmlJX4tRxUNt8fx2zQdlda3wRThxGD LV58tAZdi0rbWaWMDJZSAVJsVZedAiPYo8k/3F2IYBitVpfv8tVItycR+OKTXQej1w H1UBd+pUJOppxYEB6gT9nQI2Sbuati1iik4hBGOb2KPMcq/5kkISFnpVrbHdRdFDFp A7XL3UsQ0pwnQ== From: Lee Jones To: lee@kernel.org, Wim Van Sebroeck , Guenter Roeck , Fu Wei , Suravee Suthikulpanit , Al Stone , Timur Tabi , Aaron Plattner , 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 Message-ID: <20261203173039.1142495-5-lee@kernel.org> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog In-Reply-To: <20261203173039.1142495-1-lee@kernel.org> References: <20261203173039.1142495-1-lee@kernel.org> X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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