From: Lukasz Majewski Date: Mon, 24 Jun 2019 13:50:46 +0000 (+0200) Subject: dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE flag X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=1a961c9b32adf9915f7735758e9d9b5a68258ba5;p=u-boot.git dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE flag If the CLK_GET_RATE_NOCACHE flag is set - the clk_get_parent_rate() provides recalculated clock value without considering the cache setting. This may be necessary for some clocks tightly coupled with power domains (i.e. imx8), and prevents from reading invalid cached values. Signed-off-by: Lukasz Majewski Reviewed-by: Peng Fan --- diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 506ba6014c..5acf186b01 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -410,8 +410,8 @@ long long clk_get_parent_rate(struct clk *clk) if (!ops->get_rate) return -ENOSYS; - /* Read the 'rate' if not already set */ - if (!pclk->rate) + /* Read the 'rate' if not already set or if proper flag set*/ + if (!pclk->rate || pclk->flags & CLK_GET_RATE_NOCACHE) pclk->rate = clk_get_rate(pclk); return pclk->rate;