* [PATCH v7 0/8] Add syscon support for Renesas WDT driver
@ 2026-09-29 10:50 Prabhakar
2026-09-29 10:50 ` [PATCH v7 1/8] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi all,
This series adds syscon support for the Renesas RZ/T2H and RZ/N2H SoCs in
the WDT driver. The WDTDCR register is part of the CPG/MSSR block for
which the CPG driver registers SYSC regmap. WDT driver now uses this
syscon to access the WDTDCR register.
These patches were part of two seprate series [0] and [1], out of which
certain patches have been queued separately, so I have included rest of
the patches into this single series.
Merge strategy, as the WDT driver now includes renesas.h header file,
the driver patches can go via renesas-soc.
Note, patches have been rebased on top of next-20260928.
v6->v7:
- Added a new patch to introduce rzt2h_cpg_wdtdcr_count_start() function
- Added new patch to drop pm_runtime_resume_and_get() &
pm_runtime_put_sync() calls while accessing the WDTDCR register.
- Dropped propagating WDTDCR access errors.
- Dropped converting WDTDCR handling to regmap as this would require
resource address comparison to get WDT index to call
rzt2h_cpg_wdtdcr_count_start().
- Made use of rzt2h_cpg_wdtdcr_count_start() in restart handler
- Added if regmap is available, use it for WDTDCR access
- Updated commit message
v5->v6:
- Used pm_runtime_put_sync() in rzv2h_wdt_stop() function.
- rebased on top of next-20260922
v4->v5:
- patch #1 is new addressing Sashiko's comments to avoid potential deadlock
- patch #4 is new addressing Sashiko's comments
- Dropped checking rzt2h_wdt_wdtdcr_count_start() return value in
restart path.
- Handled the regmap locking in the driver and introduced nolock
version to be used in the restart path.
- Added review-by tag.
[0] https://lore.kernel.org/all/20260817192540.423994-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
[1] https://lore.kernel.org/all/20260814191415.2110732-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
Cheers,
Prabhakar
Lad Prabhakar (8):
clk: renesas: r9a09g077: Add helper to start WDTDCR counter
watchdog: rzv2h: Use pm_runtime_put_sync()
watchdog: rzv2h: Drop enabling clocks in the restart handler
watchdog: rzv2h: Drop WDTRCR_RSTIRQS define
watchdog: rzv2h: Drop runtime PM handling from WDTDCR init
watchdog: rzv2h_wdt: Add syscon based WDTDCR access
arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access
arm64: dts: renesas: r9a09g087: Use CPG/MSSR syscon for WDTDCR access
arch/arm64/boot/dts/renesas/r9a09g077.dtsi | 24 ++---
arch/arm64/boot/dts/renesas/r9a09g087.dtsi | 24 ++---
drivers/clk/renesas/r9a09g077-cpg.c | 35 +++++--
drivers/watchdog/rzv2h_wdt.c | 104 +++++++++++++++------
include/linux/clk/renesas.h | 6 ++
5 files changed, 132 insertions(+), 61 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v7 1/8] clk: renesas: r9a09g077: Add helper to start WDTDCR counter
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 2/8] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The WDTDCRm registers are not suitable for access through the SYSC regmap
from atomic or panic context, as regmap locking can deadlock when another
CPU holding the lock has already stopped.
Add a lockless helper to clear WDTDCRm.WDTSTOPCTRL and start the watchdog
counter using the existing SYSC register accessors.
Export the helper in the RZT2H_CPG namespace for use by the watchdog
driver.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- New patch
---
drivers/clk/renesas/r9a09g077-cpg.c | 35 ++++++++++++++++++++++++-----
include/linux/clk/renesas.h | 6 +++++
2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/renesas/r9a09g077-cpg.c b/drivers/clk/renesas/r9a09g077-cpg.c
index 5a0e7df1eb06..90f0c373976f 100644
--- a/drivers/clk/renesas/r9a09g077-cpg.c
+++ b/drivers/clk/renesas/r9a09g077-cpg.c
@@ -12,6 +12,7 @@
#include <linux/clk-provider.h>
#include <linux/clk/renesas.h>
#include <linux/device.h>
+#include <linux/export.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/iopoll.h>
@@ -103,10 +104,17 @@ MODULE_IMPORT_NS("RZV2H_CPG");
#define RZT2H_SYSC_BLOCK(x) FIELD_GET(RZT2H_SYSC_BLOCK_MASK, x)
#define RZT2H_SYSC_REG_OFFSET(x) FIELD_GET(RZT2H_SYSC_OFFSET_MASK, x)
+/* WDT Debug Control Registers (WDTDCRm), in the block 1 SYSC region */
+#define RZT2H_WDTDCR(n) (RZT2H_SYSC_BLOCK_MASK | (0x5100 + (n) * 4))
+#define RZT2H_WDTDCR_WDTSTOPCTRL BIT(0)
+#define RZT2H_WDT_MAX_INSTANCES 6
+
struct r9a09g077_sysc_reg {
void __iomem *base[2];
};
+static struct r9a09g077_sysc_reg *r9a09g077_sysc_regs;
+
enum rzt2h_clk_types {
CLK_TYPE_RZT2H_DIV = CLK_TYPE_CUSTOM, /* Clock with divider */
CLK_TYPE_RZT2H_MUX, /* Clock with clock source selector */
@@ -963,10 +971,25 @@ static bool r9a09g077_writeable_readable_sysc(struct device *dev, unsigned int r
}
}
+void rzt2h_cpg_wdtdcr_count_start(unsigned int wdt_index)
+{
+ struct r9a09g077_sysc_reg *sysc = r9a09g077_sysc_regs;
+ unsigned int reg, val;
+
+ /* Sanity check: ensure sysc is initialized and wdt_index is valid */
+ if (!sysc || wdt_index >= RZT2H_WDT_MAX_INSTANCES)
+ return;
+
+ reg = RZT2H_WDTDCR(wdt_index);
+ r9a09g077_regmap_read(sysc, reg, &val);
+ val &= ~RZT2H_WDTDCR_WDTSTOPCTRL;
+ r9a09g077_regmap_write(sysc, reg, val);
+}
+EXPORT_SYMBOL_NS_GPL(rzt2h_cpg_wdtdcr_count_start, "RZT2H_CPG");
+
static int r9a09g077_post_init(struct device *dev, struct cpg_mssr_pub *pub)
{
struct regmap_config *regmap_cfg __free(kfree) = kzalloc_obj(*regmap_cfg);
- struct r9a09g077_sysc_reg *sysc_reg;
struct regmap *regmap;
struct resource res;
int ret;
@@ -991,13 +1014,13 @@ static int r9a09g077_post_init(struct device *dev, struct cpg_mssr_pub *pub)
if (!regmap_cfg)
return -ENOMEM;
- sysc_reg = devm_kzalloc(dev, sizeof(*sysc_reg), GFP_KERNEL);
- if (!sysc_reg)
+ r9a09g077_sysc_regs = devm_kzalloc(dev, sizeof(*r9a09g077_sysc_regs), GFP_KERNEL);
+ if (!r9a09g077_sysc_regs)
return -ENOMEM;
/* Only allow access in the SYSC regions */
- sysc_reg->base[0] = pub->base0 + RZT2H_SYSC_OFFSET;
- sysc_reg->base[1] = pub->base1 + RZT2H_SYSC_OFFSET;
+ r9a09g077_sysc_regs->base[0] = pub->base0 + RZT2H_SYSC_OFFSET;
+ r9a09g077_sysc_regs->base[1] = pub->base1 + RZT2H_SYSC_OFFSET;
regmap_cfg->name = "rzt2h_sysc";
regmap_cfg->reg_bits = 32;
@@ -1008,7 +1031,7 @@ static int r9a09g077_post_init(struct device *dev, struct cpg_mssr_pub *pub)
regmap_cfg->readable_reg = r9a09g077_writeable_readable_sysc;
regmap_cfg->writeable_reg = r9a09g077_writeable_readable_sysc;
- regmap = devm_regmap_init(dev, &r9a09g077_sys_regmap_bus, sysc_reg, regmap_cfg);
+ regmap = devm_regmap_init(dev, &r9a09g077_sys_regmap_bus, r9a09g077_sysc_regs, regmap_cfg);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h
index c9495558cd5c..1e171db25eb7 100644
--- a/include/linux/clk/renesas.h
+++ b/include/linux/clk/renesas.h
@@ -216,4 +216,10 @@ static inline bool rzv2h_cpg_get_pll_divs_pars(const struct rzv2h_pll_limits *li
#define rzv2h_get_pll_pars rzv2h_cpg_get_pll_pars
#define rzv2h_get_pll_divs_pars rzv2h_cpg_get_pll_divs_pars
+#if defined(CONFIG_CLK_R9A09G077) || defined(CONFIG_CLK_R9A09G087)
+void rzt2h_cpg_wdtdcr_count_start(unsigned int wdt_index);
+#else
+static inline void rzt2h_cpg_wdtdcr_count_start(unsigned int wdt_index) { }
+#endif
+
#endif
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 2/8] watchdog: rzv2h: Use pm_runtime_put_sync()
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
2026-09-29 10:50 ` [PATCH v7 1/8] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler Prabhakar
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
pm_runtime_put() may trigger the idle check after pm_runtime_disable()
is run as part of devm_pm_runtime_enable()'s cleanup action, leaving
runtime PM active.
Use pm_runtime_put_sync() to ensure the idle check runs synchronously.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- No change
v5->v6:
- Used pm_runtime_put_sync() in rzv2h_wdt_stop() function.
v4->v5:
- New patch
---
drivers/watchdog/rzv2h_wdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index a8db85e85c73..f247e42d54f5 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -175,7 +175,7 @@ static int rzv2h_wdt_stop(struct watchdog_device *wdev)
if (priv->of_data->wdtdcr)
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put(wdev->parent);
+ pm_runtime_put_sync(wdev->parent);
return 0;
}
@@ -269,7 +269,7 @@ static int rzt2h_wdt_wdtdcr_init(struct platform_device *pdev,
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put_sync(&pdev->dev);
return 0;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
2026-09-29 10:50 ` [PATCH v7 1/8] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
2026-09-29 10:50 ` [PATCH v7 2/8] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 11:06 ` sashiko-bot
2026-09-29 10:50 ` [PATCH v7 4/8] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
` (4 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The watchdog restart handler runs from do_kernel_restart() with
interrupts disabled and after smp_send_stop() has halted the other CPUs.
Calling clk_enable() from the !watchdog_active() path takes the clock
framework's global enable_lock. If a stopped CPU held this lock, the
CPU executing the restart handler can spin indefinitely and prevent the
watchdog from resetting the system.
Keep pclk and oscclk enabled for the lifetime of the watchdog device by
using devm_clk_get_enabled() and devm_clk_get_optional_enabled().
Remove the conditional clock enable/disable operations from the restart
handler so it does not acquire any clock framework locks.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- No change
v5->v6:
- No change
v4->v5:
- New patch
---
drivers/watchdog/rzv2h_wdt.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index f247e42d54f5..55ac11fcfcab 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -192,22 +192,9 @@ static int rzv2h_wdt_restart(struct watchdog_device *wdev,
int ret;
if (!watchdog_active(wdev)) {
- ret = clk_enable(priv->pclk);
- if (ret)
- return ret;
-
- ret = clk_enable(priv->oscclk);
- if (ret) {
- clk_disable(priv->pclk);
- return ret;
- }
-
ret = reset_control_deassert(priv->rstc);
- if (ret) {
- clk_disable(priv->oscclk);
- clk_disable(priv->pclk);
+ if (ret)
return ret;
- }
} else {
/*
* Writing to the WDT Control Register (WDTCR) or WDT Reset
@@ -292,11 +279,11 @@ static int rzv2h_wdt_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
- priv->pclk = devm_clk_get_prepared(dev, "pclk");
+ priv->pclk = devm_clk_get_enabled(dev, "pclk");
if (IS_ERR(priv->pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "Failed to get pclk\n");
- priv->oscclk = devm_clk_get_optional_prepared(dev, "oscclk");
+ priv->oscclk = devm_clk_get_optional_enabled(dev, "oscclk");
if (IS_ERR(priv->oscclk))
return dev_err_probe(dev, PTR_ERR(priv->oscclk), "Failed to get oscclk\n");
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 4/8] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
` (2 preceding siblings ...)
2026-09-29 10:50 ` [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 5/8] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
WDTRCR_RSTIRQS is unused, so drop it.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- No change
v5->v6:
- No change
v4->v5:
- No change
v2->v3:
- Updated commit message to reflect the change in v3.
---
drivers/watchdog/rzv2h_wdt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 55ac11fcfcab..17c9e9a24ce2 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -40,8 +40,6 @@
#define WDTCR_RPSS_25 0x00
#define WDTCR_RPSS_100 0x3000
-#define WDTRCR_RSTIRQS BIT(7)
-
#define WDTDCR_WDTSTOPCTRL BIT(0)
#define WDT_DEFAULT_TIMEOUT 60U
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 5/8] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
` (3 preceding siblings ...)
2026-09-29 10:50 ` [PATCH v7 4/8] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 6/8] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
WDTDCR is located in the CPG region, outside the watchdog module, and is
accessible regardless of the watchdog's clocks and reset state.
Drop the unnecessary runtime PM handling from WDTDCR initialization and
access the register directly.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- New patch
---
drivers/watchdog/rzv2h_wdt.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 17c9e9a24ce2..40157e969f58 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -242,20 +242,12 @@ static const struct watchdog_ops rzv2h_wdt_ops = {
static int rzt2h_wdt_wdtdcr_init(struct platform_device *pdev,
struct rzv2h_wdt_priv *priv)
{
- int ret;
-
priv->wdtdcr = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(priv->wdtdcr))
return PTR_ERR(priv->wdtdcr);
- ret = pm_runtime_resume_and_get(&pdev->dev);
- if (ret)
- return ret;
-
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put_sync(&pdev->dev);
-
return 0;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 6/8] watchdog: rzv2h_wdt: Add syscon based WDTDCR access
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
` (4 preceding siblings ...)
2026-09-29 10:50 ` [PATCH v7 5/8] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 7/8] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
2026-09-29 10:50 ` [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: " Prabhakar
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
On RZ/T2H and RZ/N2H, WDTDCR is located in the SYS block rather than the
WDT register space. Allow the WDT driver to access it through the syscon
regmap exposed by the CPG driver. Retain support for the existing second
WDT register region for compatibility with older device trees.
The syscon regmap uses locks and cannot be used from the watchdog restart
handler, which runs in atomic context. Use the CPG helper for this path so
WDTDCR can be accessed without taking a lock, while continuing to use the
syscon regmap for normal start and stop operations.
Keep the WDTDCR start and stop helpers as void and treat the regmap
operations as best effort. Propagating errors from these MMIO-backed
accesses would complicate the control flow and error handling, while
the restart path in particular should make a best effort to restart
the system.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6->v7:
- Made use of rzt2h_cpg_wdtdcr_count_start() in restart handler
- Added if regmap is available, use it for WDTDCR access
- Updated commit message
v5->v6:
- No change
v4->v5:
- Code changes due to regmap_lock introduction.
v3->v4:
- No change
v2->v3:
- Made use of the new "renesas,sysc" phandle-array property to access the
WDTDCR register via the CPG/MSSR syscon node.
- Updated commit message
v1->v2:
- No change.
---
drivers/watchdog/rzv2h_wdt.c | 77 +++++++++++++++++++++++++++++++++---
1 file changed, 71 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 40157e969f58..122e5f36c6cb 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -5,18 +5,23 @@
* Copyright (C) 2024 Renesas Electronics Corporation.
*/
#include <linux/clk.h>
+#include <linux/clk/renesas.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/stringify.h>
#include <linux/units.h>
#include <linux/watchdog.h>
+MODULE_IMPORT_NS("RZT2H_CPG");
+
#define WDTRR 0x00 /* WDT Refresh Register RW, 8 */
#define WDTCR 0x02 /* WDT Control Register RW, 16 */
#define WDTSR 0x04 /* WDT Status Register RW, 16 */
@@ -44,6 +49,11 @@
#define WDT_DEFAULT_TIMEOUT 60U
+#define RZT2H_WDT_MAX_INSTANCES 6
+
+#define RZT2H_SYS_BLOCK1_BASE (BIT(16) | 0x5100)
+#define RZT2H_WDTDCR_OFFSET(n) (RZT2H_SYS_BLOCK1_BASE + (n) * 4)
+
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
@@ -64,6 +74,12 @@ struct rzv2h_of_data {
bool wdtdcr;
};
+struct rzv2h_sysc_wdtdcr {
+ struct regmap *regmap;
+ unsigned int offset;
+ unsigned int wdt_index;
+};
+
struct rzv2h_wdt_priv {
void __iomem *base;
void __iomem *wdtdcr;
@@ -72,6 +88,7 @@ struct rzv2h_wdt_priv {
struct reset_control *rstc;
struct watchdog_device wdev;
const struct rzv2h_of_data *of_data;
+ struct rzv2h_sysc_wdtdcr sysc;
};
static int rzv2h_wdt_ping(struct watchdog_device *wdev)
@@ -90,18 +107,50 @@ static int rzv2h_wdt_ping(struct watchdog_device *wdev)
static void rzt2h_wdt_wdtdcr_count_stop(struct rzv2h_wdt_priv *priv)
{
- u32 reg = readl(priv->wdtdcr + WDTDCR);
+ struct rzv2h_sysc_wdtdcr *sysc = &priv->sysc;
+ u32 reg;
+
+ if (sysc->regmap) {
+ /* Ignore the theoretical regmap error */
+ regmap_set_bits(sysc->regmap, sysc->offset, WDTDCR_WDTSTOPCTRL);
+ return;
+ }
+ reg = readl(priv->wdtdcr + WDTDCR);
writel(reg | WDTDCR_WDTSTOPCTRL, priv->wdtdcr + WDTDCR);
}
static void rzt2h_wdt_wdtdcr_count_start(struct rzv2h_wdt_priv *priv)
{
- u32 reg = readl(priv->wdtdcr + WDTDCR);
+ struct rzv2h_sysc_wdtdcr *sysc = &priv->sysc;
+ u32 reg;
+
+ if (sysc->regmap) {
+ /* Ignore the theoretical regmap error */
+ regmap_clear_bits(sysc->regmap, sysc->offset, WDTDCR_WDTSTOPCTRL);
+ return;
+ }
+ reg = readl(priv->wdtdcr + WDTDCR);
writel(reg & ~WDTDCR_WDTSTOPCTRL, priv->wdtdcr + WDTDCR);
}
+/*
+ * Restart runs in atomic context, so the syscon regmap must not be used.
+ * Go through the CPG helper, which writes the register directly.
+ */
+static void rzt2h_wdt_wdtdcr_count_start_atomic(struct rzv2h_wdt_priv *priv)
+{
+ struct rzv2h_sysc_wdtdcr *sysc = &priv->sysc;
+
+ if (sysc->regmap) {
+ rzt2h_cpg_wdtdcr_count_start(sysc->wdt_index);
+ return;
+ }
+
+ rzt2h_wdt_wdtdcr_count_start(priv);
+}
+
static void rzv2h_wdt_setup(struct watchdog_device *wdev, u16 wdtcr)
{
struct rzv2h_wdt_priv *priv = watchdog_get_drvdata(wdev);
@@ -221,7 +270,7 @@ static int rzv2h_wdt_restart(struct watchdog_device *wdev,
WDTCR_RPES_75 | WDTCR_TOPS_1024);
if (priv->of_data->wdtdcr)
- rzt2h_wdt_wdtdcr_count_start(priv);
+ rzt2h_wdt_wdtdcr_count_start_atomic(priv);
rzv2h_wdt_ping(wdev);
@@ -242,9 +291,25 @@ static const struct watchdog_ops rzv2h_wdt_ops = {
static int rzt2h_wdt_wdtdcr_init(struct platform_device *pdev,
struct rzv2h_wdt_priv *priv)
{
- priv->wdtdcr = devm_platform_ioremap_resource(pdev, 1);
- if (IS_ERR(priv->wdtdcr))
- return PTR_ERR(priv->wdtdcr);
+ struct device_node *np = dev_of_node(&pdev->dev);
+
+ if (of_property_present(np, "renesas,sysc")) {
+ struct rzv2h_sysc_wdtdcr *sysc = &priv->sysc;
+
+ sysc->regmap = syscon_regmap_lookup_by_phandle_args(np, "renesas,sysc",
+ 1, &sysc->wdt_index);
+ if (IS_ERR(sysc->regmap))
+ return PTR_ERR(sysc->regmap);
+
+ if (sysc->wdt_index >= RZT2H_WDT_MAX_INSTANCES)
+ return -EINVAL;
+
+ sysc->offset = RZT2H_WDTDCR_OFFSET(sysc->wdt_index);
+ } else {
+ priv->wdtdcr = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(priv->wdtdcr))
+ return PTR_ERR(priv->wdtdcr);
+ }
rzt2h_wdt_wdtdcr_count_stop(priv);
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 7/8] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
` (5 preceding siblings ...)
2026-09-29 10:50 ` [PATCH v7 6/8] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 10:50 ` [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: " Prabhakar
7 siblings, 0 replies; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The WDTDCR registers for wdt0-wdt5 reside in the second register region of
the CPG/MSSR block. This multi-function block is now exposed via a unified
syscon regmap interface.
Replace the direct mapping of the individual WDTDCR registers with the
new "renesas,sysc" phandle property pointing to the CPG/MSSR block syscon
node.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v6->v7:
- No change
v5->v6:
- No change
v4->v5:
- Added review-by tag.
v3->v4:
- No change
v2->v3:
- Renamed the "renesas,sys" property to "renesas,sysc"
- Updated commit message
v1->v2:
- No change.
---
arch/arm64/boot/dts/renesas/r9a09g077.dtsi | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g077.dtsi b/arch/arm64/boot/dts/renesas/r9a09g077.dtsi
index 674e35e4f242..18d748661a60 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g077.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g077.dtsi
@@ -327,61 +327,61 @@ channel1 {
wdt0: watchdog@80082000 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80082000 0 0x400>,
- <0 0x81295100 0 0x04>;
+ reg = <0 0x80082000 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 0>;
status = "disabled";
};
wdt1: watchdog@80082400 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80082400 0 0x400>,
- <0 0x81295104 0 0x04>;
+ reg = <0 0x80082400 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 1>;
status = "disabled";
};
wdt2: watchdog@80082800 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80082800 0 0x400>,
- <0 0x81295108 0 0x04>;
+ reg = <0 0x80082800 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 2>;
status = "disabled";
};
wdt3: watchdog@80082c00 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80082c00 0 0x400>,
- <0 0x8129510c 0 0x04>;
+ reg = <0 0x80082c00 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 3>;
status = "disabled";
};
wdt4: watchdog@80083000 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80083000 0 0x400>,
- <0 0x81295110 0 0x04>;
+ reg = <0 0x80083000 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 4>;
status = "disabled";
};
wdt5: watchdog@80083400 {
compatible = "renesas,r9a09g077-wdt";
- reg = <0 0x80083400 0 0x400>,
- <0 0x81295114 0 0x04>;
+ reg = <0 0x80083400 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 5>;
status = "disabled";
};
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: Use CPG/MSSR syscon for WDTDCR access
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
` (6 preceding siblings ...)
2026-09-29 10:50 ` [PATCH v7 7/8] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
@ 2026-09-29 10:50 ` Prabhakar
2026-09-29 11:00 ` sashiko-bot
7 siblings, 1 reply; 12+ messages in thread
From: Prabhakar @ 2026-09-29 10:50 UTC (permalink / raw)
To: Geert Uytterhoeven, Guenter Roeck, Magnus Damm, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Stephen Boyd, Brian Masney,
Jerome Brunet, Wim Van Sebroeck
Cc: linux-renesas-soc, devicetree, linux-kernel, linux-clk,
linux-watchdog, Prabhakar, Biju Das, Fabrizio Castro,
Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The WDTDCR registers for wdt0-wdt5 reside in the second register region of
the CPG/MSSR block. This multi-function block is now exposed via a unified
syscon regmap interface.
Replace the direct mapping of the individual WDTDCR registers with the
new "renesas,sysc" phandle property pointing to the CPG/MSSR block syscon
node.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v6->v7:
- No change
v5->v6:
- No change
v4->v5:
- Added review-by tag.
v3->v4:
- No change
v2->v3:
- Renamed the "renesas,sys" property to "renesas,sysc"
- Updated commit message
v1->v2:
- No change.
---
arch/arm64/boot/dts/renesas/r9a09g087.dtsi | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
index 68c8daed557b..abca7aa89458 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
@@ -327,61 +327,61 @@ channel1 {
wdt0: watchdog@80082000 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80082000 0 0x400>,
- <0 0x81295100 0 0x04>;
+ reg = <0 0x80082000 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 0>;
status = "disabled";
};
wdt1: watchdog@80082400 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80082400 0 0x400>,
- <0 0x81295104 0 0x04>;
+ reg = <0 0x80082400 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 1>;
status = "disabled";
};
wdt2: watchdog@80082800 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80082800 0 0x400>,
- <0 0x81295108 0 0x04>;
+ reg = <0 0x80082800 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 2>;
status = "disabled";
};
wdt3: watchdog@80082c00 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80082c00 0 0x400>,
- <0 0x8129510c 0 0x04>;
+ reg = <0 0x80082c00 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 3>;
status = "disabled";
};
wdt4: watchdog@80083000 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80083000 0 0x400>,
- <0 0x81295110 0 0x04>;
+ reg = <0 0x80083000 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 4>;
status = "disabled";
};
wdt5: watchdog@80083400 {
compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
- reg = <0 0x80083400 0 0x400>,
- <0 0x81295114 0 0x04>;
+ reg = <0 0x80083400 0 0x400>;
clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKL>;
clock-names = "pclk";
power-domains = <&cpg>;
+ renesas,sysc = <&cpg 5>;
status = "disabled";
};
--
2.55.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: Use CPG/MSSR syscon for WDTDCR access
2026-09-29 10:50 ` [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: " Prabhakar
@ 2026-09-29 11:00 ` sashiko-bot
0 siblings, 0 replies; 12+ messages in thread
From: sashiko-bot @ 2026-09-29 11:00 UTC (permalink / raw)
To: Prabhakar
Cc: conor+dt, robh, linux-clk, wsa+renesas, devicetree,
linux-watchdog
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] dt-bindings: removing second 'reg' entry breaks old kernel compatibility
--
commit 74168eab64567b9dfb3f02ff14712a6e81564a41
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
arm64: dts: renesas: r9a09g087: Use CPG/MSSR syscon for WDTDCR access
This commit updates the device tree to replace the direct mapping of
individual WDTDCR registers with a syscon phandle to the CPG/MSSR block.
This consolidates the multi-function block access via a unified syscon
regmap interface.
> diff --git a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> index 68c8daed557bd..abca7aa894589 100644
> --- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> @@ -327,61 +327,61 @@ channel1 {
>
> wdt0: watchdog@80082000 {
> compatible = "renesas,r9a09g087-wdt", "renesas,r9a09g077-wdt";
> - reg = <0 0x80082000 0 0x400>,
> - <0 0x81295100 0 0x04>;
> + reg = <0 0x80082000 0 0x400>;
[Severity: Critical]
Does removing the second reg entry here break backward compatibility with
older kernels?
Device tree bindings are typically treated as a stable ABI, meaning newer
device trees should be able to boot older kernels. The rzv2h_wdt driver
in existing kernels unconditionally calls:
devm_platform_ioremap_resource(pdev, 1)
for this compatible string. By completely removing the second reg entry at
index 1, older kernels might fail to probe the watchdog entirely. Is there
a way to deprecate this gracefully or retain the second reg entry for
compatibility?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929105021.542730-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=8
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler
2026-09-29 10:50 ` [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler Prabhakar
@ 2026-09-29 11:06 ` sashiko-bot
2026-09-30 8:36 ` Lad, Prabhakar
0 siblings, 1 reply; 12+ messages in thread
From: sashiko-bot @ 2026-09-29 11:06 UTC (permalink / raw)
To: Prabhakar
Cc: wsa+renesas, conor+dt, devicetree, robh, linux-clk,
linux-watchdog
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] watchdog: unintended system reset during suspend due to permanently enabled clocks
--
commit 465743d35253a3a281f9ce8cea373ed0c3ae3e5a
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
watchdog: rzv2h: Drop enabling clocks in the restart handler
The commit drops dynamic clock enable/disable operations from the watchdog
restart handler to avoid deadlocking on the clock framework's global
enable_lock. Instead, it keeps the peripheral and oscillator clocks enabled
for the lifetime of the device using devm_clk_get_enabled() and
devm_clk_get_optional_enabled().
> diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
> index f247e42d54f54..55ac11fcfcabd 100644
> --- a/drivers/watchdog/rzv2h_wdt.c
> +++ b/drivers/watchdog/rzv2h_wdt.c
[ ... ]
> @@ -292,11 +279,11 @@ static int rzv2h_wdt_probe(struct platform_device *pdev)
> if (IS_ERR(priv->base))
> return PTR_ERR(priv->base);
>
> - priv->pclk = devm_clk_get_prepared(dev, "pclk");
> + priv->pclk = devm_clk_get_enabled(dev, "pclk");
> if (IS_ERR(priv->pclk))
> return dev_err_probe(dev, PTR_ERR(priv->pclk), "Failed to get pclk\n");
>
> - priv->oscclk = devm_clk_get_optional_prepared(dev, "oscclk");
> + priv->oscclk = devm_clk_get_optional_enabled(dev, "oscclk");
[Severity: High]
Does switching to devm_clk_get_enabled() and devm_clk_get_optional_enabled()
prevent the PM framework from fully gating these clocks during suspend?
By permanently incrementing the CCF enable_count by 1 here in probe, it appears
that pm_clk_suspend() will only drop the count from 2 to 1 during system
suspend, leaving the clocks physically enabled.
If the clocks remain running while the system is suspended and the ping worker
is frozen, won't the hardware watchdog counter inevitably underflow and trigger
an unintended system reset?
> if (IS_ERR(priv->oscclk))
> return dev_err_probe(dev, PTR_ERR(priv->oscclk), "Failed to get oscclk\n");
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929105021.542730-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=3
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler
2026-09-29 11:06 ` sashiko-bot
@ 2026-09-30 8:36 ` Lad, Prabhakar
0 siblings, 0 replies; 12+ messages in thread
From: Lad, Prabhakar @ 2026-09-30 8:36 UTC (permalink / raw)
To: sashiko-reviews
Cc: wsa+renesas, conor+dt, devicetree, robh, linux-clk,
linux-watchdog
Hi sashiko,
On Tue, Sep 29, 2026 at 12:06 PM <sashiko-bot@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] watchdog: unintended system reset during suspend due to permanently enabled clocks
> --
>
> commit 465743d35253a3a281f9ce8cea373ed0c3ae3e5a
> Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> watchdog: rzv2h: Drop enabling clocks in the restart handler
>
> The commit drops dynamic clock enable/disable operations from the watchdog
> restart handler to avoid deadlocking on the clock framework's global
> enable_lock. Instead, it keeps the peripheral and oscillator clocks enabled
> for the lifetime of the device using devm_clk_get_enabled() and
> devm_clk_get_optional_enabled().
>
> > diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
> > index f247e42d54f54..55ac11fcfcabd 100644
> > --- a/drivers/watchdog/rzv2h_wdt.c
> > +++ b/drivers/watchdog/rzv2h_wdt.c
>
> [ ... ]
>
> > @@ -292,11 +279,11 @@ static int rzv2h_wdt_probe(struct platform_device *pdev)
> > if (IS_ERR(priv->base))
> > return PTR_ERR(priv->base);
> >
> > - priv->pclk = devm_clk_get_prepared(dev, "pclk");
> > + priv->pclk = devm_clk_get_enabled(dev, "pclk");
> > if (IS_ERR(priv->pclk))
> > return dev_err_probe(dev, PTR_ERR(priv->pclk), "Failed to get pclk\n");
> >
> > - priv->oscclk = devm_clk_get_optional_prepared(dev, "oscclk");
> > + priv->oscclk = devm_clk_get_optional_enabled(dev, "oscclk");
>
> [Severity: High]
> Does switching to devm_clk_get_enabled() and devm_clk_get_optional_enabled()
> prevent the PM framework from fully gating these clocks during suspend?
>
> By permanently incrementing the CCF enable_count by 1 here in probe, it appears
> that pm_clk_suspend() will only drop the count from 2 to 1 during system
> suspend, leaving the clocks physically enabled.
>
> If the clocks remain running while the system is suspended and the ping worker
> is frozen, won't the hardware watchdog counter inevitably underflow and trigger
> an unintended system reset?
>
The driver doesn't currently support dev pm ops so I can't test this
scenario. My current intention is to add syscon support so for now
I'll drop this patch and revisit it when adding pm ops.
Cheers,
Prabhakar
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-09-30 8:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 10:50 [PATCH v7 0/8] Add syscon support for Renesas WDT driver Prabhakar
2026-09-29 10:50 ` [PATCH v7 1/8] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
2026-09-29 10:50 ` [PATCH v7 2/8] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
2026-09-29 10:50 ` [PATCH v7 3/8] watchdog: rzv2h: Drop enabling clocks in the restart handler Prabhakar
2026-09-29 11:06 ` sashiko-bot
2026-09-30 8:36 ` Lad, Prabhakar
2026-09-29 10:50 ` [PATCH v7 4/8] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
2026-09-29 10:50 ` [PATCH v7 5/8] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
2026-09-29 10:50 ` [PATCH v7 6/8] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
2026-09-29 10:50 ` [PATCH v7 7/8] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
2026-09-29 10:50 ` [PATCH v7 8/8] arm64: dts: renesas: r9a09g087: " Prabhakar
2026-09-29 11:00 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox