From patchwork Wed Feb 21 10:15:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10231723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B988B60392 for ; Wed, 21 Feb 2018 10:15:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2C7328ADF for ; Wed, 21 Feb 2018 10:15:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96DEC28AE5; Wed, 21 Feb 2018 10:15:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02BD928AE1 for ; Wed, 21 Feb 2018 10:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932732AbeBUKPo (ORCPT ); Wed, 21 Feb 2018 05:15:44 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:53936 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932739AbeBUKPi (ORCPT ); Wed, 21 Feb 2018 05:15:38 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180221101536euoutp02c3c204ec6b7066a82d7810153db49281~VT8A4mQjD0099800998euoutp02Z; Wed, 21 Feb 2018 10:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180221101536euoutp02c3c204ec6b7066a82d7810153db49281~VT8A4mQjD0099800998euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519208136; bh=7EcMsUL8m33Y1DHFywd1KEbPNFzOjbl/LA6LwW/umHI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=KhEeBf3ZJU17AN8R2pTm3FqpuuHk+g30rv9qYbBKZqj6i2EUpIyIu7v363zkbk8wa rb86yjb+HdDL+mKDsAjooHiFNluTkxKHg9zrhHth5lr5bycU4cP6qbQmMJTJ7OlcQt Ne1wFkx4dTzlsgc0cq1lFK/lmW+h7Bf6UG7p7+JI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180221101535eucas1p1339d9e106db3f6f51a05d98740e19f09~VT8ANaCiQ3076130761eucas1p1q; Wed, 21 Feb 2018 10:15:35 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 9F.81.17380.7C64D8A5; Wed, 21 Feb 2018 10:15:35 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180221101534eucas1p24db3c1d049d9ecd0de9c76a10bb58041~VT7-EY35Q1444614446eucas1p2p; Wed, 21 Feb 2018 10:15:34 +0000 (GMT) X-AuditID: cbfec7f4-b4fc79c0000043e4-1a-5a8d46c71611 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8F.E2.04178.6C64D8A5; Wed, 21 Feb 2018 10:15:34 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P4H005K9WHT4SB0@eusync3.samsung.com>; Wed, 21 Feb 2018 10:15:34 +0000 (GMT) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 4/6] clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5x sub-CMU driver Date: Wed, 21 Feb 2018 11:15:25 +0100 Message-id: <20180221101527.25554-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.15.0 In-reply-to: <20180221101527.25554-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsWy7djP87rH3XqjDN50cVtsnLGe1eL6l+es FpPuT2CxOH9+A7vFx557rBYzzu9jslh75C67xeE37awOHB6bVnWyefRtWcXo8XmTXABzFJdN SmpOZllqkb5dAlfG110vWQreGFU869/L3sB4RbuLkZNDQsBEYuqrOexdjFwcQgIrGCUWbTgE 5XxmlNgw+wETTNXHT8vYIBLLGCXuNV5nhXAamCTmTW5hBaliEzCU6HrbxQZiiwg4SHz+9JoR pIhZoI1J4uyB/UCjODiEBVIkZjangdSwCKhKXOneBdbLK2Ar0XX4ByPENnmJxd93soGUcwrY Sex8yQEyRkKgkU3i9dwHzBA1LhIX+q+wQdjCEq+Ob2GHsGUkOjsOMkE09DNK/Pv/EsqZwSix /mMrVJW1xOHjF8E2MwvwSUzaNp0ZZJuEAK9ER5sQRImHxJ77r6HKHSWWbZ4ADZeJjBIXn25h n8AotYCRYRWjeGppcW56arFRXmq5XnFibnFpXrpecn7uJkZgRJ7+d/zLDsZdf5IOMQpwMCrx 8L4w6IkSYk0sK67MPcQowcGsJMJbKdQbJcSbklhZlVqUH19UmpNafIhRmoNFSZw3TqMuSkgg PbEkNTs1tSC1CCbLxMEp1cC4dnHlyyn7iphil/XM/Hdt9rob7+d5s/65KZ3s9eXTnlfNHx2W bsztivKf2nCzSE+toPjHE7X6XZetd+6UDzAy2dOlNtV8vY57/udVk+al7/kh1TdNxcvpebiA 8tXeqpm883vtb8cf2N1T+GPL5KDtS7e/mpKbcUR3vW/nOpPfafufHmPX6nP7osRSnJFoqMVc VJwIALvqCtbEAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4Vd1jbr1RBjOOCltsnLGe1eL6l+es FpPuT2CxOH9+A7vFx557rBYzzu9jslh75C67xeE37awOHB6bVnWyefRtWcXo8XmTXABzFJdN SmpOZllqkb5dAlfG110vWQreGFU869/L3sB4RbuLkZNDQsBE4uOnZWxdjFwcQgJLGCVO3JrG CuE0MUnsnLqCCaSKTcBQouttFxuILSLgIPH502tGkCJmgQ4miT17HwIlODiEBVIkZjangdSw CKhKXOnexQpi8wrYSnQd/sEIsU1eYvH3nWDlnAJ2EjtfcoCEhYBKpq19yz6BkWcBI8MqRpHU 0uLc9NxiQ73ixNzi0rx0veT83E2MwIDZduzn5h2MlzYGH2IU4GBU4uG10OmJEmJNLCuuzD3E KMHBrCTCWynUGyXEm5JYWZValB9fVJqTWnyIUZqDRUmc97xBZZSQQHpiSWp2ampBahFMlomD U6qBMXie2snNx8KmSj8Sub3Z//UqbuOUs/lp1geUgje9+r7vmWHlzOcy0jeuH6k/cXjzlFfb 1qyMfqMTuuTckj6plycX1pRMzVp2Xzh9s6zQqgnr5lxfynYpIiGA+e9xqYtVETvdy2SZ/v/9 tna1pGvRr2RB0bcCfFxTFte723iwuVTMMONeoWO897oSS3FGoqEWc1FxIgBFd9IUFAIAAA== X-CMS-MailID: 20180221101534eucas1p24db3c1d049d9ecd0de9c76a10bb58041 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180221101534eucas1p24db3c1d049d9ecd0de9c76a10bb58041 X-RootMTR: 20180221101534eucas1p24db3c1d049d9ecd0de9c76a10bb58041 References: <20180221101527.25554-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clocks related to DISP1 block require special handling for power domain turn on/off sequences. Till now this was handled by Exynos power domain driver, but that approach was limited only to some special cases. This patch moves handling of those operations to clock controller driver. This gives more flexibility and allows fine tune values of some clock-specific registers. This patch moves handling of those mentioned clocks to Exynos5x sub-CMU driver instantiated from Exynos5250 driver. Signed-off-by: Marek Szyprowski Acked-by: Krzysztof Kozlowski --- drivers/clk/samsung/Makefile | 1 + drivers/clk/samsung/clk-exynos5250.c | 51 +++++++++++++++++++++---------- drivers/clk/samsung/clk-exynos5x-subcmu.c | 1 + drivers/soc/samsung/pm_domains.c | 1 + 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile index f70b3f66be89..d265f4babfb0 100644 --- a/drivers/clk/samsung/Makefile +++ b/drivers/clk/samsung/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_SOC_EXYNOS3250) += clk-exynos3250.o obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4412-isp.o obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o +obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5x-subcmu.o obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 9b073c98a891..876fa4c122ca 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -18,6 +18,7 @@ #include "clk.h" #include "clk-cpu.h" +#include "clk-exynos5x-subcmu.h" #define APLL_LOCK 0x0 #define APLL_CON0 0x100 @@ -571,17 +572,6 @@ static const struct samsung_gate_clock exynos5250_gate_clks[] __initconst = { GATE(CLK_SMMU_GSCL3, "smmu_gscl3", "mout_aclk266_gscl_sub", GATE_IP_GSCL, 10, 0, 0), - GATE(CLK_FIMD1, "fimd1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 0, 0, - 0), - GATE(CLK_MIE1, "mie1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 1, 0, - 0), - GATE(CLK_DSIM0, "dsim0", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 3, 0, - 0), - GATE(CLK_DP, "dp", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 4, 0, 0), - GATE(CLK_MIXER, "mixer", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 5, 0, - 0), - GATE(CLK_HDMI, "hdmi", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 6, 0, - 0), GATE(CLK_MFC, "mfc", "mout_aclk333_sub", GATE_IP_MFC, 0, 0, 0), GATE(CLK_SMMU_MFCR, "smmu_mfcr", "mout_aclk333_sub", GATE_IP_MFC, 1, 0, @@ -671,10 +661,6 @@ static const struct samsung_gate_clock exynos5250_gate_clks[] __initconst = { GATE(CLK_WDT, "wdt", "div_aclk66", GATE_IP_PERIS, 19, 0, 0), GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0), GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0), - GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", - GATE_IP_DISP1, 9, 0, 0), - GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", - GATE_IP_DISP1, 8, 0, 0), GATE(CLK_SMMU_2D, "smmu_2d", "div_aclk200", GATE_IP_ACP, 7, 0, 0), GATE(CLK_SMMU_FIMC_ISP, "smmu_fimc_isp", "mout_aclk_266_isp_sub", GATE_IP_ISP0, 8, 0, 0), @@ -698,6 +684,38 @@ static const struct samsung_gate_clock exynos5250_gate_clks[] __initconst = { GATE_IP_ISP1, 7, 0, 0), }; +static const struct samsung_gate_clock exynos5250_disp_gate_clks[] __initconst = { + GATE(CLK_FIMD1, "fimd1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 0, 0, + 0), + GATE(CLK_MIE1, "mie1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 1, 0, + 0), + GATE(CLK_DSIM0, "dsim0", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 3, 0, + 0), + GATE(CLK_DP, "dp", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 4, 0, 0), + GATE(CLK_MIXER, "mixer", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 5, 0, + 0), + GATE(CLK_HDMI, "hdmi", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 6, 0, + 0), + GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", + GATE_IP_DISP1, 9, 0, 0), + GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", + GATE_IP_DISP1, 8, 0, 0), +}; + +static struct samsung_clk_ext_reg_dump exynos_5250_disp_suspend_regs[] = { + { GATE_IP_DISP1, 0xffffffff, 0xffffffff }, /* DISP1 gates */ + { SRC_TOP3, 0, BIT(4) }, /* MUX mout_aclk200_disp1_sub */ + { SRC_TOP3, 0, BIT(6) }, /* MUX mout_aclk300_disp1_sub */ +}; + +static const struct samsung_5x_subcmu_info exynos_5250_disp_subcmu = { + .gate_clks = exynos5250_disp_gate_clks, + .nr_gate_clks = ARRAY_SIZE(exynos5250_disp_gate_clks), + .suspend_regs = exynos_5250_disp_suspend_regs, + .nr_suspend_regs = ARRAY_SIZE(exynos_5250_disp_suspend_regs), + .pd_name = "DISP1", +}; + static const struct samsung_pll_rate_table vpll_24mhz_tbl[] __initconst = { /* sorted in descending order */ /* PLL_36XX_RATE(rate, m, p, s, k) */ @@ -859,10 +877,11 @@ static void __init exynos5250_clk_init(struct device_node *np) __raw_writel(tmp, reg_base + PWR_CTRL2); exynos5250_clk_sleep_init(); + samsung_clk_subcmus_init(ctx, 1, &exynos_5250_disp_subcmu); samsung_clk_of_add_provider(np, ctx); pr_info("Exynos5250: clock setup completed, armclk=%ld\n", _get_rate("div_arm2")); } -CLK_OF_DECLARE(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init); +CLK_OF_DECLARE_DRIVER(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init); diff --git a/drivers/clk/samsung/clk-exynos5x-subcmu.c b/drivers/clk/samsung/clk-exynos5x-subcmu.c index 256473b83264..483f70c2dd40 100644 --- a/drivers/clk/samsung/clk-exynos5x-subcmu.c +++ b/drivers/clk/samsung/clk-exynos5x-subcmu.c @@ -159,6 +159,7 @@ static int __init exynos5x_clk_probe(struct platform_device *pdev) } static const struct of_device_id exynos5x_clk_of_match[] = { + { .compatible = "samsung,exynos5250-clock", }, { .compatible = "samsung,exynos5420-clock", }, { .compatible = "samsung,exynos5800-clock", }, { }, diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index f2d6d7a09c16..caf45cf7aa8e 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -148,6 +148,7 @@ static __init const char *exynos_get_domain_name(struct device_node *node) } static const char *soc_force_no_clk[] = { + "samsung,exynos5250-clock", "samsung,exynos5420-clock", "samsung,exynos5800-clock", };