[PATCH v4 06/22] fdt: Redo devicetree setup
Simon Glass
sjg at chromium.org
Thu May 15 21:39:29 CEST 2025
Hi Jonas,
On Sat, 10 May 2025 at 17:31, Jonas Karlman <jonas at kwiboo.se> wrote:
>
> Hi Simon,
>
> On 2025-05-10 15:42, Simon Glass wrote:
> > The existing logic for handling receiving a devicetree from a previous
> > phase is quite complicated. Simplify it in preparation for introducing
> > standard passage.
> >
> > Add a Kconfig called OF_PASSAGE which indicates that the devicetree
> > must come from standard passage.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v4:
> > - Drop now-unused label
> >
> > Changes in v3:
> > - Add new patch to redo how a devicetree is set up
> >
> > dts/Kconfig | 8 ++++++++
> > lib/fdtdec.c | 35 ++++++-----------------------------
> > 2 files changed, 14 insertions(+), 29 deletions(-)
> >
> > diff --git a/dts/Kconfig b/dts/Kconfig
> > index c544f948a15..57101bddabb 100644
> > --- a/dts/Kconfig
> > +++ b/dts/Kconfig
> > @@ -159,6 +159,14 @@ config OF_EMBED
> > and development only and is not recommended for production devices.
> > Boards in the mainline U-Boot tree should not use it.
> >
> > +config OF_PASSAGE
> > + bool "DTB is provided by a standard passage, in a bloblist"
> > + help
> > + Select this to read the devicetree using the standard passage
> > + mechanism, i.e. from a previous phase in bloblist using arch-specific
> > + register conventions. If enabled, the previous phase must provide
> > + the devicetree, or U-Boot will not function correctly.
> > +
> > endchoice
> >
> > config OF_INITIAL_DTB_READONLY
> > diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> > index c38738b48c7..8559616873b 100644
> > --- a/lib/fdtdec.c
> > +++ b/lib/fdtdec.c
> > @@ -1689,35 +1689,13 @@ void fdtdec_setup_embed(void)
> >
> > int fdtdec_setup(void)
> > {
> > - int ret = -ENOENT;
> > -
> > - /*
> > - * If allowing a bloblist, check that first. There was discussion about
> > - * adding an OF_BLOBLIST Kconfig, but this was rejected.
> > - *
> > - * The necessary test is whether the previous phase passed a bloblist,
> > - * not whether this phase creates one.
> > - */
> > - if (CONFIG_IS_ENABLED(BLOBLIST) &&
> > - (xpl_prev_phase() != PHASE_TPL ||
> > - IS_ENABLED(CONFIG_TPL_BLOBLIST))) {
> > - ret = bloblist_maybe_init();
> > - if (!ret) {
> > - gd->fdt_blob = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);
> > - if (gd->fdt_blob) {
> > - gd->fdt_src = FDTSRC_BLOBLIST;
> > - log_debug("Devicetree is in bloblist at %p\n",
> > - gd->fdt_blob);
> > - goto setup_fdt;
> > - } else {
> > - log_debug("No FDT found in bloblist\n");
> > - ret = -ENOENT;
> > - }
> > - }
> > - }
> > + int ret;
> >
> > - /* Otherwise, the devicetree is typically appended to U-Boot */
> > - if (ret) {
> > + if (CONFIG_IS_ENABLED(OF_BLOBLIST)) {
>
> This looks wrong, should possible be OF_PASSAGE ?
>
> Also looks like there is more patches in need of a correction to use
> OF_PASSAGE instead of OF_BLOBLIST in commit message and/or patch content
> in this series.
Thanks, yes this is not quite right as the rename happens in this
patch but the other changes are not until later. I'll send a new
version when the week is up.
Regards,
Simon
>
> Regards,
> Jonas
>
> > + printf("Previous phase failed to provide standard passage\n");
> > + return -ENOENT;
> > + } else {
> > + /* The devicetree is typically appended to U-Boot */
> > if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
> > gd->fdt_blob = fdt_find_separate();
> > gd->fdt_src = FDTSRC_SEPARATE;
> > @@ -1752,7 +1730,6 @@ int fdtdec_setup(void)
> > }
> > }
> >
> > -setup_fdt:
> > if (CONFIG_IS_ENABLED(MULTI_DTB_FIT))
> > setup_multi_dtb_fit();
> >
>
More information about the U-Boot
mailing list