Skip to content

fdt: Make OF_BOARD a boolean option

Simon Glass u-boot 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest32 patches 3 repliesIn review
  2. v731 patches 28 repliesSuperseded
  3. v623 of 25 patches 112 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v524 of 26 patches71 repliesSuperseded
v116 patches74 repliesSuperseded

Changes in v8 from the cover letter

- Add a new patch to make it easier to debug u-boot.dtsi files
- Add an fdt: tag
- Add new patch to ensure that OF_BOARD is used when needed
- Drop documentation patches
- Drop the build-time warning, since people may ignore it
- Drop the devicetree docs in the README
- Enable the flash as suggested by Linus Walleij
- Fix devicetree logic so that just u-boot.dtb is omitted
- Mention that this is empty, rather than a dummy file
- Mention the follower patch
- Move board-config changes to a separate patch
- Rebase patch
- Reword commit message to mention the dynamic devicetree
- Use an empty tree due to maintainer objections

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/32arm: qemu: Mention -nographic in the docsdoc/board/emulation/qemu-arm.rst+4 -31 reply
2/32arm: riscv: qemu: Explain how to extract the generated dtdoc/board/emulation/qemu-arm.rst doc/board/emulation/qemu-riscv.rst doc/develop/devicetree/dt_qemu.rst +1 more+55 -00 replies
3/32arm: qemu: Add a devicetree file for qemu_armarch/arm/dts/Makefile arch/arm/dts/qemu-arm.dts configs/qemu_arm_defconfig+14 -00 replies
4/32arm: qemu: Add a devicetree file for qemu_arm64 virtarch/arm/dts/Makefile arch/arm/dts/qemu-arm64.dts configs/qemu_arm64_defconfig+13 -10 replies
5/32riscv: qemu: Split devicetree files for qemu_riscv32/64arch/riscv/dts/Makefile arch/riscv/dts/qemu-virt32.dts arch/riscv/dts/qemu-virt64.dts +6 more+21 -30 replies
6/32arm: rpi: Sync rpi dts files from Linuxarch/arm/dts/Makefile arch/arm/dts/bcm2711-rpi-4-b.dts arch/arm/dts/bcm2711-rpi.dtsi +28 more+1878 -2480 replies
7/32arm: vexpress: Add a devicetree files for junoarch/arm/dts/Makefile arch/arm/dts/juno-base.dtsi arch/arm/dts/juno-clocks.dtsi +5 more+1611 -01 reply
8/32arm: xenguest_arm64: Add a empty devicetree filearch/arm/dts/Makefile arch/arm/dts/xenguest-arm64.dts configs/xenguest_arm64_defconfig+18 -10 replies
9/32arm: octeontx: Add an empty devicetree filearch/arm/dts/Makefile arch/arm/dts/octeontx.dts configs/octeontx2_95xx_defconfig +3 more+21 -00 replies
10/32arm: xilinx_versal_virt: Add a devicetree filearch/arm/dts/Makefile arch/arm/dts/xilinx-versal-virt.dts configs/xilinx_versal_virt_defconfig+14 -10 replies
11/32arm: bcm7xxx: Add a devicetree filearch/arm/dts/Makefile arch/arm/dts/bcm7xxx.dts configs/bcm7260_defconfig +1 more+19 -00 replies
12/32arm: qemu-ppce500: Add a devicetree filearch/powerpc/dts/Makefile arch/powerpc/dts/qemu-ppce500.dts configs/qemu-ppce500_defconfig+12 -00 replies
13/32arm: highbank: Add devicetree filesarch/arm/dts/Makefile arch/arm/dts/highbank.dts configs/highbank_defconfig+12 -00 replies
14/32fdt: Make OF_BOARD a bool optionconfigs/qemu-ppce500_defconfig configs/qemu-riscv32_spl_defconfig configs/qemu-riscv64_spl_defconfig +1 more+10 -50 replies
15/32fdt: Drop CONFIG_BINMAN_STANDALONE_FDTMakefile dts/Kconfig tools/binman/binman.rst+1 -400 replies
16/32fdt: Make it easier to debug u-boot.dtsi filesscripts/Makefile.lib tools/binman/binman.rst+11 -70 replies
17/32fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()lib/fdtdec.c+38 -240 replies
18/32fdt: Drop #ifdefs with MULTI_DTB_FITdts/Kconfig include/asm-generic/global_data.h lib/fdtdec.c+19 -210 replies
19/32fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()include/fdtdec.h lib/fdtdec.c+15 -50 replies
20/32fdt: Drop #ifdef around board_fdt_blob_setup()lib/fdtdec.c+0 -20 replies
21/32fdt: Use if() for fdtcontroladdr checklib/fdtdec.c+4 -50 replies
22/32fdt: Drop OF_CONTROL check in fdtdec_setup()lib/fdtdec.c+3 -50 replies
23/32fdt: Drop remaining preprocessor macros in fdtdec_setup()lib/fdtdec.c+11 -90 replies
24/32fdt: Don't call board_fdt_blob_setup() without OF_BOARDinclude/fdtdec.h lib/fdtdec.c+17 -110 replies
25/32dm: core: Allow getting some basic statsdrivers/core/device.c drivers/core/root.c drivers/core/uclass.c +4 more+97 -10 replies
26/32fdt: Record where the devicetree came frominclude/asm-generic/global_data.h include/fdtdec.h lib/fdtdec.c+51 -50 replies
27/32fdt: Report the devicetree sourcecmd/bdinfo.c common/board_r.c lib/fdtdec.c+33 -00 replies
28/32fdt: Add a Kconfig for boards with a prior stageREADME dts/Kconfig lib/fdtdec.c+29 -340 replies
29/32fdt: Enable OF_HAS_PRIOR_STAGE for most boards with OF_BOARDarch/arm/Kconfig arch/arm/mach-bcm283x/Kconfig arch/powerpc/cpu/mpc85xx/Kconfig +28 more+12 -300 replies
30/32fdt: Makefile: Ensure that OF_BOARD is used when neededMakefile scripts/check-of.sh scripts/of_whitelist.txt+50 -01 reply
31/32fdt: Avoid emitting an device tree when not neededMakefile dts/Kconfig+14 -20 replies
32/32fdt: Show a runtime warning based on devicetree sourcecommon/board_r.c+6 -00 replies

