From patchwork Mon Nov 24 13:04:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 5366291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63DCEC11AC for ; Mon, 24 Nov 2014 13:21:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8639F203E1 for ; Mon, 24 Nov 2014 13:21:58 +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 9D8B120351 for ; Mon, 24 Nov 2014 13:21:57 +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 1XstXn-0004MP-NY; Mon, 24 Nov 2014 13:19:07 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XstXg-00043U-Ir for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 13:19:01 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFJ00JXDOZ1JE00@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 24 Nov 2014 22:18:37 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 87.6B.18484.D2033745; Mon, 24 Nov 2014 22:18:37 +0900 (KST) X-AuditID: cbfee68f-f791c6d000004834-12-5473302d0e62 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 99.D5.09430.D2033745; Mon, 24 Nov 2014 22:18: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 <0NFJ00EZLOLG6V60@mmp2.samsung.com>; Mon, 24 Nov 2014 22:18:37 +0900 (KST) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH RFC v2 08/12] soc: samsung: pm_domain: Add support for parent power domain Date: Mon, 24 Nov 2014 18:34:12 +0530 Message-id: <1416834256-11225-8-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416834256-11225-1-git-send-email-amit.daniel@samsung.com> References: <1416833572-6880-1-git-send-email-amit.daniel@samsung.com> <1416834256-11225-1-git-send-email-amit.daniel@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFFi42JZI2JSpatrUBxi8Oi2gkXD1RCL+UfOsVo8 u7WXyaJ3wVU2i6ebHzNZbHp8jdXi8q45bBafe48wWsw4v4/JYtHWL+wWZ05fYrU4/Kad1eL4 2nAHXo9NqzrZPO5c28PmcehwB6PH5iX1HluutrN49G1ZxejxeZNcAHsUl01Kak5mWWqRvl0C V8bu6fdZCvZKVuz9eIipgXGnSBcjJ4eEgIlE+8+ZjBC2mMSFe+vZuhi5OIQEljJKnHx1hx2m qKdzM1RiOqPElOnPGSGcCUwSB+/fYwapYhMwlvi5cz9QBweHiIC3xPJriiA1zAKrmSS2tn9g AqkRFoiR2PPrDBtIDYuAqsTz01ogYV4Bd4nbe7uZQMISAgoScybZgIQ5BTwkXhxsYYZY1cIo cenxXFYQR0LgGrvE2+fL2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VlalFuXHF5XmpBYfYjQFOmoi s5Rocj4wVeSVxBsam5ibGptamliYmFkqifPeuJkbIiSQnliSmp2aWpBaBNPHxMEp1cDI+zO8 jP3uXaa4nU17LpyzWKjmd7Ra0dN+0efL0j0vmjM+lX/gdFa2v7R3sdQtlczjVl+nSGktS4rI 4n2hlPG4J/T9la0Lp8S2btmxgENNK+vR8dSkzgOG9i45DM0LhSM4/69bszvz4G3uns701g++ TyLjpT9dfXc4uTrKt0W2cl+oTOHXWy5KLMUZiYZazEXFiQB6ClOc3QIAAA== 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-20141124_051900_781998_D8D54D02 X-CRM114-Status: GOOD ( 13.85 ) X-Spam-Score: -5.0 (-----) Cc: devicetree@vger.kernel.org, ulf.hansson@linaro.org, kgene.kim@samsung.com, khilman@kernel.org, pankaj.dubey@samsung.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Amit Daniel Kachhap , geert@linux-m68k.org, s.nawrocki@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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 Signed-off-by: Amit Daniel Kachhap --- .../bindings/arm/exynos/power_domain.txt | 2 + drivers/soc/samsung/pm_domains.c | 43 +++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt index 00ebda1..0160bdc 100644 --- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt +++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt @@ -24,6 +24,7 @@ Optional Properties: - pclkN, clkN: Pairs of parent of input clock and input clock to the devices in this power domain. Maximum of 4 pairs (N = 0 to 3) are supported currently. +- parents: phandle of parent power domains. Node of a device using power domains must have a samsung,power-domain property defined with a phandle to respective power domain. @@ -48,6 +49,7 @@ Example: mfc_pd: power-domain@10044060 { compatible = "samsung,exynos4210-pd", "samsung,exynos7-pd-mfc"; reg = <0x10044060 0x20>; + parents = <&pd_top>; #power-domain-cells = <0>; }; diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index f4f2a6c..89e2fd5 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -25,10 +25,10 @@ #include #define MAX_CLK_PER_DOMAIN 4 +#define MAX_PARENT_POWER_DOMAIN 10 static struct exynos_pmu_pd_ops *pd_ops; - /* * Exynos specific wrapper around the generic power domain */ @@ -169,6 +169,47 @@ no_clk: 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, "parents", 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_warn("%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; }