diff mbox series

[2/2] clocksource/drivers/renesas-ostm: Add OSTM support for RZ/V2H(P) SoC

Message ID 20240318160731.33960-3-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Add OSTM support for Renesas RZ/V2H(P) SoC | expand

Commit Message

Lad, Prabhakar March 18, 2024, 4:07 p.m. UTC
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

RZ/V2H(P) (R9A09G057) SoC has Generic Timer Module(a.k.a OSTM) which
needs to deassert the reset line before accessing any registers just
like the RZ/G2L SoC.

Enable the entry point for RZ/V2H(P) SoC so that we can deassert
the reset line in probe callback.

While at it use IS_ENABLED() macro instead of open coding.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/clocksource/renesas-ostm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven March 19, 2024, 8:33 a.m. UTC | #1
Hi Prabhakar,

Thanks for your patch!

On Mon, Mar 18, 2024 at 5:08 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> RZ/V2H(P) (R9A09G057) SoC has Generic Timer Module(a.k.a OSTM) which
> needs to deassert the reset line before accessing any registers just
> like the RZ/G2L SoC.
>
> Enable the entry point for RZ/V2H(P) SoC so that we can deassert
> the reset line in probe callback.

This is not really what is happening.
As OSTM on RZ/V2H has a reset specified, the early call to ostm_init()
through TIMER_OF_DECLARE() always fails with -EPROBE_DEFER, as resets
are not available that early in the boot process.  Hence the driver
needs to be reprobed later through the platform driver probe.

> While at it use IS_ENABLED() macro instead of open coding.

I don't see how the code was open-coding IS_ENABLED()?

>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

> --- a/drivers/clocksource/renesas-ostm.c
> +++ b/drivers/clocksource/renesas-ostm.c
> @@ -224,7 +224,7 @@ static int __init ostm_init(struct device_node *np)
>
>  TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
>
> -#ifdef CONFIG_ARCH_RZG2L
> +#if IS_ENABLED(CONFIG_ARCH_RZG2L) || IS_ENABLED(CONFIG_ARCH_R9A09G057)

I think you want to use "defined()" instead of "IS_ENABLED()"?

>  static int __init ostm_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;

Gr{oetje,eeting}s,

                        Geert
Lad, Prabhakar March 19, 2024, 9:26 a.m. UTC | #2
Hi Geert,

Thank you for the review.

On Tue, Mar 19, 2024 at 8:33 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> Thanks for your patch!
>
> On Mon, Mar 18, 2024 at 5:08 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > RZ/V2H(P) (R9A09G057) SoC has Generic Timer Module(a.k.a OSTM) which
> > needs to deassert the reset line before accessing any registers just
> > like the RZ/G2L SoC.
> >
> > Enable the entry point for RZ/V2H(P) SoC so that we can deassert
> > the reset line in probe callback.
>
> This is not really what is happening.
> As OSTM on RZ/V2H has a reset specified, the early call to ostm_init()
> through TIMER_OF_DECLARE() always fails with -EPROBE_DEFER, as resets
> are not available that early in the boot process.  Hence the driver
> needs to be reprobed later through the platform driver probe.
>
Thank you for clarification. Ill update the commit description as above.

> > While at it use IS_ENABLED() macro instead of open coding.
>
> I don't see how the code was open-coding IS_ENABLED()?
>
Ahh..

> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> > --- a/drivers/clocksource/renesas-ostm.c
> > +++ b/drivers/clocksource/renesas-ostm.c
> > @@ -224,7 +224,7 @@ static int __init ostm_init(struct device_node *np)
> >
> >  TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
> >
> > -#ifdef CONFIG_ARCH_RZG2L
> > +#if IS_ENABLED(CONFIG_ARCH_RZG2L) || IS_ENABLED(CONFIG_ARCH_R9A09G057)
>
> I think you want to use "defined()" instead of "IS_ENABLED()"?
>
OK, I will use defined().

Cheers,
Prabhakar

> >  static int __init ostm_probe(struct platform_device *pdev)
> >  {
> >         struct device *dev = &pdev->dev;
>
> 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
diff mbox series

Patch

diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
index 8da972dc1713..b8b3c82b2528 100644
--- a/drivers/clocksource/renesas-ostm.c
+++ b/drivers/clocksource/renesas-ostm.c
@@ -224,7 +224,7 @@  static int __init ostm_init(struct device_node *np)
 
 TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
 
-#ifdef CONFIG_ARCH_RZG2L
+#if IS_ENABLED(CONFIG_ARCH_RZG2L) || IS_ENABLED(CONFIG_ARCH_R9A09G057)
 static int __init ostm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;