RE: [PATCH 1/2] clk: renesas: rzg2l: Deassert reset on assert timeout
From: Biju Das
Date: Thu Jan 08 2026 - 07:47:17 EST
Hi Geert,
Thanks for the feedback.
> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: 07 January 2026 11:16
> Subject: Re: [PATCH 1/2] clk: renesas: rzg2l: Deassert reset on assert timeout
>
> Hi Biju,
>
> On Mon, 8 Dec 2025 at 11:14, Biju <biju.das.au@xxxxxxxxx> wrote:
> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > If the assert() fails due to timeout error, set the reset register bit
> > back to deasserted state. This change is needed especially for
> > handling assert error in suspend() callback that expect the device to
> > be in operational state in case of failure.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
>
> Thanks for your patch!
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> However, I am wondering what you think about the alternative below?
>
> > --- a/drivers/clk/renesas/rzg2l-cpg.c
> > +++ b/drivers/clk/renesas/rzg2l-cpg.c
> > @@ -1669,8 +1669,11 @@ static int __rzg2l_cpg_assert(struct
> > reset_controller_dev *rcdev,
> >
> > ret = readl_poll_timeout_atomic(priv->base + reg, value,
> > assert == !!(value & mask),
> > 10, 200);
>
> If this loop would use its own "u32 mon" instead of reusing "value"...
OK.
>
> > - if (ret && !assert) {
> > + if (ret) {
>
> ... then "value" would still have the wanted state here...
>
> > value = mask << 16;
> > + if (assert)
> > + value |= mask;
> > +
>
> ... and you can just switch back to the old state using:
>
> value ^= mask;
Agreed. Will send v2 incorporating those comments.
Cheers,
Biju