linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] soc: renesas: rcar-sysc: Mark device node OF_POPULATED after init
@ 2021-01-20 14:23 Geert Uytterhoeven
  2021-01-20 17:09 ` Saravana Kannan
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-01-20 14:23 UTC (permalink / raw)
  To: Saravana Kannan, Greg Kroah-Hartman, Rafael J . Wysocki
  Cc: Marc Zyngier, Kevin Hilman, Marek Szyprowski, Yoshihiro Shimoda,
	linux-renesas-soc, linux-arm-kernel, linux-pm, linux-kernel,
	devicetree, Geert Uytterhoeven

The R-Car System Controller (SYSC) driver registers PM domains from an
early_initcall().  It does not use a platform driver, as secondary CPU
startup on R-Car H1 needs to control the CPU power domains, before
initialization of the driver framework.

As fw_devlink only considers platform devices, it does not know that the
System Controller is ready.  Hence probing of on-chip devices that are
part of the SYSC PM domain fail:

    probe deferral - supplier e6180000.system-controller not ready

Fix this by setting the OF_POPULATED flag for the SYSC device node after
successful initialization.  This will make of_link_to_phandle() ignore
the SYSC device node as a dependency, and consumer devices will be
probed again.

Fixes: e590474768f1cc04 ("driver core: Set fw_devlink=on by default")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/soc/renesas/rcar-sysc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index 9b235fc900273405..a00bb098e1fe7488 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -439,6 +439,8 @@ static int __init rcar_sysc_pd_init(void)
 	}
 
 	error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
+	if (!error)
+		of_node_set_flag(np, OF_POPULATED);
 
 out_put:
 	of_node_put(np);
-- 
2.25.1


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

* Re: [PATCH/RFC] soc: renesas: rcar-sysc: Mark device node OF_POPULATED after init
  2021-01-20 14:23 [PATCH/RFC] soc: renesas: rcar-sysc: Mark device node OF_POPULATED after init Geert Uytterhoeven
@ 2021-01-20 17:09 ` Saravana Kannan
  2021-01-21 15:38   ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Saravana Kannan @ 2021-01-20 17:09 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J . Wysocki, Marc Zyngier,
	Kevin Hilman, Marek Szyprowski, Yoshihiro Shimoda, Linux-Renesas,
	linux-arm-kernel, Linux PM, LKML,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Rob Herring

On Wed, Jan 20, 2021 at 6:23 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> The R-Car System Controller (SYSC) driver registers PM domains from an
> early_initcall().  It does not use a platform driver, as secondary CPU
> startup on R-Car H1 needs to control the CPU power domains, before
> initialization of the driver framework.
>
> As fw_devlink only considers platform devices,

Correction. It only considers devices. As in, devices on all types of
busses are supported.

> it does not know that the
> System Controller is ready.  Hence probing of on-chip devices that are
> part of the SYSC PM domain fail:
>
>     probe deferral - supplier e6180000.system-controller not ready
>
> Fix this by setting the OF_POPULATED flag for the SYSC device node after
> successful initialization.  This will make of_link_to_phandle() ignore
> the SYSC device node as a dependency, and consumer devices will be
> probed again.

It'd still be nice if you could (maybe in a later patch), at least
probe all the power domains that aren't really needed this early.
Using the driver core framework (when it's possible), gives you nice
things :)

+Rob. I know he hates people using OF_POPULATED, but I think this case
is reasonable and want to make sure he's aware of this.

Once you fix my commit nitpick, you can add:
Reviewed-by: Saravana Kannan <saravanak@google.com>

-Saravana

>
> Fixes: e590474768f1cc04 ("driver core: Set fw_devlink=on by default")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/soc/renesas/rcar-sysc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
> index 9b235fc900273405..a00bb098e1fe7488 100644
> --- a/drivers/soc/renesas/rcar-sysc.c
> +++ b/drivers/soc/renesas/rcar-sysc.c
> @@ -439,6 +439,8 @@ static int __init rcar_sysc_pd_init(void)
>         }
>
>         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> +       if (!error)
> +               of_node_set_flag(np, OF_POPULATED);
>
>  out_put:
>         of_node_put(np);
> --
> 2.25.1
>

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

* Re: [PATCH/RFC] soc: renesas: rcar-sysc: Mark device node OF_POPULATED after init
  2021-01-20 17:09 ` Saravana Kannan
@ 2021-01-21 15:38   ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-01-21 15:38 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J . Wysocki, Marc Zyngier,
	Kevin Hilman, Marek Szyprowski, Yoshihiro Shimoda, Linux-Renesas,
	linux-arm-kernel, Linux PM, LKML,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Rob Herring

Hi Saravana,

On Wed, Jan 20, 2021 at 6:09 PM Saravana Kannan <saravanak@google.com> wrote:
> On Wed, Jan 20, 2021 at 6:23 AM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > The R-Car System Controller (SYSC) driver registers PM domains from an
> > early_initcall().  It does not use a platform driver, as secondary CPU
> > startup on R-Car H1 needs to control the CPU power domains, before
> > initialization of the driver framework.
> >
> > As fw_devlink only considers platform devices,
>
> Correction. It only considers devices. As in, devices on all types of
> busses are supported.

OK.

> > it does not know that the
> > System Controller is ready.  Hence probing of on-chip devices that are
> > part of the SYSC PM domain fail:
> >
> >     probe deferral - supplier e6180000.system-controller not ready
> >
> > Fix this by setting the OF_POPULATED flag for the SYSC device node after
> > successful initialization.  This will make of_link_to_phandle() ignore
> > the SYSC device node as a dependency, and consumer devices will be
> > probed again.
>
> It'd still be nice if you could (maybe in a later patch), at least
> probe all the power domains that aren't really needed this early.
> Using the driver core framework (when it's possible), gives you nice
> things :)

Which nice things are you thinking of? Making the driver modular?
At least on R-Car H1, it needs to be built-in for SMP to work.

> +Rob. I know he hates people using OF_POPULATED, but I think this case
> is reasonable and want to make sure he's aware of this.
>
> Once you fix my commit nitpick, you can add:
> Reviewed-by: Saravana Kannan <saravanak@google.com>

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] 3+ messages in thread

end of thread, other threads:[~2021-01-21 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 14:23 [PATCH/RFC] soc: renesas: rcar-sysc: Mark device node OF_POPULATED after init Geert Uytterhoeven
2021-01-20 17:09 ` Saravana Kannan
2021-01-21 15:38   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).