Reviews trailers per patch

3 of 32 patches have a Reviewed-by or Acked-by.

PatchHeinrich SchuchardtIlias ApalodimasLinus Walleij
1/32R-b
2/32
3/32T-b
4/32T-b
5/32T-b
6/32
7/32A-b
8/32
9/32
10/32
11/32
12/32
13/32
14/32
15/32
16/32
17/32R-b
18/32
19/32
20/32
21/32
22/32
23/32
24/32
25/32
26/32
27/32
28/32
29/32
30/32
31/32
32/32

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v8 thread

Cover letter [PATCH v8 00/32] fdt: Make OF_BOARD a boolean option

With Ilias' efforts we have dropped OF_PRIOR_STAGE and OF_HOSTFILE so there are only three ways to obtain a devicetree:

- OF_SEPARATE - the normal way, where the devicetree is built and appended to U-Boot
- OF_EMBED - for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
- OF_BOARD - the board figures it out on its own

The last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.

The problems with this approach were covered in another patch[1], since removed from this series.

In practice, OF_BOARD is not really distinct from OF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.

So it makes no sense to have OF_BOARD as a 'choice'. It should be an option, available with either OF_SEPARATE or OF_EMBED. This would allow rpi3, for example, to run with the devicetree provided by the prior bootloader.

This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

To make the 'prior stage' side of things more deterministic, a new OF_HAS_PRIOR_STAGE is added, which cannot be disabled by updated a board's defconfig. This should help to prevent mistakes.

It also adds a run-time message showing where the devicetree came from, as well as warnings if the board's expected flow is not being used. This comes originally from the 'standard passage' series, which depends on this series.

