diff mbox

[PATCH/RFC] drivers: sh: Handle PM_GENERIC_DOMAINS_OF=n with new r8a7795 CPG/MSSR driver

Message ID 1446117914-6392-1-git-send-email-geert+renesas@glider.be (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Geert Uytterhoeven Oct. 29, 2015, 11:25 a.m. UTC
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 <geert+renesas@glider.be>
---
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(-)

Comments

Magnus Damm Oct. 29, 2015, 12:44 p.m. UTC | #1
Hi Geert,

On Thu, Oct 29, 2015 at 8:25 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> 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 <geert+renesas@glider.be>
> ---
> I'd be happy to make CONFIG_PM=y mandatory for new SoCs/DTS, so we can
> drop this patch.
>
> Thoughts?

Yeah, making CONFIG_PM=y mandatory must be the right way forward for new SoCs.

> 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.

Thanks for your help! So shall we work towards dropping your
workaround and fix CONFIG_PM=y for r8a7795 and newer SoCs?

Cheers,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }