From patchwork Thu Mar 12 13:37:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 5995011 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 0F5E59F399 for ; Thu, 12 Mar 2015 13:38:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3C76B2037F for ; Thu, 12 Mar 2015 13:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F38A2037C for ; Thu, 12 Mar 2015 13:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754841AbbCLNht (ORCPT ); Thu, 12 Mar 2015 09:37:49 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:24680 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbbCLNhq (ORCPT ); Thu, 12 Mar 2015 09:37:46 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NL3003H5Q1H1A30@mailout4.w1.samsung.com>; Thu, 12 Mar 2015 13:41:41 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-b4-5501961672c3 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 34.8F.07834.61691055; Thu, 12 Mar 2015 13:35:18 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NL300DQQPUM5GB0@eusync2.samsung.com>; Thu, 12 Mar 2015 13:37:43 +0000 (GMT) From: Andrzej Hajda To: Kukjin Kim Cc: Andrzej Hajda , Marek Szyprowski , Kyungmin Park , javier.martinez@collabora.co.uk, Liquid.Acid@gmx.net, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 RESEND 2/4] arm/exynos/pm_domains: add support for async-bridge clocks Date: Thu, 12 Mar 2015 14:37:09 +0100 Message-id: <1426167431-24470-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1426167431-24470-1-git-send-email-a.hajda@samsung.com> References: <1426167431-24470-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t/xK7pi0xhDDaYc0bO4te4cq8X8I0Di ytf3bBZHfxdY9D9+zWxxtukNu8Wmx9dYLS7vmsNmMeP8PiaLrp8/2SzWHrnL7sDt8ff5dRaP xZv2s3lsWtXJ5nG/+ziTx+Yl9R59W1YxenzeJBfAHsVlk5Kak1mWWqRvl8CVcfHqH6aCNtGK 952LWRsYGwW7GDk5JARMJL4fu8IEYYtJXLi3nq2LkYtDSGApo8SR9+vZIZw+JonjC1vBqtgE NCX+br4JVMXBISKgKLF5gQJIDbPAYyaJuxNXs4DUCAtES6ycsY0ZxGYRUJVYduk9mM0r4Czx 79E/qG1yEiePTWYFsTkFXCSuP//EBmILAdVc7T3BOoGRdwEjwypG0dTS5ILipPRcQ73ixNzi 0rx0veT83E2MkHD8soNx8TGrQ4wCHIxKPLwRfQyhQqyJZcWVuYcYJTiYlUR4S9sZQ4V4UxIr q1KL8uOLSnNSiw8xMnFwSjUwdl2LcsvN5ldyT9gYJne9u+aawVuF65NW3SzUddj69NP+zHSm 0+oBTvVZ01/e4GauunPIY68i19bI29/vx19uf3myt269oOC2NsGLr/erTXrVv0PgZpiJjuxF y6MrNnznj9Tbxs03Wf21R0jE180mmQ3vTaUvbr68UVT15RzR7UdPb3l/81l4qxJLcUaioRZz UXEiADY6Zd8lAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Since Exynos5420 there are async-bridges (ASB) between different IPs. These bridges must be operational during power domain on/off, ie. clocks used by these bridges should be enabled. This patch enabled these clocks during domain on/off. Signed-off-by: Andrzej Hajda Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas Reviewed-by: Sylwester Nawrocki --- arch/arm/mach-exynos/pm_domains.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 37266a8..507dad0 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -37,6 +37,7 @@ struct exynos_pm_domain { struct clk *oscclk; struct clk *clk[MAX_CLK_PER_DOMAIN]; struct clk *pclk[MAX_CLK_PER_DOMAIN]; + struct clk *asb_clk[MAX_CLK_PER_DOMAIN]; }; static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) @@ -45,14 +46,19 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) void __iomem *base; u32 timeout, pwr; char *op; + int i; pd = container_of(domain, struct exynos_pm_domain, pd); base = pd->base; + for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { + if (IS_ERR(pd->asb_clk[i])) + break; + clk_prepare_enable(pd->asb_clk[i]); + } + /* Set oscclk before powering off a domain*/ if (!power_on) { - int i; - for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { if (IS_ERR(pd->clk[i])) break; @@ -81,8 +87,6 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) /* Restore clocks after powering on a domain*/ if (power_on) { - int i; - for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { if (IS_ERR(pd->clk[i])) break; @@ -92,6 +96,12 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) } } + for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { + if (IS_ERR(pd->asb_clk[i])) + break; + clk_disable_unprepare(pd->asb_clk[i]); + } + return 0; } @@ -131,6 +141,15 @@ static __init int exynos4_pm_init_power_domain(void) pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; + for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { + char clk_name[8]; + + snprintf(clk_name, sizeof(clk_name), "asb%d", i); + pd->asb_clk[i] = clk_get(dev, clk_name); + if (IS_ERR(pd->asb_clk[i])) + break; + } + pd->oscclk = clk_get(dev, "oscclk"); if (IS_ERR(pd->oscclk)) goto no_clk;