From patchwork Mon Nov 3 03:53:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 5213911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78D639F349 for ; Mon, 3 Nov 2014 04:06:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A75D201F5 for ; Mon, 3 Nov 2014 04:06:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6329201BB for ; Mon, 3 Nov 2014 04:06:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xl8s3-0000Vu-A2; Mon, 03 Nov 2014 04:03:59 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xl8ro-0008S1-B1 for linux-arm-kernel@lists.infradead.org; Mon, 03 Nov 2014 04:03:45 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEG000L23A4UQ00@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 03 Nov 2014 13:03:40 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 5A.DB.17016.99EF6545; Mon, 03 Nov 2014 13:03:37 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-24-5456fe99af84 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 23.59.20081.99EF6545; Mon, 03 Nov 2014 13:03:37 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NEG00BUJ320LR40@mmp2.samsung.com>; Mon, 03 Nov 2014 13:03:37 +0900 (KST) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 09/12] soc: samsung: pm_domain: Add support for parent power domain Date: Mon, 03 Nov 2014 09:23:07 +0530 Message-id: <1414986790-11940-10-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1414986790-11940-1-git-send-email-amit.daniel@samsung.com> References: <1414986790-11940-1-git-send-email-amit.daniel@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsWyRsSkTnfmv7AQg445ohYNV0MsehdcZbPY 9Pgaq8Xn3iOMFjPO72OyWLT1C7sDm8fmJfUefVtWMXp83iQXwBzFZZOSmpNZllqkb5fAldHy 5hBLwTrJihVTHzA3MO4S6WLk5JAQMJHY824aC4QtJnHh3nq2LkYuDiGBpYwS/540scAUtZ85 wAKRmM4oMXHyIlYIZwKTxNETC1hBqtgEjCV+7tzPDmKLCKRLrFm0mw3EZhZIkbg8vYMJxBYW CJU4t+0smM0ioCpxddMBRhCbV8BDov/rEeYuRg6gbQoScybZgIQ5gcIn+66DjRcScJeY9O45 E8heCYFmdolJ7afYIeYISHybfIgFoldWYtMBZoijJSUOrrjBMoFReAEjwypG0dSC5ILipPQi Q73ixNzi0rx0veT83E2MwCA+/e9Z7w7G2wesDzEKcDAq8fAWbA8LEWJN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3forjNIuSxuN6yIwJzvi9tnt39V/NU mriXa23S1ui6Wo8uZ1HWpsevlViKMxINtZiLihMBws7YFqcCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141102_200344_552946_4DBB0BFD X-CRM114-Status: GOOD ( 14.11 ) X-Spam-Score: -5.6 (-----) Cc: pankaj.dubey@samsung.com, Amit Daniel Kachhap , kgene.kim@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch adds supports for parent power domain. This will ensure invoking of parent/child power domain on/off in a correct sequence. In exynos7 SOC's, power domain controllers have parent and child hierarchy. Cc: Kukjin Kim Reviewed-by: Pankaj Dubey Signed-off-by: Amit Daniel Kachhap --- .../bindings/arm/exynos/power_domain.txt | 2 + drivers/soc/samsung/pm_domains.c | 42 +++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt index 07e4ffe..07752a4 100644 --- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt +++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt @@ -26,6 +26,7 @@ Optional Properties: are supported currently. - pd-power-conf: This optional parameter provides the local power configuration value for the power domain. +- parent: phandle of parent power domain. Node of a device using power domains must have a samsung,power-domain property defined with a phandle to respective power domain. @@ -51,6 +52,7 @@ Example: compatible = "samsung,exynos4210-pd", "samsung,exynos7-pd-mfc"; pd-offset = <0x4060>; pd-power-conf = <0xf>; + parent = <&pd_top>; #power-domain-cells = <0>; }; diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index 84a3f1f..f14f182 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -26,7 +26,7 @@ #define INT_LOCAL_PWR_EN 0x7 #define MAX_CLK_PER_DOMAIN 4 - +#define MAX_PARENT_POWER_DOMAIN 10 /* * Exynos specific wrapper around the generic power domain */ @@ -179,7 +179,47 @@ no_clk: pm_genpd_init(&pd->pd, NULL, !on); of_genpd_add_provider_simple(np, &pd->pd); } + /* Assign the child power domains to their parents */ + for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { + struct device_node *parent_np; + int i; + struct generic_pm_domain *child_domain, *parent_domain; + const char *name; + + if (of_property_read_string_index(np, "compatible", 1, + &name)) { + /* Second entry not found, use the node name*/ + name = np->name; + } + child_domain = pm_genpd_lookup_name(name); + if (!child_domain) + continue; + /* search parents in device tree */ + for (i = 0; i < MAX_PARENT_POWER_DOMAIN; i++) { + parent_np = of_parse_phandle(np, "parent", i); + if (!parent_np) + break; + + if (of_property_read_string_index(parent_np, + "compatible", 1, &name)) { + /* Second entry not found, use the node name*/ + name = parent_np->name; + } + + parent_domain = pm_genpd_lookup_name(name); + if (!parent_domain) + break; + if (pm_genpd_add_subdomain(parent_domain, child_domain)) + pr_err("%s failed to add subdomain: %s\n", + parent_domain->name, + child_domain->name); + else + pr_info("%s has as child subdomain: %s.\n", + parent_domain->name, + child_domain->name); + } + } return 0; }