summaryrefslogtreecommitdiff
path: root/drivers/clk/sunxi-ng/ccu_frac.c
diff options
context:
space:
mode:
authorJernej Škrabec <jernej.skrabec@siol.net>2017-07-30 19:41:50 +0300
committerChen-Yu Tsai <wens@csie.org>2017-08-01 05:18:23 +0300
commit1d42460a49347af4d1db345197e5d1277336b312 (patch)
tree498fbed490863e0f21f0fea82658cca448ce45bf /drivers/clk/sunxi-ng/ccu_frac.c
parentb655f36e2071a9a380477e2f07893c31cbf88f59 (diff)
downloadlinux-1d42460a49347af4d1db345197e5d1277336b312.tar.xz
clk: sunxi-ng: Wait for lock when using fractional mode
Currently ccu_frac_helper_set_rate() doesn't wait for a lock bit to be set before returning. Because of that, unstable clock may be used. Add a wait for lock in the helper function. Fixes: 89a3dfb78707 ("clk: sunxi-ng: Add fractional lib") Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Diffstat (limited to 'drivers/clk/sunxi-ng/ccu_frac.c')
-rw-r--r--drivers/clk/sunxi-ng/ccu_frac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/clk/sunxi-ng/ccu_frac.c b/drivers/clk/sunxi-ng/ccu_frac.c
index ff9e72dc5337..d1d168d4c4f0 100644
--- a/drivers/clk/sunxi-ng/ccu_frac.c
+++ b/drivers/clk/sunxi-ng/ccu_frac.c
@@ -85,7 +85,7 @@ unsigned long ccu_frac_helper_read_rate(struct ccu_common *common,
int ccu_frac_helper_set_rate(struct ccu_common *common,
struct ccu_frac_internal *cf,
- unsigned long rate)
+ unsigned long rate, u32 lock)
{
unsigned long flags;
u32 reg, sel;
@@ -106,5 +106,7 @@ int ccu_frac_helper_set_rate(struct ccu_common *common,
writel(reg | sel, common->base + common->reg);
spin_unlock_irqrestore(common->lock, flags);
+ ccu_helper_wait_for_lock(common, lock);
+
return 0;
}