All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: renesas: rzg2l: Fix reset status function
@ 2022-05-31  7:16 Biju Das
  2022-05-31  7:37 ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Biju Das @ 2022-05-31  7:16 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Philipp Zabel
  Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
	Chris Paterson, Lad Prabhakar, Biju Das

As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0 means
reset signal is not applied (deassert state) and 1 means reset signal
is applied (assert state).

reset_control_status() expects a positive value if the reset line is
asserted. But rzg2l_cpg_status function returns zero for asserted
state.

This patch fixes the issue by adding double inverted logic, so that
reset_control_status returns a positive value if the reset line is
asserted.

Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/clk/renesas/rzg2l-cpg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index e2999ab2b53c..3ff6ecd61756 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -1180,7 +1180,7 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev,
 	s8 monbit = info->resets[id].monbit;
 
 	if (info->has_clk_mon_regs) {
-		return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
+		return !!(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
 	} else if (monbit >= 0) {
 		u32 monbitmask = BIT(monbit);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
  2022-05-31  7:16 [PATCH] clk: renesas: rzg2l: Fix reset status function Biju Das
@ 2022-05-31  7:37 ` Geert Uytterhoeven
  2022-05-31  7:58   ` Biju Das
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2022-05-31  7:37 UTC (permalink / raw)
  To: Biju Das
  Cc: Michael Turquette, Stephen Boyd, Philipp Zabel, Linux-Renesas,
	linux-clk, Chris Paterson, Lad Prabhakar, Biju Das

Hi Biju,

On Tue, May 31, 2022 at 9:17 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0 means
> reset signal is not applied (deassert state) and 1 means reset signal
> is applied (assert state).
>
> reset_control_status() expects a positive value if the reset line is
> asserted. But rzg2l_cpg_status function returns zero for asserted
> state.
>
> This patch fixes the issue by adding double inverted logic, so that
> reset_control_status returns a positive value if the reset line is
> asserted.
>
> Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC")
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

This bug has been present since v5.14, and went unnoticed so far.
Is it OK for you to queue this in renesas-clk-for-v5.20, or do you see
a reason to fast-track this fix to v5.19?
Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] clk: renesas: rzg2l: Fix reset status function
  2022-05-31  7:37 ` Geert Uytterhoeven
@ 2022-05-31  7:58   ` Biju Das
  2022-05-31  8:20     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Biju Das @ 2022-05-31  7:58 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, Philipp Zabel, Linux-Renesas,
	linux-clk, Chris Paterson, Prabhakar Mahadev Lad, Biju Das

Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
> 
> Hi Biju,
> 
> On Tue, May 31, 2022 at 9:17 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0
> > means reset signal is not applied (deassert state) and 1 means reset
> > signal is applied (assert state).
> >
> > reset_control_status() expects a positive value if the reset line is
> > asserted. But rzg2l_cpg_status function returns zero for asserted
> > state.
> >
> > This patch fixes the issue by adding double inverted logic, so that
> > reset_control_status returns a positive value if the reset line is
> > asserted.
> >
> > Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L
> > SoC")
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> This bug has been present since v5.14, and went unnoticed so far.
> Is it OK for you to queue this in renesas-clk-for-v5.20, or do you see a
> reason to fast-track this fix to v5.19?

renesas-clk-for-v5.20 should be fine. This issue found while adding reset support
for VSPD. There is 1 user prior to this[1]

[1] https://elixir.bootlin.com/linux/latest/source/drivers/mmc/host/renesas_sdhi_core.c#L576

Cheers,
Biju

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
  2022-05-31  7:58   ` Biju Das
@ 2022-05-31  8:20     ` Geert Uytterhoeven
  2022-05-31  8:30       ` Biju Das
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2022-05-31  8:20 UTC (permalink / raw)
  To: Biju Das
  Cc: Michael Turquette, Stephen Boyd, Philipp Zabel, Linux-Renesas,
	linux-clk, Chris Paterson, Prabhakar Mahadev Lad, Biju Das

Hi Biju,

On Tue, May 31, 2022 at 9:58 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Subject: Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
> > On Tue, May 31, 2022 at 9:17 AM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > > As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0
> > > means reset signal is not applied (deassert state) and 1 means reset
> > > signal is applied (assert state).
> > >
> > > reset_control_status() expects a positive value if the reset line is
> > > asserted. But rzg2l_cpg_status function returns zero for asserted
> > > state.
> > >
> > > This patch fixes the issue by adding double inverted logic, so that
> > > reset_control_status returns a positive value if the reset line is
> > > asserted.
> > >
> > > Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L
> > > SoC")
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > This bug has been present since v5.14, and went unnoticed so far.
> > Is it OK for you to queue this in renesas-clk-for-v5.20, or do you see a
> > reason to fast-track this fix to v5.19?
>
> renesas-clk-for-v5.20 should be fine. This issue found while adding reset support

OK.

> for VSPD. There is 1 user prior to this[1]
>
> [1] https://elixir.bootlin.com/linux/latest/source/drivers/mmc/host/renesas_sdhi_core.c#L576

Oh, and that one works by accident, as it ignores the return value
of read_poll_timeout()...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] clk: renesas: rzg2l: Fix reset status function
  2022-05-31  8:20     ` Geert Uytterhoeven
@ 2022-05-31  8:30       ` Biju Das
  0 siblings, 0 replies; 5+ messages in thread
From: Biju Das @ 2022-05-31  8:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Stephen Boyd, Philipp Zabel, Linux-Renesas,
	linux-clk, Chris Paterson, Prabhakar Mahadev Lad, Biju Das

Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
> 
> Hi Biju,
> 
> On Tue, May 31, 2022 at 9:58 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH] clk: renesas: rzg2l: Fix reset status function
> > > On Tue, May 31, 2022 at 9:17 AM Biju Das
> > > <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > > As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0
> > > > means reset signal is not applied (deassert state) and 1 means
> > > > reset signal is applied (assert state).
> > > >
> > > > reset_control_status() expects a positive value if the reset line
> > > > is asserted. But rzg2l_cpg_status function returns zero for
> > > > asserted state.
> > > >
> > > > This patch fixes the issue by adding double inverted logic, so
> > > > that reset_control_status returns a positive value if the reset
> > > > line is asserted.
> > > >
> > > > Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for
> > > > RZ/G2L
> > > > SoC")
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >
> > > This bug has been present since v5.14, and went unnoticed so far.
> > > Is it OK for you to queue this in renesas-clk-for-v5.20, or do you
> > > see a reason to fast-track this fix to v5.19?
> >
> > renesas-clk-for-v5.20 should be fine. This issue found while adding
> > reset support
> 
> OK.
> 
> > for VSPD. There is 1 user prior to this[1]
> >
 
> Oh, and that one works by accident, as it ignores the return value of
> read_poll_timeout()...

Yes, I agree.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-31  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31  7:16 [PATCH] clk: renesas: rzg2l: Fix reset status function Biju Das
2022-05-31  7:37 ` Geert Uytterhoeven
2022-05-31  7:58   ` Biju Das
2022-05-31  8:20     ` Geert Uytterhoeven
2022-05-31  8:30       ` Biju Das

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.