[U-Boot] [PATCH v4 13/13] dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE flag

Peng Fan peng.fan at nxp.com
Fri May 17 06:03:39 UTC 2019


> Subject: [PATCH v4 13/13] 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 at denx.de>
> 
> ---
> 
> Changes in v4:
> - New patch
> 
> Changes in v3: None
> 
>  drivers/clk/clk-uclass.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index
> 6f054396e3..3dcfae85c4 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -13,6 +13,7 @@
>  #include <dm/read.h>
>  #include <dt-structs.h>
>  #include <errno.h>
> +#include <linux/clk-provider.h>
> 
>  static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)  { @@
> -409,8 +410,8 @@ ulong 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);

Reviewed-by: Peng Fan <peng.fan at nxp.com>

> 
>  	return pclk->rate;
> --
> 2.11.0



More information about the U-Boot mailing list