[U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible

Simon Glass sjg at chromium.org
Thu Mar 8 21:03:15 UTC 2018


Hi Andy.

On 28 February 2018 at 23:08, Andy Yan <andy.yan at rock-chips.com> wrote:
> dm_scan_fdt_node can't work when live dt is active,
> we should use dm_scan_fdt_live instead.
>
> Signed-off-by: Andy Yan <andy.yan at rock-chips.com>
> ---
>
>  drivers/core/root.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

with change below

> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index 36336b6..b437892 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>
>  int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>  {
> -       int node, ret;
> +       int ret;
> +       ofnode node;
>
>         ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>         if (ret) {
> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>         }
>
>         /* bind fixed-clock */
> -       node = ofnode_to_offset(ofnode_path("/clocks"));
> +       node = ofnode_path("/clocks");
>         /* if no DT "clocks" node, no need to go further */
> -       if (node < 0)
> +       if (!ofnode_valid(node))
>                 return ret;
>
> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
> -                              pre_reloc_only);
> +#if CONFIG_IS_ENABLED(OF_LIVE)

You should be able to drop this #if since of_live_active() takes care of it.

> +       if (of_live_active())
> +               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
> +       else
> +#endif
> +               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
> +                                      pre_reloc_only);
>         if (ret)
>                 debug("dm_scan_fdt_node() failed: %d\n", ret);
>
> --
> 2.7.4
>
>

Regards,
Simon


More information about the U-Boot mailing list