[PATCH v2 1/8] dm: core: implement oftree variant of parse_phandle OPs
Simon Glass
sjg at chromium.org
Wed Nov 20 14:46:52 CET 2024
On Sun, 10 Nov 2024 at 04:51, Christian Marangi <ansuelsmth at gmail.com> wrote:
>
> Implement oftree variant of parse_phandle OPs.
>
> There is currently a very hidden and laten BUG with parse_phandle OPs
> that doesn't permit the support of multiple DTS in a system. One usage
> example if sandbox with the usage of other.dts
>
> The BUG is only present on live scenario where of_... OPs are used and
> it's not present when fdt... OPs are used.
>
> This is caused by an assumption made in __of_parse_phandle_with_args,
> with the of_find_node_by_phandle call that pass the first arg as NULL.
>
> This makes of_find_node_by_phandle use the default root node of the
> system and doesn't permit the usage of alternative tree. This is correct
> for normal system and also for the linux kernel where it's assumed a
> single device tree.
>
> It's problematic if other device tree needs to be used.
>
> To fix this, introduce __of_root_parse_phandle_with_args to define a
> root device tree for of_find_node_by_phandle.
>
> Introduce all the variant OPs for this and in ofnode, the oftree OPs
> following how it's done for other OPs with similar task.
>
> For FDT scenario, ofnode_from_fdtdec_phandle_args is reworked to accept
> a new variable, node and noffset_to_ofnode is used instead of
> offset_to_ofnode. This is required to support multiple FDB blob to
> calculate the correct of_offset of the ofnode.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
> ---
> drivers/core/of_access.c | 61 ++++++++++++++++++++--------
> drivers/core/ofnode.c | 51 ++++++++++++++++++++++--
> include/dm/of_access.h | 86 ++++++++++++++++++++++++++++++++++++++++
> include/dm/ofnode.h | 66 ++++++++++++++++++++++++++++++
> 4 files changed, 244 insertions(+), 20 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list