From patchwork Thu Jan 26 08:33:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 92491 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp79440qgi; Thu, 26 Jan 2017 00:34:42 -0800 (PST) X-Received: by 10.84.200.200 with SMTP id u8mr2447840plh.98.1485419682876; Thu, 26 Jan 2017 00:34:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si25863883pge.197.2017.01.26.00.34.42; Thu, 26 Jan 2017 00:34:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893AbdAZIeO (ORCPT + 4 others); Thu, 26 Jan 2017 03:34:14 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:23346 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbdAZIeH (ORCPT ); Thu, 26 Jan 2017 03:34:07 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKD005ENP4TSJ50@mailout1.w1.samsung.com>; Thu, 26 Jan 2017 08:34:05 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170126083405eucas1p115c54f37b5d2eddfa636e9c52c598e83~dRUwU9il02038520385eucas1p16; Thu, 26 Jan 2017 08:34:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id A9.3E.30614.C74B9885; Thu, 26 Jan 2017 08:34:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170126083404eucas1p132ce7a0792505367f6a001f21e9d1632~dRUvZw4xp2038920389eucas1p1_; Thu, 26 Jan 2017 08:34:04 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-50-5889b47c85c8 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A3.53.10233.974B9885; Thu, 26 Jan 2017 08:34:01 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OKD000KKP4KMO50@eusync1.samsung.com>; Thu, 26 Jan 2017 08:34:03 +0000 (GMT) From: Marek Szyprowski To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Linus Walleij , Tomasz Figa , Lee Jones , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 6/8] mfd: exynos-lpass: Add support for clocks Date: Thu, 26 Jan 2017 09:33:52 +0100 Message-id: <1485419634-28331-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1485419634-28331-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djP87o1WzojDJp/mltsnLGe1WL+kXOs FufPb2C3uP/1KKPFlD/LmSw2Pb7GarF5/h9Gi8u75rBZzDi/j8li7ZG77BaH37SzWqza9YfR gcdj56y77B6bVnWyedy5tofNY/OSeo++LasYPT5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jFwcQgJLGCUa399ihXCamCTmvn7GAlLFJmAo0fW2 C6xKRGApo8T/lZ/ZQRxmgS1MEl2bLrKDVAkLOEo83L+NGcRmEVCVuNDWA7aDV8BDovn2Mqh9 chInj00GszkFPCVOP30F1isEVLPp4kL2CYy8CxgZVjGKpJYW56bnFhvpFSfmFpfmpesl5+du YgTGwrZjP7fsYOx6F3yIUYCDUYmHN2NbR4QQa2JZcWXuIUYJDmYlEd7zqzsjhHhTEiurUovy 44tKc1KLDzGaAh01kVlKNDkfGKd5JfGGJobmloZGxhYW5kZGSuK8Uz9cCRcSSE8sSc1OTS1I LYLpY+LglGpgnMu6rrlp6V7bnLwaxrMJXZ5hJpotxs0cdm7lvdpnNHxbP2569jvsy5E5aRst 7qkYLcjSVRdvcauPPbfg5ae+J9daH63+ev+goLC856/ouNdFn5c8DrT2DG9T+ic0+wP33Blp m7Rbgp//TF77bNli/tO7czq3zyySmTDn3K1p5Utvvw//9P+uohJLcUaioRZzUXEiAJWBz7mb AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170126083404eucas1p132ce7a0792505367f6a001f21e9d1632 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170126083404eucas1p132ce7a0792505367f6a001f21e9d1632 X-RootMTR: 20170126083404eucas1p132ce7a0792505367f6a001f21e9d1632 References: <1485419634-28331-1-git-send-email-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 Exynos LPASS requires some clocks to be enabled to make any access to its registers. This patch adds code for handling such clocks. For current set of registers it is enough to keep sfr0_ctrl clock enabled. Till now it worked only because those clocks were enabled by bootloader and driver probe() happened before they were disabled by clock core because of lack of users. Handling those clocks is also needed to make it possible to enable support for audio power domain. This patch requires adding sfr0_ctrl clock to device tree. Signed-off-by: Marek Szyprowski --- .../devicetree/bindings/mfd/samsung,exynos5433-lpass.txt | 6 ++++++ drivers/mfd/exynos-lpass.c | 10 ++++++++++ 2 files changed, 16 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/mfd/samsung,exynos5433-lpass.txt b/Documentation/devicetree/bindings/mfd/samsung,exynos5433-lpass.txt index a8deaee82c44..df664018c148 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,exynos5433-lpass.txt +++ b/Documentation/devicetree/bindings/mfd/samsung,exynos5433-lpass.txt @@ -5,6 +5,10 @@ Required properties: - compatible : "samsung,exynos5433-lpass" - reg : should contain the LPASS top SFR region location and size + - clock-names : should contain following required clocks: "sfr0_ctrl" + - clocks : should contain clock specifiers of all clocks, which + input names have been specified in clock-names + property, in same order. - #address-cells : should be 1 - #size-cells : should be 1 - ranges : must be present @@ -24,6 +28,8 @@ Example: audio-subsystem { compatible = "samsung,exynos5433-lpass"; reg = <0x11400000 0x100>, <0x11500000 0x08>; + clocks = <&cmu_aud CLK_PCLK_SFR0_CTRL>; + clock-names = "sfr0_ctrl"; #address-cells = <1>; #size-cells = <1>; ranges; diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c index 17915daa2e80..be264988bdc9 100644 --- a/drivers/mfd/exynos-lpass.c +++ b/drivers/mfd/exynos-lpass.c @@ -14,6 +14,7 @@ * only version 2 as published by the Free Software Foundation. */ +#include #include #include #include @@ -52,6 +53,7 @@ struct exynos_lpass { /* pointer to the LPASS TOP regmap */ struct regmap *top; + struct clk *sfr0_clk; }; static void exynos_lpass_core_sw_reset(struct exynos_lpass *lpass, int mask) @@ -71,6 +73,8 @@ static void exynos_lpass_core_sw_reset(struct exynos_lpass *lpass, int mask) static void exynos_lpass_enable(struct exynos_lpass *lpass) { + clk_prepare_enable(lpass->sfr0_clk); + /* Unmask SFR, DMA and I2S interrupt */ regmap_write(lpass->top, SFR_LPASS_INTR_CA5_MASK, LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); @@ -88,6 +92,8 @@ static void exynos_lpass_disable(struct exynos_lpass *lpass) /* Mask any unmasked IP interrupt sources */ regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK, 0); regmap_write(lpass->top, SFR_LPASS_INTR_CA5_MASK, 0); + + clk_disable_unprepare(lpass->sfr0_clk); } static const struct regmap_config exynos_lpass_reg_conf = { @@ -114,6 +120,10 @@ static int exynos_lpass_probe(struct platform_device *pdev) if (IS_ERR(base_top)) return PTR_ERR(base_top); + lpass->sfr0_clk = devm_clk_get(dev, "sfr0_ctrl"); + if (IS_ERR(lpass->sfr0_clk)) + return PTR_ERR(lpass->sfr0_clk); + lpass->top = regmap_init_mmio(dev, base_top, &exynos_lpass_reg_conf); if (IS_ERR(lpass->top)) {