It also provides a few qemu clean-ups discovered along the way. The qemu-riscv64_spl problem is fixed.

Please see [2] for discussion on the v6 series.

I put Heinrich's Tested-by tag[3] for the series onto the three devicetree patches (ARM and RISC-V) that I think it most affects. It isn't possible to apply a tag to a whole series at present and in any case there are changes in v7.

This series is available at u-boot-dm/ofb-working

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://lore.kernel.org/u-boot/20211205133207.GW1220664@bill-the-cat/T/#mcd8c0258827fbc1bb3000b7ff9ba0929df1ddcb2
[3] https://lore.kernel.org/u-boot/[email protected]/raw

Changes in v8:
- Add a new patch to make it easier to debug u-boot.dtsi files
- Add an fdt: tag
- Add new patch to ensure that OF_BOARD is used when needed
- Drop documentation patches
- Drop the build-time warning, since people may ignore it
- Drop the devicetree docs in the README
- Enable the flash as suggested by Linus Walleij
- Fix devicetree logic so that just u-boot.dtb is omitted
- Mention that this is empty, rather than a dummy file
- Mention the follower patch
- Move board-config changes to a separate patch
- Rebase patch
- Reword commit message to mention the dynamic devicetree
- Use an empty tree due to maintainer objections

Changes in v7:
- Add new patch to add a Kconfig for boards with a prior stage
- Bring in files from Linux instead
- Drop FDTSRC_PASSAGE for now
- Fix 'Is' typo in commit message
- Reword commit message
- Rewrite the commit message
- Switch to using an empty file for qemu virt
- Use 'empty' instead of 'fake'

Changes in v6:
- Expand the commit message based on comments

Changes in v5:
- Add new patches to clean up fdtdec_setup() and surrounds
- Merge RISC-V and ARM patches since they are similar

