Skip to content

Commit

Permalink
ODROID-XU4: devfreq: exynos-bus: workaround dev_pm_opp_set_rate() err…
Browse files Browse the repository at this point in the history
…ors on Exynos5422/5800 SoCs

Commit 4294a77 ("PM / devfreq: exynos-bus: Convert to use
dev_pm_opp_set_rate()") introduced errors:
exynos-bus: new bus device registered: soc:bus_wcore ( 84000 KHz ~ 400000 KHz)
exynos-bus: new bus device registered: soc:bus_noc ( 67000 KHz ~ 100000 KHz)
exynos-bus: new bus device registered: soc:bus_fsys_apb (100000 KHz ~ 200000 KHz)
...
exynos-bus soc:bus_wcore: dev_pm_opp_set_rate: failed to find current OPP for freq 532000000 (-34)
exynos-bus soc:bus_noc: dev_pm_opp_set_rate: failed to find current OPP for freq 111000000 (-34)
exynos-bus soc:bus_fsys_apb: dev_pm_opp_set_rate: failed to find current OPP for freq 222000000 (-34)

They are caused by incorrect PLL assigned to clock source, which results
in clock rate outside of OPP range. Add workaround for this in
exynos_bus_parse_of() by adjusting clock rate to those present in OPP.

Fixes: 4294a77 ("PM / devfreq: exynos-bus: Convert to use dev_pm_opp_set_rate()")
Change-Id: Ic07e2d68e0da2efa07cb81cc9b4f76d8ad15bd76
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: memeka <mihailescu2m@gmail.com>
  • Loading branch information
k.konieczny@partner.samsung.com authored and paralin committed Oct 8, 2019
1 parent 21fbb4c commit e96f6b2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions drivers/devfreq/exynos-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int exynos_bus_parse_of(struct device_node *np,
{
struct device *dev = bus->dev;
struct dev_pm_opp *opp;
unsigned long rate;
unsigned long rate, opp_rate;
int ret;

/* Get the clock to provide each bus with source clock */
Expand All @@ -271,13 +271,21 @@ static int exynos_bus_parse_of(struct device_node *np,
}

rate = clk_get_rate(bus->clk);

opp = devfreq_recommended_opp(dev, &rate, 0);
opp_rate = rate;
opp = devfreq_recommended_opp(dev, &opp_rate, 0);
if (IS_ERR(opp)) {
dev_err(dev, "failed to find dev_pm_opp\n");
ret = PTR_ERR(opp);
goto err_opp;
}
/*
* FIXME: U-boot leaves clock source at incorrect PLL, this results
* in clock rate outside defined OPP rate. Work around this bug by
* setting clock rate to recommended one.
*/
if (rate > opp_rate)
clk_set_rate(bus->clk, opp_rate);

bus->curr_freq = dev_pm_opp_get_freq(opp);
dev_pm_opp_put(opp);

Expand Down

0 comments on commit e96f6b2

Please sign in to comment.