From patchwork Thu Oct 29 11:25:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7518371 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C06EC9F399 for ; Thu, 29 Oct 2015 11:25:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD40720A27 for ; Thu, 29 Oct 2015 11:25:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7C3920652 for ; Thu, 29 Oct 2015 11:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750980AbbJ2LZO (ORCPT ); Thu, 29 Oct 2015 07:25:14 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:35726 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbbJ2LZN (ORCPT ); Thu, 29 Oct 2015 07:25:13 -0400 Received: from ayla.of.borg ([84.195.106.123]) by laurent.telenet-ops.be with bizsmtp id azRB1r0052fm56U01zRB4w; Thu, 29 Oct 2015 12:25:11 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZrlKR-0002X6-4m; Thu, 29 Oct 2015 12:25:11 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZrlKX-0001fh-EY; Thu, 29 Oct 2015 12:25:17 +0100 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm Cc: linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC] drivers: sh: Handle PM_GENERIC_DOMAINS_OF=n with new r8a7795 CPG/MSSR driver Date: Thu, 29 Oct 2015 12:25:14 +0100 Message-Id: <1446117914-6392-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }