Currently, we request exact clock rates from the firmware to be set with
set_rate. Due to some rounding errors and internal functionality of the
firmware itself, this can fail. Thus, add some slack to the set_rate
functionality so that we are always guaranteed to pass. The firmware
always attempts to use frequency as close to the target freq as
possible despite the slack given here.

Signed-off-by: Tero Kristo <[email protected]>
---
 drivers/clk/keystone/sci-clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index b6477b08af04..aaf31abe1c8f 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -221,7 +221,8 @@ static int sci_clk_set_rate(struct clk_hw *hw, unsigned 
long rate,
        struct sci_clk *clk = to_sci_clk(hw);
 
        return clk->provider->ops->set_freq(clk->provider->sci, clk->dev_id,
-                                           clk->clk_id, rate, rate, rate);
+                                           clk->clk_id, rate / 10 * 9, rate,
+                                           rate / 10 * 11);
 }
 
 /**
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Reply via email to