If CONFIG_PM=n (and thus PM_GENERIC_DOMAINS_OF=n), the CPG/MSSR driver
doesn't install its Clock Domain. Make sure the needed module clocks are
still enabled by using the Legacy Clock Domain.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
I'd be happy to make CONFIG_PM=y mandatory for new SoCs/DTS, so we can
drop this patch.

Thoughts?

For your convenience, I have push this patch to the
topic/r8a7795-drivers-sh-v1 branch of my renesas-drivers repository.  A
full integration for R-Car Gen3 is available in the topic/gen3-latest
branch.
---
 drivers/sh/pm_runtime.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index 91a003011acfacb2..5eeed1db1bb3f9d8 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -32,17 +32,26 @@ static struct pm_clk_notifier_block platform_bus_notifier = 
{
        .con_ids = { NULL, },
 };
 
+static const struct of_device_id clk_domain_matches[] = {
+       { .compatible = "renesas,cpg-mstp-clocks", },
+       { .compatible = "renesas,r8a7795-cpg-mssr", },
+       { /* sentinel */ }
+};
+
 static int __init sh_pm_runtime_init(void)
 {
        if (IS_ENABLED(CONFIG_ARCH_SHMOBILE)) {
-               if (!of_find_compatible_node(NULL, NULL,
-                                            "renesas,cpg-mstp-clocks"))
+               if (!of_find_matching_node(NULL, clk_domain_matches))
                        return 0;
+
                if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS_OF) &&
-                   of_find_node_with_property(NULL, "#power-domain-cells"))
+                   of_find_node_with_property(NULL, "#power-domain-cells")) {
+                       pr_debug("Using DT Clock Domain\n");
                        return 0;
+               }
        }
 
+       pr_debug("Using Legacy Clock Domain\n");
        pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
        return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to