From patchwork Thu Jul 25 14:42:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Konieczny X-Patchwork-Id: 11059011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 728381398 for ; Thu, 25 Jul 2019 14:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 644A9289EF for ; Thu, 25 Jul 2019 14:43:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 573A2288FD; Thu, 25 Jul 2019 14:43:59 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 D7FAD28A11 for ; Thu, 25 Jul 2019 14:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387419AbfGYOn3 (ORCPT ); Thu, 25 Jul 2019 10:43:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:50387 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729161AbfGYOn2 (ORCPT ); Thu, 25 Jul 2019 10:43:28 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190725144327euoutp01bc13ecad6897bfb0c60165fbfcd0b0d9~0rZCSCmq_2892628926euoutp019 for ; Thu, 25 Jul 2019 14:43:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190725144327euoutp01bc13ecad6897bfb0c60165fbfcd0b0d9~0rZCSCmq_2892628926euoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1564065807; bh=AawwEP56U+vYoQivP5dWZ0mbAArK+m1U0+xIgjdYc/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrnjrNqKMT0MVsu6iwx2gYx1UG8l/sEaWxnIviAjIF7UM2nROd7VMugUcNjRtecNw Nuy1gcQDyPVMM8/7a3i20YqQGConC4vlE/+h3VDfUCQT3/vo8cL0Pcf+GmhYaG3+6J rGTWzJwhr0Jj/C8QBieDXc/1x6tysLI1L3qYTrmU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190725144326eucas1p201dfa63ff1d2649b8728aa007337f8ad~0rZBbr-nD1638016380eucas1p2Z; Thu, 25 Jul 2019 14:43:26 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 40.51.04325.D00C93D5; Thu, 25 Jul 2019 15:43:25 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff~0rZAewaCl0145701457eucas1p1D; Thu, 25 Jul 2019 14:43:25 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190725144324eusmtrp109079162b86d53b8d95e222c3caf0023~0rZAQewzX0724307243eusmtrp1_; Thu, 25 Jul 2019 14:43:24 +0000 (GMT) X-AuditID: cbfec7f5-b75ff700000010e5-66-5d39c00d8d86 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6A.56.04140.C00C93D5; Thu, 25 Jul 2019 15:43:24 +0100 (BST) Received: from AMDC3218.DIGITAL.local (unknown [106.120.51.18]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190725144324eusmtip1c1767b422b17e551cd7850ba8e98f062~0rY-gYVCH0174901749eusmtip1g; Thu, 25 Jul 2019 14:43:24 +0000 (GMT) From: k.konieczny@partner.samsung.com To: k.konieczny@partner.samsung.com Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Chanwoo Choi , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Mark Rutland , MyungJoo Ham , Nishanth Menon , Rob Herring , Stephen Boyd , Viresh Kumar , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 1/5] devfreq: exynos-bus: correct clock enable sequence Date: Thu, 25 Jul 2019 16:42:56 +0200 Message-Id: <20190725144300.25014-2-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725144300.25014-1-k.konieczny@partner.samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djPc7q8ByxjDU4vMrXYOGM9q8X1L89Z LeYfOcdq0bfvP6NF/+PXzBbnz29gtzjb9IbdYtPja6wWl3fNYbP43HuE0WLG+X1MFmuP3GW3 WHr9IpPF7cYVbBZvfpxlsmjde4Td4t+1jSwWmx8cY3MQ8lgzbw2jx6ZVnWwem5fUexx8t4fJ o2/LKkaP4ze2M3l83iQXwB7FZZOSmpNZllqkb5fAlbHxxXa2ggmiFXsPLWJsYJwg2MXIySEh YCKxfMlTli5GLg4hgRWMEq/6T7NDOF8YJebuvAaV+cwo8XD2ayaYltetp5hBbCGB5YwSd17k wXUs3XeOHSTBJqAqsWXGSzBbREBZYvK96cwgRcwCP1kkNlzeCJYQFvCSaDy+A2gFBw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9PBJjELdLJK rHhyBGySsICXROPxHSxdjBwcLEANG+a4goR5BVwkdi55ygyxQF6ic8duFhCbU8BV4m/jWrD5 QkA1jf3HGCHqBSVOznwCVsMMVN+8dTbzBEaBWUhSs5CkFjAyrWIUSS0tzk3PLTbSK07MLS7N S9dLzs/dxAiMym3Hfm7Zwdj1LvgQowAHoxIP74XllrFCrIllxZW5hxglOJiVRHi37gAK8aYk VlalFuXHF5XmpBYfYjQF+mEis5Rocj4wYeSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJ zU5NLUgtgulj4uCUamC8PiHy4Od7+d/TC6dXaDfUcM85uenf/9iPXn9Z10zaFzWtpzhE+Ef3 7FqVnVeKT/6cs/Cg3sZfa4KKeTUWpp6uYW/WqP9w9OFdGZttJhtXyCiX/dDQOR5nxSEXvCiy o3JG15srilOaVrfdmO1hlnRwy9n9unPSGz8wligenzAlWdEgtVfexniDEktxRqKhFnNRcSIA McT9bOACAAA= X-CMS-MailID: 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff X-Msg-Generator: CA X-RootMTR: 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff References: <20190725144300.25014-1-k.konieczny@partner.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 Regulators should be enabled before clocks to avoid h/w hang. This require change in exynos_bus_probe() to move exynos_bus_parse_of() after exynos_bus_parent_parse_of() and change in error handling. Similar change is needed in exynos_bus_exit() where clock should be disabled before regulators. Signed-off-by: Kamil Konieczny --- Changes: v4: - move regulator disable after clock disable - remove unrelated changes - add disabling regulators in error path in exynos_bus_probe() --- drivers/devfreq/exynos-bus.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 486cc5b422f1..f34fa26f00d0 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -194,11 +194,10 @@ static void exynos_bus_exit(struct device *dev) if (ret < 0) dev_warn(dev, "failed to disable the devfreq-event devices\n"); - if (bus->regulator) - regulator_disable(bus->regulator); - dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); + if (bus->regulator) + regulator_disable(bus->regulator); } /* @@ -386,6 +385,7 @@ static int exynos_bus_probe(struct platform_device *pdev) struct exynos_bus *bus; int ret, max_state; unsigned long min_freq, max_freq; + bool passive = false; if (!np) { dev_err(dev, "failed to find devicetree node\n"); @@ -399,27 +399,27 @@ static int exynos_bus_probe(struct platform_device *pdev) bus->dev = &pdev->dev; platform_set_drvdata(pdev, bus); - /* Parse the device-tree to get the resource information */ - ret = exynos_bus_parse_of(np, bus); - if (ret < 0) - return ret; - profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); - if (!profile) { - ret = -ENOMEM; - goto err; - } + if (!profile) + return -ENOMEM; node = of_parse_phandle(dev->of_node, "devfreq", 0); if (node) { of_node_put(node); - goto passive; + passive = true; } else { ret = exynos_bus_parent_parse_of(np, bus); + if (ret < 0) + return ret; } + /* Parse the device-tree to get the resource information */ + ret = exynos_bus_parse_of(np, bus); if (ret < 0) - goto err; + goto err_reg; + + if (passive) + goto passive; /* Initialize the struct profile and governor data for parent device */ profile->polling_ms = 50; @@ -510,6 +510,9 @@ static int exynos_bus_probe(struct platform_device *pdev) err: dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); +err_reg: + if (!passive) + regulator_disable(bus->regulator); return ret; }