Simon Glass (32):
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file for qemu_arm
arm: qemu: Add a devicetree file for qemu_arm64 virt
riscv: qemu: Split devicetree files for qemu_riscv32/64
arm: rpi: Sync rpi dts files from Linux
arm: vexpress: Add a devicetree files for juno
arm: xenguest_arm64: Add a empty devicetree file
arm: octeontx: Add an empty devicetree file
arm: xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add devicetree files
fdt: Make OF_BOARD a bool option
fdt: Drop CONFIG_BINMAN_STANDALONE_FDT
fdt: Make it easier to debug u-boot.dtsi files
fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
fdt: Drop #ifdefs with MULTI_DTB_FIT
fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
fdt: Drop #ifdef around board_fdt_blob_setup()
fdt: Use if() for fdtcontroladdr check
fdt: Drop OF_CONTROL check in fdtdec_setup()
fdt: Drop remaining preprocessor macros in fdtdec_setup()
fdt: Don't call board_fdt_blob_setup() without OF_BOARD
dm: core: Allow getting some basic stats
fdt: Record where the devicetree came from
fdt: Report the devicetree source
fdt: Add a Kconfig for boards with a prior stage
fdt: Enable OF_HAS_PRIOR_STAGE for most boards with OF_BOARD
fdt: Makefile: Ensure that OF_BOARD is used when needed
fdt: Avoid emitting an device tree when not needed
fdt: Show a runtime warning based on devicetree source

 Makefile                                      |   16 +-
 README                                        |   29 -
 arch/arm/Kconfig                              |   12 +-
 arch/arm/dts/Makefile                         |   20 +-
 arch/arm/dts/bcm2711-rpi-4-b.dts              |  262 ++++
 arch/arm/dts/bcm2711-rpi.dtsi                 |   74 ++
 arch/arm/dts/bcm2711.dtsi                     | 1100 +++++++++++++++++
 arch/arm/dts/bcm2835-common.dtsi              |  207 ++++
 arch/arm/dts/bcm2835-rpi-a-plus.dts           |   18 +-
 arch/arm/dts/bcm2835-rpi-a.dts                |   16 +-
 arch/arm/dts/bcm2835-rpi-b-plus.dts           |   18 +-
 arch/arm/dts/bcm2835-rpi-b-rev2.dts           |   16 +-
 arch/arm/dts/bcm2835-rpi-b.dts                |   16 +-
 arch/arm/dts/bcm2835-rpi-cm1-io1.dts          |    9 +
 arch/arm/dts/bcm2835-rpi-cm1.dtsi             |    7 +-
 arch/arm/dts/bcm2835-rpi-common.dtsi          |   12 +
 arch/arm/dts/bcm2835-rpi-zero-w.dts           |   20 +-
 arch/arm/dts/bcm2835-rpi-zero.dts             |   16 +-
 arch/arm/dts/bcm2835-rpi.dtsi                 |   35 +-
 arch/arm/dts/bcm2835.dtsi                     |    2 +
 arch/arm/dts/bcm2836-rpi-2-b.dts              |   14 +-
 arch/arm/dts/bcm2836.dtsi                     |    2 +
 arch/arm/dts/bcm2837-rpi-3-a-plus.dts         |    9 +-
 arch/arm/dts/bcm2837-rpi-3-b-plus.dts         |    9 +-
 arch/arm/dts/bcm2837-rpi-3-b.dts              |    5 +-
 arch/arm/dts/bcm2837-rpi-cm3-io3.dts          |    9 +
 arch/arm/dts/bcm2837-rpi-cm3.dtsi             |    9 +
 arch/arm/dts/bcm2837.dtsi                     |    2 +
 arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi  |    7 +
 arch/arm/dts/bcm283x.dtsi                     |  224 +---
 arch/arm/dts/bcm7xxx.dts                      |   15 +
 arch/arm/dts/highbank.dts                     |    9 +
 arch/arm/dts/juno-base.dtsi                   |  831 +++++++++++++
 arch/arm/dts/juno-clocks.dtsi                 |   46 +
 arch/arm/dts/juno-cs-r1r2.dtsi                |   85 ++
 arch/arm/dts/juno-motherboard.dtsi            |  303 +++++
 arch/arm/dts/juno-r2-u-boot.dtsi              |   20 +
 arch/arm/dts/juno-r2.dts                      |  322 +++++
 arch/arm/dts/octeontx.dts                     |   14 +
 arch/arm/dts/qemu-arm.dts                     |   11 +
 arch/arm/dts/qemu-arm64.dts                   |   11 +
 arch/arm/dts/xenguest-arm64.dts               |   15 +
 arch/arm/dts/xilinx-versal-virt.dts           |   11 +
 arch/arm/mach-bcm283x/Kconfig                 |    1 +
 arch/powerpc/cpu/mpc85xx/Kconfig              |    1 +
 arch/powerpc/dts/Makefile                     |    1 +
 arch/powerpc/dts/qemu-ppce500.dts             |   10 +
 arch/riscv/dts/Makefile                       |    2 +-
 .../dts/{qemu-virt.dts => qemu-virt32.dts}    |    3 +
 arch/riscv/dts/qemu-virt64.dts                |   11 +
 board/emulation/qemu-riscv/Kconfig            |    1 +
 cmd/bdinfo.c                                  |    2 +
 common/board_r.c                              |   24 +
 configs/ae350_rv32_defconfig                  |    1 -
 configs/ae350_rv32_spl_defconfig              |    1 -
 configs/ae350_rv32_spl_xip_defconfig          |    1 -
 configs/ae350_rv64_defconfig                  |    1 -
 configs/ae350_rv64_spl_defconfig              |    1 -
 configs/ae350_rv64_spl_xip_defconfig          |    1 -
 configs/bcm7260_defconfig                     |    2 +-
 configs/bcm7445_defconfig                     |    2 +-
 configs/highbank_defconfig                    |    2 +-
 configs/octeontx2_95xx_defconfig              |    2 +-
 configs/octeontx2_96xx_defconfig              |    2 +-
 configs/octeontx_81xx_defconfig               |    2 +-
 configs/octeontx_83xx_defconfig               |    2 +-
 configs/qemu-ppce500_defconfig                |    3 +-
 configs/qemu-riscv32_defconfig                |    2 +-
 configs/qemu-riscv32_smode_defconfig          |    2 +-
 configs/qemu-riscv32_spl_defconfig            |    5 +-
 configs/qemu-riscv64_defconfig                |    2 +-
 configs/qemu-riscv64_smode_defconfig          |    2 +-
 configs/qemu-riscv64_spl_defconfig            |    4 +-
 configs/qemu_arm64_defconfig                  |    2 +-
 configs/qemu_arm_defconfig                    |    2 +-
 configs/rpi_4_32b_defconfig                   |    2 +-
 configs/rpi_4_defconfig                       |    2 +-
 configs/rpi_arm64_defconfig                   |    2 +-
 configs/vexpress_aemv8a_juno_defconfig        |    2 +-
 configs/xenguest_arm64_defconfig              |    3 +-
 configs/xilinx_versal_virt_defconfig          |    1 +
 doc/board/emulation/qemu-arm.rst              |   10 +-
 doc/board/emulation/qemu-riscv.rst            |    3 +
 doc/develop/devicetree/dt_qemu.rst            |   48 +
 doc/develop/devicetree/index.rst              |    1 +
 drivers/core/device.c                         |   11 +
 drivers/core/root.c                           |    7 +
 drivers/core/uclass.c                         |   13 +
 dts/Kconfig                                   |   65 +-
 include/asm-generic/global_data.h             |   12 +
 include/dm/device.h                           |   11 +-
 include/dm/root.h                             |    8 +
 include/dm/uclass-internal.h                  |    7 +
 include/dt-bindings/clock/bcm2835.h           |    2 +
 include/fdtdec.h                              |   53 +-
 lib/fdtdec.c                                  |  141 ++-
 scripts/Makefile.lib                          |    4 +-
 scripts/check-of.sh                           |   42 +
 scripts/of_whitelist.txt                      |    1 +
 test/dm/core.c                                |   41 +
 tools/binman/binman.rst                       |   34 +-
 101 files changed, 4082 insertions(+), 432 deletions(-)
 create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
 create mode 100644 arch/arm/dts/bcm2711-rpi.dtsi
 create mode 100644 arch/arm/dts/bcm2711.dtsi
 create mode 100644 arch/arm/dts/bcm2835-common.dtsi
 create mode 100644 arch/arm/dts/bcm2835-rpi-common.dtsi
 create mode 100644 arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi
 create mode 100644 arch/arm/dts/bcm7xxx.dts
 create mode 100644 arch/arm/dts/highbank.dts
 create mode 100644 arch/arm/dts/juno-base.dtsi
 create mode 100644 arch/arm/dts/juno-clocks.dtsi
 create mode 100644 arch/arm/dts/juno-cs-r1r2.dtsi
 create mode 100644 arch/arm/dts/juno-motherboard.dtsi
 create mode 100644 arch/arm/dts/juno-r2-u-boot.dtsi
 create mode 100644 arch/arm/dts/juno-r2.dts
 create mode 100644 arch/arm/dts/octeontx.dts
 create mode 100644 arch/arm/dts/qemu-arm.dts
 create mode 100644 arch/arm/dts/qemu-arm64.dts
 create mode 100644 arch/arm/dts/xenguest-arm64.dts
 create mode 100644 arch/arm/dts/xilinx-versal-virt.dts
 create mode 100644 arch/powerpc/dts/qemu-ppce500.dts
 rename arch/riscv/dts/{qemu-virt.dts => qemu-virt32.dts} (94%)
 create mode 100644 arch/riscv/dts/qemu-virt64.dts
 create mode 100644 doc/develop/devicetree/dt_qemu.rst
 create mode 100755 scripts/check-of.sh
 create mode 100644 scripts/of_whitelist.txt
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog