Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp86295ybp; Thu, 3 Oct 2019 10:32:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIjrIjItcxaioMWrPM4N6vsAWSCwxGaJTHIL8F/p/gwQPnaNiKif52TCNUkHlh0j+nNMEY X-Received: by 2002:aa7:ce8b:: with SMTP id y11mr10700930edv.231.1570123943512; Thu, 03 Oct 2019 10:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570123943; cv=none; d=google.com; s=arc-20160816; b=oXDKad4knShwKUYvMt37phod2S/Jq/RDWUGx0j4SzMGC3+g7RvTsPabHfYsQ5M3TMK ceusYGMwFf0y0UW+JS4aq2ji6bgV6p3tfzV4ONDz6159P+uXUDucnjbwWXDFuswIZRXO wRaVg8Cw9CxSlD6byjDDWX0HtHHHyWy2FwOrjRgHKHhCD4ZEMEciV9PZF0/zann7YZH4 nTazUQDNiziMXck23Vp4ecvftxH0RWt7x5SbYkZMQG2chTGq8qIUZVOtA1Tf728eEGwN NCOH2HOtF/SDMMFAJ1ERO5+tgF7jq0fXRAXi5a4thvlAYdyey94mc+Mi/CtGV821sgxB 60Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oBW5WI1w4QF8yMTIoPEy5r9/AAo8zTyVGWDa+McEtoo=; b=LC5vuDcwXInOcN+2HOJkOTJltggJF/RLuhTS5ZahxnTgQZOTu3zkBkaRn6rfpYewby lB6bhsHJ9bqtPspPnHcIOHM1k+vWKlIeCQkN619GedX406tok1mMyGaRtK5TeAO7ZE1y spG4kIZ7B6oDDHqYTInJxW0XWRsZ1/aWjxl6JPpNcB+wi2Yx/+aiG44fuLBIaYnpRwbX WlPsPFJn/N26e9ZopaJVFhcvxxj1Q/2I/Azt7bRPseK6Jg14fRKvD6HzOeed7b3KVn+x w8zsHS4O9Vsn7nyXWCd/5a4BZ3gda5Lr8e/SICh8CsZumtCt2bfALLohD2tJ7eZSjcMl vYjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mAw+a3TO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f57si1906468edb.165.2019.10.03.10.31.59; Thu, 03 Oct 2019 10:32:23 -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=@kernel.org header.s=default header.b=mAw+a3TO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388153AbfJCQS5 (ORCPT + 99 others); Thu, 3 Oct 2019 12:18:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:45510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731428AbfJCQSt (ORCPT ); Thu, 3 Oct 2019 12:18:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E0B64215EA; Thu, 3 Oct 2019 16:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119528; bh=BBNfDOkcg1k0JdkfBUbMlcSU5RE1PB/28Jm5RYZReUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAw+a3TOw/qgWhufNe9fZVVi88J+mxg8fd2HpG/nLPkuBMQKqMMxnt9nGperKFcjt 2syTBFch5eO8VmXWqhANzSV9g2IRlQ0TDqK9ebiEaYdtAx9rK2I0bfOGOWjrd0w/6W xoIS+hGUiHmKzrFwvILwgI8Px4pF/1U1a4gFYaS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamil Konieczny , Chanwoo Choi , MyungJoo Ham , Sasha Levin Subject: [PATCH 4.19 098/211] PM / devfreq: exynos-bus: Correct clock enable sequence Date: Thu, 3 Oct 2019 17:52:44 +0200 Message-Id: <20191003154509.118577246@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kamil Konieczny [ Upstream commit 2c2b20e0da89c76759ee28c6824413ab2fa3bfc6 ] 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 Signed-off-by: MyungJoo Ham Signed-off-by: Sasha Levin --- 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 c25658b265988..24a9658348d78 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.20.1