Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5477220ybh; Wed, 7 Aug 2019 06:40:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqynl0Ke5Pdt+RbUtke9AKkPr/rtmIyASnHv71eXU5eNGxN6Q9OTzvKXxRl6D+KqGBC5XHSJ X-Received: by 2002:a63:e148:: with SMTP id h8mr7788502pgk.275.1565185210052; Wed, 07 Aug 2019 06:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565185210; cv=none; d=google.com; s=arc-20160816; b=aa5ojQrc/P3iXGm+WoCv1OueZ94UXC7PWZL0jSqjVpsjMhHhQupWEIz0MbyaS9YN3Z /ydlNMOCtk0/yVNERxHLesnUfDCIKE1E9Bc3Et7pD4Nf5sM53BKsQJvn+pncohsYZ5YP mPNNpOeGwwTC95k41GWMFsDD3ldT2j2mBK6JAQoqEpVZ10DrcW8BPaR8kIuiL0njZCJz uJErdsTZ/x/VqVA/32rLpxmggIG2Ef+bJZyo+UDdq6WJle7RABrgeW7BqKmzLzholvjA Gzbe7XJ8b1680owheqo9m4rLnYOvxoEZTquN1JEFglcbj4p6JDTNUPbShxpG8Sfwtz4g skwA== 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=CjwZyowP2SyGv4qfE/HxF+yoeTjTHLNxjLACzBKukg4=; b=ToYfguzIi3o5W9LV9TMLxpi5njKCMaljSGHQC7e7PprfdZ8rfMi7GLKLMgyxkHFpZz vcUZIv+ofqEL0ltDLj/jwIulGAd+J2jEPOTkzlqIwBC64lO+H4ftoDj9kOL5Xm+5paFj j+ShnRQzWXfWb3bP/4Kuwya9G3wer1uFJLjwrDug8h4aekRaDx0Z3V5Z1DCMF6pAR97Y lbhERXjhFQrkcSAS56M5gzA9D4tBpp4EmidkiZPO6QaATon/RO7guhv7pUUkSJzSbIbB aAw382A1SNrzL2QHcGoZGRYOKhdePpxbjhBrBV7taydUcdtamMUswaRlekTWc9hXXLL9 ueXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=AqZTuv1C; 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 d8si52414180pfr.182.2019.08.07.06.39.54; Wed, 07 Aug 2019 06:40:10 -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=AqZTuv1C; 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 S2388521AbfHGNjB (ORCPT + 99 others); Wed, 7 Aug 2019 09:39:01 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:58138 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388453AbfHGNi7 (ORCPT ); Wed, 7 Aug 2019 09:38:59 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190807133858euoutp012b6c5e2e74284f15f23c317e1ddd87ab~4p5c53jzV2498224982euoutp019 for ; Wed, 7 Aug 2019 13:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190807133858euoutp012b6c5e2e74284f15f23c317e1ddd87ab~4p5c53jzV2498224982euoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1565185138; bh=CjwZyowP2SyGv4qfE/HxF+yoeTjTHLNxjLACzBKukg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqZTuv1CcWRC8/YCOLDcc/C+XeqiIdIZ9/Ubs1H+88Wji6XYvFjQUexJoiZVkeaQv 1iRdPPzeUjtQauWnJEKIx8ZxZlggS6Bw/SNKAT9n0K++6mOQIVKGt5SK4Y8rH9vsf2 cxCIhIAhpIs7RzkDWYdEUa6V4zqJFDYb2Ua7nm8c= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190807133857eucas1p21a53d364906d342b94849ed7fa78e5eb~4p5cLVJC11098810988eucas1p2J; Wed, 7 Aug 2019 13:38:57 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 7E.19.04309.174DA4D5; Wed, 7 Aug 2019 14:38:57 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190807133856eucas1p2a893cd24096b089307e4216a1033a742~4p5bT0yde1099710997eucas1p2q; Wed, 7 Aug 2019 13:38:56 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190807133856eusmtrp2f02b70f236ecc6e971a43f8c3fc3e8d6~4p5bFhwWl0146501465eusmtrp2E; Wed, 7 Aug 2019 13:38:56 +0000 (GMT) X-AuditID: cbfec7f4-afbff700000010d5-a8-5d4ad471ec33 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DB.0F.04117.074DA4D5; Wed, 7 Aug 2019 14:38:56 +0100 (BST) Received: from AMDC3218.DIGITAL.local (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190807133855eusmtip2f1ea21a25bffbbee728eb421bb70d871~4p5aYMd4m1919719197eusmtip2c; Wed, 7 Aug 2019 13:38:55 +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 v5 1/4] devfreq: exynos-bus: correct clock enable sequence Date: Wed, 7 Aug 2019 15:38:35 +0200 Message-Id: <20190807133838.14678-2-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190807133838.14678-1-k.konieczny@partner.samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHKsWRmVeSWpSXmKPExsWy7djP87qFV7xiDTZtErXYOGM9q8X1L89Z LeYfOcdq0bfvP6NF/+PXzBbnz29gtzjb9IbdYtPja6wWl3fNYbP43HuE0WLG+X1MFmuP3GW3 WHr9IpPF7cYVbBZvfpxlsmjde4Td4t+1jSwWmx8cY3MQ8lgzbw2jx6ZVnWwem5fUexx8t4fJ o2/LKkaP4ze2M3l83iQXwB7FZZOSmpNZllqkb5fAlbFn+wyWgtuiFbN2hDQwnhfsYuTkkBAw kfh4ZylrFyMXh5DACkaJLw8XskE4XxglVszfwgLhfGaU+HrpPStMy/lpT5khEssZJV533mCF a7l5cjsbSBWbgKrElhkv2UFsEQFlicn3poN1MAv8ZJHYcHkjWEJYwEuiafI3MJsFqOHh5rdg Nq+Ai8ShWaeYIdbJS3Tu2M0CYnMKuEp83TuBEaJGUOL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pyc+QSshhmovnnrbOYJjAKzkKRmIUktYGRaxSiSWlqcm55bbKRXnJhbXJqXrpec n7uJERiV24793LKDsetd8CFGAQ5GJR5ehgtesUKsiWXFlbmHGCU4mJVEeO+VecYK8aYkVlal FuXHF5XmpBYfYjQFemIis5Rocj4wYeSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJzU5N LUgtgulj4uCUamC0EazqmvLl+4JuGYEL3P/D3vc9Wfrpkj9TtFhQB69ml3LsItE9/PMZJRV5 zyR5VwTNOmny636Xjeed1N9rLpRILrU7JXn119dDaTYLoitKGRwrdvo+0/WYv+63h2jffYuo 2BOTj94XemCc1VPuHHe9x1vCfcm5t8cz+wIVNcX2FNtk69f+uavEUpyRaKjFXFScCADdVKh0 4AIAAA== X-CMS-MailID: 20190807133856eucas1p2a893cd24096b089307e4216a1033a742 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190807133856eucas1p2a893cd24096b089307e4216a1033a742 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190807133856eucas1p2a893cd24096b089307e4216a1033a742 References: <20190807133838.14678-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 Acked-by: Chanwoo Choi --- Changes: v5: - added Acked-by tag 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