[PATCH 4/4] commands: of_overlay: Allow to register clocks from overlay

Sascha Hauer s.hauer at pengutronix.de
Wed Mar 22 02:25:06 PDT 2023


On Wed, Mar 22, 2023 at 09:32:45AM +0100, Sascha Hauer wrote:
> When clocks are added from an overlay calling of_probe() is enough
> for devices handled by regular drivers, but not for clocks declared
> with CLK_OF_DECLARE(). Additionally call of_clk_init() to support
> these as well.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  commands/of_overlay.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/of_overlay.c b/commands/of_overlay.c
> index 37d29b88e5..1bd54a7b10 100644
> --- a/commands/of_overlay.c
> +++ b/commands/of_overlay.c
> @@ -10,6 +10,7 @@
>  #include <getopt.h>
>  #include <libfile.h>
>  #include <of.h>
> +#include <linux/clk.h>
>  
>  static int do_of_overlay(int argc, char *argv[])
>  {
> @@ -49,8 +50,11 @@ static int do_of_overlay(int argc, char *argv[])
>  
>  	if (live_tree) {
>  		ret = of_overlay_apply_tree(of_get_root_node(), overlay);
> -		if (!ret)
> -			ret = of_probe();
> +		if (ret)
> +			goto err;
> +
> +		of_probe();
> +		of_clk_init();

Just realized we better call of_clk_init() first in case the just added
clock is really used by the devices added in the overlay.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list