Re: [PATCH 2/3] watchdog: rzv2h: Convert WDTDCR handling to regmap

From: Lad, Prabhakar

Date: Tue Jul 14 2026 - 11:43:15 EST


Hi Philipp,

Thank you for the review.

On Fri, Jul 3, 2026 at 8:35 AM Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> wrote:
>
> On Do, 2026-07-02 at 17:04 +0100, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> >
> > Convert the WDTDCR register access from raw readl/writel variants over to
> > the regmap framework using devm_regmap_init_mmio().
> >
> > This conversion serves as a preparatory refactoring step. It allows the
> > driver to subsequently support syscon-based system controllers natively
> > by passing along alternative regmap handles without forcing messy
> > architectural branching at runtime.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> > ---
> > drivers/watchdog/rzv2h_wdt.c | 83 +++++++++++++++++++++++++-----------
> > 1 file changed, 57 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
> > index e9545b8f5fd0..d0b38450cc32 100644
> > --- a/drivers/watchdog/rzv2h_wdt.c
> > +++ b/drivers/watchdog/rzv2h_wdt.c
> > @@ -12,6 +12,7 @@
> > #include <linux/of.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_runtime.h>
> > +#include <linux/regmap.h>
> > #include <linux/reset.h>
> > #include <linux/units.h>
> > #include <linux/watchdog.h>
> > @@ -67,7 +68,7 @@ struct rzv2h_of_data {
> >
> > struct rzv2h_wdt_priv {
> > void __iomem *base;
> > - void __iomem *wdtdcr;
> > + struct regmap *wdtdcr_regmap;
> > struct clk *pclk;
> > struct clk *oscclk;
> > struct reset_control *rstc;
> > @@ -89,26 +90,20 @@ static int rzv2h_wdt_ping(struct watchdog_device *wdev)
> > return 0;
> > }
> >
> > -static void rzt2h_wdt_wdtdcr_count_ctrl(struct rzv2h_wdt_priv *priv, bool start)
> > +static int rzt2h_wdt_wdtdcr_count_ctrl(struct rzv2h_wdt_priv *priv, bool start)
> > {
> > - u32 reg = readl(priv->wdtdcr + WDTDCR);
> > -
> > - if (start)
> > - reg &= ~WDTDCR_WDTSTOPCTRL;
> > - else
> > - reg |= WDTDCR_WDTSTOPCTRL;
> > -
> > - writel(reg, priv->wdtdcr + WDTDCR);
> > + return regmap_update_bits(priv->wdtdcr_regmap, WDTDCR, WDTDCR_WDTSTOPCTRL,
> > + start ? 0 : WDTDCR_WDTSTOPCTRL);
> > }
>
> I would drop this helper function and just call regmap_set/clear_bits()
> directly in rzt2h_wdt_wdtdcr_count_stop/start().
>
Ok, I will update as suggested and send a v2.

Cheers,
Prabhakar