Commit d51268d7 authored by Kamil Konieczny's avatar Kamil Konieczny Committed by Greg Kroah-Hartman

PM / devfreq: exynos-bus: Correct clock enable sequence

[ Upstream commit 2c2b20e0 ]

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: default avatarKamil Konieczny <k.konieczny@partner.samsung.com>
Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7e19b7e0
...@@ -194,11 +194,10 @@ static void exynos_bus_exit(struct device *dev) ...@@ -194,11 +194,10 @@ static void exynos_bus_exit(struct device *dev)
if (ret < 0) if (ret < 0)
dev_warn(dev, "failed to disable the devfreq-event devices\n"); 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); dev_pm_opp_of_remove_table(dev);
clk_disable_unprepare(bus->clk); 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) ...@@ -386,6 +385,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
struct exynos_bus *bus; struct exynos_bus *bus;
int ret, max_state; int ret, max_state;
unsigned long min_freq, max_freq; unsigned long min_freq, max_freq;
bool passive = false;
if (!np) { if (!np) {
dev_err(dev, "failed to find devicetree node\n"); dev_err(dev, "failed to find devicetree node\n");
...@@ -399,27 +399,27 @@ static int exynos_bus_probe(struct platform_device *pdev) ...@@ -399,27 +399,27 @@ static int exynos_bus_probe(struct platform_device *pdev)
bus->dev = &pdev->dev; bus->dev = &pdev->dev;
platform_set_drvdata(pdev, bus); 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); profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL);
if (!profile) { if (!profile)
ret = -ENOMEM; return -ENOMEM;
goto err;
}
node = of_parse_phandle(dev->of_node, "devfreq", 0); node = of_parse_phandle(dev->of_node, "devfreq", 0);
if (node) { if (node) {
of_node_put(node); of_node_put(node);
goto passive; passive = true;
} else { } else {
ret = exynos_bus_parent_parse_of(np, bus); 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) if (ret < 0)
goto err; goto err_reg;
if (passive)
goto passive;
/* Initialize the struct profile and governor data for parent device */ /* Initialize the struct profile and governor data for parent device */
profile->polling_ms = 50; profile->polling_ms = 50;
...@@ -510,6 +510,9 @@ static int exynos_bus_probe(struct platform_device *pdev) ...@@ -510,6 +510,9 @@ static int exynos_bus_probe(struct platform_device *pdev)
err: err:
dev_pm_opp_of_remove_table(dev); dev_pm_opp_of_remove_table(dev);
clk_disable_unprepare(bus->clk); clk_disable_unprepare(bus->clk);
err_reg:
if (!passive)
regulator_disable(bus->regulator);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment