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 <lukma@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Lukasz Majewski 2019-06-24 15:50:46 +02:00 committed by Stefano Babic
parent 1d7993d1d0
commit 1a961c9b32

View File

@ -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;