]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: renesas: mstp: Add genpd OF provider at postcore_initcall()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 13 Aug 2025 08:20:22 +0000 (10:20 +0200)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 18 Aug 2025 07:36:55 +0000 (09:36 +0200)
Genpd OF providers must now be registered after genpd bus registration.
However, cpg_mstp_add_clk_domain() is only called from CLK_OF_DECLARE(),
which is too early.  Hence on R-Car M1A, R-Car H1, and RZ/A1, the
CPG/MSTP Clock Domain fails to register, and any devices residing in
that clock domain fail to probe.

Fix this by splitting initialization into two steps:
  - The first part keeps on registering the PM domain with genpd at
    CLK_OF_DECLARE(),
  - The second and new part moves the registration of the genpd OF
    provider to a postcore_initcall().

See also commit c5ae5a0c61120d0c ("pmdomain: renesas: rcar-sysc: Add
genpd OF provider at postcore_initcall").

Fixes: 18a3a510ecfd0e50 ("pmdomain: core: Add the genpd->dev to the genpd provider bus")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/81ef5f8d5d31374b7852b05453c52d2f735062a2.1755073087.git.geert+renesas@glider.be
drivers/clk/renesas/clk-mstp.c

index 5bc473c2adb33a9c1ac5ee1c6a18c4989cd483ae..2f65fe2c6bdf07c65a15411f24c042ac83dd9983 100644 (file)
@@ -303,6 +303,9 @@ void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev)
                pm_clk_destroy(dev);
 }
 
+static struct device_node *cpg_mstp_pd_np __initdata = NULL;
+static struct generic_pm_domain *cpg_mstp_pd_genpd __initdata = NULL;
+
 void __init cpg_mstp_add_clk_domain(struct device_node *np)
 {
        struct generic_pm_domain *pd;
@@ -324,5 +327,20 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np)
        pd->detach_dev = cpg_mstp_detach_dev;
        pm_genpd_init(pd, &pm_domain_always_on_gov, false);
 
-       of_genpd_add_provider_simple(np, pd);
+       cpg_mstp_pd_np = of_node_get(np);
+       cpg_mstp_pd_genpd = pd;
+}
+
+static int __init cpg_mstp_pd_init_provider(void)
+{
+       int error;
+
+       if (!cpg_mstp_pd_np)
+               return -ENODEV;
+
+       error = of_genpd_add_provider_simple(cpg_mstp_pd_np, cpg_mstp_pd_genpd);
+
+       of_node_put(cpg_mstp_pd_np);
+       return error;
 }
+postcore_initcall(cpg_mstp_pd_init_provider);