* [PATCH v8 0/7] Add syscon support for Renesas WDT driver
@ 2026-10-01 16:51 Prabhakar
2026-10-01 16:51 ` [PATCH v8 1/7] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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-20260930.
v7->v8:
- Dropped patch "watchdog: rzv2h: Drop enabling clocks in the
restart handler" addressing Sashiko's comments
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 (7):
clk: renesas: r9a09g077: Add helper to start WDTDCR counter
watchdog: rzv2h: Use pm_runtime_put_sync()
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 | 85 ++++++++++++++++++----
include/linux/clk/renesas.h | 6 ++
5 files changed, 129 insertions(+), 45 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v8 1/7] clk: renesas: r9a09g077: Add helper to start WDTDCR counter
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
@ 2026-10-01 16:51 ` Prabhakar
2026-10-01 16:51 ` [PATCH v8 2/7] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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>
---
v7->v8:
- No change
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] 9+ messages in thread
* [PATCH v8 2/7] watchdog: rzv2h: Use pm_runtime_put_sync()
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
2026-10-01 16:51 ` [PATCH v8 1/7] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
@ 2026-10-01 16:51 ` Prabhakar
2026-10-01 16:51 ` [PATCH v8 3/7] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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>
---
v7->v8:
- No change
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] 9+ messages in thread
* [PATCH v8 3/7] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
2026-10-01 16:51 ` [PATCH v8 1/7] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
2026-10-01 16:51 ` [PATCH v8 2/7] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
@ 2026-10-01 16:51 ` Prabhakar
2026-10-01 16:51 ` [PATCH v8 4/7] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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>
---
v7->v8:
- No change
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 f247e42d54f5..4beaac44d027 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] 9+ messages in thread
* [PATCH v8 4/7] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
` (2 preceding siblings ...)
2026-10-01 16:51 ` [PATCH v8 3/7] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
@ 2026-10-01 16:51 ` Prabhakar
2026-10-01 16:51 ` [PATCH v8 5/7] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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>
---
v7->v8:
- No change
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 4beaac44d027..e8a40482d580 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -255,20 +255,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] 9+ messages in thread
* [PATCH v8 5/7] watchdog: rzv2h_wdt: Add syscon based WDTDCR access
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
` (3 preceding siblings ...)
2026-10-01 16:51 ` [PATCH v8 4/7] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
@ 2026-10-01 16:51 ` Prabhakar
2026-10-01 16:52 ` [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
2026-10-01 16:52 ` [PATCH v8 7/7] arm64: dts: renesas: r9a09g087: " Prabhakar
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:51 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>
---
v7->v8:
- No change
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 e8a40482d580..70d2b133c5aa 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);
@@ -234,7 +283,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);
@@ -255,9 +304,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] 9+ messages in thread
* [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
` (4 preceding siblings ...)
2026-10-01 16:51 ` [PATCH v8 5/7] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
@ 2026-10-01 16:52 ` Prabhakar
2026-10-01 17:03 ` sashiko-bot
2026-10-01 16:52 ` [PATCH v8 7/7] arm64: dts: renesas: r9a09g087: " Prabhakar
6 siblings, 1 reply; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:52 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>
---
v7->v8:
- No change
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] 9+ messages in thread
* [PATCH v8 7/7] arm64: dts: renesas: r9a09g087: Use CPG/MSSR syscon for WDTDCR access
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
` (5 preceding siblings ...)
2026-10-01 16:52 ` [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
@ 2026-10-01 16:52 ` Prabhakar
6 siblings, 0 replies; 9+ messages in thread
From: Prabhakar @ 2026-10-01 16:52 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>
---
v7->v8:
- No change
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] 9+ messages in thread
* Re: [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access
2026-10-01 16:52 ` [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
@ 2026-10-01 17:03 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-01 17:03 UTC (permalink / raw)
To: Prabhakar
Cc: devicetree, linux-clk, robh, conor+dt, linux-watchdog,
wsa+renesas
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] dt-bindings: ABI breakage in r9a09g077 wdt nodes due to removed reg
--
commit 73d1717297166d802fe57978f0ccd518dcd4b8df
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access
This commit replaces the direct mapping of WDTDCR registers with a syscon
regmap interface. The individual watchdog nodes now use the renesas,sysc
property instead of multiple reg entries.
> diff --git a/arch/arm64/boot/dts/renesas/r9a09g077.dtsi b/arch/arm64/boot/dts/renesas/r9a09g077.dtsi
> index 674e35e4f2425..18d748661a609 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>;
[Severity: Critical]
Does removing this second reg entry break forward compatibility for older
kernels?
Older kernels that unconditionally expect to map index 1 for the
renesas,r9a09g077-wdt binding during probe will fail to initialize the
watchdog device when booted with this updated device tree. Calling
devm_platform_ioremap_resource(pdev, 1) will return -EINVAL and abort
the probe.
Since device tree files are treated as firmware ABIs, removing the reg entry
without providing a fallback or changing the compatible string constitutes an
ABI breakage. Could the second reg entry be retained alongside the new
renesas,sysc property to preserve compatibility?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001165201.763882-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=6
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-10-01 17:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 16:51 [PATCH v8 0/7] Add syscon support for Renesas WDT driver Prabhakar
2026-10-01 16:51 ` [PATCH v8 1/7] clk: renesas: r9a09g077: Add helper to start WDTDCR counter Prabhakar
2026-10-01 16:51 ` [PATCH v8 2/7] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
2026-10-01 16:51 ` [PATCH v8 3/7] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
2026-10-01 16:51 ` [PATCH v8 4/7] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Prabhakar
2026-10-01 16:51 ` [PATCH v8 5/7] watchdog: rzv2h_wdt: Add syscon based WDTDCR access Prabhakar
2026-10-01 16:52 ` [PATCH v8 6/7] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for " Prabhakar
2026-10-01 17:03 ` sashiko-bot
2026-10-01 16:52 ` [PATCH v8 7/7] arm64: dts: renesas: r9a09g087: " Prabhakar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox