Skip to content

Commit f63aaf6

Browse files
committed
clk: renesas: mstp: Add genpd OF provider at postcore_initcall()
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 c5ae5a0 ("pmdomain: renesas: rcar-sysc: Add genpd OF provider at postcore_initcall"). Fixes: 18a3a51 ("pmdomain: core: Add the genpd->dev to the genpd provider bus") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/81ef5f8d5d31374b7852b05453c52d2f735062a2.1755073087.git.geert+renesas@glider.be
1 parent 8f5ae30 commit f63aaf6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/clk/renesas/clk-mstp.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ void cpg_mstp_detach_dev(struct generic_pm_domain *unused, struct device *dev)
303303
pm_clk_destroy(dev);
304304
}
305305

306+
static struct device_node *cpg_mstp_pd_np __initdata = NULL;
307+
static struct generic_pm_domain *cpg_mstp_pd_genpd __initdata = NULL;
308+
306309
void __init cpg_mstp_add_clk_domain(struct device_node *np)
307310
{
308311
struct generic_pm_domain *pd;
@@ -324,5 +327,20 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np)
324327
pd->detach_dev = cpg_mstp_detach_dev;
325328
pm_genpd_init(pd, &pm_domain_always_on_gov, false);
326329

327-
of_genpd_add_provider_simple(np, pd);
330+
cpg_mstp_pd_np = of_node_get(np);
331+
cpg_mstp_pd_genpd = pd;
332+
}
333+
334+
static int __init cpg_mstp_pd_init_provider(void)
335+
{
336+
int error;
337+
338+
if (!cpg_mstp_pd_np)
339+
return -ENODEV;
340+
341+
error = of_genpd_add_provider_simple(cpg_mstp_pd_np, cpg_mstp_pd_genpd);
342+
343+
of_node_put(cpg_mstp_pd_np);
344+
return error;
328345
}
346+
postcore_initcall(cpg_mstp_pd_init_provider);

0 commit comments

Comments
 (0)