From patchwork Wed Oct 26 06:12:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9395947 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 BA60D60231 for ; Wed, 26 Oct 2016 06:12:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD2329810 for ; Wed, 26 Oct 2016 06:12:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 802DA29814; Wed, 26 Oct 2016 06:12:34 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 DFA3029810 for ; Wed, 26 Oct 2016 06:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753266AbcJZGMd (ORCPT ); Wed, 26 Oct 2016 02:12:33 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:58422 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbcJZGMc (ORCPT ); Wed, 26 Oct 2016 02:12:32 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OFN009NZ58SCZ40@mailout3.w1.samsung.com>; Wed, 26 Oct 2016 07:12:28 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161026061227eucas1p2cbe1ff1ca4e814b33dead4605b92aa3e~BAC1kSgrZ2784027840eucas1p2u; Wed, 26 Oct 2016 06:12:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 6E.E1.23383.C4940185; Wed, 26 Oct 2016 07:12:28 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161026061227eucas1p20fb865eafd802044ed79ce336fa90eab~BAC0_EupQ2784427844eucas1p2q; Wed, 26 Oct 2016 06:12:26 +0000 (GMT) X-AuditID: cbfec7ef-f79e76d000005b57-17-5810494cdddd Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7B.DB.10494.92940185; Wed, 26 Oct 2016 07:11:53 +0100 (BST) 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 <0OFN002AD58N8M20@eusync1.samsung.com>; Wed, 26 Oct 2016 07:12:26 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Stephen Boyd , Michael Turquette , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Javier Martinez Canillas Subject: [PATCH v2] clk/samsung: Use CLK_OF_DECLARE_DRIVER initialization method for CLKOUT Date: Wed, 26 Oct 2016 08:12:20 +0200 Message-id: <1477462340-7867-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDIsWRmVeSWpSXmKPExsWy7djPc7o+ngIRBl/WiFlsnLGe1eL6l+es Fm/ermGyOH9+A7vFx557rBYzzu9jslh75C67xcVTrhaH37SzWvw4083iwOX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hIWAiMWnf XRYIW0ziwr31bF2MXBxCAksYJdZPPM0E4TQxSTx484YJpIpNwFCi620XG4gtIuAg8fnTa0aQ ImaBD0wSUw7vZAdJCAvESmzcMgmoiIODRUBVYuUETxCTV8BdouF/CcQyOYmTxyazTmDkXsDI sIpRJLW0ODc9t9hIrzgxt7g0L10vOT93EyMwgLcd+7llB2PXu+BDjAIcjEo8vDvS+SOEWBPL iitzDzFKcDArifAmOApECPGmJFZWpRblxxeV5qQWH2I0BVo9kVlKNDkfGF15JfGGJobmloZG xhYW5kZGSuK8Uz9cCRcSSE8sSc1OTS1ILYLpY+LglGpg9JFYLnXSucPmh5X+65ZtZs4xQe4d qYGJjpW/O5TlH/l4S+mdDjrKZ7Z+o84zvXV/Hr7bGb72p6xMY97emVpGEg4O/JoWB9W2Ce3L +fjnu9Lrlz+4/9t0S+qKNywWNWJed/yQ4vF6757lj/qWSc7coTBhqY1zVQ3r5RCtJSIXT+r8 j5g8zfejEktxRqKhFnNRcSIAxKynEXYCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161026061227eucas1p20fb865eafd802044ed79ce336fa90eab X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161026061227eucas1p20fb865eafd802044ed79ce336fa90eab X-RootMTR: 20161026061227eucas1p20fb865eafd802044ed79ce336fa90eab References: 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 The Exynos PMU node is an interrupt, clock and PMU (Power Management Unit) controller, and these functionalities are supported by different drivers that matches the same compatible strings. Since commit 989eafd0b609 ("clk: core: Avoid double initialization of clocks") the OF core flags clock controllers registered with the CLK_OF_DECLARE() macro as OF_POPULATED, so platform devices with the same compatible string will not be registered. This prevents the PMU platform device to be created, so the Exynos PMU driver is never probed. This breaks (among other things) Suspend-to-RAM. Fix this by changing CLKOUT driver initialization method to CLK_OF_DECLARE_DRIVER(), which doesn't clear the OF_POPULATED flag, so later a platform device is created and the Exynos PMU platform driver can be be probed properly. Fixes: 989eafd0b609 ("clk: core: Avoid double initialization of clocks") Signed-off-by: Marek Szyprowski Reviewed-by: Chanwoo Choi Reviewed-by: Javier Martinez Canillas --- Changelog: v2: - switched to CLK_OF_DECLARE_DRIVER instead of calling of_node_clear_flag(node, OF_POPULATED) as suggested by Stephen Boyd v1: https://www.spinics.net/lists/linux-clk/msg12833.html - initial version --- drivers/clk/samsung/clk-exynos-clkout.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 96fab6cfb202..6c6afb87b4ce 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -132,28 +132,34 @@ static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask) pr_err("%s: failed to register clkout clock\n", __func__); } +/* + * We use CLK_OF_DECLARE_DRIVER initialization method to avoid setting + * the OF_POPULATED flag on the pmu device tree node, so later the + * Exynos PMU platform device can be properly probed with PMU driver. + */ + static void __init exynos4_clkout_init(struct device_node *node) { exynos_clkout_init(node, EXYNOS4_CLKOUT_MUX_MASK); } -CLK_OF_DECLARE(exynos4210_clkout, "samsung,exynos4210-pmu", +CLK_OF_DECLARE_DRIVER(exynos4210_clkout, "samsung,exynos4210-pmu", exynos4_clkout_init); -CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu", +CLK_OF_DECLARE_DRIVER(exynos4212_clkout, "samsung,exynos4212-pmu", exynos4_clkout_init); -CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu", +CLK_OF_DECLARE_DRIVER(exynos4412_clkout, "samsung,exynos4412-pmu", exynos4_clkout_init); -CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu", +CLK_OF_DECLARE_DRIVER(exynos3250_clkout, "samsung,exynos3250-pmu", exynos4_clkout_init); static void __init exynos5_clkout_init(struct device_node *node) { exynos_clkout_init(node, EXYNOS5_CLKOUT_MUX_MASK); } -CLK_OF_DECLARE(exynos5250_clkout, "samsung,exynos5250-pmu", +CLK_OF_DECLARE_DRIVER(exynos5250_clkout, "samsung,exynos5250-pmu", exynos5_clkout_init); -CLK_OF_DECLARE(exynos5410_clkout, "samsung,exynos5410-pmu", +CLK_OF_DECLARE_DRIVER(exynos5410_clkout, "samsung,exynos5410-pmu", exynos5_clkout_init); -CLK_OF_DECLARE(exynos5420_clkout, "samsung,exynos5420-pmu", +CLK_OF_DECLARE_DRIVER(exynos5420_clkout, "samsung,exynos5420-pmu", exynos5_clkout_init); -CLK_OF_DECLARE(exynos5433_clkout, "samsung,exynos5433-pmu", +CLK_OF_DECLARE_DRIVER(exynos5433_clkout, "samsung,exynos5433-pmu", exynos5_clkout_init);