Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11158672ybi; Thu, 25 Jul 2019 11:01:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFJUS5ihl8o2S28S7P0v0ETQaGHQXEIzzk06BKB/fFT3whOiclbNL8t7GcHiFbOUSH5/RS X-Received: by 2002:a65:430b:: with SMTP id j11mr85870551pgq.383.1564077680622; Thu, 25 Jul 2019 11:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564077680; cv=none; d=google.com; s=arc-20160816; b=ewvQE1GQ2O579MFGfC6j5e7iKA1ctSdwxlNLymPTaenuX1y40177aftSFCMBpQ1sLe gsCcphzAfObQvMu964mqGMyUX/qc1lKqT5gGZ6XVoHaYidDUzq0bfuArPo2HYY0nW1E8 /yUT8xqRZv/6VPw4Mu6AK4znQVpf92dWN5yw5yi2HwRkwh1FAuYUIcIUoKhgMohvs+io W/MVXQtL2srqzynnoo+ozXIbHyYZMEwTBkxAg4IohemHx8DKC5RjRClQVgvci2Unebax K6syDZKbZqQtrFDCU0X1e+fML6BKxaXaq9zG7HKpd+jY3HOLim8ByBGvA/xStM/kWRnK lcqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=AawwEP56U+vYoQivP5dWZ0mbAArK+m1U0+xIgjdYc/c=; b=XjeyqLIsXh1r7IC0Ksye5IRgbaQrKcDcrtZQg3mWON9dVHUn0uQvwrfNsy7Gjcdb8/ 7OAFe4wwiUCFbW381Wdm63P06vbzbZ1mDo6+0jaBgj088pGKwBzdSHj7mfgOpYPgiLB7 ZCeOMulncaSoxYefy0+Edcn20turIZtQ0RpCtc35hOGyxAso0yuw7dZDWoukNhsCH7z8 sbDRdD+dp1w+OpDkBiDBklkoVCDfZS6H6eT6fMHiwfji6oP2FrsBdz4CzDK4IGLcrgvu w3P+TyBA2yDhgnrHnsXzpUq3mEI2hCfoPd2K+3QDFVT1TODmYc1Nx60JNZKM52qJhxa/ 3shQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=FrnjrNqK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si17412237pfi.139.2019.07.25.11.01.05; Thu, 25 Jul 2019 11:01:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=FrnjrNqK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388222AbfGYOna (ORCPT + 99 others); Thu, 25 Jul 2019 10:43:30 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:41879 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729151AbfGYOn2 (ORCPT ); Thu, 25 Jul 2019 10:43:28 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190725144327euoutp02bdd60ae211ab776463d4e2a6427f18fb~0rZCRs6-k1159811598euoutp02h for ; Thu, 25 Jul 2019 14:43:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190725144327euoutp02bdd60ae211ab776463d4e2a6427f18fb~0rZCRs6-k1159811598euoutp02h 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 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djPc7q8ByxjDU4vMrXYOGM9q8X1L89Z LeYfOcdq0bfvP6NF/+PXzBbnz29gtzjb9IbdYtPja6wWl3fNYbP43HuE0WLG+X1MFmuP3GW3 WHr9IpPF7cYVbBZvfpxlsmjde4Td4t+1jSwWmx8cY3MQ8lgzbw2jx6ZVnWwem5fUexx8t4fJ o2/LKkaP4ze2M3l83iQXwB7FZZOSmpNZllqkb5fAlbHxxXa2ggmiFXsPLWJsYJwg2MXIySEh YCKxfMlTli5GLg4hgRWMEq/6T7NDOF8YJebuvAaV+cwo8XD2ayaYltetp5hBbCGB5YwSd17k wXUs3XeOHSTBJqAqsWXGSzBbREBZYvK96cwgRcwCP1kkNlzeCJYQFvCSaDy+A2gFBwcLUMOG Oa4gYV4BF4mdS54yQyyTl+jcsZsFxOYUcJX427iWEaJGUOLkzCdg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ic8duFhCbU8BV4m/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 Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190725144325eucas1p1463ecde90f9c93cb73d3c54c7cf3f1ff References: <20190725144300.25014-1-k.konieczny@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.22.0