From patchwork Fri Jan 17 06:27:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 239692 List-Id: U-Boot discussion From: lokeshvutla at ti.com (Lokesh Vutla) Date: Fri, 17 Jan 2020 11:57:30 +0530 Subject: [PATCH] clk: sci-clk: add slack to clk-set-rate passed to firmware Message-ID: <20200117062730.15824-1-lokeshvutla@ti.com> Add slack to the clock frequency parameters passed to firmware within clk_set_rate. min-freq is changed to 0 and max-rate is changed to ULONG_MAX. This fixes certain issues with pll clock rounding when the firmware is not able to set the frequency exactly to the target, the current implementation fails if the available frequency is even 1Hz off the target. With the change, the firmware still tries its best to set the frequency as close as possible to the target. Reported-by: Vishal Mahaveer Signed-off-by: Lokesh Vutla Signed-off-by: Tero Kristo --- drivers/clk/clk-ti-sci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/clk-ti-sci.c b/drivers/clk/clk-ti-sci.c index 478349f22f..ed1facbbcd 100644 --- a/drivers/clk/clk-ti-sci.c +++ b/drivers/clk/clk-ti-sci.c @@ -106,8 +106,7 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate) k3_avs_notify_freq(clk->id, clk->data, rate); #endif - /* Ask for exact frequency by using same value for min/target/max */ - ret = cops->set_freq(sci, clk->id, clk->data, rate, rate, rate); + ret = cops->set_freq(sci, clk->id, clk->data, 0, rate, ULONG_MAX); if (ret) dev_err(clk->dev, "%s: set_freq failed (%d)\n", __func__, ret);