]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pmdomain: renesas: rcar-sysc: Add genpd OF provider at postcore_initcall
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 1 Jul 2025 11:47:03 +0000 (13:47 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 9 Jul 2025 11:28:29 +0000 (13:28 +0200)
Subsequent changes to genpd adds a limitation that registering a genpd OF
providers must be done after its bus registration, which is at
core_initcall.

To adopt to this, let's split the initialization into two steps. The first
part keep registering the PM domains with genpd at early_initcall, as this
is needed to bringup the CPUs for R-Car H1, by calling
rcar_sysc_power_up_cpu(). The second and new part, moves the registration
of the genpd OF provider to a postcore_initcall().

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20250701114733.636510-2-ulf.hansson@linaro.org
drivers/pmdomain/renesas/rcar-sysc.c

index 047495f54e8adc0d616fe4f067c80f76e4a739cc..4b310c1d35fa6bb5943c499c474a9c548843160d 100644 (file)
@@ -342,6 +342,7 @@ struct rcar_pm_domains {
 };
 
 static struct genpd_onecell_data *rcar_sysc_onecell_data;
+static struct device_node *rcar_sysc_onecell_np;
 
 static int __init rcar_sysc_pd_init(void)
 {
@@ -428,7 +429,8 @@ static int __init rcar_sysc_pd_init(void)
                }
        }
 
-       error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
+       rcar_sysc_onecell_np = np;
+       return 0;
 
 out_put:
        of_node_put(np);
@@ -436,6 +438,21 @@ out_put:
 }
 early_initcall(rcar_sysc_pd_init);
 
+static int __init rcar_sysc_pd_init_provider(void)
+{
+       int error;
+
+       if (!rcar_sysc_onecell_np)
+               return -ENODEV;
+
+       error = of_genpd_add_provider_onecell(rcar_sysc_onecell_np,
+                                             rcar_sysc_onecell_data);
+
+       of_node_put(rcar_sysc_onecell_np);
+       return error;
+}
+postcore_initcall(rcar_sysc_pd_init_provider);
+
 #ifdef CONFIG_ARCH_R8A7779
 static int rcar_sysc_power_cpu(unsigned int idx, bool on)
 {