Skip to contentSkip to conversation

fdt: Make OF_BOARD a boolean option

PATCH Superseded Simon Glass 13 participants 91 messages Oct 13, 2021 – Nov 2, 2021 Page 1 of 2

Subsystems (7)
Arm (32-bit) PowerPC Kbuild RISC-V +3 more subsystems

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover 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 are documented at [1].

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

It also provides a few qemu clean-ups discovered along the way.

This series is based on Ilias' two series for OF_HOSTFILE and OF_PRIOR_STAGE removal.

It is available at u-boot-dm/ofb-working

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Simon Glass (16):
arm: qemu: Mention -nographic in the docs
arm: qemu: Explain how to extract the generate devicetree
riscv: qemu: Explain how to extract the generate devicetree
arm: qemu: Add a devicetree file for qemu_arm
arm: qemu: Add a devicetree file for qemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file for rpi_4
arm: vexpress: Add a devicetree file for juno
arm: xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake 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 a fake devicetree file
fdt: Make OF_BOARD a bool option
Drop CONFIG_BINMAN_STANDALONE_FDT

 Makefile                               |    3 +-
 arch/arm/dts/Makefile                  |   20 +-
 arch/arm/dts/bcm2711-rpi-4-b.dts       | 1958 ++++++++++++++++++++++++
 arch/arm/dts/bcm7xxx.dts               |   15 +
 arch/arm/dts/highbank.dts              |   14 +
 arch/arm/dts/juno-r2.dts               | 1038 +++++++++++++
 arch/arm/dts/octeontx.dts              |   14 +
 arch/arm/dts/qemu-arm.dts              |  402 +++++
 arch/arm/dts/qemu-arm64.dts            |  381 +++++
 arch/arm/dts/xenguest-arm64.dts        |   15 +
 arch/arm/dts/xilinx-versal-virt.dts    |  307 ++++
 arch/powerpc/dts/Makefile              |    1 +
 arch/powerpc/dts/qemu-ppce500.dts      |  264 ++++
 arch/riscv/dts/Makefile                |    2 +-
 arch/riscv/dts/qemu-virt.dts           |    8 -
 arch/riscv/dts/qemu-virt32.dts         |  217 +++
 arch/riscv/dts/qemu-virt64.dts         |  217 +++
 configs/bcm7260_defconfig              |    1 +
 configs/bcm7445_defconfig              |    1 +
 configs/highbank_defconfig             |    2 +-
 configs/octeontx2_95xx_defconfig       |    1 +
 configs/octeontx2_96xx_defconfig       |    1 +
 configs/octeontx_81xx_defconfig        |    1 +
 configs/octeontx_83xx_defconfig        |    1 +
 configs/qemu-ppce500_defconfig         |    2 +
 configs/qemu-riscv32_defconfig         |    1 +
 configs/qemu-riscv32_smode_defconfig   |    1 +
 configs/qemu-riscv32_spl_defconfig     |    4 +-
 configs/qemu-riscv64_defconfig         |    1 +
 configs/qemu-riscv64_smode_defconfig   |    1 +
 configs/qemu-riscv64_spl_defconfig     |    3 +-
 configs/qemu_arm64_defconfig           |    1 +
 configs/qemu_arm_defconfig             |    1 +
 configs/rpi_4_32b_defconfig            |    1 +
 configs/rpi_4_defconfig                |    1 +
 configs/rpi_arm64_defconfig            |    1 +
 configs/vexpress_aemv8a_juno_defconfig |    1 +
 configs/xenguest_arm64_defconfig       |    1 +
 configs/xilinx_versal_virt_defconfig   |    1 +
 doc/board/emulation/qemu-arm.rst       |   19 +-
 doc/board/emulation/qemu-riscv.rst     |   12 +
 dts/Kconfig                            |   27 +-
 tools/binman/binman.rst                |   20 -
 43 files changed, 4922 insertions(+), 61 deletions(-)
 create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
 create mode 100644 arch/arm/dts/bcm7xxx.dts
 create mode 100644 arch/arm/dts/highbank.dts
 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
 delete mode 100644 arch/riscv/dts/qemu-virt.dts
 create mode 100644 arch/riscv/dts/qemu-virt32.dts
 create mode 100644 arch/riscv/dts/qemu-virt64.dts
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#1 lore raw

PATCH 1/16 arm: qemu: Mention -nographic in the docs

Without this option QEMU appears to hang. Add it to avoid confusion.

---

 doc/board/emulation/qemu-arm.rst | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
doc/board/emulation/qemu-arm.rst +4 -3
index 8d7fda10f15..97b6ec64905 100644
@@ -41,14 +41,15 @@ The minimal QEMU command line to get U-Boot up and running is:
 
 - For ARM::
 
-    qemu-system-arm -machine virt -bios u-boot.bin
+    qemu-system-arm -machine virt -nographic -bios u-boot.bin
 
 - For AArch64::
 
-    qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
+    qemu-system-aarch64 -machine virt -nographic -cpu cortex-a57 -bios u-boot.bin
 
 Note that for some odd reason qemu-system-aarch64 needs to be explicitly
-told to use a 64-bit CPU or it will boot in 32-bit mode.
+told to use a 64-bit CPU or it will boot in 32-bit mode. The -nographic argument
+ensures that output appears on the terminal. Use Ctrl-A X to quit.
 
 Additional persistent U-boot environment support can be added as follows:
 
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#2 lore raw

PATCH 2/16 arm: qemu: Explain how to extract the generate devicetree

In reply to Simon Glass

QEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.

---

 doc/board/emulation/qemu-arm.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/board/emulation/qemu-arm.rst +12 -0
index 97b6ec64905..b458a398c69 100644
@@ -91,3 +91,15 @@ The debug UART on the ARM virt board uses these settings::
     CONFIG_DEBUG_UART_PL010=y
     CONFIG_DEBUG_UART_BASE=0x9000000
     CONFIG_DEBUG_UART_CLOCK=0
+
+Obtaining the QEMU devicetree
+-----------------------------
+
+QEMU generates its own devicetree to pass to U-Boot and does this by default.
+You can use `-dtb u-boot.dtb` to force QEMU to use U-Boot's in-tree version.
+
+To obtain the devicetree that qemu generates, add `-machine dumpdtb=dtb.dtb`,
+e.g.::
+
+    qemu-system-aarch64 -machine virt -nographic -cpu cortex-a57 \
+	    -bios u-boot.bin -machine dumpdtb=dtb.dtb
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#3 lore raw

Re: [PATCH 02/16] arm: qemu: Explain how to extract the generate devicetree

Quoted 24 lines · Simon Glass

QEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.

---

 doc/board/emulation/qemu-arm.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/board/emulation/qemu-arm.rst +0 -0
index 97b6ec64905..b458a398c69 100644
@@ -91,3 +91,15 @@ The debug UART on the ARM virt board uses these

settings::

     CONFIG_DEBUG_UART_PL010=y
     CONFIG_DEBUG_UART_BASE=0x9000000
     CONFIG_DEBUG_UART_CLOCK=0
doc/board/emulation/qemu-arm.rst +5 -0
+
+Obtaining the QEMU devicetree
+-----------------------------
+
+QEMU generates its own devicetree to pass to U-Boot and does this by
Quoted 3 lines

default.
+You can use -dtb u-boot.dtb to force QEMU to use U-Boot's in-tree version.

this is for either Qemu experts or u-boot for Qemu maintainers. Not for the kernel développer as it is recipe for problems: could you add this warning ?

Quoted 11 lines
doc/board/emulation/qemu-arm.rst +2 -0
+
+To obtain the devicetree that qemu generates, add `-machine

dumpdtb=dtb.dtb`,

doc/board/emulation/qemu-arm.rst +4 -1
+e.g.::
+
+    qemu-system-aarch64 -machine virt -nographic -cpu cortex-a57 \
+           -bios u-boot.bin -machine dumpdtb=dtb.dtb
--

2.33.0.882.g93a45727a2-goog

Quoted 1 line

--

François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog

#4 lore raw

Re: [PATCH 02/16] arm: qemu: Explain how to extract the generate devicetree

Hi François,

Quoted 14 lines · François Ozog
Quoted 10 lines · Simon Glass

QEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.

---

 doc/board/emulation/qemu-arm.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 16 lines
Quoted 5 lines
doc/board/emulation/qemu-arm.rst +0 -0
index 97b6ec64905..b458a398c69 100644

doc/board/emulation/qemu-arm.rst The debug UART on the ARM virt board uses these settings:: · line 99

Quoted 9 lines
doc/board/emulation/qemu-arm.rst +6 -0
@@ -91,3 +91,15 @@ The debug UART on the ARM virt board uses these settings::
     CONFIG_DEBUG_UART_PL010=y
     CONFIG_DEBUG_UART_BASE=0x9000000
     CONFIG_DEBUG_UART_CLOCK=0
+
+Obtaining the QEMU devicetree
+-----------------------------
+
+QEMU generates its own devicetree to pass to U-Boot and does this by default.
+You can use `-dtb u-boot.dtb` to force QEMU to use U-Boot's in-tree version.

this is for either Qemu experts or u-boot for Qemu maintainers. Not for the kernel développer as it is recipe for problems: could you add this warning ?

Yes I can do that...or would it be better to hide this in doc/develop somewhere with a link here?

Quoted 11 lines
Quoted 11 lines
doc/board/emulation/qemu-arm.rst +6 -1
+
+To obtain the devicetree that qemu generates, add `-machine dumpdtb=dtb.dtb`,
+e.g.::
+
+    qemu-system-aarch64 -machine virt -nographic -cpu cortex-a57 \
+           -bios u-boot.bin -machine dumpdtb=dtb.dtb
--

2.33.0.882.g93a45727a2-goog

Regards,
Simon

#5 lore raw

Re: [PATCH 02/16] arm: qemu: Explain how to extract the generate devicetree

Quoted 34 lines · Simon Glass

Hi François,

Quoted 14 lines · François Ozog
Quoted 10 lines · Simon Glass

QEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.

---

 doc/board/emulation/qemu-arm.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Quoted 16 lines
Quoted 5 lines
doc/board/emulation/qemu-arm.rst +0 -0
index 97b6ec64905..b458a398c69 100644

doc/board/emulation/qemu-arm.rst The debug UART on the ARM virt board uses these settings:: · line 99

Quoted 9 lines
doc/board/emulation/qemu-arm.rst +6 -0
@@ -91,3 +91,15 @@ The debug UART on the ARM virt board uses these settings::
     CONFIG_DEBUG_UART_PL010=y
     CONFIG_DEBUG_UART_BASE=0x9000000
     CONFIG_DEBUG_UART_CLOCK=0
+
+Obtaining the QEMU devicetree
+-----------------------------
+
+QEMU generates its own devicetree to pass to U-Boot and does this by default.
+You can use `-dtb u-boot.dtb` to force QEMU to use U-Boot's in-tree version.

this is for either Qemu experts or u-boot for Qemu maintainers. Not for the kernel développer as it is recipe for problems: could you add this warning ?

Quoted 2 lines

Yes I can do that...or would it be better to hide this in doc/develop somewhere with a link here?

Somewhere under doc/develop and an external link to the QEMU documentation on dumpdtb would be good, as it's (as you demonstrate throughout this series) a generic feature.

Signature · 1 line
Tom
#6 lore raw

PATCH 3/16 riscv: qemu: Explain how to extract the generate devicetree

In reply to Simon Glass

QEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.

---

 doc/board/emulation/qemu-riscv.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/board/emulation/qemu-riscv.rst +12 -0
index 4b8e104a215..b3cf7085847 100644
@@ -113,3 +113,15 @@ An attached disk can be emulated by adding::
     -device ide-hd,drive=mydisk,bus=ahci.0
 
 You will have to run 'scsi scan' to use it.
+
+Obtaining the QEMU devicetree
+-----------------------------
+
+QEMU generates its own devicetree to pass to U-Boot and does this by default.
+You can use `-dtb u-boot.dtb` to force QEMU to use U-Boot's in-tree version.
+
+To obtain the devicetree that qemu generates, add `-machine dumpdtb=dtb.dtb`,
+e.g.::
+
+    qemu-system-riscv64 -nographic -machine virt -bios u-boot \
+	    -machine dumpdtb=dtb.dtb
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#7 lore raw

PATCH 4/16 arm: qemu: Add a devicetree file for qemu_arm

In reply to Simon Glass

Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.

---

 arch/arm/dts/Makefile      |   2 +
 arch/arm/dts/qemu-arm.dts  | 402 +++++++++++++++++++++++++++++++++++++
 configs/qemu_arm_defconfig |   1 +
 3 files changed, 405 insertions(+)
 create mode 100644 arch/arm/dts/qemu-arm.dts
arch/arm/dts/Makefile +2 -0
index b8a382d1539..e2fc0cb65fc 100644
@@ -1145,6 +1145,8 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) += imx8mm-cl-iot-gate.dtb
 
 dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb
 
+dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
arch/arm/dts/qemu-arm.dts new file +402 -0

402 lines not on this page · raw message

configs/qemu_arm_defconfig +1 -0
index ded58d387ad..81ca4ca9166 100644
@@ -5,6 +5,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x40000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-arm"
 CONFIG_TARGET_QEMU_ARM_32BIT=y
 CONFIG_ARMV7_LPAE=y
 CONFIG_AHCI=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#8 lore raw

PATCH 5/16 arm: qemu: Add a devicetree file for qemu_arm64

In reply to Simon Glass

Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.

---

 arch/arm/dts/Makefile        |   2 +-
 arch/arm/dts/qemu-arm64.dts  | 381 +++++++++++++++++++++++++++++++++++
 configs/qemu_arm64_defconfig |   1 +
 3 files changed, 383 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/qemu-arm64.dts
arch/arm/dts/Makefile +1 -1
index e2fc0cb65fc..52c586f3974 100644
@@ -1145,7 +1145,7 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) += imx8mm-cl-iot-gate.dtb
 
 dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb
 
-dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb
+dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb qemu-arm64.dtb
 
 targets += $(dtb-y)
 
arch/arm/dts/qemu-arm64.dts new file +381 -0

381 lines not on this page · raw message

configs/qemu_arm64_defconfig +1 -0
index cf5a03e8a2f..e51ce5c799f 100644
@@ -5,6 +5,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x40000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-arm64"
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x40200000
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#9 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

Hi Simon

The only place I could agree with this file presence is in the documentation directory, not in dts. It creates a mental picture for the reader an entirely bad mind scheme around Qemu and DT.

And even in a documentation directory I would place a bug warning: don’t use this with any kernel , Qemu generates a DT dynamically based on cpu, memory and devices specified at the command line.

I would also document how to get the DT that Qemu generates (and lkvm btw) outside any firmware/os provided.

Cheers

FF

Quoted 431 lines · Simon Glass

Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.

---

 arch/arm/dts/Makefile        |   2 +-
 arch/arm/dts/qemu-arm64.dts  | 381 +++++++++++++++++++++++++++++++++++
 configs/qemu_arm64_defconfig |   1 +
 3 files changed, 383 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/qemu-arm64.dts
arch/arm/dts/Makefile +0 -0
index e2fc0cb65fc..52c586f3974 100644
@@ -1145,7 +1145,7 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) +=

imx8mm-cl-iot-gate.dtb

dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb

arch/arm/dts/Makefile +1 -1
-dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb
+dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb qemu-arm64.dtb
 
 targets += $(dtb-y)
arch/arm/dts/qemu-arm64.dts new file +331 -0
new file mode 100644
index 00000000000..7590e49cc84
@@ -0,0 +1,381 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Sample device tree for qemu_arm64
+
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+       interrupt-parent = <0x8001>;
+       #size-cells = <0x02>;
+       #address-cells = <0x02>;
+       compatible = "linux,dummy-virt";
+
+       psci {
+               migrate = <0xc4000005>;
+               cpu_on = <0xc4000003>;
+               cpu_off = <0x84000002>;
+               cpu_suspend = <0xc4000001>;
+               method = "hvc";
+               compatible = "arm,psci-0.2\0arm,psci";
+       };
+
+       memory@40000000 {
+               reg = <0x00 0x40000000 0x00 0x8000000>;
+               device_type = "memory";
+       };
+
+       platform@c000000 {
+               interrupt-parent = <0x8001>;
+               ranges = <0x00 0x00 0xc000000 0x2000000>;
+               #address-cells = <0x01>;
+               #size-cells = <0x01>;
+               compatible = "qemu,platform\0simple-bus";
+       };
+
+       fw-cfg@9020000 {
+               dma-coherent;
+               reg = <0x00 0x9020000 0x00 0x18>;
+               compatible = "qemu,fw-cfg-mmio";
+       };
+
+       virtio_mmio@a000000 {
+               dma-coherent;
+               interrupts = <0x00 0x10 0x01>;
+               reg = <0x00 0xa000000 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000200 {
+               dma-coherent;
+               interrupts = <0x00 0x11 0x01>;
+               reg = <0x00 0xa000200 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000400 {
+               dma-coherent;
+               interrupts = <0x00 0x12 0x01>;
+               reg = <0x00 0xa000400 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000600 {
+               dma-coherent;
+               interrupts = <0x00 0x13 0x01>;
+               reg = <0x00 0xa000600 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000800 {
+               dma-coherent;
+               interrupts = <0x00 0x14 0x01>;
+               reg = <0x00 0xa000800 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000a00 {
+               dma-coherent;
+               interrupts = <0x00 0x15 0x01>;
+               reg = <0x00 0xa000a00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000c00 {
+               dma-coherent;
+               interrupts = <0x00 0x16 0x01>;
+               reg = <0x00 0xa000c00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a000e00 {
+               dma-coherent;
+               interrupts = <0x00 0x17 0x01>;
+               reg = <0x00 0xa000e00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001000 {
+               dma-coherent;
+               interrupts = <0x00 0x18 0x01>;
+               reg = <0x00 0xa001000 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001200 {
+               dma-coherent;
+               interrupts = <0x00 0x19 0x01>;
+               reg = <0x00 0xa001200 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001400 {
+               dma-coherent;
+               interrupts = <0x00 0x1a 0x01>;
+               reg = <0x00 0xa001400 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001600 {
+               dma-coherent;
+               interrupts = <0x00 0x1b 0x01>;
+               reg = <0x00 0xa001600 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001800 {
+               dma-coherent;
+               interrupts = <0x00 0x1c 0x01>;
+               reg = <0x00 0xa001800 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001a00 {
+               dma-coherent;
+               interrupts = <0x00 0x1d 0x01>;
+               reg = <0x00 0xa001a00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001c00 {
+               dma-coherent;
+               interrupts = <0x00 0x1e 0x01>;
+               reg = <0x00 0xa001c00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a001e00 {
+               dma-coherent;
+               interrupts = <0x00 0x1f 0x01>;
+               reg = <0x00 0xa001e00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002000 {
+               dma-coherent;
+               interrupts = <0x00 0x20 0x01>;
+               reg = <0x00 0xa002000 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002200 {
+               dma-coherent;
+               interrupts = <0x00 0x21 0x01>;
+               reg = <0x00 0xa002200 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002400 {
+               dma-coherent;
+               interrupts = <0x00 0x22 0x01>;
+               reg = <0x00 0xa002400 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002600 {
+               dma-coherent;
+               interrupts = <0x00 0x23 0x01>;
+               reg = <0x00 0xa002600 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002800 {
+               dma-coherent;
+               interrupts = <0x00 0x24 0x01>;
+               reg = <0x00 0xa002800 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002a00 {
+               dma-coherent;
+               interrupts = <0x00 0x25 0x01>;
+               reg = <0x00 0xa002a00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002c00 {
+               dma-coherent;
+               interrupts = <0x00 0x26 0x01>;
+               reg = <0x00 0xa002c00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a002e00 {
+               dma-coherent;
+               interrupts = <0x00 0x27 0x01>;
+               reg = <0x00 0xa002e00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003000 {
+               dma-coherent;
+               interrupts = <0x00 0x28 0x01>;
+               reg = <0x00 0xa003000 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003200 {
+               dma-coherent;
+               interrupts = <0x00 0x29 0x01>;
+               reg = <0x00 0xa003200 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003400 {
+               dma-coherent;
+               interrupts = <0x00 0x2a 0x01>;
+               reg = <0x00 0xa003400 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003600 {
+               dma-coherent;
+               interrupts = <0x00 0x2b 0x01>;
+               reg = <0x00 0xa003600 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003800 {
+               dma-coherent;
+               interrupts = <0x00 0x2c 0x01>;
+               reg = <0x00 0xa003800 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003a00 {
+               dma-coherent;
+               interrupts = <0x00 0x2d 0x01>;
+               reg = <0x00 0xa003a00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003c00 {
+               dma-coherent;
+               interrupts = <0x00 0x2e 0x01>;
+               reg = <0x00 0xa003c00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       virtio_mmio@a003e00 {
+               dma-coherent;
+               interrupts = <0x00 0x2f 0x01>;
+               reg = <0x00 0xa003e00 0x00 0x200>;
+               compatible = "virtio,mmio";
+       };
+
+       pcie@10000000 {
+               interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
+               interrupt-map = <0x00 0x00 0x00 0x01 0x8001 0x00 0x00 0x00
+                       0x03 0x04 0x00 0x00 0x00 0x02 0x8001 0x00
+                       0x00 0x00 0x04 0x04 0x00 0x00 0x00 0x03
+                       0x8001 0x00 0x00 0x00 0x05 0x04 0x00 0x00
+                       0x00 0x04 0x8001 0x00 0x00 0x00 0x06 0x04
+                       0x800 0x00 0x00 0x01 0x8001 0x00 0x00 0x00
+                       0x04 0x04 0x800 0x00 0x00 0x02 0x8001 0x00
+                       0x00 0x00 0x05 0x04 0x800 0x00 0x00 0x03
+                       0x8001 0x00 0x00 0x00 0x06 0x04 0x800 0x00
+                       0x00 0x04 0x8001 0x00 0x00 0x00 0x03 0x04
+                       0x1000 0x00 0x00 0x01 0x8001 0x00 0x00 0x00
+                       0x05 0x04 0x1000 0x00 0x00 0x02 0x8001 0x00
+                       0x00 0x00 0x06 0x04 0x1000 0x00 0x00 0x03
+                       0x8001 0x00 0x00 0x00 0x03 0x04 0x1000 0x00
+                       0x00 0x04 0x8001 0x00 0x00 0x00 0x04 0x04
+                       0x1800 0x00 0x00 0x01 0x8001 0x00 0x00 0x00
+                       0x06 0x04 0x1800 0x00 0x00 0x02 0x8001 0x00
+                       0x00 0x00 0x03 0x04 0x1800 0x00 0x00 0x03
+                       0x8001 0x00 0x00 0x00 0x04 0x04 0x1800 0x00
+                       0x00 0x04 0x8001 0x00 0x00 0x00 0x05 0x04>;
+               #interrupt-cells = <0x01>;
+               ranges = <0x1000000 0x00 0x00 0x00
+                       0x3eff0000 0x00 0x10000 0x2000000
+                       0x00 0x10000000 0x00 0x10000000
+                       0x00 0x2eff0000 0x3000000 0x80
+                       0x00 0x80 0x00 0x80
+                       0x00>;
+               reg = <0x40 0x10000000 0x00 0x10000000>;
+               msi-parent = <0x8002>;
+               dma-coherent;
+               bus-range = <0x00 0xff>;
+               linux,pci-domain = <0x00>;
+               #size-cells = <0x02>;
+               #address-cells = <0x03>;
+               device_type = "pci";
+               compatible = "pci-host-ecam-generic";
+       };
+
+       pl031@9010000 {
+               clock-names = "apb_pclk";
+               clocks = <0x8000>;
+               interrupts = <0x00 0x02 0x04>;
+               reg = <0x00 0x9010000 0x00 0x1000>;
+               compatible = "arm,pl031\0arm,primecell";
+       };
+
+       pl011@9000000 {
+               clock-names = "uartclk\0apb_pclk";
+               clocks = <0x8000 0x8000>;
+               interrupts = <0x00 0x01 0x04>;
+               reg = <0x00 0x9000000 0x00 0x1000>;
+               compatible = "arm,pl011\0arm,primecell";
+       };
+
+       pmu {
+               interrupts = <0x01 0x07 0x104>;
+               compatible = "arm,armv8-pmuv3";
+       };
+
+       intc@8000000 {
+               phandle = <0x8001>;
+               reg = <0x00 0x8000000 0x00 0x10000 0x00 0x8010000 0x00

0x10000>;

arch/arm/dts/qemu-arm64.dts new file +18 -0
+               compatible = "arm,cortex-a15-gic";
+               ranges;
+               #size-cells = <0x02>;
+               #address-cells = <0x02>;
+               interrupt-controller;
+               #interrupt-cells = <0x03>;
+
+               v2m@8020000 {
+                       phandle = <0x8002>;
+                       reg = <0x00 0x8020000 0x00 0x1000>;
+                       msi-controller;
+                       compatible = "arm,gic-v2m-frame";
+               };
+       };
+
+       flash@0 {
+               bank-width = <0x04>;
+               reg = <0x00 0x00 0x00 0x4000000 0x00 0x4000000 0x00

0x4000000>;

arch/arm/dts/qemu-arm64.dts new file +16 -0
+               compatible = "cfi-flash";
+       };
+
+       cpus {
+               #size-cells = <0x00>;
+               #address-cells = <0x01>;
+
+               cpu@0 {
+                       reg = <0x00>;
+                       compatible = "arm,cortex-a57";
+                       device_type = "cpu";
+               };
+       };
+
+       timer {
+               interrupts = <0x01 0x0d 0x104 0x01 0x0e 0x104 0x01 0x0b

0x104 0x01 0x0a 0x104>;

arch/arm/dts/qemu-arm64.dts new file +16 -0
+               always-on;
+               compatible = "arm,armv8-timer\0arm,armv7-timer";
+       };
+
+       apb-pclk {
+               phandle = <0x8000>;
+               clock-output-names = "clk24mhz";
+               clock-frequency = <0x16e3600>;
+               #clock-cells = <0x00>;
+               compatible = "fixed-clock";
+       };
+
+       chosen {
+               stdout-path = "/pl011@9000000";
+       };
+};
configs/qemu_arm64_defconfig +1 -1
index cf5a03e8a2f..e51ce5c799f 100644
@@ -5,6 +5,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x40000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-arm64"
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x40200000
--

2.33.0.882.g93a45727a2-goog

Quoted 1 line

--

François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog

#10 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

Quoted 7 lines · François Ozog

Hi Simon

The only place I could agree with this file presence is in the documentation directory, not in dts. It creates a mental picture for the reader an entirely bad mind scheme around Qemu and DT.

And even in a documentation directory I would place a bug warning: don’t use this with any kernel , Qemu generates a DT dynamically based on cpu, memory and devices specified at the command line.

Certainly for the arm, aarch64 and riscv "virt" machines you should always use the QEMU generated DTB. I'm not entirely clear what a qemu_arm and qemu_arm64 def targets are meant to be in this context.

Signature · 1 line
Alex Bennée
#11 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

Quoted 8 lines · Alex Bennée
Quoted 5 lines · François Ozog

Hi Simon

The only place I could agree with this file presence is in the documentation directory, not in dts. It creates a mental picture for the reader an entirely bad mind scheme around Qemu and DT.

Quoted 6 lines
Quoted 2 lines

And even in a documentation directory I would place a bug warning: don’t use this with any kernel , Qemu generates a DT dynamically based on cpu, memory and devices specified at the command line.

Certainly for the arm, aarch64 and riscv "virt" machines you should always use the QEMU generated DTB. I'm not entirely clear what a qemu_arm and qemu_arm64 def targets are meant to be in this context.

Agreed. We cannot include random device trees in U-Boot for devices that generate their own at run time or otherwise have the source of truth elsewhere.

Signature · 1 line
Tom
#12 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

Hi all,

Quoted 13 lines · Tom Rini
Quoted 11 lines · Alex Bennée
Quoted 7 lines · François Ozog

Hi Simon

The only place I could agree with this file presence is in the documentation directory, not in dts. It creates a mental picture for the reader an entirely bad mind scheme around Qemu and DT.

And even in a documentation directory I would place a bug warning: don’t use this with any kernel , Qemu generates a DT dynamically based on cpu, memory and devices specified at the command line.

Quoted 7 lines
Quoted 3 lines

Certainly for the arm, aarch64 and riscv "virt" machines you should always use the QEMU generated DTB. I'm not entirely clear what a qemu_arm and qemu_arm64 def targets are meant to be in this context.

Agreed. We cannot include random device trees in U-Boot for devices that generate their own at run time or otherwise have the source of truth elsewhere.

Until we have a way of bringing in the u-boot.dtsi that people in QEMU can agree on, I don't see an alternative. I will send a series for the bloblist handoff next week and I think you will all see what I mean.

Perhaps all this will be easier a year or so, if we continue to make progress on the devicetree validation/sharing stuff, but for now, this seems like the only viable approach to me.

Regards,
Simon

#13 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

Quoted 20 lines · Simon Glass

Hi all,

Quoted 17 lines · Tom Rini
Quoted 14 lines · Alex Bennée
Quoted 7 lines · François Ozog

Hi Simon

The only place I could agree with this file presence is in the documentation directory, not in dts. It creates a mental picture for the reader an entirely bad mind scheme around Qemu and DT.

And even in a documentation directory I would place a bug warning: don’t use this with any kernel , Qemu generates a DT dynamically based on cpu, memory and devices specified at the command line.

Certainly for the arm, aarch64 and riscv "virt" machines you should always use the QEMU generated DTB. I'm not entirely clear what a qemu_arm and qemu_arm64 def targets are meant to be in this context.

Quoted 7 lines
Quoted 3 lines

Agreed. We cannot include random device trees in U-Boot for devices that generate their own at run time or otherwise have the source of truth elsewhere.

Until we have a way of bringing in the u-boot.dtsi that people in QEMU can agree on, I don't see an alternative. I will send a series for the bloblist handoff next week and I think you will all see what I mean.

I think the alternative is that QEMU in U-Boot just can't be used for certain features. Which is annoying in that it would be good to use it to test certain feature, yes. It's generating a good and valid enough dtb for Linux, so it should be good enough for us in general.

Signature · 1 line
Tom
#14 lore raw

Re: [PATCH 05/16] arm: qemu: Add a devicetree file for qemu_arm64

There are QEMU targets that have fixed hardware which do rely on the firmware to have a fixed view of the hardware. sbsa-ref is one such board although there will be some versioning required for later levels.

Quoted 40 lines · On Wed, 27 Oct 2021, 19:39 Tom Rini, <[email protected]> wrote:
Quoted 11 lines · Simon Glass

Hi all,

Quoted 8 lines · Tom Rini
Quoted 6 lines · Alex Bennée
Quoted 3 lines · François Ozog

Hi Simon

The only place I could agree with this file presence is in the

documentation directory, not in dts. It creates a mental picture for the reader

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

an entirely bad mind scheme around Qemu and DT.

And even in a documentation directory I would place a bug warning:

don’t use this with any kernel , Qemu generates a DT dynamically

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

based on cpu, memory and devices specified at the command line.

Certainly for the arm, aarch64 and riscv "virt" machines you should always use the QEMU generated DTB. I'm not entirely clear what a qemu_arm and qemu_arm64 def targets are meant to be in this context.

Quoted 7 lines
Quoted 3 lines

Agreed. We cannot include random device trees in U-Boot for devices that generate their own at run time or otherwise have the source of truth elsewhere.

Until we have a way of bringing in the u-boot.dtsi that people in QEMU can agree on, I don't see an alternative. I will send a series for the bloblist handoff next week and I think you will all see what I mean.

I think the alternative is that QEMU in U-Boot just can't be used for certain features. Which is annoying in that it would be good to use it to test certain feature, yes. It's generating a good and valid enough dtb for Linux, so it should be good enough for us in general.

--
Tom

#15 lore raw

PATCH 6/16 riscv: qemu: Add devicetree files for qemu_riscv32/64

In reply to Simon Glass

Add these files, generated from qemu, so there is a reference devicetree in the U-Boot tree.

Split the existing qemu-virt into two, since we need a different devicetree for 32- and 64-bit machines.

---

 arch/riscv/dts/Makefile              |   2 +-
 arch/riscv/dts/qemu-virt.dts         |   8 -
 arch/riscv/dts/qemu-virt32.dts       | 217 +++++++++++++++++++++++++++
 arch/riscv/dts/qemu-virt64.dts       | 217 +++++++++++++++++++++++++++
 configs/qemu-riscv32_defconfig       |   1 +
 configs/qemu-riscv32_smode_defconfig |   1 +
 configs/qemu-riscv32_spl_defconfig   |   2 +-
 configs/qemu-riscv64_defconfig       |   1 +
 configs/qemu-riscv64_smode_defconfig |   1 +
 configs/qemu-riscv64_spl_defconfig   |   2 +-
 10 files changed, 441 insertions(+), 11 deletions(-)
 delete mode 100644 arch/riscv/dts/qemu-virt.dts
 create mode 100644 arch/riscv/dts/qemu-virt32.dts
 create mode 100644 arch/riscv/dts/qemu-virt64.dts
arch/riscv/dts/Makefile +1 -1
index b6e9166767b..90d3f35e6e3 100644
@@ -2,7 +2,7 @@
 
 dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb
 dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb
-dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt.dtb
+dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
 dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
 dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
 dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
arch/riscv/dts/qemu-virt.dts deleted +0 -8
deleted file mode 100644
index fecff542b91..00000000000
@@ -1,8 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2021, Bin Meng <[email protected]>
- */
-
-/dts-v1/;
-
-#include "binman.dtsi"
arch/riscv/dts/qemu-virt32.dts new file +217 -0

217 lines not on this page · raw message

arch/riscv/dts/qemu-virt64.dts new file +217 -0

217 lines not on this page · raw message

configs/qemu-riscv32_defconfig +1 -0
index e77e3ed53a0..54953cd347b 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x80200000
configs/qemu-riscv32_smode_defconfig +1 -0
index 03787416f10..21ee08a643e 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_RISCV_SMODE=y
 CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv32_spl_defconfig +1 -1
index b0e655be416..3909c9a15ad 100644
@@ -2,7 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
-CONFIG_DEFAULT_DEVICE_TREE="qemu-virt"
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
 CONFIG_SPL=y
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_defconfig +1 -0
index 1f8dc2d2053..303ad2d5f39 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_ARCH_RV64I=y
 CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv64_smode_defconfig +1 -0
index bdcec1fdaba..62cdf91699f 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_ARCH_RV64I=y
 CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_spl_defconfig +1 -1
index 9745c1a586a..34d88da41b0 100644
@@ -2,7 +2,7 @@ CONFIG_RISCV=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_SYS_MALLOC_LEN=0x800000
-CONFIG_DEFAULT_DEVICE_TREE="qemu-virt"
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
 CONFIG_SPL=y
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_ARCH_RV64I=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#16 lore raw

Re: [PATCH 06/16] riscv: qemu: Add devicetree files for qemu_riscv32/64

Quoted 6 lines · Simon Glass

Add these files, generated from qemu, so there is a reference devicetree in the U-Boot tree.

Split the existing qemu-virt into two, since we need a different devicetree for 32- and 64-bit machines.

You only sent patch 6/16 and 15/16 to me. No clue why. Please, send complete patchsets instead of selected patches which cannot be reviewed without the context.

Which devices exist depends on the QEMU comannd line.

The files you create here do neither reflect the superset of all QEMU settings nor the minimum set. They do not include all devices supported on QEMU by U-Boot either.

You cannot assume that the values in this patch will match values used by the next invocation of QEMU.

Hence it is totally unclear what this patch might be good for.

Best regards

Heinrich

Quoted 566 lines

---

  arch/riscv/dts/Makefile              |   2 +-
  arch/riscv/dts/qemu-virt.dts         |   8 -
  arch/riscv/dts/qemu-virt32.dts       | 217 +++++++++++++++++++++++++++
  arch/riscv/dts/qemu-virt64.dts       | 217 +++++++++++++++++++++++++++
  configs/qemu-riscv32_defconfig       |   1 +
  configs/qemu-riscv32_smode_defconfig |   1 +
  configs/qemu-riscv32_spl_defconfig   |   2 +-
  configs/qemu-riscv64_defconfig       |   1 +
  configs/qemu-riscv64_smode_defconfig |   1 +
  configs/qemu-riscv64_spl_defconfig   |   2 +-
  10 files changed, 441 insertions(+), 11 deletions(-)

delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts

arch/riscv/dts/Makefile +1 -1
index b6e9166767b..90d3f35e6e3 100644
@@ -2,7 +2,7 @@
 
  dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb
  dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb
-dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt.dtb
+dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb
  dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb
  dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
  dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
arch/riscv/dts/qemu-virt.dts deleted +0 -8
deleted file mode 100644
index fecff542b91..00000000000
@@ -1,8 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2021, Bin Meng <[email protected]>
- */
-
-/dts-v1/;
-
-#include "binman.dtsi"
arch/riscv/dts/qemu-virt32.dts new file +217 -0
new file mode 100644
index 00000000000..3c449413523
@@ -0,0 +1,217 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021, Bin Meng <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "binman.dtsi"
+
+/ {
+	#address-cells = <0x02>;
+	#size-cells = <0x02>;
+	compatible = "riscv-virtio";
+	model = "riscv-virtio,qemu";
+
+	fw-cfg@10100000 {
+		dma-coherent;
+		reg = <0x00 0x10100000 0x00 0x18>;
+		compatible = "qemu,fw-cfg-mmio";
+	};
+
+	flash@20000000 {
+		bank-width = <0x04>;
+		reg = <0x00 0x20000000 0x00 0x2000000
+			0x00 0x22000000 0x00 0x2000000>;
+		compatible = "cfi-flash";
+	};
+
+	chosen {
+		bootargs = [00];
+		stdout-path = "/soc/uart@10000000";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x00 0x80000000 0x00 0x8000000>;
+	};
+
+	cpus {
+		#address-cells = <0x01>;
+		#size-cells = <0x00>;
+		timebase-frequency = <0x989680>;
+
+		cpu@0 {
+			phandle = <0x01>;
+			device_type = "cpu";
+			reg = <0x00>;
+			status = "okay";
+			compatible = "riscv";
+			riscv,isa = "rv32imafdcsu";
+			mmu-type = "riscv,sv32";
+
+			interrupt-controller {
+				#interrupt-cells = <0x01>;
+				interrupt-controller;
+				compatible = "riscv,cpu-intc";
+				phandle = <0x02>;
+			};
+		};
+
+		cpu-map {
+
+			cluster0 {
+
+				core0 {
+					cpu = <0x01>;
+				};
+			};
+		};
+	};
+
+	soc {
+		#address-cells = <0x02>;
+		#size-cells = <0x02>;
+		compatible = "simple-bus";
+		ranges;
+
+		rtc@101000 {
+			interrupts = <0x0b>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x101000 0x00 0x1000>;
+			compatible = "google,goldfish-rtc";
+		};
+
+		uart@10000000 {
+			interrupts = <0x0a>;
+			interrupt-parent = <0x03>;
+			clock-frequency = <0x384000>;
+			reg = <0x00 0x10000000 0x00 0x100>;
+			compatible = "ns16550a";
+		};
+
+		poweroff {
+			value = <0x5555>;
+			offset = <0x00>;
+			regmap = <0x04>;
+			compatible = "syscon-poweroff";
+		};
+
+		reboot {
+			value = <0x7777>;
+			offset = <0x00>;
+			regmap = <0x04>;
+			compatible = "syscon-reboot";
+		};
+
+		test@100000 {
+			phandle = <0x04>;
+			reg = <0x00 0x100000 0x00 0x1000>;
+			compatible = "sifive,test1\0sifive,test0\0syscon";
+		};
+
+		pci@30000000 {
+			interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
+			interrupt-map = <0x00 0x00 0x00 0x01 0x03 0x20 0x00 0x00
+				0x00 0x02 0x03 0x21 0x00 0x00 0x00 0x03
+				0x03 0x22 0x00 0x00 0x00 0x04 0x03 0x23
+				0x800 0x00 0x00 0x01 0x03 0x21 0x800 0x00
+				0x00 0x02 0x03 0x22 0x800 0x00 0x00 0x03
+				0x03 0x23 0x800 0x00 0x00 0x04 0x03 0x20
+				0x1000 0x00 0x00 0x01 0x03 0x22 0x1000 0x00
+				0x00 0x02 0x03 0x23 0x1000 0x00 0x00 0x03
+				0x03 0x20 0x1000 0x00 0x00 0x04 0x03 0x21
+				0x1800 0x00 0x00 0x01 0x03 0x23 0x1800 0x00
+				0x00 0x02 0x03 0x20 0x1800 0x00 0x00 0x03
+				0x03 0x21 0x1800 0x00 0x00 0x04 0x03 0x22>;
+			ranges = <0x1000000 0x00 0x00 0x00
+				0x3000000 0x00 0x10000 0x2000000
+				0x00 0x40000000 0x00 0x40000000
+				0x00 0x40000000 0x3000000 0x03
+				0x00 0x03 0x00 0x01
+				0x00>;
+			reg = <0x00 0x30000000 0x00 0x10000000>;
+			dma-coherent;
+			bus-range = <0x00 0xff>;
+			linux,pci-domain = <0x00>;
+			device_type = "pci";
+			compatible = "pci-host-ecam-generic";
+			#size-cells = <0x02>;
+			#interrupt-cells = <0x01>;
+			#address-cells = <0x03>;
+		};
+
+		virtio_mmio@10008000 {
+			interrupts = <0x08>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10008000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10007000 {
+			interrupts = <0x07>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10007000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10006000 {
+			interrupts = <0x06>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10006000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10005000 {
+			interrupts = <0x05>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10005000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10004000 {
+			interrupts = <0x04>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10004000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10003000 {
+			interrupts = <0x03>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10003000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10002000 {
+			interrupts = <0x02>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10002000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10001000 {
+			interrupts = <0x01>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10001000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		plic@c000000 {
+			phandle = <0x03>;
+			riscv,ndev = <0x35>;
+			reg = <0x00 0xc000000 0x00 0x210000>;
+			interrupts-extended = <0x02 0x0b 0x02 0x09>;
+			interrupt-controller;
+			compatible = "sifive,plic-1.0.0\0riscv,plic0";
+			#interrupt-cells = <0x01>;
+			#address-cells = <0x00>;
+		};
+
+		clint@2000000 {
+			interrupts-extended = <0x02 0x03 0x02 0x07>;
+			reg = <0x00 0x2000000 0x00 0x10000>;
+			compatible = "sifive,clint0\0riscv,clint0";
+		};
+	};
+};
arch/riscv/dts/qemu-virt64.dts new file +217 -0
new file mode 100644
index 00000000000..61bc084e280
@@ -0,0 +1,217 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021, Bin Meng <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "binman.dtsi"
+
+/ {
+	#address-cells = <0x02>;
+	#size-cells = <0x02>;
+	compatible = "riscv-virtio";
+	model = "riscv-virtio,qemu";
+
+	fw-cfg@10100000 {
+		dma-coherent;
+		reg = <0x00 0x10100000 0x00 0x18>;
+		compatible = "qemu,fw-cfg-mmio";
+	};
+
+	flash@20000000 {
+		bank-width = <0x04>;
+		reg = <0x00 0x20000000 0x00 0x2000000
+			0x00 0x22000000 0x00 0x2000000>;
+		compatible = "cfi-flash";
+	};
+
+	chosen {
+		bootargs = [00];
+		stdout-path = "/soc/uart@10000000";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x00 0x80000000 0x00 0x8000000>;
+	};
+
+	cpus {
+		#address-cells = <0x01>;
+		#size-cells = <0x00>;
+		timebase-frequency = <0x989680>;
+
+		cpu@0 {
+			phandle = <0x01>;
+			device_type = "cpu";
+			reg = <0x00>;
+			status = "okay";
+			compatible = "riscv";
+			riscv,isa = "rv64imafdcsu";
+			mmu-type = "riscv,sv48";
+
+			interrupt-controller {
+				#interrupt-cells = <0x01>;
+				interrupt-controller;
+				compatible = "riscv,cpu-intc";
+				phandle = <0x02>;
+			};
+		};
+
+		cpu-map {
+
+			cluster0 {
+
+				core0 {
+					cpu = <0x01>;
+				};
+			};
+		};
+	};
+
+	soc {
+		#address-cells = <0x02>;
+		#size-cells = <0x02>;
+		compatible = "simple-bus";
+		ranges;
+
+		rtc@101000 {
+			interrupts = <0x0b>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x101000 0x00 0x1000>;
+			compatible = "google,goldfish-rtc";
+		};
+
+		uart@10000000 {
+			interrupts = <0x0a>;
+			interrupt-parent = <0x03>;
+			clock-frequency = <0x384000>;
+			reg = <0x00 0x10000000 0x00 0x100>;
+			compatible = "ns16550a";
+		};
+
+		poweroff {
+			value = <0x5555>;
+			offset = <0x00>;
+			regmap = <0x04>;
+			compatible = "syscon-poweroff";
+		};
+
+		reboot {
+			value = <0x7777>;
+			offset = <0x00>;
+			regmap = <0x04>;
+			compatible = "syscon-reboot";
+		};
+
+		test@100000 {
+			phandle = <0x04>;
+			reg = <0x00 0x100000 0x00 0x1000>;
+			compatible = "sifive,test1\0sifive,test0\0syscon";
+		};
+
+		pci@30000000 {
+			interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
+			interrupt-map = <0x00 0x00 0x00 0x01 0x03 0x20 0x00 0x00
+				0x00 0x02 0x03 0x21 0x00 0x00 0x00 0x03
+				0x03 0x22 0x00 0x00 0x00 0x04 0x03 0x23
+				0x800 0x00 0x00 0x01 0x03 0x21 0x800 0x00
+				0x00 0x02 0x03 0x22 0x800 0x00 0x00 0x03
+				0x03 0x23 0x800 0x00 0x00 0x04 0x03 0x20
+				0x1000 0x00 0x00 0x01 0x03 0x22 0x1000 0x00
+				0x00 0x02 0x03 0x23 0x1000 0x00 0x00 0x03
+				0x03 0x20 0x1000 0x00 0x00 0x04 0x03 0x21
+				0x1800 0x00 0x00 0x01 0x03 0x23 0x1800 0x00
+				0x00 0x02 0x03 0x20 0x1800 0x00 0x00 0x03
+				0x03 0x21 0x1800 0x00 0x00 0x04 0x03 0x22>;
+			ranges = <0x1000000 0x00 0x00 0x00
+				0x3000000 0x00 0x10000 0x2000000
+				0x00 0x40000000 0x00 0x40000000
+				0x00 0x40000000 0x3000000 0x03
+				0x00 0x03 0x00 0x01
+				0x00>;
+			reg = <0x00 0x30000000 0x00 0x10000000>;
+			dma-coherent;
+			bus-range = <0x00 0xff>;
+			linux,pci-domain = <0x00>;
+			device_type = "pci";
+			compatible = "pci-host-ecam-generic";
+			#size-cells = <0x02>;
+			#interrupt-cells = <0x01>;
+			#address-cells = <0x03>;
+		};
+
+		virtio_mmio@10008000 {
+			interrupts = <0x08>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10008000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10007000 {
+			interrupts = <0x07>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10007000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10006000 {
+			interrupts = <0x06>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10006000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10005000 {
+			interrupts = <0x05>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10005000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10004000 {
+			interrupts = <0x04>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10004000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10003000 {
+			interrupts = <0x03>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10003000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10002000 {
+			interrupts = <0x02>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10002000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		virtio_mmio@10001000 {
+			interrupts = <0x01>;
+			interrupt-parent = <0x03>;
+			reg = <0x00 0x10001000 0x00 0x1000>;
+			compatible = "virtio,mmio";
+		};
+
+		plic@c000000 {
+			phandle = <0x03>;
+			riscv,ndev = <0x35>;
+			reg = <0x00 0xc000000 0x00 0x210000>;
+			interrupts-extended = <0x02 0x0b 0x02 0x09>;
+			interrupt-controller;
+			compatible = "sifive,plic-1.0.0\0riscv,plic0";
+			#interrupt-cells = <0x01>;
+			#address-cells = <0x00>;
+		};
+
+		clint@2000000 {
+			interrupts-extended = <0x02 0x03 0x02 0x07>;
+			reg = <0x00 0x2000000 0x00 0x10000>;
+			compatible = "sifive,clint0\0riscv,clint0";
+		};
+	};
+};
configs/qemu-riscv32_defconfig +1 -0
index e77e3ed53a0..54953cd347b 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_DISTRO_DEFAULTS=y
  CONFIG_SYS_LOAD_ADDR=0x80200000
configs/qemu-riscv32_smode_defconfig +1 -0
index 03787416f10..21ee08a643e 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_RISCV_SMODE=y
  CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv32_spl_defconfig +1 -1
index b0e655be416..3909c9a15ad 100644
@@ -2,7 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
-CONFIG_DEFAULT_DEVICE_TREE="qemu-virt"
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
  CONFIG_SPL=y
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_defconfig +1 -0
index 1f8dc2d2053..303ad2d5f39 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_ARCH_RV64I=y
  CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv64_smode_defconfig +1 -0
index bdcec1fdaba..62cdf91699f 100644
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_ARCH_RV64I=y
  CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_spl_defconfig +1 -1
index 9745c1a586a..34d88da41b0 100644
@@ -2,7 +2,7 @@ CONFIG_RISCV=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_SIZE=0x20000
  CONFIG_SYS_MALLOC_LEN=0x800000
-CONFIG_DEFAULT_DEVICE_TREE="qemu-virt"
+CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
  CONFIG_SPL=y
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_ARCH_RV64I=y
#17 lore raw

PATCH 7/16 arm: rpi: Add a devicetree file for rpi_4

In reply to Simon Glass

Add this file, obtained from the Raspbian boot disk, so there is a reference devicetree in the U-Boot tree. The same one is used for 32- and 64-bit variants.

Note that U-Boot does not normally need this at runtime, since CONFIG_OF_BOARD is enabled. The previous firmware stage provides a devicetree at runtime.

---

 arch/arm/dts/Makefile            |    3 +-
 arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++++++++++++++++++++++++++++++
 configs/rpi_4_32b_defconfig      |    1 +
 configs/rpi_4_defconfig          |    1 +
 configs/rpi_arm64_defconfig      |    1 +
 5 files changed, 1963 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
arch/arm/dts/Makefile +2 -1
index 52c586f3974..efc01a70bf2 100644
@@ -1062,7 +1062,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
 	bcm2837-rpi-3-a-plus.dtb \
 	bcm2837-rpi-3-b.dtb \
 	bcm2837-rpi-3-b-plus.dtb \
-	bcm2837-rpi-cm3-io3.dtb
+	bcm2837-rpi-cm3-io3.dtb \
+	bcm2711-rpi-4-b.dtb
 
 dtb-$(CONFIG_ARCH_BCM63158) += \
 	bcm963158.dtb
arch/arm/dts/bcm2711-rpi-4-b.dts new file +1958 -0

1,958 lines not on this page · raw message

configs/rpi_4_32b_defconfig +1 -0
index d592df50706..31d77dbe4eb 100644
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000
 CONFIG_TARGET_RPI_4_32B=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
+CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_OF_BOARD_SETUP=y
configs/rpi_4_defconfig +1 -0
index ab5cc90d912..a2a88d66dbd 100644
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000
 CONFIG_TARGET_RPI_4=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
+CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_OF_BOARD_SETUP=y
configs/rpi_arm64_defconfig +1 -0
index 382d99dc2eb..fb8abbccc45 100644
@@ -6,6 +6,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="pci enum; usb start;"
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#18 lore raw

Re: [PATCH 07/16] arm: rpi: Add a devicetree file for rpi_4

Hi Simon

This is making a clean environment go in the wrong direction. I have witnessed that bus to mmio changed for instance, have seen patches to patch live u-boot embedded DT because it does not do the work that Videocore does.

The Videocore handles that properly so why adding this?

Si i would agree to have the file on the documentation directory not on the dts with the same warning I mentioned earlier

Quoted 2,075 lines · Simon Glass

Add this file, obtained from the Raspbian boot disk, so there is a reference devicetree in the U-Boot tree. The same one is used for 32- and 64-bit variants.

Note that U-Boot does not normally need this at runtime, since CONFIG_OF_BOARD is enabled. The previous firmware stage provides a devicetree at runtime.

---

 arch/arm/dts/Makefile            |    3 +-
 arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++++++++++++++++++++++++++++++
 configs/rpi_4_32b_defconfig      |    1 +
 configs/rpi_4_defconfig          |    1 +
 configs/rpi_arm64_defconfig      |    1 +
 5 files changed, 1963 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
arch/arm/dts/Makefile +2 -1
index 52c586f3974..efc01a70bf2 100644
@@ -1062,7 +1062,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
        bcm2837-rpi-3-a-plus.dtb \
        bcm2837-rpi-3-b.dtb \
        bcm2837-rpi-3-b-plus.dtb \
-       bcm2837-rpi-cm3-io3.dtb
+       bcm2837-rpi-cm3-io3.dtb \
+       bcm2711-rpi-4-b.dtb
 
 dtb-$(CONFIG_ARCH_BCM63158) += \
        bcm963158.dtb
arch/arm/dts/bcm2711-rpi-4-b.dts new file +91 -0
new file mode 100644
index 00000000000..425e9fb91c4
@@ -0,0 +1,1958 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Sample device tree for rpi_4
+
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/memreserve/   0x0000000000000000 0x0000000000001000;
+/ {
+       compatible = "raspberrypi,4-model-b\0brcm,bcm2838\0brcm,bcm2837";
+       model = "Raspberry Pi 4 Model B";
+       interrupt-parent = <0x01>;
+       #address-cells = <0x02>;
+       #size-cells = <0x01>;
+
+       aliases {
+               serial0 = "/soc/serial@7e215040";
+               serial1 = "/soc/serial@7e201000";
+               audio = "/soc/audio";
+               aux = "/soc/aux@7e215000";
+               sound = "/soc/sound";
+               soc = "/soc";
+               dma = "/soc/dma@7e007000";
+               watchdog = "/soc/watchdog@7e100000";
+               random = "/soc/rng@7e104000";
+               mailbox = "/soc/mailbox@7e00b880";
+               gpio = "/soc/gpio@7e200000";
+               uart0 = "/soc/serial@7e201000";
+               sdhost = "/soc/mmc@7e202000";
+               mmc0 = "/soc/emmc2@7e340000";
+               i2s = "/soc/i2s@7e203000";
+               spi0 = "/soc/spi@7e204000";
+               i2c0 = "/soc/i2c@7e205000";
+               uart1 = "/soc/serial@7e215040";
+               spi1 = "/soc/spi@7e215080";
+               spi2 = "/soc/spi@7e2150c0";
+               mmc = "/soc/mmc@7e300000";
+               mmc1 = "/soc/mmcnr@7e300000";
+               i2c1 = "/soc/i2c@7e804000";
+               i2c2 = "/soc/i2c@7e805000";
+               usb = "/soc/usb@7e980000";
+               leds = "/leds";
+               fb = "/soc/fb";
+               thermal = "/soc/thermal@7d5d2200";
+               axiperf = "/soc/axiperf";
+               mmc2 = "/soc/mmc@7e202000";
+               ethernet0 = "/scb/genet@7d580000";
+       };
+
+       chosen {
+               bootargs = "8250.nr_uarts=1 cma=64M";
+       };
+
+       thermal-zones {
+
+               cpu-thermal {
+                       polling-delay-passive = <0x00>;
+                       polling-delay = <0x3e8>;
+                       thermal-sensors = <0x02>;
+                       coefficients = <0xfffffe19 0x641b8>;
+                       phandle = <0x2f>;
+
+                       cooling-maps {
+                       };
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <0x01>;
+               #size-cells = <0x01>;
+               ranges = <0x7e000000 0x00 0xfe000000 0x1800000
+                       0x7c000000 0x00 0xfc000000 0x2000000
+                       0x40000000 0x00 0xff800000 0x800000>;
+               dma-ranges = <0xc0000000 0x00 0x00 0x3c000000>;
+               phandle = <0x30>;
+
+               txp@7e004000 {
+                       compatible = "brcm,bcm2835-txp";
+                       reg = <0x7e004000 0x20>;
+                       interrupts = <0x00 0x4b 0x04>;
+                       status = "disabled";
+                       phandle = <0x31>;
+               };
+
+               dma@7e007000 {
+                       compatible = "brcm,bcm2835-dma";
+                       reg = <0x7e007000 0xb00>;
+                       interrupts = <0x00 0x50 0x04 0x00 0x51 0x04 0x00

0x52

arch/arm/dts/bcm2711-rpi-4-b.dts new file +5 -0
+                               0x04 0x00 0x53 0x04 0x00 0x54 0x04 0x00
+                               0x55 0x04 0x00 0x56 0x04 0x00 0x57 0x04
+                               0x00 0x57 0x04 0x00 0x58 0x04 0x00 0x58
+                               0x04>;
+                       interrupt-names =

"dma0\0dma1\0dma2\0dma3\0dma4\0dma5\0dma6\0dma7\0dma8\0dma9\0dma10";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +7 -0
+                       #dma-cells = <0x01>;
+                       brcm,dma-channel-mask = <0x7ef5>;
+                       phandle = <0x0a>;
+               };
+
+               watchdog@7e100000 {
+                       compatible =

"brcm,bcm2835-pm\0brcm,bcm2835-pm-wdt";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +3 -0
+                       #power-domain-cells = <0x01>;
+                       #reset-cells = <0x01>;
+                       reg = <0x7e100000 0x114 0x7e00a000 0x24 0x7ec11000

0x20>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +54 -0
+                       clocks = <0x03 0x15 0x03 0x1d 0x03 0x17 0x03 0x16>;
+                       clock-names = "v3d\0peri_image\0h264\0isp";
+                       system-power-controller;
+                       phandle = <0x1c>;
+               };
+
+               cprman@7e101000 {
+                       compatible = "brcm,bcm2838-cprman";
+                       #clock-cells = <0x01>;
+                       reg = <0x7e101000 0x2000>;
+                       clocks = <0x04 0x05 0x00 0x05 0x01 0x05 0x02 0x06
+                                0x00 0x06 0x01 0x06 0x02>;
+                       firmware = <0x07>;
+                       phandle = <0x03>;
+               };
+
+               rng@7e104000 {
+                       compatible = "brcm,bcm2838-rng200";
+                       reg = <0x7e104000 0x10>;
+                       interrupts = <0x00 0x7d 0x04>;
+                       phandle = <0x26>;
+               };
+
+               mailbox@7e00b880 {
+                       compatible = "brcm,bcm2835-mbox";
+                       reg = <0x7e00b880 0x40>;
+                       interrupts = <0x00 0x21 0x04>;
+                       #mbox-cells = <0x00>;
+                       phandle = <0x1a>;
+               };
+
+               gpio: gpio@7e200000 {
+                       compatible = "brcm,bcm2835-gpio";
+                       reg = <0x7e200000 0xb4>;
+                       interrupts = <0x00 0x71 0x04 0x00 0x72 0x04>;
+                       gpio-controller;
+                       #gpio-cells = <0x02>;
+                       interrupt-controller;
+                       #interrupt-cells = <0x02>;
+                       phandle = <0x0f>;
+
+                       dpi_gpio0 {
+                               brcm,pins = <0x00 0x01 0x02 0x03 0x04
+                                       0x05 0x06 0x07 0x08 0x09
+                                       0x0a 0x0b 0x0c 0x0d 0x0e
+                                       0x0f 0x10 0x11 0x12 0x13
+                                       0x14 0x15 0x16 0x17 0x18
+                                       0x19 0x1a 0x1b>;
+                               brcm,function = <0x06>;
+                               phandle = <0x32>;
+                       };
+
+                       emmc_gpio22 {
+                               brcm,pins = <0x16 0x17 0x18 0x19 0x1a

0x1b>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +6 -0
+                               brcm,function = <0x07>;
+                               phandle = <0x33>;
+                       };
+
+                       emmc_gpio34 {
+                               brcm,pins = <0x22 0x23 0x24 0x25 0x26

0x27>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+                               brcm,function = <0x07>;
+                               brcm,pull = <0x00 0x02 0x02 0x02 0x02

0x02>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +5 -0
+                               phandle = <0x34>;
+                       };
+
+                       emmc_gpio48 {
+                               brcm,pins = <0x30 0x31 0x32 0x33 0x34

0x35>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +73 -0
+                               brcm,function = <0x07>;
+                               phandle = <0x35>;
+                       };
+
+                       gpclk0_gpio4 {
+                               brcm,pins = <0x04>;
+                               brcm,function = <0x04>;
+                               phandle = <0x36>;
+                       };
+
+                       gpclk1_gpio5 {
+                               brcm,pins = <0x05>;
+                               brcm,function = <0x04>;
+                               phandle = <0x37>;
+                       };
+
+                       gpclk1_gpio42 {
+                               brcm,pins = <0x2a>;
+                               brcm,function = <0x04>;
+                               phandle = <0x38>;
+                       };
+
+                       gpclk1_gpio44 {
+                               brcm,pins = <0x2c>;
+                               brcm,function = <0x04>;
+                               phandle = <0x39>;
+                       };
+
+                       gpclk2_gpio6 {
+                               brcm,pins = <0x06>;
+                               brcm,function = <0x04>;
+                               phandle = <0x3a>;
+                       };
+
+                       gpclk2_gpio43 {
+                               brcm,pins = <0x2b>;
+                               brcm,function = <0x04>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x3b>;
+                       };
+
+                       i2c0_gpio0 {
+                               brcm,pins = <0x00 0x01>;
+                               brcm,function = <0x04>;
+                               phandle = <0x3c>;
+                       };
+
+                       i2c0_gpio28 {
+                               brcm,pins = <0x1c 0x1d>;
+                               brcm,function = <0x04>;
+                               phandle = <0x3d>;
+                       };
+
+                       i2c0_gpio44 {
+                               brcm,pins = <0x2c 0x2d>;
+                               brcm,function = <0x05>;
+                               phandle = <0x3e>;
+                       };
+
+                       i2c1_gpio2 {
+                               brcm,pins = <0x02 0x03>;
+                               brcm,function = <0x04>;
+                               phandle = <0x3f>;
+                       };
+
+                       i2c1_gpio44 {
+                               brcm,pins = <0x2c 0x2d>;
+                               brcm,function = <0x06>;
+                               phandle = <0x40>;
+                       };
+
+                       jtag_gpio22 {
+                               brcm,pins = <0x16 0x17 0x18 0x19 0x1a

0x1b>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +60 -0
+                               brcm,function = <0x03>;
+                               phandle = <0x41>;
+                       };
+
+                       pcm_gpio18 {
+                               brcm,pins = <0x12 0x13 0x14 0x15>;
+                               brcm,function = <0x04>;
+                               phandle = <0x42>;
+                       };
+
+                       pcm_gpio28 {
+                               brcm,pins = <0x1c 0x1d 0x1e 0x1f>;
+                               brcm,function = <0x06>;
+                               phandle = <0x43>;
+                       };
+
+                       pwm0_gpio12 {
+                               brcm,pins = <0x0c>;
+                               brcm,function = <0x04>;
+                               phandle = <0x44>;
+                       };
+
+                       pwm0_gpio18 {
+                               brcm,pins = <0x12>;
+                               brcm,function = <0x02>;
+                               phandle = <0x45>;
+                       };
+
+                       pwm0_gpio40 {
+                               brcm,pins = <0x28>;
+                               brcm,function = <0x04>;
+                               phandle = <0x46>;
+                       };
+
+                       pwm1_gpio13 {
+                               brcm,pins = <0x0d>;
+                               brcm,function = <0x04>;
+                               phandle = <0x47>;
+                       };
+
+                       pwm1_gpio19 {
+                               brcm,pins = <0x13>;
+                               brcm,function = <0x02>;
+                               phandle = <0x48>;
+                       };
+
+                       pwm1_gpio41 {
+                               brcm,pins = <0x29>;
+                               brcm,function = <0x04>;
+                               phandle = <0x49>;
+                       };
+
+                       pwm1_gpio45 {
+                               brcm,pins = <0x2d>;
+                               brcm,function = <0x04>;
+                               phandle = <0x4a>;
+                       };
+
+                       sdhost_gpio48 {
+                               brcm,pins = <0x16 0x17 0x18 0x19 0x1a

0x1b>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +18 -0
+                               brcm,function = <0x04>;
+                               phandle = <0x0b>;
+                       };
+
+                       spi0_gpio7 {
+                               brcm,pins = <0x07 0x08 0x09 0x0a 0x0b>;
+                               brcm,function = <0x04>;
+                               phandle = <0x4b>;
+                       };
+
+                       spi0_gpio35 {
+                               brcm,pins = <0x23 0x24 0x25 0x26 0x27>;
+                               brcm,function = <0x04>;
+                               phandle = <0x4c>;
+                       };
+
+                       spi1_gpio16 {
+                               brcm,pins = <0x10 0x11 0x12 0x13 0x14

0x15>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +6 -0
+                               brcm,function = <0x03>;
+                               phandle = <0x4d>;
+                       };
+
+                       spi2_gpio40 {
+                               brcm,pins = <0x28 0x29 0x2a 0x2b 0x2c

0x2d>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +167 -0
+                               brcm,function = <0x03>;
+                               phandle = <0x4e>;
+                       };
+
+                       uart0_gpio14: uart0_gpio14 {
+                               brcm,pins = <0x0e 0x0f>;
+                               brcm,function = <0x04>;
+                               phandle = <0x4f>;
+                       };
+
+                       uart0: uart0_ctsrts_gpio16 {
+                               brcm,pins = <0x10 0x11>;
+                               brcm,function = <0x07>;
+                               phandle = <0x50>;
+                       };
+
+                       uart0_ctsrts_gpio30 {
+                               brcm,pins = <0x1e 0x1f>;
+                               brcm,function = <0x07>;
+                               brcm,pull = <0x02 0x00>;
+                               phandle = <0x51>;
+                       };
+
+                       uart0_gpio32 {
+                               brcm,pins = <0x20 0x21>;
+                               brcm,function = <0x07>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x52>;
+                       };
+
+                       uart0_gpio36 {
+                               brcm,pins = <0x24 0x25>;
+                               brcm,function = <0x06>;
+                               phandle = <0x53>;
+                       };
+
+                       uart0_ctsrts_gpio38 {
+                               brcm,pins = <0x26 0x27>;
+                               brcm,function = <0x06>;
+                               phandle = <0x54>;
+                       };
+
+                       uart1_gpio14: uart1_gpio14 {
+                               brcm,pins = <0x0e 0x0f>;
+                               brcm,function = <0x02>;
+                               phandle = <0x55>;
+                       };
+
+                       uart1: uart1_ctsrts_gpio16 {
+                               brcm,pins = <0x10 0x11>;
+                               brcm,function = <0x02>;
+                               phandle = <0x56>;
+                       };
+
+                       uart1_gpio32 {
+                               brcm,pins = <0x20 0x21>;
+                               brcm,function = <0x02>;
+                               phandle = <0x57>;
+                       };
+
+                       uart1_ctsrts_gpio30 {
+                               brcm,pins = <0x1e 0x1f>;
+                               brcm,function = <0x02>;
+                               phandle = <0x58>;
+                       };
+
+                       uart1_gpio40 {
+                               brcm,pins = <0x28 0x29>;
+                               brcm,function = <0x02>;
+                               phandle = <0x59>;
+                       };
+
+                       uart1_ctsrts_gpio42 {
+                               brcm,pins = <0x2a 0x2b>;
+                               brcm,function = <0x02>;
+                               phandle = <0x5a>;
+                       };
+
+                       gpclk0_gpio49 {
+                               brcm,pins = <0x31>;
+                               brcm,function = <0x05>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x5b>;
+                       };
+
+                       gpclk1_gpio50 {
+                               brcm,pins = <0x32>;
+                               brcm,function = <0x05>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x5c>;
+                       };
+
+                       gpclk2_gpio51 {
+                               brcm,pins = <0x33>;
+                               brcm,function = <0x05>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x5d>;
+                       };
+
+                       i2c0_gpio46 {
+                               brcm,pins = <0x2e 0x2f>;
+                               brcm,function = <0x04>;
+                               phandle = <0x5e>;
+                       };
+
+                       i2c1_gpio46 {
+                               brcm,pins = <0x2e 0x2f>;
+                               brcm,function = <0x05>;
+                               phandle = <0x5f>;
+                       };
+
+                       i2c3_gpio2 {
+                               brcm,pins = <0x02 0x03>;
+                               brcm,function = <0x02>;
+                               phandle = <0x60>;
+                       };
+
+                       i2c3_gpio4 {
+                               brcm,pins = <0x04 0x05>;
+                               brcm,function = <0x02>;
+                               phandle = <0x61>;
+                       };
+
+                       i2c4_gpio6 {
+                               brcm,pins = <0x06 0x07>;
+                               brcm,function = <0x02>;
+                               phandle = <0x62>;
+                       };
+
+                       i2c4_gpio8 {
+                               brcm,pins = <0x08 0x09>;
+                               brcm,function = <0x02>;
+                               phandle = <0x63>;
+                       };
+
+                       i2c5_gpio10 {
+                               brcm,pins = <0x0a 0x0b>;
+                               brcm,function = <0x02>;
+                               phandle = <0x64>;
+                       };
+
+                       i2c5_gpio12 {
+                               brcm,pins = <0x0c 0x0d>;
+                               brcm,function = <0x02>;
+                               phandle = <0x65>;
+                       };
+
+                       i2c6_gpio0 {
+                               brcm,pins = <0x00 0x01>;
+                               brcm,function = <0x02>;
+                               phandle = <0x66>;
+                       };
+
+                       i2c6_gpio22 {
+                               brcm,pins = <0x16 0x17>;
+                               brcm,function = <0x02>;
+                               phandle = <0x67>;
+                       };
+
+                       i2c_slave_gpio8 {
+                               brcm,pins = <0x08 0x09 0x0a 0x0b>;
+                               brcm,function = <0x07>;
+                               phandle = <0x68>;
+                       };
+
+                       jtag_gpio48 {
+                               brcm,pins = <0x30 0x31 0x32 0x33 0x34

0x35>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +273 -0
+                               brcm,function = <0x03>;
+                               phandle = <0x69>;
+                       };
+
+                       mii_gpio28 {
+                               brcm,pins = <0x1c 0x1d 0x1e 0x1f>;
+                               brcm,function = <0x03>;
+                               phandle = <0x6a>;
+                       };
+
+                       mii_gpio36 {
+                               brcm,pins = <0x24 0x25 0x26 0x27>;
+                               brcm,function = <0x02>;
+                               phandle = <0x6b>;
+                       };
+
+                       pcm_gpio50 {
+                               brcm,pins = <0x32 0x33 0x34 0x35>;
+                               brcm,function = <0x06>;
+                               phandle = <0x6c>;
+                       };
+
+                       pwm0_gpio52 {
+                               brcm,pins = <0x34>;
+                               brcm,function = <0x05>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x6d>;
+                       };
+
+                       pwm1_gpio53 {
+                               brcm,pins = <0x35>;
+                               brcm,function = <0x05>;
+                               brcm,pull = <0x00>;
+                               phandle = <0x6e>;
+                       };
+
+                       rgmii_gpio35 {
+                               brcm,pins = <0x23 0x24>;
+                               brcm,function = <0x03>;
+                               phandle = <0x6f>;
+                       };
+
+                       rgmii_irq_gpio34 {
+                               brcm,pins = <0x22>;
+                               brcm,function = <0x02>;
+                               phandle = <0x70>;
+                       };
+
+                       rgmii_irq_gpio39 {
+                               brcm,pins = <0x27>;
+                               brcm,function = <0x03>;
+                               phandle = <0x71>;
+                       };
+
+                       rgmii_mdio_gpio28 {
+                               brcm,pins = <0x1c 0x1d>;
+                               brcm,function = <0x02>;
+                               phandle = <0x72>;
+                       };
+
+                       rgmii_mdio_gpio37 {
+                               brcm,pins = <0x25 0x26>;
+                               brcm,function = <0x03>;
+                               phandle = <0x73>;
+                       };
+
+                       spi0_gpio46 {
+                               brcm,pins = <0x2e 0x2f 0x30 0x31>;
+                               brcm,function = <0x06>;
+                               phandle = <0x74>;
+                       };
+
+                       spi2_gpio46 {
+                               brcm,pins = <0x2e 0x2f 0x30 0x31 0x32>;
+                               brcm,function = <0x02>;
+                               phandle = <0x75>;
+                       };
+
+                       spi3_gpio0 {
+                               brcm,pins = <0x00 0x01 0x02 0x03>;
+                               brcm,function = <0x07>;
+                               phandle = <0x76>;
+                       };
+
+                       spi4_gpio4 {
+                               brcm,pins = <0x04 0x05 0x06 0x07>;
+                               brcm,function = <0x07>;
+                               phandle = <0x77>;
+                       };
+
+                       spi5_gpio12 {
+                               brcm,pins = <0x0c 0x0d 0x0e 0x0f>;
+                               brcm,function = <0x07>;
+                               phandle = <0x78>;
+                       };
+
+                       spi6_gpio18 {
+                               brcm,pins = <0x12 0x13 0x14 0x15>;
+                               brcm,function = <0x07>;
+                               phandle = <0x79>;
+                       };
+
+                       uart2_gpio0 {
+                               brcm,pins = <0x00 0x01>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x7a>;
+                       };
+
+                       uart2_ctsrts_gpio2 {
+                               brcm,pins = <0x02 0x03>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x02 0x00>;
+                               phandle = <0x7b>;
+                       };
+
+                       uart3_gpio4 {
+                               brcm,pins = <0x04 0x05>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x7c>;
+                       };
+
+                       uart3_ctsrts_gpio6 {
+                               brcm,pins = <0x06 0x07>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x02 0x00>;
+                               phandle = <0x7d>;
+                       };
+
+                       uart4_gpio8 {
+                               brcm,pins = <0x08 0x09>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x7e>;
+                       };
+
+                       uart4_ctsrts_gpio10 {
+                               brcm,pins = <0x0a 0x0b>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x02 0x00>;
+                               phandle = <0x7f>;
+                       };
+
+                       uart5_gpio12 {
+                               brcm,pins = <0x0c 0x0d>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x80>;
+                       };
+
+                       uart5_ctsrts_gpio14 {
+                               brcm,pins = <0x0e 0x0f>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x02 0x00>;
+                               phandle = <0x81>;
+                       };
+
+                       dpi_18bit_gpio0 {
+                               brcm,pins = <0x00 0x01 0x02 0x03
+                                       0x04 0x05 0x06 0x07
+                                       0x08 0x09 0x0a 0x0b
+                                       0x0c 0x0d 0x0e 0x0f
+                                       0x10 0x11 0x12 0x13
+                                       0x14 0x15>;
+                               brcm,function = <0x06>;
+                               phandle = <0x82>;
+                       };
+
+                       spi0_pins {
+                               brcm,pins = <0x09 0x0a 0x0b>;
+                               brcm,function = <0x04>;
+                               phandle = <0x0d>;
+                       };
+
+                       spi0_cs_pins {
+                               brcm,pins = <0x08 0x07>;
+                               brcm,function = <0x01>;
+                               phandle = <0x0e>;
+                       };
+
+                       spi3_pins {
+                               brcm,pins = <0x01 0x02 0x03>;
+                               brcm,function = <0x07>;
+                               phandle = <0x83>;
+                       };
+
+                       spi3_cs_pins {
+                               brcm,pins = <0x00 0x18>;
+                               brcm,function = <0x01>;
+                               phandle = <0x84>;
+                       };
+
+                       spi4_pins {
+                               brcm,pins = <0x05 0x06 0x07>;
+                               brcm,function = <0x07>;
+                               phandle = <0x85>;
+                       };
+
+                       spi4_cs_pins {
+                               brcm,pins = <0x04 0x19>;
+                               brcm,function = <0x01>;
+                               phandle = <0x86>;
+                       };
+
+                       spi5_pins {
+                               brcm,pins = <0x0d 0x0e 0x0f>;
+                               brcm,function = <0x07>;
+                               phandle = <0x87>;
+                       };
+
+                       spi5_cs_pins {
+                               brcm,pins = <0x0c 0x1a>;
+                               brcm,function = <0x01>;
+                               phandle = <0x88>;
+                       };
+
+                       spi6_pins {
+                               brcm,pins = <0x13 0x14 0x15>;
+                               brcm,function = <0x07>;
+                               phandle = <0x89>;
+                       };
+
+                       spi6_cs_pins {
+                               brcm,pins = <0x12 0x1b>;
+                               brcm,function = <0x01>;
+                               phandle = <0x8a>;
+                       };
+
+                       i2c0 {
+                               brcm,pins = <0x00 0x01>;
+                               brcm,function = <0x04>;
+                               phandle = <0x10>;
+                       };
+
+                       i2c1 {
+                               brcm,pins = <0x02 0x03>;
+                               brcm,function = <0x04>;
+                               phandle = <0x14>;
+                       };
+
+                       i2c3 {
+                               brcm,pins = <0x04 0x05>;
+                               brcm,function = <0x02>;
+                               phandle = <0x8b>;
+                       };
+
+                       i2c4 {
+                               brcm,pins = <0x08 0x09>;
+                               brcm,function = <0x02>;
+                               phandle = <0x8c>;
+                       };
+
+                       i2c5 {
+                               brcm,pins = <0x0c 0x0d>;
+                               brcm,function = <0x02>;
+                               phandle = <0x8d>;
+                       };
+
+                       i2c6 {
+                               brcm,pins = <0x16 0x17>;
+                               brcm,function = <0x02>;
+                               phandle = <0x8e>;
+                       };
+
+                       i2s {
+                               brcm,pins = <0x12 0x13 0x14 0x15>;
+                               brcm,function = <0x04>;
+                               phandle = <0x0c>;
+                       };
+
+                       sdio_pins {
+                               brcm,pins = <0x22 0x23 0x24 0x25 0x26

0x27>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+                               brcm,function = <0x07>;
+                               brcm,pull = <0x00 0x02 0x02 0x02 0x02

0x02>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +61 -0
+                               phandle = <0x19>;
+                       };
+
+                       bt_pins {
+                               brcm,pins = [2d 00];
+                               brcm,function = <0x00>;
+                               brcm,pull = <0x02>;
+                               phandle = <0x09>;
+                       };
+
+                       uart0_pins {
+                               brcm,pins = <0x20 0x21>;
+                               brcm,function = <0x07>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x08>;
+                       };
+
+                       uart1_pins {
+                               brcm,pins;
+                               brcm,function;
+                               brcm,pull;
+                               phandle = <0x12>;
+                       };
+
+                       uart2_pins {
+                               brcm,pins = <0x00 0x01>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x8f>;
+                       };
+
+                       uart3_pins {
+                               brcm,pins = <0x04 0x05>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x90>;
+                       };
+
+                       uart4_pins {
+                               brcm,pins = <0x08 0x09>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x91>;
+                       };
+
+                       uart5_pins {
+                               brcm,pins = <0x0c 0x0d>;
+                               brcm,function = <0x03>;
+                               brcm,pull = <0x00 0x02>;
+                               phandle = <0x92>;
+                       };
+
+                       audio_pins {
+                               brcm,pins = <0x28 0x29>;
+                               brcm,function = <0x04>;
+                               phandle = <0x1b>;
+                       };
+               };
+
+               serial@7e201000 {
+                       compatible =

"brcm,bcm2835-pl011\0arm,pl011\0arm,primecell";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +126 -0
+                       reg = <0x7e201000 0x200>;
+                       interrupts = <0x00 0x79 0x04>;
+                       clocks = <0x03 0x13 0x03 0x14>;
+                       clock-names = "uartclk\0apb_pclk";
+                       arm,primecell-periphid = <0x241011>;
+                       cts-event-workaround;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x08 0x09>;
+                       status = "okay";
+                       phandle = <0x1f>;
+               };
+
+               mmc@7e202000 {
+                       compatible = "brcm,bcm2835-sdhost";
+                       reg = <0x7e202000 0x100>;
+                       interrupts = <0x00 0x78 0x04>;
+                       clocks = <0x03 0x14>;
+                       dmas = <0x0a 0x2000000d>;
+                       dma-names = "rx-tx";
+                       status = "disabled";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x0b>;
+                       bus-width = <0x04>;
+                       brcm,overclock-50 = <0x00>;
+                       brcm,pio-limit = <0x01>;
+                       phandle = <0x27>;
+               };
+
+               i2s@7e203000 {
+                       compatible = "brcm,bcm2835-i2s";
+                       reg = <0x7e203000 0x24>;
+                       clocks = <0x03 0x1f>;
+                       dmas = <0x0a 0x02 0x0a 0x03>;
+                       dma-names = "tx\0rx";
+                       status = "disabled";
+                       #sound-dai-cells = <0x00>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x0c>;
+                       phandle = <0x21>;
+               };
+
+               spi@7e204000 {
+                       compatible = "brcm,bcm2835-spi";
+                       reg = <0x7e204000 0x200>;
+                       interrupts = <0x00 0x76 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       dmas = <0x0a 0x06 0x0a 0x07>;
+                       dma-names = "tx\0rx";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x0d 0x0e>;
+                       cs-gpios = <0x0f 0x08 0x01 0x0f 0x07 0x01>;
+                       phandle = <0x22>;
+
+                       spidev@0 {
+                               compatible = "spidev";
+                               reg = <0x00>;
+                               #address-cells = <0x01>;
+                               #size-cells = <0x00>;
+                               spi-max-frequency = <0x7735940>;
+                               phandle = <0x93>;
+                       };
+
+                       spidev@1 {
+                               compatible = "spidev";
+                               reg = <0x01>;
+                               #address-cells = <0x01>;
+                               #size-cells = <0x00>;
+                               spi-max-frequency = <0x7735940>;
+                               phandle = <0x94>;
+                       };
+               };
+
+               i2c@7e205000 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e205000 0x200>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x10>;
+                       clock-frequency = <0x186a0>;
+                       phandle = <0x23>;
+               };
+
+               pixelvalve@7e206000 {
+                       compatible = "brcm,bcm2835-pixelvalve0";
+                       reg = <0x7e206000 0x100>;
+                       interrupts = <0x00 0x6d 0x04>;
+                       status = "disabled";
+                       phandle = <0x95>;
+               };
+
+               pixelvalve@7e207000 {
+                       compatible = "brcm,bcm2835-pixelvalve1";
+                       reg = <0x7e207000 0x100>;
+                       interrupts = <0x00 0x6e 0x04>;
+                       status = "disabled";
+                       phandle = <0x96>;
+               };
+
+               dpi@7e208000 {
+                       compatible = "brcm,bcm2835-dpi";
+                       reg = <0x7e208000 0x8c>;
+                       clocks = <0x03 0x14 0x03 0x2c>;
+                       clock-names = "core\0pixel";
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0x97>;
+               };
+
+               dsi@7e209000 {
+                       compatible = "brcm,bcm2835-dsi0";
+                       reg = <0x7e209000 0x78>;
+                       interrupts = <0x00 0x64 0x04>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       #clock-cells = <0x01>;
+                       clocks = <0x03 0x20 0x03 0x2f 0x03 0x31>;
+                       clock-names = "phy\0escape\0pixel";
+                       clock-output-names =

"dsi0_byte\0dsi0_ddr2\0dsi0_ddr";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +73 -0
+                       phandle = <0x05>;
+               };
+
+               aux@7e215000 {
+                       compatible = "brcm,bcm2835-aux";
+                       #clock-cells = <0x01>;
+                       reg = <0x7e215000 0x08>;
+                       clocks = <0x03 0x14>;
+                       phandle = <0x11>;
+               };
+
+               serial@7e215040 {
+                       compatible = "brcm,bcm2835-aux-uart";
+                       reg = <0x7e215040 0x40>;
+                       interrupts = <0x00 0x5d 0x04>;
+                       clocks = <0x11 0x00>;
+                       status = "okay";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x12>;
+                       phandle = <0x20>;
+               };
+
+               spi@7e215080 {
+                       compatible = "brcm,bcm2835-aux-spi";
+                       reg = <0x7e215080 0x40>;
+                       interrupts = <0x00 0x5d 0x04>;
+                       clocks = <0x11 0x01>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0x98>;
+               };
+
+               spi@7e2150c0 {
+                       compatible = "brcm,bcm2835-aux-spi";
+                       reg = <0x7e2150c0 0x40>;
+                       interrupts = <0x00 0x5d 0x04>;
+                       clocks = <0x11 0x02>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0x99>;
+               };
+
+               pwm@7e20c000 {
+                       compatible = "brcm,bcm2835-pwm";
+                       reg = <0x7e20c000 0x28>;
+                       clocks = <0x03 0x1e>;
+                       assigned-clocks = <0x03 0x1e>;
+                       assigned-clock-rates = <0x989680>;
+                       #pwm-cells = <0x02>;
+                       status = "disabled";
+                       phandle = <0x9a>;
+               };
+
+               hvs@7e400000 {
+                       compatible = "brcm,bcm2835-hvs";
+                       reg = <0x7e400000 0x6000>;
+                       interrupts = <0x00 0x61 0x04>;
+                       status = "disabled";
+                       phandle = <0x9b>;
+               };
+
+               dsi@7e700000 {
+                       compatible = "brcm,bcm2835-dsi1";
+                       reg = <0x7e700000 0x8c>;
+                       interrupts = <0x00 0x6c 0x04>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       #clock-cells = <0x01>;
+                       clocks = <0x03 0x23 0x03 0x30 0x03 0x32>;
+                       clock-names = "phy\0escape\0pixel";
+                       clock-output-names =

"dsi1_byte\0dsi1_ddr2\0dsi1_ddr";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +128 -0
+                       status = "disabled";
+                       phandle = <0x06>;
+               };
+
+               csi@7e800000 {
+                       compatible = "brcm,bcm2835-unicam";
+                       reg = <0x7e800000 0x800 0x7e802000 0x04>;
+                       interrupts = <0x00 0x66 0x04>;
+                       clocks = <0x03 0x2d>;
+                       clock-names = "lp";
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       #clock-cells = <0x01>;
+                       status = "disabled";
+                       power-domains = <0x13 0x0c>;
+                       phandle = <0x9c>;
+               };
+
+               csi@7e801000 {
+                       compatible = "brcm,bcm2835-unicam";
+                       reg = <0x7e801000 0x800 0x7e802004 0x04>;
+                       interrupts = <0x00 0x67 0x04>;
+                       clocks = <0x03 0x2e>;
+                       clock-names = "lp";
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       #clock-cells = <0x01>;
+                       status = "disabled";
+                       power-domains = <0x13 0x0d>;
+                       phandle = <0x9d>;
+
+                       port {
+
+                               endpoint {
+                                       data-lanes = <0x01 0x02>;
+                               };
+                       };
+               };
+
+               i2c@7e804000 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e804000 0x1000>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x14>;
+                       clock-frequency = <0x186a0>;
+                       phandle = <0x24>;
+               };
+
+               i2c@7e805000 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e805000 0x1000>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       clock-frequency = <0x186a0>;
+                       phandle = <0x15>;
+               };
+
+               vec@7e806000 {
+                       compatible = "brcm,bcm2835-vec";
+                       reg = <0x7e806000 0x1000>;
+                       clocks = <0x03 0x18>;
+                       interrupts = <0x00 0x7b 0x04>;
+                       status = "disabled";
+                       phandle = <0x9e>;
+               };
+
+               pixelvalve@7e807000 {
+                       compatible = "brcm,bcm2835-pixelvalve2";
+                       reg = <0x7e807000 0x100>;
+                       interrupts = <0x00 0x6a 0x04>;
+                       status = "disabled";
+                       phandle = <0x9f>;
+               };
+
+               hdmi@7e902000 {
+                       compatible = "brcm,bcm2835-hdmi";
+                       reg = <0x7e902000 0x600 0x7e808000 0x100>;
+                       interrupts = <0x00 0x68 0x04 0x00 0x69 0x04>;
+                       ddc = <0x15>;
+                       clocks = <0x03 0x10 0x03 0x19>;
+                       clock-names = "pixel\0hdmi";
+                       dmas = <0x0a 0x11>;
+                       dma-names = "audio-rx";
+                       status = "disabled";
+                       power-domains = <0x13 0x05>;
+                       phandle = <0xa0>;
+               };
+
+               usb@7e980000 {
+                       compatible = "brcm,bcm2708-usb";
+                       reg = <0x7e980000 0x10000 0x7e00b200 0x200>;
+                       interrupts = <0x00 0x49 0x04 0x00 0x28 0x04>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       clocks = <0x16>;
+                       clock-names = "otg";
+                       phys = <0x17>;
+                       phy-names = "usb2-phy";
+                       interrupt-names = "usb\0soft";
+                       power-domains = <0x13 0x06>;
+                       phandle = <0xa1>;
+               };
+
+               gpu {
+                       compatible = "brcm,bcm2835-vc4";
+                       status = "disabled";
+                       phandle = <0xa2>;
+               };
+
+               local_intc@40000000 {
+                       compatible = "brcm,bcm2836-l1-intc";
+                       reg = <0x40000000 0x100>;
+                       phandle = <0xa3>;
+               };
+
+               gic400@40041000 {
+                       interrupt-controller;
+                       #interrupt-cells = <0x03>;
+                       compatible = "arm,gic-400";
+                       reg = <0x40041000 0x1000 0x40042000 0x2000

0x40046000 0x2000 0x40048000 0x2000>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +16 -0
+                       phandle = <0x01>;
+               };
+
+               thermal@7d5d2200 {
+                       compatible = "brcm,avs-tmon-bcm2838";
+                       reg = <0x7d5d2200 0x2c>;
+                       interrupts = <0x00 0x89 0x04>;
+                       interrupt-names = "tmon";
+                       clocks = <0x03 0x1b>;
+                       #thermal-sensor-cells = <0x00>;
+                       status = "okay";
+                       phandle = <0x02>;
+               };
+
+               serial@7e201400 {
+                       compatible =

"brcm,bcm2835-pl011\0arm,pl011\0arm,primecell";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +11 -0
+                       reg = <0x7e201400 0x200>;
+                       interrupts = <0x00 0x79 0x04>;
+                       clocks = <0x03 0x13 0x03 0x14>;
+                       clock-names = "uartclk\0apb_pclk";
+                       arm,primecell-periphid = <0x241011>;
+                       status = "disabled";
+                       phandle = <0xa4>;
+               };
+
+               serial@7e201600 {
+                       compatible =

"brcm,bcm2835-pl011\0arm,pl011\0arm,primecell";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +11 -0
+                       reg = <0x7e201600 0x200>;
+                       interrupts = <0x00 0x79 0x04>;
+                       clocks = <0x03 0x13 0x03 0x14>;
+                       clock-names = "uartclk\0apb_pclk";
+                       arm,primecell-periphid = <0x241011>;
+                       status = "disabled";
+                       phandle = <0xa5>;
+               };
+
+               serial@7e201800 {
+                       compatible =

"brcm,bcm2835-pl011\0arm,pl011\0arm,primecell";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +11 -0
+                       reg = <0x7e201800 0x200>;
+                       interrupts = <0x00 0x79 0x04>;
+                       clocks = <0x03 0x13 0x03 0x14>;
+                       clock-names = "uartclk\0apb_pclk";
+                       arm,primecell-periphid = <0x241011>;
+                       status = "disabled";
+                       phandle = <0xa6>;
+               };
+
+               serial@7e201a00 {
+                       compatible =

"brcm,bcm2835-pl011\0arm,pl011\0arm,primecell";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +110 -0
+                       reg = <0x7e201a00 0x200>;
+                       interrupts = <0x00 0x79 0x04>;
+                       clocks = <0x03 0x13 0x03 0x14>;
+                       clock-names = "uartclk\0apb_pclk";
+                       arm,primecell-periphid = <0x241011>;
+                       status = "disabled";
+                       phandle = <0xa7>;
+               };
+
+               spi@7e204600 {
+                       compatible = "brcm,bcm2835-spi";
+                       reg = <0x7e204600 0x200>;
+                       interrupts = <0x00 0x76 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xa8>;
+               };
+
+               spi@7e204800 {
+                       compatible = "brcm,bcm2835-spi";
+                       reg = <0x7e204800 0x200>;
+                       interrupts = <0x00 0x76 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xa9>;
+               };
+
+               spi@7e204a00 {
+                       compatible = "brcm,bcm2835-spi";
+                       reg = <0x7e204a00 0x200>;
+                       interrupts = <0x00 0x76 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xaa>;
+               };
+
+               spi@7e204c00 {
+                       compatible = "brcm,bcm2835-spi";
+                       reg = <0x7e204c00 0x200>;
+                       interrupts = <0x00 0x76 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xab>;
+               };
+
+               i2c@7e205600 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e205600 0x200>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xac>;
+               };
+
+               i2c@7e205800 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e205800 0x200>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xad>;
+               };
+
+               i2c@7e205a00 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e205a00 0x200>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xae>;
+               };
+
+               i2c@7e205c00 {
+                       compatible = "brcm,bcm2835-i2c";
+                       reg = <0x7e205c00 0x200>;
+                       interrupts = <0x00 0x75 0x04>;
+                       clocks = <0x03 0x14>;
+                       #address-cells = <0x01>;
+                       #size-cells = <0x00>;
+                       status = "disabled";
+                       phandle = <0xaf>;
+               };
+
+               emmc2@7e340000 {
+                       compatible = "brcm,bcm2711-emmc2";
+                       status = "okay";
+                       interrupts = <0x00 0x7e 0x04>;
+                       clocks = <0x03 0x33>;
+                       reg = <0x7e340000 0x100>;
+                       broken-cd;
+                       vqmmc-supply = <0x18>;
+                       phandle = <0xb0>;
+               };
+
+               mmc@7e300000 {
+                       compatible =

"brcm,bcm2835-mmc\0brcm,bcm2835-sdhci";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +12 -0
+                       reg = <0x7e300000 0x100>;
+                       interrupts = <0x00 0x7e 0x04>;
+                       clocks = <0x03 0x1c>;
+                       dmas = <0x0a 0x0b>;
+                       dma-names = "rx-tx";
+                       brcm,overclock-50 = <0x00>;
+                       status = "disabled";
+                       phandle = <0x28>;
+               };
+
+               mmcnr@7e300000 {
+                       compatible =

"brcm,bcm2835-mmc\0brcm,bcm2835-sdhci";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +51 -0
+                       reg = <0x7e300000 0x100>;
+                       interrupts = <0x00 0x7e 0x04>;
+                       clocks = <0x03 0x1c>;
+                       dmas = <0x0a 0x0b>;
+                       dma-names = "rx-tx";
+                       brcm,overclock-50 = <0x00>;
+                       non-removable;
+                       status = "okay";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x19>;
+                       bus-width = <0x04>;
+                       phandle = <0x29>;
+               };
+
+               firmwarekms@7e600000 {
+                       compatible = "raspberrypi,rpi-firmware-kms";
+                       reg = <0x7e600000 0x100>;
+                       interrupts = <0x00 0x70 0x04>;
+                       brcm,firmware = <0x07>;
+                       status = "disabled";
+                       phandle = <0xb1>;
+               };
+
+               smi@7e600000 {
+                       compatible = "brcm,bcm2835-smi";
+                       reg = <0x7e600000 0x100>;
+                       interrupts = <0x00 0x70 0x04>;
+                       clocks = <0x03 0x2a>;
+                       assigned-clocks = <0x03 0x2a>;
+                       assigned-clock-rates = <0x7735940>;
+                       dmas = <0x0a 0x04>;
+                       dma-names = "rx-tx";
+                       status = "disabled";
+                       phandle = <0xb2>;
+               };
+
+               axiperf {
+                       compatible = "brcm,bcm2835-axiperf";
+                       reg = <0x7e009800 0x100 0x7ee08000 0x100>;
+                       firmware = <0x07>;
+                       status = "disabled";
+                       phandle = <0x2a>;
+               };
+
+               gpiomem {
+                       compatible = "brcm,bcm2835-gpiomem";
+                       reg = <0x7e200000 0x1000>;
+               };
+
+               firmware {
+                       compatible =

"raspberrypi,bcm2835-firmware\0simple-bus";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +92 -0
+                       #address-cells = <0x00>;
+                       #size-cells = <0x00>;
+                       mboxes = <0x1a>;
+                       phandle = <0x07>;
+
+                       expgpio {
+                               compatible = "raspberrypi,firmware-gpio";
+                               gpio-controller;
+                               #gpio-cells = <0x02>;
+                               status = "okay";
+                               phandle = <0x2d>;
+                       };
+               };
+
+               power {
+                       compatible = "raspberrypi,bcm2835-power";
+                       firmware = <0x07>;
+                       #power-domain-cells = <0x01>;
+                       phandle = <0x13>;
+               };
+
+               fb {
+                       compatible = "brcm,bcm2708-fb";
+                       firmware = <0x07>;
+                       status = "okay";
+                       phandle = <0xb3>;
+               };
+
+               vcsm {
+                       compatible = "raspberrypi,bcm2835-vcsm";
+                       firmware = <0x07>;
+                       status = "okay";
+                       phandle = <0xb4>;
+               };
+
+               audio {
+                       compatible = "brcm,bcm2835-audio";
+                       brcm,pwm-channels = <0x08>;
+                       status = "disabled";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <0x1b>;
+                       phandle = <0x25>;
+               };
+
+               sound {
+                       status = "disabled";
+                       phandle = <0xb5>;
+               };
+
+               virtgpio {
+                       compatible = "brcm,bcm2835-virtgpio";
+                       gpio-controller;
+                       #gpio-cells = <0x02>;
+                       firmware = <0x07>;
+                       status = "okay";
+                       phandle = <0xb6>;
+               };
+       };
+
+       clocks {
+               compatible = "simple-bus";
+               #address-cells = <0x01>;
+               #size-cells = <0x00>;
+
+               clock@3 {
+                       compatible = "fixed-clock";
+                       reg = <0x03>;
+                       #clock-cells = <0x00>;
+                       clock-output-names = "osc";
+                       clock-frequency = <0x337f980>;
+                       phandle = <0x04>;
+               };
+
+               clock@4 {
+                       compatible = "fixed-clock";
+                       reg = <0x04>;
+                       #clock-cells = <0x00>;
+                       clock-output-names = "otg";
+                       clock-frequency = <0x1c9c3800>;
+                       phandle = <0x16>;
+               };
+       };
+
+       phy {
+               compatible = "usb-nop-xceiv";
+               #phy-cells = <0x00>;
+               phandle = <0x17>;
+       };
+
+       arm-pmu {
+               compatible = "arm,cortex-a72-pmu\0arm,cortex-a53-pmu";
+               interrupts = <0x00 0x10 0x04 0x00 0x11 0x04 0x00 0x12 0x04

0x00 0x13 0x04>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +5 -0
+       };
+
+       timer {
+               compatible = "arm,armv7-timer";
+               interrupts = <0x01 0x0d 0xf08 0x01 0x0e 0xf08 0x01 0x0b

0xf08 0x01 0x0a 0xf08>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +52 -0
+               arm,cpu-registers-not-fw-configured;
+               always-on;
+       };
+
+       cpus {
+               #address-cells = <0x01>;
+               #size-cells = <0x00>;
+               enable-method = "brcm,bcm2836-smp";
+               phandle = <0xb7>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       reg = <0x00>;
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x00 0xd8>;
+                       phandle = <0xb8>;
+               };
+
+               cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       reg = <0x01>;
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x00 0xe0>;
+                       phandle = <0xb9>;
+               };
+
+               cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       reg = <0x02>;
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x00 0xe8>;
+                       phandle = <0xba>;
+               };
+
+               cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       reg = <0x03>;
+                       enable-method = "spin-table";
+                       cpu-release-addr = <0x00 0xf0>;
+                       phandle = <0xbb>;
+               };
+       };
+
+       v3dbus {
+               compatible = "simple-bus";
+               #address-cells = <0x01>;
+               #size-cells = <0x01>;
+               ranges = <0x7c500000 0x00 0xfc500000 0x3300000 0x40000000

0x00 0xff800000 0x800000>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +29 -0
+               dma-ranges = <0x00 0x00 0x00 0x3c000000>;
+
+               v3d@7ec04000 {
+                       compatible = "brcm,2711-v3d";
+                       reg = <0x7ec00000 0x4000 0x7ec04000 0x4000>;
+                       reg-names = "hub\0core0";
+                       power-domains = <0x1c 0x01>;
+                       resets = <0x1c 0x00>;
+                       clocks = <0x03 0x15>;
+                       interrupts = <0x00 0x4a 0x04>;
+                       status = "okay";
+                       phandle = <0xbc>;
+               };
+       };
+
+       scb {
+               compatible = "simple-bus";
+               #address-cells = <0x02>;
+               #size-cells = <0x01>;
+               ranges = <0x00 0x7c000000 0x00 0xfc000000
+                       0x3800000 0x00 0x40000000 0x00
+                       0xff800000 0x800000 0x06 0x00
+                       0x06 0x00 0x40000000 0x00
+                       0x00 0x00 0x00 0xfc000000>;
+               dma-ranges = <0x00 0x00 0x00 0x00 0xfc000000>;
+               phandle = <0xbd>;
+
+               pcie@7d500000 {
+                       reg = <0x00 0x7d500000 0x9310 0x00 0x7e00f300

0x20>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +7 -0
+                       msi-controller;
+                       msi-parent = <0x1d>;
+                       #address-cells = <0x03>;
+                       #interrupt-cells = <0x01>;
+                       #size-cells = <0x02>;
+                       bus-range = <0x00 0x01>;
+                       compatible =

"brcm,bcm7211-pcie\0brcm,bcm7445-pcie\0brcm,pci-plat-dev";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +12 -0
+                       max-link-speed = <0x02>;
+                       tot-num-pcie = <0x01>;
+                       linux,pci-domain = <0x00>;
+                       interrupts = <0x00 0x94 0x04 0x00 0x94 0x04>;
+                       interrupt-names = "pcie\0msi";
+                       interrupt-map-mask = <0x00 0x00 0x00 0x07>;
+                       interrupt-map = <0x00 0x00 0x00 0x01
+                               0x01 0x00 0x8f 0x04 0x00 0x00 0x00 0x02
+                               0x01 0x00 0x90 0x04 0x00 0x00 0x00 0x03
+                               0x01 0x00 0x91 0x04 0x00 0x00 0x00 0x04
+                               0x01 0x00 0x92 0x04>;
+                       ranges = <0x2000000 0x00 0xf8000000 0x06 0x00 0x00

0x4000000>;
+ dma-ranges = <0x2000000 0x00 0x00 0x00 0x00 0x01
0x00>;

arch/arm/dts/bcm2711-rpi-4-b.dts new file +24 -0
+                       status = "okay";
+                       phandle = <0x1d>;
+               };
+
+               genet@7d580000 {
+                       compatible = "brcm,genet-v5";
+                       reg = <0x00 0x7d580000 0x10000>;
+                       status = "okay";
+                       #address-cells = <0x01>;
+                       #size-cells = <0x01>;
+                       interrupts = <0x00 0x9d 0x04 0x00 0x9e 0x04>;
+                       phy-handle = <0x1e>;
+                       phy-mode = "rgmii";
+                       phandle = <0xbe>;
+
+                       mdio@e14 {
+                               #address-cells = <0x00>;
+                               #size-cells = <0x01>;
+                               compatible = "brcm,genet-mdio-v5";
+                               reg = <0xe14 0x08>;
+                               reg-names = "mdio";
+
+                               genet-phy@0 {
+                                       compatible =

"ethernet-phy-ieee802.3-c22";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +11 -0
+                                       max-speed = <0x3e8>;
+                                       reg = <0x01>;
+                                       phandle = <0x1e>;
+                               };
+                       };
+               };
+
+               dma@7e007b00 {
+                       compatible = "brcm,bcm2838-dma";
+                       reg = <0x00 0x7e007b00 0x400>;
+                       interrupts = <0x00 0x59 0x04 0x00 0x5a 0x04 0x00

0x5b

arch/arm/dts/bcm2711-rpi-4-b.dts new file +92 -0
+                               0x04 0x00 0x5c 0x04>;
+                       interrupt-names = "dma11\0dma12\0dma13\0dma14";
+                       #dma-cells = <0x01>;
+                       brcm,dma-channel-mask = <0x7000>;
+                       phandle = <0xbf>;
+               };
+
+               xhci@7e9c0000 {
+                       compatible = "generic-xhci";
+                       status = "disabled";
+                       reg = <0x00 0x7e9c0000 0x100000>;
+                       interrupts = <0x00 0xb0 0x04>;
+                       phandle = <0xc0>;
+               };
+
+               mailbox@7e00b840 {
+                       compatible = "brcm,bcm2838-vchiq";
+                       reg = <0x00 0x7e00b840 0x3c>;
+                       interrupts = <0x00 0x22 0x04>;
+                       phandle = <0xc1>;
+               };
+
+               hevc-decoder@7eb00000 {
+                       compatible = "raspberrypi,argon-hevc-decoder";
+                       reg = <0x00 0x7eb00000 0x10000>;
+                       status = "okay";
+               };
+
+               argon-local-intc@7eb10000 {
+                       compatible = "raspberrypi,argon-local-intc";
+                       reg = <0x00 0x7eb10000 0x1000>;
+                       status = "okay";
+                       interrupts = <0x00 0x62 0x04>;
+               };
+
+               h264-decoder@7eb20000 {
+                       compatible = "raspberrypi,argon-h264-decoder";
+                       reg = <0x00 0x7eb20000 0x10000>;
+                       status = "okay";
+               };
+
+               vp9-decoder@7eb30000 {
+                       compatible = "raspberrypi,argon-vp9-decoder";
+                       reg = <0x00 0x7eb30000 0x10000>;
+                       status = "okay";
+               };
+       };
+
+       fixedregulator_5v0 {
+               compatible = "regulator-fixed";
+               regulator-name = "5v0";
+               regulator-min-microvolt = <0x4c4b40>;
+               regulator-max-microvolt = <0x4c4b40>;
+               regulator-always-on;
+               phandle = <0x2e>;
+       };
+
+       fixedregulator_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "3v3";
+               regulator-min-microvolt = <0x325aa0>;
+               regulator-max-microvolt = <0x325aa0>;
+               regulator-always-on;
+               phandle = <0xc2>;
+       };
+
+       __overrides__ {
+               cam0-pwdn-ctrl;
+               cam0-pwdn;
+               cam0-led-ctrl;
+               cam0-led;
+               cache_line_size;
+               uart0 = [00 00 00 1f 73 74 61 74 75 73 00];
+               uart1 = "\0\0\0 status";
+               i2s = "\0\0\0!status";
+               spi = "\0\0\0\"status";
+               i2c0 = "\0\0\0#status";
+               i2c1 = "\0\0\0$status";
+               i2c2_iknowwhatimdoing = [00 00 00 15 73 74 61 74 75 73 00];
+               i2c0_baudrate = "\0\0\0#clock-frequency:0";
+               i2c1_baudrate = "\0\0\0$clock-frequency:0";
+               i2c2_baudrate = [00 00 00 15 63 6c 6f 63
+                       6b 2d 66 72 65 71 75 65
+                       6e 63 79 3a 30 00];
+               audio = "\0\0\0%status";
+               watchdog = [00 00 00 1c 73 74 61 74 75 73 00];
+               random = "\0\0\0&status";
+               sd_overclock = "\0\0\0'brcm,overclock-50:0";
+               sd_force_pio = "\0\0\0'brcm,force-pio?";
+               sd_pio_limit = "\0\0\0'brcm,pio-limit:0";
+               sd_debug = "\0\0\0'brcm,debug";
+               sdio_overclock =

"\0\0\0(brcm,overclock-50:0\0\0\0\0)brcm,overclock-50:0";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +94 -0
+               axiperf = "\0\0\0*status";
+               arm_freq;
+               act_led_gpio = "\0\0\0+gpios:4";
+               act_led_activelow = "\0\0\0+gpios:8";
+               act_led_trigger = "\0\0\0+linux,default-trigger";
+               pwr_led_gpio = "\0\0\0,gpios:4";
+               pwr_led_activelow = "\0\0\0,gpios:8";
+               pwr_led_trigger = "\0\0\0,linux,default-trigger";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x00 0x00 0x00>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               phandle = <0xc3>;
+
+               act {
+                       label = "led0";
+                       linux,default-trigger = "mmc0";
+                       gpios = <0x0f 0x2a 0x00>;
+                       phandle = <0x2b>;
+               };
+
+               pwr {
+                       label = "led1";
+                       linux,default-trigger = "input";
+                       gpios = <0x2d 0x02 0x00>;
+                       phandle = <0x2c>;
+               };
+       };
+
+       sd_io_1v8_reg {
+               status = "okay";
+               compatible = "regulator-gpio";
+               vin-supply = <0x2e>;
+               regulator-name = "vdd-sd-io";
+               regulator-min-microvolt = <0x1b7740>;
+               regulator-max-microvolt = <0x325aa0>;
+               regulator-boot-on;
+               regulator-always-on;
+               regulator-settling-time-us = <0x1388>;
+               gpios = <0x2d 0x04 0x00>;
+               states = <0x1b7740 0x01 0x325aa0 0x00>;
+               phandle = <0x18>;
+       };
+
+       __symbols__ {
+               cpu_thermal = "/thermal-zones/cpu-thermal";
+               soc = "/soc";
+               txp = "/soc/txp@7e004000";
+               dma = "/soc/dma@7e007000";
+               watchdog = "/soc/watchdog@7e100000";
+               pm = "/soc/watchdog@7e100000";
+               clocks = "/soc/cprman@7e101000";
+               random = "/soc/rng@7e104000";
+               rng = "/soc/rng@7e104000";
+               mailbox = "/soc/mailbox@7e00b880";
+               gpio = "/soc/gpio@7e200000";
+               dpi_gpio0 = "/soc/gpio@7e200000/dpi_gpio0";
+               emmc_gpio22 = "/soc/gpio@7e200000/emmc_gpio22";
+               emmc_gpio34 = "/soc/gpio@7e200000/emmc_gpio34";
+               emmc_gpio48 = "/soc/gpio@7e200000/emmc_gpio48";
+               gpclk0_gpio4 = "/soc/gpio@7e200000/gpclk0_gpio4";
+               gpclk1_gpio5 = "/soc/gpio@7e200000/gpclk1_gpio5";
+               gpclk1_gpio42 = "/soc/gpio@7e200000/gpclk1_gpio42";
+               gpclk1_gpio44 = "/soc/gpio@7e200000/gpclk1_gpio44";
+               gpclk2_gpio6 = "/soc/gpio@7e200000/gpclk2_gpio6";
+               gpclk2_gpio43 = "/soc/gpio@7e200000/gpclk2_gpio43";
+               i2c0_gpio0 = "/soc/gpio@7e200000/i2c0_gpio0";
+               i2c0_gpio28 = "/soc/gpio@7e200000/i2c0_gpio28";
+               i2c0_gpio44 = "/soc/gpio@7e200000/i2c0_gpio44";
+               i2c1_gpio2 = "/soc/gpio@7e200000/i2c1_gpio2";
+               i2c1_gpio44 = "/soc/gpio@7e200000/i2c1_gpio44";
+               jtag_gpio22 = "/soc/gpio@7e200000/jtag_gpio22";
+               pcm_gpio18 = "/soc/gpio@7e200000/pcm_gpio18";
+               pcm_gpio28 = "/soc/gpio@7e200000/pcm_gpio28";
+               pwm0_gpio12 = "/soc/gpio@7e200000/pwm0_gpio12";
+               pwm0_gpio18 = "/soc/gpio@7e200000/pwm0_gpio18";
+               pwm0_gpio40 = "/soc/gpio@7e200000/pwm0_gpio40";
+               pwm1_gpio13 = "/soc/gpio@7e200000/pwm1_gpio13";
+               pwm1_gpio19 = "/soc/gpio@7e200000/pwm1_gpio19";
+               pwm1_gpio41 = "/soc/gpio@7e200000/pwm1_gpio41";
+               pwm1_gpio45 = "/soc/gpio@7e200000/pwm1_gpio45";
+               sdhost_pins = "/soc/gpio@7e200000/sdhost_gpio48";
+               sdhost_gpio48 = "/soc/gpio@7e200000/sdhost_gpio48";
+               spi0_gpio7 = "/soc/gpio@7e200000/spi0_gpio7";
+               spi0_gpio35 = "/soc/gpio@7e200000/spi0_gpio35";
+               spi1_gpio16 = "/soc/gpio@7e200000/spi1_gpio16";
+               spi2_gpio40 = "/soc/gpio@7e200000/spi2_gpio40";
+               uart0_gpio14 = "/soc/gpio@7e200000/uart0_gpio14";
+               uart0_ctsrts_gpio16 = "/soc/gpio@7e200000

/uart0_ctsrts_gpio16";
+ uart0_ctsrts_gpio30 = "/soc/gpio@7e200000
/uart0_ctsrts_gpio30";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +3 -0
+               uart0_gpio32 = "/soc/gpio@7e200000/uart0_gpio32";
+               uart0_gpio36 = "/soc/gpio@7e200000/uart0_gpio36";
+               uart0_ctsrts_gpio38 = "/soc/gpio@7e200000

/uart0_ctsrts_gpio38";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart1_gpio14 = "/soc/gpio@7e200000/uart1_gpio14";
+               uart1_ctsrts_gpio16 = "/soc/gpio@7e200000

/uart1_ctsrts_gpio16";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart1_gpio32 = "/soc/gpio@7e200000/uart1_gpio32";
+               uart1_ctsrts_gpio30 = "/soc/gpio@7e200000

/uart1_ctsrts_gpio30";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart1_gpio40 = "/soc/gpio@7e200000/uart1_gpio40";
+               uart1_ctsrts_gpio42 = "/soc/gpio@7e200000

/uart1_ctsrts_gpio42";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +24 -0
+               gpclk0_gpio49 = "/soc/gpio@7e200000/gpclk0_gpio49";
+               gpclk1_gpio50 = "/soc/gpio@7e200000/gpclk1_gpio50";
+               gpclk2_gpio51 = "/soc/gpio@7e200000/gpclk2_gpio51";
+               i2c0_gpio46 = "/soc/gpio@7e200000/i2c0_gpio46";
+               i2c1_gpio46 = "/soc/gpio@7e200000/i2c1_gpio46";
+               i2c3_gpio2 = "/soc/gpio@7e200000/i2c3_gpio2";
+               i2c3_gpio4 = "/soc/gpio@7e200000/i2c3_gpio4";
+               i2c4_gpio6 = "/soc/gpio@7e200000/i2c4_gpio6";
+               i2c4_gpio8 = "/soc/gpio@7e200000/i2c4_gpio8";
+               i2c5_gpio10 = "/soc/gpio@7e200000/i2c5_gpio10";
+               i2c5_gpio12 = "/soc/gpio@7e200000/i2c5_gpio12";
+               i2c6_gpio0 = "/soc/gpio@7e200000/i2c6_gpio0";
+               i2c6_gpio22 = "/soc/gpio@7e200000/i2c6_gpio22";
+               i2c_slave_gpio8 = "/soc/gpio@7e200000/i2c_slave_gpio8";
+               jtag_gpio48 = "/soc/gpio@7e200000/jtag_gpio48";
+               mii_gpio28 = "/soc/gpio@7e200000/mii_gpio28";
+               mii_gpio36 = "/soc/gpio@7e200000/mii_gpio36";
+               pcm_gpio50 = "/soc/gpio@7e200000/pcm_gpio50";
+               pwm0_gpio52 = "/soc/gpio@7e200000/pwm0_gpio52";
+               pwm1_gpio53 = "/soc/gpio@7e200000/pwm1_gpio53";
+               rgmii_gpio35 = "/soc/gpio@7e200000/rgmii_gpio35";
+               rgmii_irq_gpio34 = "/soc/gpio@7e200000/rgmii_irq_gpio34";
+               rgmii_irq_gpio39 = "/soc/gpio@7e200000/rgmii_irq_gpio39";
+               rgmii_mdio_gpio28 = "/soc/gpio@7e200000

/rgmii_mdio_gpio28";
+ rgmii_mdio_gpio37 = "/soc/gpio@7e200000
/rgmii_mdio_gpio37";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +8 -0
+               spi0_gpio46 = "/soc/gpio@7e200000/spi0_gpio46";
+               spi2_gpio46 = "/soc/gpio@7e200000/spi2_gpio46";
+               spi3_gpio0 = "/soc/gpio@7e200000/spi3_gpio0";
+               spi4_gpio4 = "/soc/gpio@7e200000/spi4_gpio4";
+               spi5_gpio12 = "/soc/gpio@7e200000/spi5_gpio12";
+               spi6_gpio18 = "/soc/gpio@7e200000/spi6_gpio18";
+               uart2_gpio0 = "/soc/gpio@7e200000/uart2_gpio0";
+               uart2_ctsrts_gpio2 = "/soc/gpio@7e200000

/uart2_ctsrts_gpio2";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart3_gpio4 = "/soc/gpio@7e200000/uart3_gpio4";
+               uart3_ctsrts_gpio6 = "/soc/gpio@7e200000

/uart3_ctsrts_gpio6";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart4_gpio8 = "/soc/gpio@7e200000/uart4_gpio8";
+               uart4_ctsrts_gpio10 = "/soc/gpio@7e200000

/uart4_ctsrts_gpio10";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +2 -0
+               uart5_gpio12 = "/soc/gpio@7e200000/uart5_gpio12";
+               uart5_ctsrts_gpio14 = "/soc/gpio@7e200000

/uart5_ctsrts_gpio14";

arch/arm/dts/bcm2711-rpi-4-b.dts new file +108 -0
+               dpi_18bit_gpio0 = "/soc/gpio@7e200000/dpi_18bit_gpio0";
+               spi0_pins = "/soc/gpio@7e200000/spi0_pins";
+               spi0_cs_pins = "/soc/gpio@7e200000/spi0_cs_pins";
+               spi3_pins = "/soc/gpio@7e200000/spi3_pins";
+               spi3_cs_pins = "/soc/gpio@7e200000/spi3_cs_pins";
+               spi4_pins = "/soc/gpio@7e200000/spi4_pins";
+               spi4_cs_pins = "/soc/gpio@7e200000/spi4_cs_pins";
+               spi5_pins = "/soc/gpio@7e200000/spi5_pins";
+               spi5_cs_pins = "/soc/gpio@7e200000/spi5_cs_pins";
+               spi6_pins = "/soc/gpio@7e200000/spi6_pins";
+               spi6_cs_pins = "/soc/gpio@7e200000/spi6_cs_pins";
+               i2c0_pins = "/soc/gpio@7e200000/i2c0";
+               i2c1_pins = "/soc/gpio@7e200000/i2c1";
+               i2c3_pins = "/soc/gpio@7e200000/i2c3";
+               i2c4_pins = "/soc/gpio@7e200000/i2c4";
+               i2c5_pins = "/soc/gpio@7e200000/i2c5";
+               i2c6_pins = "/soc/gpio@7e200000/i2c6";
+               i2s_pins = "/soc/gpio@7e200000/i2s";
+               sdio_pins = "/soc/gpio@7e200000/sdio_pins";
+               bt_pins = "/soc/gpio@7e200000/bt_pins";
+               uart0_pins = "/soc/gpio@7e200000/uart0_pins";
+               uart1_pins = "/soc/gpio@7e200000/uart1_pins";
+               uart2_pins = "/soc/gpio@7e200000/uart2_pins";
+               uart3_pins = "/soc/gpio@7e200000/uart3_pins";
+               uart4_pins = "/soc/gpio@7e200000/uart4_pins";
+               uart5_pins = "/soc/gpio@7e200000/uart5_pins";
+               audio_pins = "/soc/gpio@7e200000/audio_pins";
+               uart0 = "/soc/serial@7e201000";
+               sdhost = "/soc/mmc@7e202000";
+               i2s = "/soc/i2s@7e203000";
+               spi0 = "/soc/spi@7e204000";
+               spi = "/soc/spi@7e204000";
+               spidev0 = "/soc/spi@7e204000/spidev@0";
+               spidev1 = "/soc/spi@7e204000/spidev@1";
+               i2c0 = "/soc/i2c@7e205000";
+               pixelvalve0 = "/soc/pixelvalve@7e206000";
+               pixelvalve1 = "/soc/pixelvalve@7e207000";
+               dpi = "/soc/dpi@7e208000";
+               dsi0 = "/soc/dsi@7e209000";
+               aux = "/soc/aux@7e215000";
+               uart1 = "/soc/serial@7e215040";
+               spi1 = "/soc/spi@7e215080";
+               spi2 = "/soc/spi@7e2150c0";
+               pwm = "/soc/pwm@7e20c000";
+               hvs = "/soc/hvs@7e400000";
+               dsi1 = "/soc/dsi@7e700000";
+               csi0 = "/soc/csi@7e800000";
+               csi1 = "/soc/csi@7e801000";
+               i2c1 = "/soc/i2c@7e804000";
+               i2c2 = "/soc/i2c@7e805000";
+               vec = "/soc/vec@7e806000";
+               pixelvalve2 = "/soc/pixelvalve@7e807000";
+               hdmi = "/soc/hdmi@7e902000";
+               usb = "/soc/usb@7e980000";
+               vc4 = "/soc/gpu";
+               local_intc = "/soc/local_intc@40000000";
+               gicv2 = "/soc/gic400@40041000";
+               thermal = "/soc/thermal@7d5d2200";
+               uart2 = "/soc/serial@7e201400";
+               uart3 = "/soc/serial@7e201600";
+               uart4 = "/soc/serial@7e201800";
+               uart5 = "/soc/serial@7e201a00";
+               spi3 = "/soc/spi@7e204600";
+               spi4 = "/soc/spi@7e204800";
+               spi5 = "/soc/spi@7e204a00";
+               spi6 = "/soc/spi@7e204c00";
+               i2c3 = "/soc/i2c@7e205600";
+               i2c4 = "/soc/i2c@7e205800";
+               i2c5 = "/soc/i2c@7e205a00";
+               i2c6 = "/soc/i2c@7e205c00";
+               emmc2 = "/soc/emmc2@7e340000";
+               mmc = "/soc/mmc@7e300000";
+               mmcnr = "/soc/mmcnr@7e300000";
+               firmwarekms = "/soc/firmwarekms@7e600000";
+               smi = "/soc/smi@7e600000";
+               axiperf = "/soc/axiperf";
+               firmware = "/soc/firmware";
+               expgpio = "/soc/firmware/expgpio";
+               power = "/soc/power";
+               fb = "/soc/fb";
+               vcsm = "/soc/vcsm";
+               audio = "/soc/audio";
+               sound = "/soc/sound";
+               virtgpio = "/soc/virtgpio";
+               clk_osc = "/clocks/clock@3";
+               clk_usb = "/clocks/clock@4";
+               usbphy = "/phy";
+               cpus = "/cpus";
+               cpu0 = "/cpus/cpu@0";
+               cpu1 = "/cpus/cpu@1";
+               cpu2 = "/cpus/cpu@2";
+               cpu3 = "/cpus/cpu@3";
+               v3d = "/v3dbus/v3d@7ec04000";
+               scb = "/scb";
+               pcie_0 = "/scb/pcie@7d500000";
+               genet = "/scb/genet@7d580000";
+               phy1 = "/scb/genet@7d580000/mdio@e14/genet-phy@0";
+               dma40 = "/scb/dma@7e007b00";
+               xhci = "/scb/xhci@7e9c0000";
+               vchiq = "/scb/mailbox@7e00b840";
+               vdd_5v0_reg = "/fixedregulator_5v0";
+               vdd_3v3_reg = "/fixedregulator_3v3";
+               leds = "/leds";
+               act_led = "/leds/act";
+               pwr_led = "/leds/pwr";
+               sd_io_1v8_reg = "/sd_io_1v8_reg";
+       };
+};
configs/rpi_4_32b_defconfig +1 -0
index d592df50706..31d77dbe4eb 100644
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000
 CONFIG_TARGET_RPI_4_32B=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
+CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_OF_BOARD_SETUP=y
configs/rpi_4_defconfig +1 -0
index ab5cc90d912..a2a88d66dbd 100644
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000
 CONFIG_TARGET_RPI_4=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
+CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_OF_BOARD_SETUP=y
configs/rpi_arm64_defconfig +0 -0
index 382d99dc2eb..fb8abbccc45 100644
@@ -6,6 +6,7 @@ CONFIG_S
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#19 lore raw

PATCH 8/16 arm: vexpress: Add a devicetree file for juno

In reply to Simon Glass

Add this file, obtained from the Linaro website[1], so there is a reference file in the U-Boot tree.

Note that U-Boot does not normally need this at runtime, since CONFIG_OF_BOARD is enabled. The previous firmware stage provides a devicetree at runtime.

[1] https://releases.linaro.org/android/reference-lcr/juno/7.1-17.05/

---

 arch/arm/dts/Makefile                  |    3 +
 arch/arm/dts/juno-r2.dts               | 1038 ++++++++++++++++++++++++
 configs/vexpress_aemv8a_juno_defconfig |    1 +
 3 files changed, 1042 insertions(+)
 create mode 100644 arch/arm/dts/juno-r2.dts
arch/arm/dts/Makefile +3 -0
index efc01a70bf2..57f06670b23 100644
@@ -1134,7 +1134,10 @@ dtb-$(CONFIG_TARGET_GE_BX50V3) += \
 dtb-$(CONFIG_TARGET_GE_B1X5V2) += imx6dl-b1x5v2.dtb
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 
+# TODO(Linus Walleij <[email protected]>): Should us a single vexpress
+# Kconfig option to build all of these. See examples above.
 dtb-$(CONFIG_TARGET_VEXPRESS_CA9X4) += vexpress-v2p-ca9.dtb
+dtb-$(CONFIG_TARGET_VEXPRESS64_JUNO) += juno-r2.dtb
 
 dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb
 
arch/arm/dts/juno-r2.dts new file +1038 -0

1,038 lines not on this page · raw message

configs/vexpress_aemv8a_juno_defconfig +1 -0
index 3125adaf5c4..95b4fe2c0a9 100644
@@ -52,3 +52,4 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_GENERIC=y
+CONFIG_DEFAULT_DEVICE_TREE="juno-r2"
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#20 lore raw

PATCH 9/16 arm: xenguest_arm64: Add a fake devicetree file

In reply to Simon Glass

Add an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.

The build instructions in U-Boot do not provide enough detail to build a useful devicetree, unfortunately.

---

 arch/arm/dts/Makefile            |  2 ++
 arch/arm/dts/xenguest-arm64.dts  | 15 +++++++++++++++
 configs/xenguest_arm64_defconfig |  1 +
 3 files changed, 18 insertions(+)
 create mode 100644 arch/arm/dts/xenguest-arm64.dts
arch/arm/dts/Makefile +2 -0
index 57f06670b23..f09a81eea8e 100644
@@ -1125,6 +1125,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt8516-pumpkin.dtb \
 	mt8518-ap1-emmc.dtb
 
+dtb-$(CONFIG_XEN) += xenguest-arm64.dtb
+
 dtb-$(CONFIG_TARGET_GE_BX50V3) += \
 	imx6q-bx50v3.dtb \
 	imx6q-b850v3.dtb \
arch/arm/dts/xenguest-arm64.dts new file +15 -0
new file mode 100644
index 00000000000..52d3b062248
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dummy devicetre file for xenguest_arm64
+ *
+ * This is required to make the board build with CONFIG OF_SEPARATE
+ * Build instructions at xenguest_arm64.rst are inadequate for obtaining a real
+ * devicetree.
+ *
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+};
configs/xenguest_arm64_defconfig +1 -0
index b72e40a1399..8e32cd63229 100644
@@ -4,6 +4,7 @@ CONFIG_TARGET_XENGUEST_ARM64=y
 CONFIG_SYS_TEXT_BASE=0x40080000
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SYS_MALLOC_LEN=0x2000000
+CONFIG_DEFAULT_DEVICE_TREE="xenguest-arm64"
 CONFIG_IDENT_STRING=" xenguest"
 CONFIG_SYS_LOAD_ADDR=0x40000000
 CONFIG_BOOTDELAY=10
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#21 lore raw

PATCH 10/16 arm: octeontx: Add a fake devicetree file

In reply to Simon Glass

Add an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.

Unfortunately there are no build instructions in the U-Boot tree to enable a real file to be created.

---

 arch/arm/dts/Makefile            |  3 +++
 arch/arm/dts/octeontx.dts        | 14 ++++++++++++++
 configs/octeontx2_95xx_defconfig |  1 +
 configs/octeontx2_96xx_defconfig |  1 +
 configs/octeontx_81xx_defconfig  |  1 +
 configs/octeontx_83xx_defconfig  |  1 +
 6 files changed, 21 insertions(+)
 create mode 100644 arch/arm/dts/octeontx.dts
arch/arm/dts/Makefile +3 -0
index f09a81eea8e..0fec648dd77 100644
@@ -1127,6 +1127,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 
 dtb-$(CONFIG_XEN) += xenguest-arm64.dtb
 
+dtb-$(CONFIG_ARCH_OCTEONTX) += octeontx.dtb
+dtb-$(CONFIG_ARCH_OCTEONTX2) += octeontx.dtb
+
 dtb-$(CONFIG_TARGET_GE_BX50V3) += \
 	imx6q-bx50v3.dtb \
 	imx6q-b850v3.dtb \
arch/arm/dts/octeontx.dts new file +14 -0
new file mode 100644
index 00000000000..60a15f5df23
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dummy devicetre file for octeontx2 boards
+ *
+ * This is required to make the board build with CONFIG OF_SEPARATE
+ * I could not find any in-tree documentation at all so this is a dummy file.
+ *
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+};
configs/octeontx2_95xx_defconfig +1 -0
index 6d8457f1d07..fac4c50aec4 100644
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX2_95XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx2_96xx_defconfig +1 -0
index b72caef77d8..db883b5542c 100644
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX2_96XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx_81xx_defconfig +1 -0
index 52678d59ff1..8309c29c091 100644
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX_81XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx_83xx_defconfig +1 -0
index 3890c1e97d4..dae1d4880f8 100644
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX_83XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#22 lore raw

Re: [PATCH 10/16] arm: octeontx: Add a fake devicetree file

Hi Simon

It’s even in the title!

The idea of having a DT in dts for ALL boards is not properly rooted. You may add some sample dts with warnings in the doc tree though.

Quoted 108 lines · Simon Glass

Add an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.

Unfortunately there are no build instructions in the U-Boot tree to enable a real file to be created.

---

 arch/arm/dts/Makefile            |  3 +++
 arch/arm/dts/octeontx.dts        | 14 ++++++++++++++
 configs/octeontx2_95xx_defconfig |  1 +
 configs/octeontx2_96xx_defconfig |  1 +
 configs/octeontx_81xx_defconfig  |  1 +
 configs/octeontx_83xx_defconfig  |  1 +
 6 files changed, 21 insertions(+)
 create mode 100644 arch/arm/dts/octeontx.dts
arch/arm/dts/Makefile +3 -0
index f09a81eea8e..0fec648dd77 100644
@@ -1127,6 +1127,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 
 dtb-$(CONFIG_XEN) += xenguest-arm64.dtb
 
+dtb-$(CONFIG_ARCH_OCTEONTX) += octeontx.dtb
+dtb-$(CONFIG_ARCH_OCTEONTX2) += octeontx.dtb
+
 dtb-$(CONFIG_TARGET_GE_BX50V3) += \
        imx6q-bx50v3.dtb \
        imx6q-b850v3.dtb \
arch/arm/dts/octeontx.dts new file +6 -0
new file mode 100644
index 00000000000..60a15f5df23
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dummy devicetre file for octeontx2 boards
+ *
+ * This is required to make the board build with CONFIG OF_SEPARATE
+ * I could not find any in-tree documentation at all so this is a dummy

file.
+ *
+ * Copyright 2021 Google LLC
+ */

arch/arm/dts/octeontx.dts new file +5 -0
+
+/dts-v1/;
+
+/ {
+};
configs/octeontx2_95xx_defconfig +1 -0
index 6d8457f1d07..fac4c50aec4 100644
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX2_95XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx2_96xx_defconfig +1 -0
index b72caef77d8..db883b5542c 100644
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX2_96XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx_81xx_defconfig +1 -0
index 52678d59ff1..8309c29c091 100644
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX_81XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
configs/octeontx_83xx_defconfig +1 -1
index 3890c1e97d4..dae1d4880f8 100644
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_TARGET_OCTEONTX_83XX=y
 CONFIG_SYS_MALLOC_LEN=0x4008000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="octeontx"
 CONFIG_DEBUG_UART_BASE=0x87e028000000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
--

2.33.0.882.g93a45727a2-goog

Quoted 1 line

--

François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog

#23 lore raw

PATCH 11/16 arm: xilinx_versal_virt: Add a devicetree file

In reply to Simon Glass

Add a devicetree file obtained from qemu for this board. This was obtained with:

qemu-system-aarch64 -M xlnx-versal-virt -machine dumpdtb=dtb.dtb

---

 arch/arm/dts/Makefile                |   3 +-
 arch/arm/dts/xilinx-versal-virt.dts  | 307 +++++++++++++++++++++++++++
 configs/xilinx_versal_virt_defconfig |   1 +
 3 files changed, 310 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/xilinx-versal-virt.dts
arch/arm/dts/Makefile +2 -1
index 0fec648dd77..dd6d66af5e6 100644
@@ -352,7 +352,8 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \
 dtb-$(CONFIG_ARCH_VERSAL) += \
 	versal-mini.dtb \
 	versal-mini-emmc0.dtb \
-	versal-mini-emmc1.dtb
+	versal-mini-emmc1.dtb \
+	xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \
 	zynqmp-r5.dtb
 dtb-$(CONFIG_AM33XX) += \
arch/arm/dts/xilinx-versal-virt.dts new file +307 -0

307 lines not on this page · raw message

configs/xilinx_versal_virt_defconfig +1 -0
index 11598623954..f0ec2639a38 100644
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x100000
 CONFIG_SYS_MEMTEST_START=0x00000000
 CONFIG_SYS_MEMTEST_END=0x00001000
 CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
 CONFIG_CMD_FRU=y
 CONFIG_DEFINE_TCM_OCM_MMAP=y
 CONFIG_COUNTER_FREQUENCY=100000000
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#24 lore raw

Re: [PATCH 11/16] arm: xilinx_versal_virt: Add a devicetree file

Quoted 347 lines · Simon Glass

Add a devicetree file obtained from qemu for this board. This was obtained with:

qemu-system-aarch64 -M xlnx-versal-virt -machine dumpdtb=dtb.dtb

---

  arch/arm/dts/Makefile                |   3 +-
  arch/arm/dts/xilinx-versal-virt.dts  | 307 +++++++++++++++++++++++++++
  configs/xilinx_versal_virt_defconfig |   1 +
  3 files changed, 310 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/dts/xilinx-versal-virt.dts

arch/arm/dts/Makefile +2 -1
index 0fec648dd77..dd6d66af5e6 100644
@@ -352,7 +352,8 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \
  dtb-$(CONFIG_ARCH_VERSAL) += \
  	versal-mini.dtb \
  	versal-mini-emmc0.dtb \
-	versal-mini-emmc1.dtb
+	versal-mini-emmc1.dtb \
+	xilinx-versal-virt.dtb
  dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \
  	zynqmp-r5.dtb
  dtb-$(CONFIG_AM33XX) += \
arch/arm/dts/xilinx-versal-virt.dts new file +307 -0
new file mode 100644
index 00000000000..3712af9e7a4
@@ -0,0 +1,307 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Sample device tree for versal-virt board
+
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+	compatible = "xlnx-versal-virt";
+	model = "Xilinx Versal Virtual development board";
+	#address-cells = <0x02>;
+	#size-cells = <0x02>;
+	interrupt-parent = <0x8000>;
+
+	memory@0 {
+		reg = <0x00 0x00 0x00 0x8000000>;
+		device_type = "memory";
+	};
+
+	clk25 {
+		u-boot,dm-pre-reloc;
+		compatible = "fixed-clock";
+		#clock-cells = <0x00>;
+		clock-frequency = <0x17d7840>;
+		phandle = <0x8003>;
+	};
+
+	clk125 {
+		u-boot,dm-pre-reloc;
+		compatible = "fixed-clock";
+		#clock-cells = <0x00>;
+		clock-frequency = <0x7735940>;
+		phandle = <0x8004>;
+	};
+
+	cpus {
+		#address-cells = <0x01>;
+		#size-cells = <0x00>;
+
+		cpu@0 {
+			compatible = "arm,cortex-a72";
+			device_type = "cpu";
+			reg = <0x00>;
+		};
+
+		cpu@1 {
+			compatible = "arm,cortex-a72";
+			device_type = "cpu";
+			reg = <0x01>;
+		};
+	};
+
+	rtc@f12a0000 {
+		compatible = "xlnx,zynqmp-rtc";
+		reg = <0x00 0xf12a0000 0x00 0x10000>;
+		interrupt-names = "alarm\0sec";
+		interrupts = <0x00 0x8e 0x04 0x00 0x8f 0x04>;
+	};
+
+	sdhci@f1040000 {
+		compatible = "arasan,sdhci-8.9a";
+		reg = <0x00 0xf1040000 0x00 0x10000>;
+		interrupts = <0x00 0x7e 0x04>;
+		clock-names = "clk_xin\0clk_ahb";
+		clocks = <0x8003 0x8003>;
+	};
+
+	sdhci@f1050000 {
+		compatible = "arasan,sdhci-8.9a";
+		reg = <0x00 0xf1050000 0x00 0x10000>;
+		interrupts = <0x00 0x80 0x04>;
+		clock-names = "clk_xin\0clk_ahb";
+		clocks = <0x8003 0x8003>;
+	};
+
+	usb@ff9d0000 {
+		phandle = <0x8005>;
+		#size-cells = <0x02>;
+		#address-cells = <0x02>;
+		ranges;
+		clocks = <0x8003 0x8004>;
+		clock-names = "bus_clk\0ref_clk";
+		reg = <0x00 0xff9d0000 0x00 0x10000>;
+		compatible = "xlnx,versal-dwc3";
+
+		dwc3@fe200000 {
+			maximum-speed = "high-speed";
+			phandle = <0x8006>;
+			snps,mask_phy_reset;
+			snps,refclk_fladj;
+			snps,dis_u3_susphy_quirk;
+			snps,dis_u2_susphy_quirk;
+			phy-names = "usb3-phy";
+			dr_mode = "host";
+			#stream-id-cells = <0x01>;
+			snps,quirk-frame-length-adjustment = <0x20>;
+			interrupts = <0x00 0x16 0x04>;
+			interrupt-names = "dwc_usb3";
+			reg = <0x00 0xfe200000 0x00 0x10000>;
+			compatible = "snps,dwc3";
+		};
+	};
+
+	dma@ffa80000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffa80000 0x00 0x1000>;
+		interrupts = <0x00 0x3c 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffa90000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffa90000 0x00 0x1000>;
+		interrupts = <0x00 0x3d 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffaa0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffaa0000 0x00 0x1000>;
+		interrupts = <0x00 0x3e 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffab0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffab0000 0x00 0x1000>;
+		interrupts = <0x00 0x3f 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffac0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffac0000 0x00 0x1000>;
+		interrupts = <0x00 0x40 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffad0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffad0000 0x00 0x1000>;
+		interrupts = <0x00 0x41 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffae0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffae0000 0x00 0x1000>;
+		interrupts = <0x00 0x42 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	dma@ffaf0000 {
+		compatible = "xlnx,zynqmp-dma-1.0";
+		reg = <0x00 0xffaf0000 0x00 0x1000>;
+		interrupts = <0x00 0x43 0x04>;
+		clock-names = "clk_main\0clk_apb";
+		clocks = <0x8003 0x8003>;
+		xlnx,bus-width = <0x40>;
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <0x01 0x0d 0x04 0x01 0x0e 0x04 0x01 0x0b 0x04 0x01 0x0a 0x04>;
+	};
+
+	gic@f9000000 {
+		compatible = "arm,gic-v3";
+		#interrupt-cells = <0x03>;
+		reg = <0x00 0xf9000000 0x00 0x10000 0x00 0xf9080000 0x00 0x80000>;
+		interrupt-controller;
+		interrupts = <0x01 0x09 0x04>;
+		phandle = <0x8000>;
+	};
+
+	uart@ff000000 {
+		u-boot,dm-pre-reloc;
+		compatible = "arm,pl011\0arm,sbsa-uart";
+		reg = <0x00 0xff000000 0x00 0x1000>;
+		interrupts = <0x00 0x12 0x04>;
+		clock-names = "uartclk\0apb_pclk";
+		clocks = <0x8004 0x8004>;
+		current-speed = <0x1c200>;
+	};
+
+	uart@ff010000 {
+		u-boot,dm-pre-reloc;
+		compatible = "arm,pl011\0arm,sbsa-uart";
+		reg = <0x00 0xff010000 0x00 0x1000>;
+		interrupts = <0x00 0x13 0x04>;
+		clock-names = "uartclk\0apb_pclk";
+		clocks = <0x8004 0x8004>;
+		current-speed = <0x1c200>;
+	};
+
+	ethernet@ff0c0000 {
+		#size-cells = <0x00>;
+		#address-cells = <0x01>;
+		compatible = "cdns,zynqmp-gem\0cdns,gem";
+		reg = <0x00 0xff0c0000 0x00 0x1000>;
+		interrupts = <0x00 0x38 0x04 0x00 0x38 0x04>;
+		clock-names = "pclk\0hclk\0tx_clk\0rx_clk";
+		clocks = <0x8003 0x8003 0x8004 0x8004>;
+		phy-handle = <0x8002>;
+		phy-mode = "rgmii-id";
+
+		fixed-link {
+			speed = <0x3e8>;
+			full-duplex;
+			phandle = <0x8002>;
+		};
+	};
+
+	ethernet@ff0d0000 {
+		#size-cells = <0x00>;
+		#address-cells = <0x01>;
+		compatible = "cdns,zynqmp-gem\0cdns,gem";
+		reg = <0x00 0xff0d0000 0x00 0x1000>;
+		interrupts = <0x00 0x3a 0x04 0x00 0x3a 0x04>;
+		clock-names = "pclk\0hclk\0tx_clk\0rx_clk";
+		clocks = <0x8003 0x8003 0x8004 0x8004>;
+		phy-handle = <0x8001>;
+		phy-mode = "rgmii-id";
+
+		fixed-link {
+			speed = <0x3e8>;
+			full-duplex;
+			phandle = <0x8001>;
+		};
+	};
+
+	virtio_mmio@a0000e00 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000e00 0x00 0x200>;
+		interrupts = <0x00 0x76 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000c00 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000c00 0x00 0x200>;
+		interrupts = <0x00 0x75 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000a00 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000a00 0x00 0x200>;
+		interrupts = <0x00 0x74 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000800 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000800 0x00 0x200>;
+		interrupts = <0x00 0x73 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000600 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000600 0x00 0x200>;
+		interrupts = <0x00 0x72 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000400 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000400 0x00 0x200>;
+		interrupts = <0x00 0x71 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000200 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000200 0x00 0x200>;
+		interrupts = <0x00 0x70 0x01>;
+		dma-coherent;
+	};
+
+	virtio_mmio@a0000000 {
+		compatible = "virtio,mmio";
+		reg = <0x00 0xa0000000 0x00 0x200>;
+		interrupts = <0x00 0x6f 0x01>;
+		dma-coherent;
+	};
+
+	chosen {
+		stdout-path = "/uart@ff000000";
+	};
+};
configs/xilinx_versal_virt_defconfig +0 -0
index 11598623954..f0ec2639a38 100644

configs/xilinx_versal_virt_defconfig CONFIG_SYS_MALLOC_F_LEN=0x100000 · line 13

Quoted 7 lines
configs/xilinx_versal_virt_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x100000
  CONFIG_SYS_MEMTEST_START=0x00000000
  CONFIG_SYS_MEMTEST_END=0x00001000
  CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
  CONFIG_CMD_FRU=y
  CONFIG_DEFINE_TCM_OCM_MMAP=y
  CONFIG_COUNTER_FREQUENCY=100000000

I have also concern about adding these files. When this series is accepted from high level point of view it would be better to simply use what we use already which describe standard versal boards. I just didn't push that files yet.

Thanks,
Michal

#25 lore raw

Re: [PATCH 11/16] arm: xilinx_versal_virt: Add a devicetree file

Hi Michal,

Quoted 12 lines · Michal Simek
Quoted 8 lines · Simon Glass

Add a devicetree file obtained from qemu for this board. This was obtained with:

qemu-system-aarch64 -M xlnx-versal-virt -machine dumpdtb=dtb.dtb

---

Quoted 6 lines
Quoted 6 lines
  arch/arm/dts/Makefile                |   3 +-
  arch/arm/dts/xilinx-versal-virt.dts  | 307 +++++++++++++++++++++++++++
  configs/xilinx_versal_virt_defconfig |   1 +
  3 files changed, 310 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/dts/xilinx-versal-virt.dts

[.]

Quoted 5 lines

I have also concern about adding these files. When this series is accepted from high level point of view it would be better to simply use what we use already which describe standard versal boards. I just didn't push that files yet.

That's fine and there is no need to wait, you could add the files now. I also suggest a few notes in doc/board/emulation and doc/board/xilinx

Regards,
Simon

#26 lore raw

PATCH 12/16 arm: bcm7xxx: Add a devicetree file

In reply to Simon Glass

Add a dummy devicetree file for these boards. It seems to be possible to obtain a real one from another bootloader called 'bolt' but I will leave this to the maintainer.

---

 arch/arm/dts/Makefile     |  2 ++
 arch/arm/dts/bcm7xxx.dts  | 15 +++++++++++++++
 configs/bcm7260_defconfig |  1 +
 configs/bcm7445_defconfig |  1 +
 4 files changed, 19 insertions(+)
 create mode 100644 arch/arm/dts/bcm7xxx.dts
arch/arm/dts/Makefile +2 -0
index dd6d66af5e6..ea7a4cf87de 100644
@@ -1077,6 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM6858) += \
 
 dtb-$(CONFIG_TARGET_BCMNS3) += ns3-board.dtb
 
+dtb-$(CONFIG_ARCH_BCMSTB) += bcm7xxx.dtb
+
 dtb-$(CONFIG_ASPEED_AST2500) += ast2500-evb.dtb
 dtb-$(CONFIG_ASPEED_AST2600) += ast2600-evb.dtb
 
arch/arm/dts/bcm7xxx.dts new file +15 -0
new file mode 100644
index 00000000000..799cc9caad4
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dummy devicetre file for bcm7260 board
+ *
+ * This is required to make the board build with CONFIG OF_SEPARATE
+ * In-tree document explains how to obtain a real devicetree using 'bolt' but
+ * I did not attempt this.
+ *
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+};
configs/bcm7260_defconfig +1 -0
index 3afb909f712..89b5b01ad76 100644
@@ -7,6 +7,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x10000
 CONFIG_ENV_OFFSET=0x814800
 CONFIG_SYS_MALLOC_LEN=0x2800000
+CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx"
 CONFIG_ENV_OFFSET_REDUND=0x824800
 CONFIG_SYS_LOAD_ADDR=0x02000000
 CONFIG_FIT=y
configs/bcm7445_defconfig +1 -0
index 3726abd7354..92c1b36185a 100644
@@ -8,6 +8,7 @@ CONFIG_ENV_SIZE=0x10000
 CONFIG_ENV_OFFSET=0x1E0000
 CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_SYS_MALLOC_LEN=0xa00000
+CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx"
 CONFIG_ENV_OFFSET_REDUND=0x1F0000
 CONFIG_SYS_LOAD_ADDR=0x02000000
 CONFIG_FIT=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#27 lore raw

PATCH 13/16 arm: qemu-ppce500: Add a devicetree file

In reply to Simon Glass

Add a devicetree file obtained from qemu for this board. This was obtained with:

qemu-system-ppc64 -machine ppce500 -cpu e6500 -M dumpdtb=dtb.dtb

---

 arch/powerpc/dts/Makefile         |   1 +
 arch/powerpc/dts/qemu-ppce500.dts | 264 ++++++++++++++++++++++++++++++
 configs/qemu-ppce500_defconfig    |   1 +
 3 files changed, 266 insertions(+)
 create mode 100644 arch/powerpc/dts/qemu-ppce500.dts
arch/powerpc/dts/Makefile +1 -0
index ceaa8ce5c82..66d22ae8a45 100644
@@ -18,6 +18,7 @@ dtb-$(CONFIG_TARGET_P2041RDB) += p2041rdb.dtb
 dtb-$(CONFIG_TARGET_P3041DS) += p3041ds.dtb
 dtb-$(CONFIG_TARGET_P4080DS) += p4080ds.dtb
 dtb-$(CONFIG_TARGET_P5040DS) += p5040ds.dtb
+dtb-$(CONFIG_TARGET_QEMU_PPCE500) += qemu-ppce500.dtb
 dtb-$(CONFIG_TARGET_SOCRATES) += socrates.dtb
 dtb-$(CONFIG_TARGET_T1024RDB) += t1024rdb.dtb
 dtb-$(CONFIG_TARGET_T1042D4RDB) += t1042d4rdb.dtb
arch/powerpc/dts/qemu-ppce500.dts new file +264 -0

264 lines not on this page · raw message

configs/qemu-ppce500_defconfig +1 -0
index 55f646537b2..5bf3e8de37a 100644
@@ -1,6 +1,7 @@
 CONFIG_PPC=y
 CONFIG_SYS_TEXT_BASE=0xf01000
 CONFIG_ENV_SIZE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="qemu-ppce500"
 CONFIG_MPC85xx=y
 # CONFIG_CMD_ERRATA is not set
 CONFIG_TARGET_QEMU_PPCE500=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#28 lore raw

PATCH 14/16 arm: highbank: Add a fake devicetree file

In reply to Simon Glass

Add an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.

Unfortunately there are no build instructions in the U-Boot tree to enable a real file to be created.

---

 arch/arm/dts/Makefile      |  2 ++
 arch/arm/dts/highbank.dts  | 14 ++++++++++++++
 configs/highbank_defconfig |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/highbank.dts
arch/arm/dts/Makefile +2 -0
index ea7a4cf87de..3499966bc23 100644
@@ -858,6 +858,8 @@ dtb-$(CONFIG_MX7) += imx7d-sdb.dtb \
 dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-com.dtb \
 	imx7ulp-evk.dtb
 
+dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb
+
 dtb-$(CONFIG_ARCH_IMX8) += \
 	fsl-imx8qm-apalis.dtb \
 	fsl-imx8qm-mek.dtb \
arch/arm/dts/highbank.dts new file +14 -0
new file mode 100644
index 00000000000..29ac48f5788
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dummy devicetre file for highbank board
+ *
+ * This is required to make the board build with CONFIG OF_SEPARATE
+ * There appears to be no in-tree documentation about this board at all.
+ *
+ * Copyright 2021 Google LLC
+ */
+
+/dts-v1/;
+
+/ {
+};
configs/highbank_defconfig +1 -1
index 43a070e7233..b9d325d391a 100644
@@ -7,6 +7,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_ENV_SIZE=0x2000
 CONFIG_SYS_MALLOC_LEN=0x80000
+CONFIG_DEFAULT_DEVICE_TREE="highbank"
 CONFIG_SYS_BOOTCOUNT_ADDR=0xfff3cf0c
 CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
 CONFIG_DISTRO_DEFAULTS=y
@@ -21,7 +22,6 @@ CONFIG_AUTOBOOT_KEYED_CTRLC=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_MISC_INIT_R=y
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_OF_BOARD=y
 CONFIG_ENV_IS_IN_NVRAM=y
 CONFIG_ENV_ADDR=0xFFF88000
 CONFIG_SCSI_AHCI=y
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#29 lore raw

PATCH 15/16 fdt: Make OF_BOARD a bool option

In reply to Simon Glass

This should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.

Move the option out of the choice.

Disable BINMAN_FDT for a few boards which don't actually use it.

---

 configs/qemu-ppce500_defconfig     | 1 +
 configs/qemu-riscv32_spl_defconfig | 2 ++
 configs/qemu-riscv64_spl_defconfig | 1 +
 dts/Kconfig                        | 9 +++++----
 4 files changed, 9 insertions(+), 4 deletions(-)
configs/qemu-ppce500_defconfig +1 -0
index 5bf3e8de37a..66411f73a11 100644
@@ -54,4 +54,5 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_NET=y
 CONFIG_VIRTIO_BLK=y
 CONFIG_ADDR_MAP=y
+# CONFIG_BINMAN_FDT is not set
 CONFIG_PANIC_HANG=y
configs/qemu-riscv32_spl_defconfig +2 -0
index 3909c9a15ad..4621afb1a87 100644
@@ -6,6 +6,7 @@ CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
 CONFIG_SPL=y
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_RISCV_SMODE=y
+# CONFIG_OF_BOARD_FIXUP is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_LOAD_ADDR=0x80200000
 CONFIG_FIT=y
@@ -18,3 +19,4 @@ CONFIG_OF_BOARD=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYSRESET_SBI=y
+# CONFIG_BINMAN_FDT is not set
configs/qemu-riscv64_spl_defconfig +1 -0
index 34d88da41b0..6f8ff91df9e 100644
@@ -19,3 +19,4 @@ CONFIG_OF_BOARD=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYSRESET_SBI=y
+# CONFIG_BINMAN_FDT is not set
dts/Kconfig +5 -4
index 313b9e5d70b..6be5710df7d 100644
@@ -104,7 +104,6 @@ choice
 
 config OF_SEPARATE
 	bool "Separate DTB for DT control"
-	depends on !SANDBOX
 	help
 	  If this option is enabled, the device tree will be built and
 	  placed as a separate u-boot.dtb file alongside the U-Boot image.
@@ -117,14 +116,16 @@ config OF_EMBED
 	  and development only and is not recommended for production devices.
 	  Boards in the mainline U-Boot tree should not use it.
 
+endchoice
+
 config OF_BOARD
 	bool "Provided by the board (e.g a previous loader) at runtime"
 	help
 	  If this option is enabled, the device tree will be provided by
-	  the board at runtime if the board supports it, instead of being
-	  bundled with the image.
+	  the board at runtime if the board supports it. The device tree bundled
+	  with the image (if any) will be overridden / ignored.
 
-endchoice
+	  A device tree file must be provided in the tree.
 
 config DEFAULT_DEVICE_TREE
 	string "Default Device Tree for DT control"
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#30 lore raw

Re: [PATCH 15/16] fdt: Make OF_BOARD a bool option

Quoted 6 lines · Simon Glass

This should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.

Move the option out of the choice.

Disable BINMAN_FDT for a few boards which don't actually use it.

You only sent patch 6/16 and 15/16 to me. No clue why. Please, send complete patch sets instead of selected patches which cannot be reviewed without the context.

Best regards

Heinrich

Quoted 79 lines

---

  configs/qemu-ppce500_defconfig     | 1 +
  configs/qemu-riscv32_spl_defconfig | 2 ++
  configs/qemu-riscv64_spl_defconfig | 1 +
  dts/Kconfig                        | 9 +++++----
  4 files changed, 9 insertions(+), 4 deletions(-)
configs/qemu-ppce500_defconfig +1 -0
index 5bf3e8de37a..66411f73a11 100644
@@ -54,4 +54,5 @@ CONFIG_VIRTIO_PCI=y
  CONFIG_VIRTIO_NET=y
  CONFIG_VIRTIO_BLK=y
  CONFIG_ADDR_MAP=y
+# CONFIG_BINMAN_FDT is not set
  CONFIG_PANIC_HANG=y
configs/qemu-riscv32_spl_defconfig +2 -0
index 3909c9a15ad..4621afb1a87 100644
@@ -6,6 +6,7 @@ CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
  CONFIG_SPL=y
  CONFIG_TARGET_QEMU_VIRT=y
  CONFIG_RISCV_SMODE=y
+# CONFIG_OF_BOARD_FIXUP is not set
  CONFIG_DISTRO_DEFAULTS=y
  CONFIG_SYS_LOAD_ADDR=0x80200000
  CONFIG_FIT=y
@@ -18,3 +19,4 @@ CONFIG_OF_BOARD=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  CONFIG_DM_MTD=y
  CONFIG_SYSRESET_SBI=y
+# CONFIG_BINMAN_FDT is not set
configs/qemu-riscv64_spl_defconfig +1 -0
index 34d88da41b0..6f8ff91df9e 100644
@@ -19,3 +19,4 @@ CONFIG_OF_BOARD=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  CONFIG_DM_MTD=y
  CONFIG_SYSRESET_SBI=y
+# CONFIG_BINMAN_FDT is not set
dts/Kconfig +5 -4
index 313b9e5d70b..6be5710df7d 100644
@@ -104,7 +104,6 @@ choice
 
  config OF_SEPARATE
  	bool "Separate DTB for DT control"
-	depends on !SANDBOX
  	help
  	  If this option is enabled, the device tree will be built and
  	  placed as a separate u-boot.dtb file alongside the U-Boot image.
@@ -117,14 +116,16 @@ config OF_EMBED
  	  and development only and is not recommended for production devices.
  	  Boards in the mainline U-Boot tree should not use it.
 
+endchoice
+
  config OF_BOARD
  	bool "Provided by the board (e.g a previous loader) at runtime"
  	help
  	  If this option is enabled, the device tree will be provided by
-	  the board at runtime if the board supports it, instead of being
-	  bundled with the image.
+	  the board at runtime if the board supports it. The device tree bundled
+	  with the image (if any) will be overridden / ignored.
 
-endchoice
+	  A device tree file must be provided in the tree.
 
  config DEFAULT_DEVICE_TREE
  	string "Default Device Tree for DT control"
#31 lore raw

Re: [PATCH 15/16] fdt: Make OF_BOARD a bool option

Hi Heinrich,

Quoted 7 lines · Heinrich Schuchardt
Quoted 3 lines · Simon Glass

This should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.

Quoted 7 lines
Quoted 3 lines

Move the option out of the choice.

Disable BINMAN_FDT for a few boards which don't actually use it.

You only sent patch 6/16 and 15/16 to me. No clue why. Please, send complete patch sets instead of selected patches which cannot be reviewed without the context.

I actually only explicitly cc'd Ilias (who has been working on similar things) and Tom. Everyone else came in via maintainer files. Can you see the rest in the mailing list, assuming you are subscribed? I can add you to the next version.

For the record, here is what patman produced:

$ patman -n
Cleaned 16 patches
...
checkpatch.pl found 0 error(s), 14 warning(s), 0 checks(s)
Not sending emails due to errors/warnings
Dry run, so not doing much. But I would do this:

Send a total of 16 patches with a cover letter.
0001-arm-qemu-Mention-nographic-in-the-docs.patch

      Cc:  Albert Aribaud <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  [email protected]
   0002-arm-qemu-Explain-how-to-extract-the-generate-devicet.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  [email protected]
   0003-riscv-qemu-Explain-how-to-extract-the-generate-devic.patch
      Cc:  Atish Patra <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Heinrich Schuchardt <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  [email protected]
   0004-arm-qemu-Add-a-devicetree-file-for-qemu_arm.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tim Harvey <[email protected]>
      Cc:  Tuomas Tynkkynen <[email protected]>
      Cc:  [email protected]
   0005-arm-qemu-Add-a-devicetree-file-for-qemu_arm64.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tim Harvey <[email protected]>
      Cc:  Tuomas Tynkkynen <[email protected]>
      Cc:  [email protected]
   0006-riscv-qemu-Add-devicetree-files-for-qemu_riscv32-64.patch
      Cc:  Bin Meng <[email protected]>
      Cc:  David Abdurachmanov <[email protected]>
      Cc:  Dimitri John Ledkov <[email protected]>
      Cc:  Green Wan <[email protected]>
      Cc:  Heinrich Schuchardt <[email protected]>
      Cc:  Jonathan Balkind <[email protected]>
      Cc:  Leo <[email protected]>
      Cc:  Padmarao Begari <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tianrui Wei <[email protected]>
      Cc:  Zong Li <[email protected]>
      Cc:  [email protected]
   0007-arm-rpi-Add-a-devicetree-file-for-rpi_4.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Matthias Brugger <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Stephen Warren <[email protected]>
      Cc:  Stephen Warren <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0008-arm-vexpress-Add-a-devicetree-file-for-juno.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Linus Walleij <[email protected]>
      Cc:  Liviu Dudau <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0009-arm-xenguest_arm64-Add-a-fake-devicetree-file.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Anastasiia Lukianenko <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Oleksandr Andrushchenko <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0010-arm-octeontx-Add-a-fake-devicetree-file.patch
      Cc:  Aaron Williams <[email protected]>
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Stefan Roese <[email protected]>
      Cc:  Tero Kristo <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0011-arm-xilinx_versal_virt-Add-a-devicetree-file.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Ashok Reddy Soma <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Michal Simek <[email protected]>
      Cc:  Michal Simek <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  T Karthik Reddy <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0012-arm-bcm7xxx-Add-a-devicetree-file.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Thomas Fitzsimmons <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0013-arm-qemu-ppce500-Add-a-devicetree-file.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Alexander Graf <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Niel Fourie <[email protected]>
      Cc:  Priyanka Jain <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Sinan Akman <[email protected]>
      Cc:  Stefan Roese <[email protected]>
      Cc:  Valentin Longchamp <[email protected]>
      Cc:  Vladimir Oltean <[email protected]>
      Cc:  Wolfgang Denk <[email protected]>
   0014-arm-highbank-Add-a-fake-devicetree-file.patch
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Ramon Fried <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Tim Harvey <[email protected]>
   0015-fdt-Make-OF_BOARD-a-bool-option.patch
      Cc:  Bin Meng <[email protected]>
      Cc:  Heinrich Schuchardt <[email protected]>
      Cc:  Jerry Van Baren <[email protected]>
      Cc:  Leo Yu-Chi Liang <[email protected]>
      Cc:  Priyanka Jain <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Vladimir Oltean <[email protected]>
   0016-Drop-CONFIG_BINMAN_STANDALONE_FDT.patch
      Cc:  Bin Meng <[email protected]>
      Cc:  Marek Behún <[email protected]>
      Cc:  Pali Rohár <[email protected]>
      Cc:  Simon Glass <[email protected]>
To:   U-Boot Mailing List <[email protected]>
To:   [email protected]
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
Version:  None
Prefix:   None
Cover: 36 lines
      Cc:  Aaron Williams <[email protected]>
      Cc:  Albert Aribaud <[email protected]>
      Cc:  Alexander Graf <[email protected]>
      Cc:  Anastasiia Lukianenko <[email protected]>
      Cc:  Andre Przywara <[email protected]>
      Cc:  Ashok Reddy Soma <[email protected]>
      Cc:  Atish Patra <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Bin Meng <[email protected]>
      Cc:  Christian Hewitt <[email protected]>
      Cc:  David Abdurachmanov <[email protected]>
      Cc:  Dimitri John Ledkov <[email protected]>
      Cc:  Fabio Estevam <[email protected]>
      Cc:  Green Wan <[email protected]>
      Cc:  Heiko Schocher <[email protected]>
      Cc:  Heinrich Schuchardt <[email protected]>
      Cc:  Heinrich Schuchardt <[email protected]>
      Cc:  Jagan Teki <[email protected]>
      Cc:  Jerry Van Baren <[email protected]>
      Cc:  Jonathan Balkind <[email protected]>
      Cc:  Kever Yang <[email protected]>
      Cc:  Leo <[email protected]>
      Cc:  Leo Yu-Chi Liang <[email protected]>
      Cc:  Linus Walleij <[email protected]>
      Cc:  Liviu Dudau <[email protected]>
      Cc:  Marek Behún <[email protected]>
      Cc:  Matthias Brugger <[email protected]>
      Cc:  Michal Simek <[email protected]>
      Cc:  Michal Simek <[email protected]>
      Cc:  Neil Armstrong <[email protected]>
      Cc:  Niel Fourie <[email protected]>
      Cc:  Oleksandr Andrushchenko <[email protected]>
      Cc:  Padmarao Begari <[email protected]>
      Cc:  Pali Rohár <[email protected]>
      Cc:  Peter Robinson <[email protected]>
      Cc:  Priyanka Jain <[email protected]>
      Cc:  Ramon Fried <[email protected]>
      Cc:  Rick Chen <[email protected]>
      Cc:  Sean Anderson <[email protected]>
      Cc:  Simon Glass <[email protected]>
      Cc:  Sinan Akman <[email protected]>
      Cc:  Stefan Roese <[email protected]>
      Cc:  Stephen Warren <[email protected]>
      Cc:  Stephen Warren <[email protected]>
      Cc:  T Karthik Reddy <[email protected]>
      Cc:  Tero Kristo <[email protected]>
      Cc:  Thomas Fitzsimmons <[email protected]>
      Cc:  Tianrui Wei <[email protected]>
      Cc:  Tim Harvey <[email protected]>
      Cc:  Tuomas Tynkkynen <[email protected]>
      Cc:  Valentin Longchamp <[email protected]>
      Cc:  Vladimir Oltean <[email protected]>
      Cc:  Wolfgang Denk <[email protected]>
      Cc:  Zong Li <[email protected]>
      Cc:  [email protected]

Regards,
Simon

#32 lore raw

Re: [PATCH 15/16] fdt: Make OF_BOARD a bool option

Quoted 19 lines · Simon Glass

Hi Heinrich,

Quoted 7 lines · Heinrich Schuchardt
Quoted 3 lines · Simon Glass

This should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.

Quoted 7 lines
Quoted 3 lines

Move the option out of the choice.

Disable BINMAN_FDT for a few boards which don't actually use it.

You only sent patch 6/16 and 15/16 to me. No clue why. Please, send complete patch sets instead of selected patches which cannot be reviewed without the context.

Quoted 6 lines

I actually only explicitly cc'd Ilias (who has been working on similar things) and Tom. Everyone else came in via maintainer files. Can you see the rest in the mailing list, assuming you are subscribed? I can add you to the next version.

For the record, here is what patman produced:

FWIW I have always thought that patman CCs too many people by default. It is only partially based on MAINTAINERS; the rest of the CCs are from people who have touched the file recently. This results in many people being CC'd who have made only minor or unrelated changes to the code (especially from treewide changes). For this reason, I curate my CCs manually to hopefully CC only those people who are actually interested in my patches.

--Sean

Quoted 273 lines
$ patman -n
Cleaned 16 patches
...
checkpatch.pl found 0 error(s), 14 warning(s), 0 checks(s)
Not sending emails due to errors/warnings
Dry run, so not doing much. But I would do this:

Send a total of 16 patches with a cover letter.
0001-arm-qemu-Mention-nographic-in-the-docs.patch
Cc: Albert Aribaud <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: [email protected]
0002-arm-qemu-Explain-how-to-extract-the-generate-devicet.patch
Cc: Albert Aribaud <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: [email protected]
0003-riscv-qemu-Explain-how-to-extract-the-generate-devic.patch
Cc: Atish Patra <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: [email protected]
0004-arm-qemu-Add-a-devicetree-file-for-qemu_arm.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tuomas Tynkkynen <[email protected]>
Cc: [email protected]
0005-arm-qemu-Add-a-devicetree-file-for-qemu_arm64.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tuomas Tynkkynen <[email protected]>
Cc: [email protected]
0006-riscv-qemu-Add-devicetree-files-for-qemu_riscv32-64.patch
Cc: Bin Meng <[email protected]>
Cc: David Abdurachmanov <[email protected]>
Cc: Dimitri John Ledkov <[email protected]>
Cc: Green Wan <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jonathan Balkind <[email protected]>
Cc: Leo <[email protected]>
Cc: Padmarao Begari <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tianrui Wei <[email protected]>
Cc: Zong Li <[email protected]>
Cc: [email protected]
0007-arm-rpi-Add-a-devicetree-file-for-rpi_4.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Tim Harvey <[email protected]>
0008-arm-vexpress-Add-a-devicetree-file-for-juno.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Liviu Dudau <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
0009-arm-xenguest_arm64-Add-a-fake-devicetree-file.patch
Cc: Albert Aribaud <[email protected]>
Cc: Anastasiia Lukianenko <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Oleksandr Andrushchenko <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
0010-arm-octeontx-Add-a-fake-devicetree-file.patch
Cc: Aaron Williams <[email protected]>
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tero Kristo <[email protected]>
Cc: Tim Harvey <[email protected]>
0011-arm-xilinx_versal_virt-Add-a-devicetree-file.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Ashok Reddy Soma <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: T Karthik Reddy <[email protected]>
Cc: Tim Harvey <[email protected]>
0012-arm-bcm7xxx-Add-a-devicetree-file.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Thomas Fitzsimmons <[email protected]>
Cc: Tim Harvey <[email protected]>
0013-arm-qemu-ppce500-Add-a-devicetree-file.patch
Cc: Albert Aribaud <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Niel Fourie <[email protected]>
Cc: Priyanka Jain <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sinan Akman <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Valentin Longchamp <[email protected]>
Cc: Vladimir Oltean <[email protected]>
Cc: Wolfgang Denk <[email protected]>
0014-arm-highbank-Add-a-fake-devicetree-file.patch
Cc: Albert Aribaud <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: Christian Hewitt <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
0015-fdt-Make-OF_BOARD-a-bool-option.patch
Cc: Bin Meng <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jerry Van Baren <[email protected]>
Cc: Leo Yu-Chi Liang <[email protected]>
Cc: Priyanka Jain <[email protected]>
Cc: Rick Chen <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Vladimir Oltean <[email protected]>
0016-Drop-CONFIG_BINMAN_STANDALONE_FDT.patch
Cc: Bin Meng <[email protected]>
Cc: Marek Behún <[email protected]>
Cc: Pali Rohár <[email protected]>
Cc: Simon Glass <[email protected]>

To:   U-Boot Mailing List <[email protected]>
To:   [email protected]
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
Version:  None
Prefix:   None
Cover: 36 lines
       Cc:  Aaron Williams <[email protected]>
       Cc:  Albert Aribaud <[email protected]>
       Cc:  Alexander Graf <[email protected]>
       Cc:  Anastasiia Lukianenko <[email protected]>
       Cc:  Andre Przywara <[email protected]>
       Cc:  Ashok Reddy Soma <[email protected]>
       Cc:  Atish Patra <[email protected]>
       Cc:  Bin Meng <[email protected]>
       Cc:  Bin Meng <[email protected]>
       Cc:  Christian Hewitt <[email protected]>
       Cc:  David Abdurachmanov <[email protected]>
       Cc:  Dimitri John Ledkov <[email protected]>
       Cc:  Fabio Estevam <[email protected]>
       Cc:  Green Wan <[email protected]>
       Cc:  Heiko Schocher <[email protected]>
       Cc:  Heinrich Schuchardt <[email protected]>
       Cc:  Heinrich Schuchardt <[email protected]>
       Cc:  Jagan Teki <[email protected]>
       Cc:  Jerry Van Baren <[email protected]>
       Cc:  Jonathan Balkind <[email protected]>
       Cc:  Kever Yang <[email protected]>
       Cc:  Leo <[email protected]>
       Cc:  Leo Yu-Chi Liang <[email protected]>
       Cc:  Linus Walleij <[email protected]>
       Cc:  Liviu Dudau <[email protected]>
       Cc:  Marek Behún <[email protected]>
       Cc:  Matthias Brugger <[email protected]>
       Cc:  Michal Simek <[email protected]>
       Cc:  Michal Simek <[email protected]>
       Cc:  Neil Armstrong <[email protected]>
       Cc:  Niel Fourie <[email protected]>
       Cc:  Oleksandr Andrushchenko <[email protected]>
       Cc:  Padmarao Begari <[email protected]>
       Cc:  Pali Rohár <[email protected]>
       Cc:  Peter Robinson <[email protected]>
       Cc:  Priyanka Jain <[email protected]>
       Cc:  Ramon Fried <[email protected]>
       Cc:  Rick Chen <[email protected]>
       Cc:  Sean Anderson <[email protected]>
       Cc:  Simon Glass <[email protected]>
       Cc:  Sinan Akman <[email protected]>
       Cc:  Stefan Roese <[email protected]>
       Cc:  Stephen Warren <[email protected]>
       Cc:  Stephen Warren <[email protected]>
       Cc:  T Karthik Reddy <[email protected]>
       Cc:  Tero Kristo <[email protected]>
       Cc:  Thomas Fitzsimmons <[email protected]>
       Cc:  Tianrui Wei <[email protected]>
       Cc:  Tim Harvey <[email protected]>
       Cc:  Tuomas Tynkkynen <[email protected]>
       Cc:  Valentin Longchamp <[email protected]>
       Cc:  Vladimir Oltean <[email protected]>
       Cc:  Wolfgang Denk <[email protected]>
       Cc:  Zong Li <[email protected]>
       Cc:  [email protected]

Regards,
Simon

#33 lore raw

Re: [PATCH 15/16] fdt: Make OF_BOARD a bool option

Hi Sean,

Quoted 28 lines · Sean Anderson
Quoted 19 lines · Simon Glass

Hi Heinrich,

Quoted 7 lines · Heinrich Schuchardt
Quoted 3 lines · Simon Glass

This should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.

Quoted 7 lines
Quoted 3 lines

Move the option out of the choice.

Disable BINMAN_FDT for a few boards which don't actually use it.

You only sent patch 6/16 and 15/16 to me. No clue why. Please, send complete patch sets instead of selected patches which cannot be reviewed without the context.

Quoted 6 lines

I actually only explicitly cc'd Ilias (who has been working on similar things) and Tom. Everyone else came in via maintainer files. Can you see the rest in the mailing list, assuming you are subscribed? I can add you to the next version.

For the record, here is what patman produced:

Quoted 7 lines

FWIW I have always thought that patman CCs too many people by default. It is only partially based on MAINTAINERS; the rest of the CCs are from people who have touched the file recently. This results in many people being CC'd who have made only minor or unrelated changes to the code (especially from treewide changes). For this reason, I curate my CCs manually to hopefully CC only those people who are actually interested in my patches.

Patman uses only the commit tags and get_maintainers, so the fault may live with the latter?

Regards,
Simon

#34 lore raw

PATCH 16/16 Drop CONFIG_BINMAN_STANDALONE_FDT

In reply to Simon Glass

This was added as a hack to work around not having an in-tree devicetree. Now that this is fixed it is not needed.

Drop it.

---

 Makefile                |  3 +--
 dts/Kconfig             | 18 ------------------
 tools/binman/binman.rst | 20 --------------------
 3 files changed, 1 insertion(+), 40 deletions(-)
Makefile +1 -2
index 94c4fd548b4..c20aaf73710 100644
@@ -939,7 +939,6 @@ endif
 endif
 INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
 INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb
-INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb
 ifeq ($(CONFIG_SPL_FRAMEWORK),y)
 INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
 endif
@@ -1406,7 +1405,7 @@ u-boot-lzma.img: u-boot.bin.lzma FORCE
 
 u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
 		$(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \
-			$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \
+			$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \
 		,$(UBOOT_BIN)) FORCE
 	$(call if_changed,mkimage)
 	$(BOARD_SIZE_CHECK)
dts/Kconfig +0 -18
index 6be5710df7d..58356b45e46 100644
@@ -19,24 +19,6 @@ config BINMAN
 	bool
 	select DTOC
 
-config BINMAN_STANDALONE_FDT
-	bool
-	depends on BINMAN
-	default y if OF_BOARD
-	help
-	  This option tells U-Boot build system that a standalone device tree
-	  source is explicitly required when using binman to package U-Boot.
-
-	  This is not necessary in a common scenario where a device tree source
-	  that contains the binman node is provided in the arch/<arch>/dts
-	  directory for a specific board. Such device tree sources are built for
-	  OF_SEPARATE or OF_EMBED. However for a scenario like the board device
-	  tree blob is not provided in the U-Boot build tree, but fed to U-Boot
-	  in the runtime, e.g.: in the OF_BOARD case that it is passed by
-	  a prior stage bootloader. For such scenario, a standalone device tree
-	  blob containing binman node to describe how to package U-Boot should
-	  be provided explicitly.
-
 menu "Device Tree Control"
 	depends on SUPPORT_OF_CONTROL
 
tools/binman/binman.rst +0 -20
index 614df541c5a..f90dd3a5e5d 100644
@@ -232,26 +232,6 @@ You can use other, more specific CONFIG options - see 'Automatic .dtsi
 inclusion' below.
 
 
-Using binman with OF_BOARD
---------------------------------------------
-
-Normally binman is used with a board configured with OF_SEPARATE or OF_EMBED.
-This is a typical scenario where a device tree source that contains the binman
-node is provided in the arch/<arch>/dts directory for a specific board.
-
-However for a board configured with OF_BOARD, no device tree blob is provided
-in the U-Boot build phase hence the binman node information is not available.
-In order to support such use case, a new Kconfig option BINMAN_STANDALONE_FDT
-is introduced, to tell the build system that a standalone device tree blob
-containing binman node is explicitly required.
-
-Note there is a Kconfig option BINMAN_FDT which enables U-Boot run time to
-access information about binman entries, stored in the device tree in a binman
-node. Generally speaking, this option makes sense for OF_SEPARATE or OF_EMBED.
-For the other OF_CONTROL methods, it's quite possible binman node is not
-available as binman is invoked during the build phase, thus this option is not
-turned on by default for these OF_CONTROL methods.
-
 Access to binman entry offsets at run time (symbols)
 ----------------------------------------------------
 
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#35 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

I am not sure I understand the whole point of this.

Quoted 10 lines

It also provides a few qemu clean-ups discovered along the way.

This series is based on Ilias' two series for OF_HOSTFILE and OF_PRIOR_STAGE removal.

It is available at u-boot-dm/ofb-working

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Regards,
Bin

#36 lore raw
Quoted 31 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Quoted 8 lines

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

Signature · 1 line
Tom
#37 lore raw

Hi Simon

Quoted 42 lines · Tom Rini
Quoted 20 lines · Bin Meng

Hi Simon,

Quoted 17 lines · Simon Glass

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 are documented at [1].

In practice, OF_BOARD is not really distinct from OF_SEPARATE. Any

board

Quoted 2 lines
Quoted 2 lines

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

Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware available in the

machine.

Quoted 15 lines
Quoted 7 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 8 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

--
Tom

+1

While the cleanup go get three options, including OF_BOARD is nice, the build solution you propose does not sound the right approach: U-Boot should be buildable without any DT.

Getting the DT you produced as sample information can be useful and kept out of build path in documentation with ad-hoc warnings though as I explained in other mails of the series.

OF_BOARD is a choice to say “I don’t override the legitimate DT with either OF_SEPARATE or OF_EMBED” (which I see in this case as debug facility for U-Boot maintainer of the platform).

Quoted 2 lines

--

François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog

#38 lore raw
In reply to Tom Rini

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!) But in any case it doesn't really help U-Boot. I think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed. U-Boot needs to be flexible enough to function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

I can't quite pinpoint the patch where U-Boot started allowing the devicetree to be omitted, but if people are interested I could try a little harder. It was certainly not my intention (putting on my device-tree-maintainer hat) to go down that path and it slipped in somehow in all the confusion. I'm not sure anyone could tell you that rpi_3 has an in-tree devicetree but rpi_4 does not...

Anyway this series is very modest. It just adds the requirement that all in-tree boards have some sort of sample devicetree and preferably some documentation as to where it might come from at runtime. That should not be a tough call IMO. Assuming we can get the validation in place (mentioned by Rob Herring recently) it will be quite natural to sync them between (presumably) Linux and U-Boot.

I am also quite happy to discuss what should actually be in these devicetree files and whether some of them should be essentially empty. As you probably noticed, some of them are empty since I literally could not figure out where they come from! But there needs to be at least some skeleton for U-Boot to progress, since devicetree is critical to its feature set.

It is high time we tidied all this up. I predict it will be much harder, and much more confusing, in 6 months.

Regards,
Simon

#39 lore raw

Hi Simon

Quoted 73 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 4 lines · Tom Rini
Quoted 2 lines · Bin Meng

Hi Simon,

Quoted 8 lines
Quoted 8 lines · Simon Glass
Quoted 7 lines

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

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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 are documented at [1].

In practice, OF_BOARD is not really distinct from OF_SEPARATE. Any

board

Quoted 1 line
Quoted 1 line
Quoted 1 line

can obtain its devicetree at runtime, even it is has a devicetree

built

Quoted 1 line
Quoted 1 line
Quoted 1 line

in U-Boot. This is because U-Boot may be a second-stage bootloader

and its

Quoted 1 line
Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware available in the

machine.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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 series makes this change, adding various missing devicetree

files

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

(and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 9 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 10 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 8 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

That seems inconsistent with the OF_BOARD becomes the default.

Quoted 11 lines

I can't quite pinpoint the patch where U-Boot started allowing the devicetree to be omitted, but if people are interested I could try a little harder. It was certainly not my intention (putting on my device-tree-maintainer hat) to go down that path and it slipped in somehow in all the confusion. I'm not sure anyone could tell you that rpi_3 has an in-tree devicetree but rpi_4 does not...

Anyway this series is very modest. It just adds the requirement that all in-tree boards have some sort of sample devicetree and preferably some documentation as to where it might come from at runtime.

That’s a very good goal. But adding files in dts make them not samples but templates to be used and replace board provided DTB.
If you push all your DTS files in documentation, you do what you say:
adding sample files.

Quoted 11 lines

That
should not be a tough call IMO. Assuming we can get the validation in place (mentioned by Rob Herring recently) it will be quite natural to sync them between (presumably) Linux and U-Boot.

I am also quite happy to discuss what should actually be in these devicetree files and whether some of them should be essentially empty. As you probably noticed, some of them are empty since I literally could not figure out where they come from! But there needs to be at least some skeleton for U-Boot to progress, since devicetree is critical to its feature set.

absolutely. And thank you for your efforts to make that center stage. This is also Linaro Edge group mist challenging task on the next 6 moths. Knowing that we have lived in a floating situation for over 10 years, I just hope we get consensus across projects and distro providers about the right end goal and migration strategy.

Quoted 8 lines

It is high time we tidied all this up. I predict it will be much harder, and much more confusing, in 6 months.

Regards,
Simon

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#40 lore raw

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

Quoted 21 lines
Quoted 9 lines

I can't quite pinpoint the patch where U-Boot started allowing the devicetree to be omitted, but if people are interested I could try a little harder. It was certainly not my intention (putting on my device-tree-maintainer hat) to go down that path and it slipped in somehow in all the confusion. I'm not sure anyone could tell you that rpi_3 has an in-tree devicetree but rpi_4 does not...

Quoted 3 lines

Anyway this series is very modest. It just adds the requirement that all in-tree boards have some sort of sample devicetree and preferably some documentation as to where it might come from at runtime.

That’s a very good goal. But adding files in dts make them not samples but templates to be used and replace board provided DTB. If you push all your DTS files in documentation, you do what you say: adding sample files.

Quoted 6 lines

That
should not be a tough call IMO. Assuming we can get the validation in place (mentioned by Rob Herring recently) it will be quite natural to sync them between (presumably) Linux and U-Boot.

Quoted 9 lines
Quoted 6 lines

I am also quite happy to discuss what should actually be in these devicetree files and whether some of them should be essentially empty. As you probably noticed, some of them are empty since I literally could not figure out where they come from! But there needs to be at least some skeleton for U-Boot to progress, since devicetree is critical to its feature set.

absolutely. And thank you for your efforts to make that center stage. This is also Linaro Edge group mist challenging task on the next 6 moths. Knowing that we have lived in a floating situation for over 10 years, I just hope we get consensus across projects and distro providers about the right end goal and migration strategy.

Quoted 1 line

Thank you.

Quoted 4 lines
Quoted 4 lines

It is high time we tidied all this up. I predict it will be much harder, and much more confusing, in 6 months.

Just to set a road map here in case you can help unblock anything, here are the things I am aware of, excluding the things I have forgotten:

- Ilias OF_PRIOR_STAGE, OF_HOSTFILE series
- this series
- the devicetree docs patch
- devicetree bindings upstream for U-Boot (first patch under discussion)
- bloblist as a means of passing devicetree, ACPI, tiny config info as C structs to U-Boot (needs to be written)
- VPL so we can handle verification (patches pending)
- bootflow / VBE v2 series (coming next week)

Regards,
Simon

#41 lore raw
Quoted 130 lines · Simon Glass

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Quoted 3 lines

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

And in that case, would not be using the "fake" tree we built in?

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

Signature · 1 line
Tom
#42 lore raw

Hi Tom,

Quoted 132 lines · Tom Rini
Quoted 130 lines · Simon Glass

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Quoted 7 lines
Quoted 3 lines

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

Yes. The OF_BOARD feature provides this.

Quoted 2 lines

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

Quoted 5 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may want to boot with or without TF-A or some other, earlier stage.

I believe we have got unstuck because OF_BOARD (perhaps inadvertently) provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

Regards,
Simon

#43 lore raw
Quoted 143 lines · Simon Glass

Hi Tom,

Quoted 132 lines · Tom Rini
Quoted 130 lines · Simon Glass

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Quoted 7 lines
Quoted 3 lines

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

Quoted 6 lines

Yes. The OF_BOARD feature provides this.

Quoted 2 lines

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 9 lines
Quoted 4 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may want to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not have to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

Quoted 5 lines

I believe we have got unstuck because OF_BOARD (perhaps inadvertently) provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Signature · 1 line
Tom
#44 lore raw
Quoted 235 lines · Tom Rini
Quoted 8 lines · Simon Glass

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 3 lines · Simon Glass

Hi François,

On Wed, 13 Oct 2021 at 11:35, François Ozog <

Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Simon

Le mer. 13 oct. 2021 à 16:49, Simon Glass <[email protected]> a

écrit :

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Tom, Bin,François,

On Tue, 12 Oct 2021 at 19:34, Tom Rini <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Bin Meng
Quoted 3 lines

Hi Simon,

On Wed, Oct 13, 2021 at 9:01 AM Simon Glass <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

With Ilias' efforts we have dropped OF_PRIOR_STAGE and

OF_HOSTFILE so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

there are only three ways to obtain a devicetree:

- OF_SEPARATE - the normal way, where the devicetree is

built and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

appended to U-Boot
- OF_EMBED - for development purposes, the devicetree is

embedded in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in the U-Boot tree. Most boards do provide one, but some

don't. Some

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

don't even provide instructions on how to boot on the board.

The problems with this approach are documented at [1].

In practice, OF_BOARD is not really distinct from

OF_SEPARATE. Any board

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can obtain its devicetree at runtime, even it is has a

devicetree built

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in U-Boot. This is because U-Boot may be a second-stage

bootloader and its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware available

in the machine.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

option, available with either OF_SEPARATE or OF_EMBED.

This series makes this change, adding various missing

devicetree files

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

(and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to

me.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For QEMU, device tree is dynamically generated on the fly

based on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

command line parameters, and the device tree you put in this

series

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has various hardcoded <phandle> values which normally do not

show up

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

in hand-written dts files.

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device

trees for

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

platforms that are capable of and can / do have a device tree

to give us

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

at run time.

(I'll just reply to this one email, since the same points applies

to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

all replies I think)

I have been thinking about this and discussing it with people for

a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with

Linaro

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

people. I sent a patch (below) to try to explain things. I hope

it is

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger

footing.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

BTW I did suggest to QEMU ARM that they support a way of adding

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for

booting

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

Linux directly!)

i understand their point of view and agree with it.

Quoted 7 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option,

not a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

build-time one. It creates all sorts of problems and obscurity

which

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have taken months to unpick. See the above patch for the

rationale.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

To add to that rationale, OF_BOARD needs to be an option

available to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to it. It doesn't make any sense to have people decide whether or

not

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious

where

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of

build

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

explosion is not needed.

If you mean that when boards are by construction providing a DTB

to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it

finds

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the

image.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We can't support that unless we are building a devicetree, nor

can the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

running program access the image layout without that information.

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since

OF_BOARD

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is, still, enabled. We already use OF_BOARD for various boards

that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for

example

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(as I said in the cover letter "Most boards do provide one, but

some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't."). So this series is just completing the picture by

enforcing

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

that *some sort* of devicetree is always present.

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that

very

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

clearly.

Another big issue is that I believe we need ONE devicetree for

U-Boot,

Quoted 1 line
Quoted 1 line
Quoted 1 line

not two that get merged by U-Boot. Again I have gone through that in

a

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

Quoted 6 lines

Yes. The OF_BOARD feature provides this.

Quoted 2 lines

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 9 lines
Quoted 4 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may want to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not have to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

Quoted 5 lines

I believe we have got unstuck because OF_BOARD (perhaps inadvertently) provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

Quoted 6 lines

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

+1
if there is a complex build problem to solve when no DT is needed when OF_BOARD is needed i could agree to temporarily have a void.dts like

/dts-v1/;
/ {
/* required to pass build until proper makefike for OF_BOARD */ };

But not pseudo dts for boards that provide a DT to U-Boot. The pseudo dts are good for reference in the documentation part of the tree.

Quoted 4 lines

--
Tom

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#45 lore raw
In reply to Tom Rini

Hi all,

Quoted 171 lines · Tom Rini
Quoted 143 lines · Simon Glass

Hi Tom,

Quoted 132 lines · Tom Rini
Quoted 130 lines · Simon Glass

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Quoted 7 lines
Quoted 3 lines

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

Quoted 6 lines

Yes. The OF_BOARD feature provides this.

Quoted 2 lines

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 9 lines
Quoted 4 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may want to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not have to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Quoted 4 lines

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

See below.

Quoted 11 lines
Quoted 6 lines

I believe we have got unstuck because OF_BOARD (perhaps inadvertently) provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

Quoted 6 lines

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business. We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG. b) Well then U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

#46 lore raw

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 9 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

Quoted 8 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

Quoted 7 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Quoted 23 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

Regards
/Ilias

Quoted 9 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

#47 lore raw
Quoted 54 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 5 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1. Still others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 7 lines

The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

Quoted 17 lines
Quoted 7 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

Quoted 3 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Quoted 8 lines
Quoted 5 lines

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

Quoted 48 lines
Quoted 7 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Quoted 23 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

Why does it matter if Linux sees some u-boot, properties? If some huge stink is going to be thrown, we could probably prune them out at run time but it's already being passed N disabled nodes, yes?

Signature · 1 line
Tom
#48 lore raw

Hi Tom,

Quoted 64 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we could

then

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 35 lines
Quoted 35 lines
Quoted 2 lines

use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 7 lines
Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge

pain

Quoted 2 lines

and that's probably one of the main reasons our DTs are out of sync for a large number of boards.

Quoted 8 lines

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

Quoted 15 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 3 lines

The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing restrictions

on

Quoted 3 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 6 lines

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

This is not about size but about firmware supply chain organization.

Quoted 26 lines
Quoted 9 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get

Quoted 6 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be included

in

Quoted 2 lines

U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 11 lines

it's flash).

Quoted 8 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

Quoted 7 lines
Quoted 1 line

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

There shall be authoritative System Device Trees as vendors are working on. Those System Device Trees cover all aspects of a board, not just the Cortex-A part that U-Boot cares about.
Out of those system device trees, a tool (lopper) is going to carve out the "authoritative dts for the cortex-A".
Essentially, that carve out will correspond to what would come out of Linux. This scheme will not be generalized, just adopted by vendors on some boards.
DT for those board become part of the OS ABI (meaning, the driver developper is constrained).

Quoted 65 lines
Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 2 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be

able to use

Quoted 1 line

that. So the only case were you'll need 3 DTs is if the *vendor* breaks

the

Quoted 26 lines

DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Quoted 23 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 7 lines
Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd

prefer

Quoted 2 lines

if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

Why does it matter if Linux sees some u-boot, properties? If some huge stink is going to be thrown, we could probably prune them out at run time but it's already being passed N disabled nodes, yes?

--
Tom

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#49 lore raw
Quoted 74 lines · François Ozog

Hi Tom,

Quoted 70 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we could

then

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 35 lines
Quoted 35 lines
Quoted 2 lines

use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 7 lines
Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge

pain

Quoted 2 lines

and that's probably one of the main reasons our DTs are out of sync for a large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Quoted 6 lines
Quoted 2 lines

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

I'd really like to see some progress (as would the other non-NXP folks working on NXP SoCs) in that regard.

Quoted 15 lines
Quoted 15 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 3 lines

The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing restrictions

on

Quoted 3 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 7 lines
Quoted 5 lines

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

This is not about size but about firmware supply chain organization.

That's great since it means we just need the bindings reviewed then everyone can pass whatever everyone else needs.

Quoted 33 lines
Quoted 26 lines
Quoted 9 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get

Quoted 6 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be included

in

Quoted 2 lines

U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 11 lines

it's flash).

Quoted 8 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

Quoted 7 lines
Quoted 1 line

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

Quoted 6 lines

There shall be authoritative System Device Trees as vendors are working on. Those System Device Trees cover all aspects of a board, not just the Cortex-A part that U-Boot cares about.
Out of those system device trees, a tool (lopper) is going to carve out the "authoritative dts for the cortex-A".
Essentially, that carve out will correspond to what would come out of Linux.

s/Linux/software/

Quoted 4 lines

This scheme will not be generalized, just adopted by vendors on some boards.
DT for those board become part of the OS ABI (meaning, the driver developper is constrained).

OK? And is going to pick and choose which valid bindings to implement? Or is it going to provide half a node for Linux? No? I assume no. So it will also provide whatever bindings we've upstreamed and say need to be passed.

Signature · 1 line
Tom
#50 lore raw

Hi trying to reply to all at the same time!

Quoted 66 lines · Tom Rini
Quoted 65 lines · François Ozog

Hi Tom,

Quoted 61 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we could

then

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 35 lines
Quoted 35 lines
Quoted 2 lines

use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 7 lines
Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge

pain

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

and that's probably one of the main reasons our DTs are out of sync for a large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Agree on both, but still this is the reality we have to deal with right now

Quoted 32 lines
Quoted 7 lines
Quoted 3 lines

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

I'd really like to see some progress (as would the other non-NXP folks working on NXP SoCs) in that regard.

Quoted 21 lines
Quoted 20 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 3 lines

The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing restrictions

on

Quoted 3 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

Quoted 5 lines
Quoted 1 line

This is not about size but about firmware supply chain organization.

That's great since it means we just need the bindings reviewed then everyone can pass whatever everyone else needs.

Size here is not my concern. If the bindings u-boot expects gets upstreamed I am obviously fine with the previous stage bootloader passing them over. What I strongly disagree, is *demand* the previous stage boot loader have knowledge about them if they are not in upstream.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 9 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get

Quoted 6 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be included

in

Quoted 2 lines

U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 11 lines

it's flash).

Quoted 8 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

yes

Quoted 14 lines
Quoted 6 lines

There shall be authoritative System Device Trees as vendors are working on. Those System Device Trees cover all aspects of a board, not just the Cortex-A part that U-Boot cares about.
Out of those system device trees, a tool (lopper) is going to carve out the "authoritative dts for the cortex-A".
Essentially, that carve out will correspond to what would come out of Linux.

s/Linux/software/

Quoted 4 lines

This scheme will not be generalized, just adopted by vendors on some boards.
DT for those board become part of the OS ABI (meaning, the driver developper is constrained).

Quoted 7 lines

OK? And is going to pick and choose which valid bindings to implement? Or is it going to provide half a node for Linux? No? I assume no. So it will also provide whatever bindings we've upstreamed and say need to be passed.

Signature · 1 line
Tom

Regards
/Ilias

#51 lore raw
Quoted 114 lines · Ilias Apalodimas

Hi trying to reply to all at the same time!

Quoted 66 lines · Tom Rini
Quoted 65 lines · François Ozog

Hi Tom,

Quoted 61 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we could

then

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 35 lines
Quoted 35 lines
Quoted 2 lines

use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 7 lines
Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge

pain

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

and that's probably one of the main reasons our DTs are out of sync for a large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Agree on both, but still this is the reality we have to deal with right now

Quoted 34 lines
Quoted 7 lines
Quoted 3 lines

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

I'd really like to see some progress (as would the other non-NXP folks working on NXP SoCs) in that regard.

Quoted 22 lines
Quoted 15 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 3 lines

The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing restrictions

on

Quoted 3 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 5 lines

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

This is not about size but about firmware supply chain organization.

Quoted 8 lines
Quoted 3 lines

That's great since it means we just need the bindings reviewed then everyone can pass whatever everyone else needs.

Size here is not my concern. If the bindings u-boot expects gets upstreamed I am obviously fine with the previous stage bootloader passing them over. What I strongly disagree, is *demand* the previous stage boot loader have knowledge about them if they are not in upstream.

I also agree that bindings MUST be upstreamed for there to be a reasonable expectation that any other project (or human creating a dts) be adding them, either statically or any sort of run-time modification (think memory information, this gets fixed up at run-time often still).

And it may end up being zero "u-boot,FOO" bindings where this is the case. Or it may end up being related to secure / verified boot stuff only.

Signature · 1 line
Tom
#52 lore raw
In reply to Tom Rini
Quoted 192 lines · Tom Rini
Quoted 13 lines · François Ozog

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we

could

Quoted 2 lines
Quoted 2 lines

then

Quoted 1 line
Quoted 1 line
Quoted 1 line

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we

could

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can

come

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 1 line
Quoted 1 line
Quoted 1 line

use the device tree from build time at run time, ignoring the

device

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry

on

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different components. Binman was one effort there. I feel that

putting

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will

set

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the

past

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history.

We

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

should sacrifice efficiency, expedience and expandability on the

altar

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for its own purposes, as well as for booting the OS. I am not

saying

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is

essential.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So let's just assume that we need this everywhere, since we

certainly

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

need it in at least some places.

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine.

Adding

Quoted 1 line
Quoted 1 line
Quoted 1 line

that to the DTs that are copied over from linux isn't imho. There

are

Quoted 1 line
Quoted 1 line
Quoted 1 line

various reasons for that. First of all syncing device trees is a

huge

Quoted 2 lines
Quoted 2 lines

pain

Quoted 1 line

and that's probably one of the main reasons our DTs are out of sync

for a

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Quoted 6 lines
Quoted 2 lines

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

I'd really like to see some progress (as would the other non-NXP folks working on NXP SoCs) in that regard.

Quoted 6 lines
Quoted 6 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 1 line

The point is this was fine in 2011 were we had SPL only, but the

reality

Quoted 1 line
Quoted 1 line
Quoted 1 line

today is completely different. There's previous stage boot loaders

(and

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing

restrictions

Quoted 2 lines
Quoted 2 lines

on

Quoted 1 line

it wrt to the device tree it has to include, and require them to

have

Quoted 1 line
Quoted 1 line
Quoted 1 line

knowledge of U-Boot and it's internal config mechanism makes no

sense not

Quoted 9 lines
Quoted 7 lines
Quoted 1 line

to mention it doesn't scale at all.

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

This is not about size but about firmware supply chain organization.

That's great since it means we just need the bindings reviewed then everyone can pass whatever everyone else needs.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get

Quoted 2 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"),

we

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have binman definitions, etc. So we need a way to overlay those

things

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

into the DT. We already support this for in-tree DTs, so IMO this

is

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be

included

Quoted 2 lines
Quoted 2 lines

in

Quoted 1 line

U-Boot source is not the right way to do that, not to mention cases

were

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 7 lines

it's flash).

Quoted 5 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT

to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

come from a prior stage. How to handle that? IMO that is only

going to

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

There shall be authoritative System Device Trees as vendors are working

on.

Quoted 3 lines

Those System Device Trees cover all aspects of a board, not just the Cortex-A part that U-Boot cares about.
Out of those system device trees, a tool (lopper) is going to carve out

the

Quoted 2 lines

"authoritative dts for the cortex-A".
Essentially, that carve out will correspond to what would come out of

Linux.

s/Linux/software/

Quoted 4 lines

This scheme will not be generalized, just adopted by vendors on some boards.
DT for those board become part of the OS ABI (meaning, the driver developper is constrained).

Quoted 5 lines

OK? And is going to pick and choose which valid bindings to implement? Or is it going to provide half a node for Linux? No? I assume no. So it will also provide whatever bindings we've upstreamed and say need to be passed.

Until we can agree on a better scheme, Linux will server as the basis for most of the bindings.
Some projects, like TF-A maintain their own bindings specifications. I guess U-Boot shall do the same.
The U-Boot DT (for properties or whatever purpose) can be stored in a various of U-Boot decided ways and as part of the TF-A FIP image in the ad-hoc section: NT_FW_CONFIG. Passing FIP information to U-Boot to retrieve the NF_FW_CONFIG should be part of the blob_list discussion that started a while ago.
For System Device Tree, the bindings and the master repo will be maintained in devicetree.org (AFAIK).

Quoted 4 lines

--
Tom

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#53 lore raw
Quoted 194 lines · François Ozog
Quoted 192 lines · Tom Rini
Quoted 13 lines · François Ozog

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 8 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we

could

Quoted 2 lines
Quoted 2 lines

then

Quoted 1 line
Quoted 1 line
Quoted 1 line

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we

could

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can

come

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 1 line
Quoted 1 line
Quoted 1 line

use the device tree from build time at run time, ignoring the

device

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry

on

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different components. Binman was one effort there. I feel that

putting

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will

set

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the

past

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history.

We

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

should sacrifice efficiency, expedience and expandability on the

altar

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for its own purposes, as well as for booting the OS. I am not

saying

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is

essential.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So let's just assume that we need this everywhere, since we

certainly

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

need it in at least some places.

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine.

Adding

Quoted 1 line
Quoted 1 line
Quoted 1 line

that to the DTs that are copied over from linux isn't imho. There

are

Quoted 1 line
Quoted 1 line
Quoted 1 line

various reasons for that. First of all syncing device trees is a

huge

Quoted 2 lines
Quoted 2 lines

pain

Quoted 1 line

and that's probably one of the main reasons our DTs are out of sync

for a

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

large number of boards.

This re-sync is only a pain because:
1. Some platforms have been modifying the core dts files LIKE THEY ARE NOT SUPPOSED TO.
2. DTS files are getting closer to being the super stable API that has been promised now that there's validation tools.

Quoted 6 lines
Quoted 2 lines

Some SoCs, like stm32 are doing an amazing job and keeping things in sync, every release. Others like NXP are violating rule #1.

With NXP commitment to SystemReady on some IMX8 boards, I think this is changing,
at least for the SystemReady boards.

I'd really like to see some progress (as would the other non-NXP folks working on NXP SoCs) in that regard.

Quoted 6 lines
Quoted 6 lines

Still
others like some TI platforms get bit by #2 (I solved one of these, and need to cycle back to the one you and I talked about on IRC a while back, I bet it's another node name dash changed to underbar).

Quoted 1 line

The point is this was fine in 2011 were we had SPL only, but the

reality

Quoted 1 line
Quoted 1 line
Quoted 1 line

today is completely different. There's previous stage boot loaders

(and

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing

restrictions

Quoted 2 lines
Quoted 2 lines

on

Quoted 1 line

it wrt to the device tree it has to include, and require them to

have

Quoted 1 line
Quoted 1 line
Quoted 1 line

knowledge of U-Boot and it's internal config mechanism makes no

sense not

Quoted 9 lines
Quoted 7 lines
Quoted 1 line

to mention it doesn't scale at all.

If you are passing the full device tree around, a few more nodes/properties aren't going to make the situation worse. If we're talking about a 60 kilobyte blob one more kilobyte isn't where we call the line, especially since if we wait another 6 months it'll be a 62 kilobyte file coming in from Linux instead.

This is not about size but about firmware supply chain organization.

That's great since it means we just need the bindings reviewed then everyone can pass whatever everyone else needs.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get

Quoted 2 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"),

we

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have binman definitions, etc. So we need a way to overlay those

things

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

into the DT. We already support this for in-tree DTs, so IMO this

is

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be

included

Quoted 2 lines
Quoted 2 lines

in

Quoted 1 line

U-Boot source is not the right way to do that, not to mention cases

were

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 7 lines

it's flash).

Quoted 5 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT

to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

come from a prior stage. How to handle that? IMO that is only

going to

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

Both of these are solved by having our bindings reviewed and upstreamed and then what we need included in the authoritative dts files.

There shall be authoritative System Device Trees as vendors are working

on.

Quoted 3 lines

Those System Device Trees cover all aspects of a board, not just the Cortex-A part that U-Boot cares about.
Out of those system device trees, a tool (lopper) is going to carve out

the

Quoted 2 lines

"authoritative dts for the cortex-A".
Essentially, that carve out will correspond to what would come out of

Linux.

s/Linux/software/

Quoted 4 lines

This scheme will not be generalized, just adopted by vendors on some boards.
DT for those board become part of the OS ABI (meaning, the driver developper is constrained).

Quoted 7 lines
Quoted 5 lines

OK? And is going to pick and choose which valid bindings to implement? Or is it going to provide half a node for Linux? No? I assume no. So it will also provide whatever bindings we've upstreamed and say need to be passed.

Until we can agree on a better scheme, Linux will server as the basis for most of the bindings.

Yes, this is the de-facto standard since the beginning.

Quoted 1 line

Some projects, like TF-A maintain their own bindings specifications. I

And as I keep saying I believe this to be totally wrong. Unless and only unless the TF-A bindings are for TF-A only to care about, and then it's just one-off do what you guys want non-standard stuff.

Quoted 1 line

guess U-Boot shall do the same.

No, U-Boot is going to upstream the bindings that we want to have be considered official.

Quoted 5 lines

The U-Boot DT (for properties or whatever purpose) can be stored in a various of U-Boot decided ways and as part of the TF-A FIP image in the ad-hoc section: NT_FW_CONFIG. Passing FIP information to U-Boot to retrieve the NF_FW_CONFIG should be part of the blob_list discussion that started a while ago.

Yes, we'll have to see where things progress about what bindings are needed, and where.

Quoted 2 lines

For System Device Tree, the bindings and the master repo will be maintained in devicetree.org (AFAIK).

Interesting, okay.

Signature · 1 line
Tom
#54 lore raw
In reply to Ilias Apalodimas

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 4 lines
Quoted 4 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Quoted 8 lines
Quoted 5 lines

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 28 lines
Quoted 24 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)
{
int property;
int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;
      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;

}

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;
      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;

}

return 0;

}

Quoted 10 lines

Regards
/Ilias

Quoted 7 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

#55 lore raw

Hi Simon,

Quoted 87 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 5 lines

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we could

then

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 35 lines
Quoted 35 lines
Quoted 2 lines

use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 7 lines
Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge

pain

Quoted 5 lines

and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line

to use it's own device tree for whatever reason, imposing restrictions

on

Quoted 3 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 4 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

I am going to change my position in all mail threads I participate. I was trying to make patches relevant in the future and conceptually clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

If you mandate U-Boot has nodes in the device tree passed to the OS, we can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

If you want to put fake, non future proof, DT sources in the dts for platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

Quoted 214 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 2 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included

in

Quoted 2 lines

U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 1 line

it's flash).

I think you are at step 2. See above for my response.

Quoted 11 lines
Quoted 9 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales,

without

Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 2 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be

able to use

Quoted 1 line

that. So the only case were you'll need 3 DTs is if the *vendor* breaks

the

Quoted 2 lines

DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 24 lines
Quoted 24 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 7 lines
Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd

prefer

Quoted 2 lines

if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;

}

Quoted 10 lines

Regards
/Ilias

Quoted 7 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

#56 lore raw

Hi François,

Quoted 93 lines · François Ozog

Hi Simon,

Quoted 83 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 4 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

Quoted 7 lines

I am going to change my position in all mail threads I participate.
I was trying to make patches relevant in the future and conceptually clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

If you mandate U-Boot has nodes in the device tree passed to the OS, we can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

If you want to put fake, non future proof, DT sources in the dts for platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

OK thank you. It doesn't sound like you are very on-board though. Also, you mischaracterise my intent with in-tree devicetrees.

I would be happy enough for now if you could accept that U-Boot has nodes/properties of its own in the devicetree. It has been a feature of U-Boot for 10 years now.

Regards,
Simon

Quoted 209 lines
Quoted 209 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 4 lines
Quoted 4 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Quoted 8 lines
Quoted 5 lines

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 28 lines
Quoted 24 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;

}

Quoted 10 lines

Regards
/Ilias

Quoted 7 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

#57 lore raw

Hi Simon

Quoted 136 lines · Simon Glass

Hi François,

Quoted 23 lines · François Ozog

Hi Simon,

Quoted 19 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 5 lines

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we

could then

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we

could

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can

come

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also

don't

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

use the device tree from build time at run time, ignoring the

device

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different components. Binman was one effort there. I feel that

putting

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the

past

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the

altar

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is

essential.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So let's just assume that we need this everywhere, since we

certainly

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

need it in at least some places.

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine.

Adding

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a

huge pain

Quoted 1 line
Quoted 1 line
Quoted 1 line

and that's probably one of the main reasons our DTs are out of sync

for a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

large number of boards.
The point is this was fine in 2011 were we had SPL only, but the

reality

Quoted 1 line
Quoted 1 line
Quoted 1 line

today is completely different. There's previous stage boot loaders

(and

Quoted 1 line
Quoted 1 line
Quoted 1 line

enough cases were vendors prefer those over SPL). If that bootloader

needs

Quoted 1 line
Quoted 1 line
Quoted 1 line

to use it's own device tree for whatever reason, imposing

restrictions on

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense

not

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 8 lines
Quoted 4 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

I am going to change my position in all mail threads I participate. I was trying to make patches relevant in the future and conceptually

clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

Quoted 3 lines

If you mandate U-Boot has nodes in the device tree passed to the OS, we

can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

Quoted 2 lines

If you want to put fake, non future proof, DT sources in the dts for

platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

Quoted 6 lines

OK thank you. It doesn't sound like you are very on-board though. Also, you mischaracterise my intent with in-tree devicetrees.

I would be happy enough for now if you could accept that U-Boot has nodes/properties of its own in the devicetree. It has been a feature of U-Boot for 10 years now.

On SystemReady systems the DT passed to U-Boot for the OS will be assembled from the board DT and a U-Boot fragment/overlay. The board DT is free from any software/firmware aspects, just contains hardware description. The U-Boot fragment/overlay can contain any nodes it wants. The location of the bindings specification is essentially irrelevant: it could be devicetree.org, U-Boot doc or Linux kernel. Both DTs will be stored in the FIP. OEMs making their firmware will just put whatever is needed in this “dynamic config” DT. On SystemReady platforms U-Boot will always be given a DT, like on the RPI4. U-Boot will be able to ignore it obviously. That said, doing so, a platform may end-up failing compliance tests.
I think we need to document the above in U-Boot and refer to relevant specifications. I’ll let Ilias propose something.

Quoted 241 lines

Regards,
Simon

Quoted 8 lines
Quoted 8 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 2 lines
Quoted 2 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those

things

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's own

DT.

Quoted 1 line
Quoted 1 line
Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be

included in

Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot source is not the right way to do that, not to mention cases

were

Quoted 1 line
Quoted 1 line
Quoted 1 line

that's completely unrealistic (e.g QEMU or a board that reads the DTB

from

Quoted 11 lines
Quoted 11 lines
Quoted 1 line

it's flash).

I think you are at step 2. See above for my response.

Quoted 7 lines
Quoted 7 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going

to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that

scales, without

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 4 lines
Quoted 4 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's

just

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

do it. We have the u-boot.dtsi and we can use binman to put the

image

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

together, for example. Or we can get clever and create some sort of overlay dtb.

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one

internal

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and one from the prior stage....well that is not very efficient and

it

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be

able to use

Quoted 1 line
Quoted 1 line
Quoted 1 line

that. So the only case were you'll need 3 DTs is if the *vendor*

breaks the

Quoted 1 line
Quoted 1 line
Quoted 1 line

DT across kernel versions, In which case there's not much you can do

to

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

Quoted 6 lines
Quoted 6 lines

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 3 lines
Quoted 3 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then

U-Boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can merge the two when it starts. Again that is not very efficient.

It

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

means that U-Boot cannot be controlled by the prior stage (e.g. to

get

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to

deal

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Step 5: If we get clever and want to remove them from the U-Boot

tree

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two?

Six?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot

merge

Quoted 1 line
Quoted 1 line
Quoted 1 line

the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd

prefer

Quoted 1 line
Quoted 1 line
Quoted 1 line

if linux gets handed a clean device tree without the u-boot internals

in

Quoted 92 lines
Quoted 92 lines
Quoted 1 line

it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;

}

Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Regards
/Ilias

Quoted 4 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I

feel

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#58 lore raw

Hi François,

Quoted 112 lines · François Ozog

Hi Simon

Quoted 108 lines · Simon Glass

Hi François,

Quoted 93 lines · François Ozog

Hi Simon,

Quoted 83 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 4 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

Quoted 7 lines

I am going to change my position in all mail threads I participate.
I was trying to make patches relevant in the future and conceptually clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

If you mandate U-Boot has nodes in the device tree passed to the OS, we can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

If you want to put fake, non future proof, DT sources in the dts for platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

OK thank you. It doesn't sound like you are very on-board though. Also, you mischaracterise my intent with in-tree devicetrees.

Quoted 6 lines
Quoted 3 lines

I would be happy enough for now if you could accept that U-Boot has nodes/properties of its own in the devicetree. It has been a feature of U-Boot for 10 years now.

On SystemReady systems the DT passed to U-Boot for the OS will be assembled from the board DT and a U-Boot fragment/overlay. The board DT is free from any software/firmware aspects, just contains hardware description. The U-Boot fragment/overlay can contain any nodes it wants. The location of the bindings specification is essentially irrelevant: it could be devicetree.org, U-Boot doc or Linux kernel. Both DTs will be stored in the FIP. OEMs making their firmware will just put whatever is needed in this “dynamic config” DT. On SystemReady platforms U-Boot will always be given a DT, like on the RPI4. U-Boot will be able to ignore it obviously. That said, doing so, a platform may end-up failing compliance tests. I think we need to document the above in U-Boot and refer to relevant specifications. I’ll let Ilias propose something.

Hmm. So long as OF_BOARD is enabled, the devicetree will not be 'ignored'.

Are you talking here about what TF-A will do? I assume so, since you mention FIP and I believe that is a TF-A invention.

Of course the image is all packaged together in fact, so binman could presumably merge the DTs at build time, if desired.

Regards,
Simon

Quoted 214 lines
Quoted 206 lines
Quoted 206 lines
Quoted 206 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 4 lines
Quoted 4 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Quoted 8 lines
Quoted 5 lines

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 28 lines
Quoted 24 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;

}

Quoted 10 lines

Regards
/Ilias

Quoted 7 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Simon

--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog

#59 lore raw

Hi Simon

Quoted 181 lines · Simon Glass

Hi François,

Quoted 8 lines · François Ozog

Hi Simon

Quoted 4 lines · Simon Glass

Hi François,

On Thu, 28 Oct 2021 at 02:21, François Ozog <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines

Hi Simon,

Le jeu. 28 oct. 2021 à 04:51, Simon Glass <[email protected]> a écrit

:

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think

it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is all that helpful for me to reply to a lot of things on this

thread,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

since I would not be adding much to my cover letter and patches)

Quoted 5 lines

[...]

Quoted 2 lines
Quoted 2 lines

I really want to see what the binary case looks like since we

could then

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we

could

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can

come

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we

also don't

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

use the device tree from build time at run time, ignoring the

device

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to

find

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the instructions. It doesn't have to be that way, but if we

carry on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

as we are, it will continue to be messy and in five years you

will

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency

to the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different components. Binman was one effort there. I feel that

putting

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings,

devicetree

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will

set

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over

the past

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

two months:

Step 1: At present, some people think U-Boot is not even allowed

to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less

history. We

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

should sacrifice efficiency, expedience and expandability on the

altar

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of 'devicetree is a hardware description'. How do we get over

that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

one? Wel, I just think we need to accept that U-Boot uses

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for its own purposes, as well as for booting the OS. I am not

saying

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it always has to have those properties, but with existing

features

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is

essential.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So let's just assume that we need this everywhere, since we

certainly

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

need it in at least some places.

(stop reading here if you disagree, because nothing below will

make

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Having U-Boot keep it's *internal* config state in DTs is fine.

Adding

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that to the DTs that are copied over from linux isn't imho. There

are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

various reasons for that. First of all syncing device trees is a

huge pain

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and that's probably one of the main reasons our DTs are out of

sync for a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

large number of boards.
The point is this was fine in 2011 were we had SPL only, but the

reality

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

today is completely different. There's previous stage boot

loaders (and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

enough cases were vendors prefer those over SPL). If that

bootloader needs

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to use it's own device tree for whatever reason, imposing

restrictions on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it wrt to the device tree it has to include, and require them to

have

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

knowledge of U-Boot and it's internal config mechanism makes no

sense not

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

If you think about it, it doesn't matter what properties are in the

DT

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

I am going to change my position in all mail threads I participate. I was trying to make patches relevant in the future and conceptually

clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

If you mandate U-Boot has nodes in the device tree passed to the OS,

we can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If you want to put fake, non future proof, DT sources in the dts for

platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

Quoted 9 lines
Quoted 7 lines

OK thank you. It doesn't sound like you are very on-board though. Also, you mischaracterise my intent with in-tree devicetrees.

I would be happy enough for now if you could accept that U-Boot has nodes/properties of its own in the devicetree. It has been a feature of U-Boot for 10 years now.

On SystemReady systems the DT passed to U-Boot for the OS will be

assembled from the board DT and a U-Boot fragment/overlay. The board DT is free from any software/firmware aspects, just contains hardware description. The U-Boot fragment/overlay can contain any nodes it wants. The location of the bindings specification is essentially irrelevant: it could be devicetree.org, U-Boot doc or Linux kernel. Both DTs will be stored in the FIP. OEMs making their firmware will just put whatever is needed in this “dynamic config” DT. On SystemReady platforms U-Boot will always be given a DT, like on the RPI4. U-Boot will be able to ignore it obviously. That said, doing so, a platform may end-up failing compliance tests.

Quoted 8 lines
Quoted 1 line

I think we need to document the above in U-Boot and refer to relevant

specifications. I’ll let Ilias propose something.

Hmm. So long as OF_BOARD is enabled, the devicetree will not be 'ignored'.

Are you talking here about what TF-A will do? I assume so, since you mention FIP and I believe that is a TF-A invention.

Yes

Quoted 3 lines

Of course the image is all packaged together in fact, so binman could presumably merge the DTs at build time, if desired.

Practically I don’t think so. The passed device tree will contain all authoritative information such as discovered normal memory (excluded the secure memory ranges), architectural nodes such as PSCI and other nodes coming from TEE-OS or secure partitions such as SCMI interface or firmwareTPM.
If you combine the two static parts at build time you will have to extract the runtime pieces from the DT passed to U-Boot.

Quoted 268 lines

Regards,
Simon

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 3 lines
Quoted 3 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they

get

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi

file"), we

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have binman definitions, etc. So we need a way to overlay those

things

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

into the DT. We already support this for in-tree DTs, so IMO

this is

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

easy. Just require every board to have an in-tree DT. It helps

with

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

discoverability and documentation, anyway. That is this series.

Again, the board might decide for it's own reason to provide it's

own DT.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

IMHO U-Boot must be able to cope with that and asking DTs to be

included in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot source is not the right way to do that, not to mention

cases were

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that's completely unrealistic (e.g QEMU or a board that reads the

DTB from

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

it's flash).

I think you are at step 2. See above for my response.

Quoted 2 lines
Quoted 2 lines

(I think most of us are at the beginning of step 2, unsure about

it

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a

particular

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

flow only, or boards that sometimes use a flow) which need the

DT to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

come from a prior stage. How to handle that? IMO that is only

going to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that

scales, without

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there

is

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

a standard binding, we should be fine.

Quoted 3 lines
Quoted 3 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its

build

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

system. Is TF-A the only thing being discussed here? If so,

let's just

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

do it. We have the u-boot.dtsi and we can use binman to put the

image

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

together, for example. Or we can get clever and create some sort

of

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

overlay dtb.

Step 3a. But I don't want to do that. a) If U-Boot needs this

stuff

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

then it will need to build it in and use two devicetrees, one

internal

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and one from the prior stage....well that is not very efficient

and it

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the

one

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

it uses. So perhaps we have three devicetrees? OMG.

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will

be able to use

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that. So the only case were you'll need 3 DTs is if the *vendor*

breaks the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

DT across kernel versions, In which case there's not much you can

do to

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to

Linux

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 3 lines
Quoted 3 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then

U-Boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can merge the two when it starts. Again that is not very

efficient. It

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

means that U-Boot cannot be controlled by the prior stage (e.g.

to get

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very

confusing,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up

out of

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

whole cloth. What about that? Well, we are just going to have to

deal

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time

issues.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We have a discoverable DT in U-Boot, which should be considered

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come

up

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Step 5: If we get clever and want to remove them from the U-Boot

tree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and pick them up from somewhere else, we can do that with

sufficient

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

tooling. Perhaps we should set a timeline for that? A year? Two?

Six?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot

merge

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH

I'd prefer

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

if linux gets handed a clean device tree without the u-boot

internals in

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain.

With

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot

how

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the

fragment to

Quoted 63 lines
Quoted 63 lines
Quoted 63 lines
Quoted 63 lines

* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

}

Quoted 5 lines

Regards
/Ilias

Quoted 2 lines

To repeat, if we set things up correctly and agree on the

bindings,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

devicetree can be the unifying configuration mechanism through

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

whole of firmware (except for very early bits) and into the OS.

I feel

Quoted 12 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

this will set us up very well to deal with the complexity that is coming.

Regards,
Simon

--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#60 lore raw

Hi François,

Quoted 132 lines · François Ozog

Hi Simon

Quoted 120 lines · Simon Glass

Hi François,

Quoted 116 lines · François Ozog

Hi Simon

Quoted 111 lines · Simon Glass

Hi François,

Quoted 93 lines · François Ozog

Hi Simon,

Quoted 83 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer? I am replying to this but I don't think it is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 4 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

Quoted 7 lines

I am going to change my position in all mail threads I participate.
I was trying to make patches relevant in the future and conceptually clean. That may not be the most effective position: I should just care about Linaro and its members being able to implement SystemReady concepts.

If you mandate U-Boot has nodes in the device tree passed to the OS, we can put DT fragment in the nt_fw_config section of the fip and merge it at boot time. So there is a solution compatible with SystemReady.

If you want to put fake, non future proof, DT sources in the dts for platforms that are organized to provide the authoritative DT to U-Boot at runtime, that's kind of your choice (hopefully representing the rest of U-Boot community). There will be quirk code in U-Boot to redo the adaptations on its non authoritative DT that the platform previous stage firmware does (already saw one in the past month); as Mark said there will be issues over time; and it will confuse people about the role of the DT. But I am fine with it as it does not impair Linaro and its members ability to implement SystemReady way of handling DT.

OK thank you. It doesn't sound like you are very on-board though. Also, you mischaracterise my intent with in-tree devicetrees.

I would be happy enough for now if you could accept that U-Boot has nodes/properties of its own in the devicetree. It has been a feature of U-Boot for 10 years now.

Quoted 7 lines
Quoted 2 lines

On SystemReady systems the DT passed to U-Boot for the OS will be assembled from the board DT and a U-Boot fragment/overlay. The board DT is free from any software/firmware aspects, just contains hardware description. The U-Boot fragment/overlay can contain any nodes it wants. The location of the bindings specification is essentially irrelevant: it could be devicetree.org, U-Boot doc or Linux kernel. Both DTs will be stored in the FIP. OEMs making their firmware will just put whatever is needed in this “dynamic config” DT. On SystemReady platforms U-Boot will always be given a DT, like on the RPI4. U-Boot will be able to ignore it obviously. That said, doing so, a platform may end-up failing compliance tests. I think we need to document the above in U-Boot and refer to relevant specifications. I’ll let Ilias propose something.

Hmm. So long as OF_BOARD is enabled, the devicetree will not be 'ignored'.

Are you talking here about what TF-A will do? I assume so, since you mention FIP and I believe that is a TF-A invention.

Quoted 8 lines

Yes

Quoted 4 lines

Of course the image is all packaged together in fact, so binman could presumably merge the DTs at build time, if desired.

Practically I don’t think so. The passed device tree will contain all authoritative information such as discovered normal memory (excluded the secure memory ranges), architectural nodes such as PSCI and other nodes coming from TEE-OS or secure partitions such as SCMI interface or firmwareTPM. If you combine the two static parts at build time you will have to extract the runtime pieces from the DT passed to U-Boot.

This could be the subject of some future discussion, perhaps, as I don't think we are talking about the same thing. I am talking about the DT packaged in the firmware, but I think you are talking about the things detected at runtime. Binman is for the first problem, not the second.

Regards,
Simon

Quoted 226 lines
Quoted 220 lines

Regards,
Simon

Quoted 214 lines
Quoted 206 lines
Quoted 206 lines
Quoted 206 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 4 lines
Quoted 4 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Quoted 8 lines
Quoted 5 lines

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 16 lines
Quoted 8 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Quoted 28 lines
Quoted 24 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

/**
* overlay_apply_node - Merges a node into the base device tree
* @fdt: Base Device Tree blob
* @target: Node offset in the base device tree to apply the fragment to
* @fdto: Device tree overlay blob
* @node: Node offset in the overlay holding the changes to merge *
* overlay_apply_node() merges a node into a target base device tree
* node pointed.
*
* This is part of the final step in the device tree overlay
* application process, when all the phandles have been adjusted and
* resolved and you just have to merge overlay into the base device
* tree.
*
* returns:
* 0 on success
* Negative error code on failure
*/
static int overlay_apply_node(void *fdt, int target,
void *fdto, int node)

{
   int property;
   int subnode;

   fdt_for_each_property_offset(property, fdto, node) {
      const char *name;
      const void *prop;
      int prop_len;
      int ret;

      prop = fdt_getprop_by_offset(fdto, property, &name,
                    &prop_len);
      if (prop_len == -FDT_ERR_NOTFOUND)
         return -FDT_ERR_INTERNAL;
      if (prop_len < 0)
         return prop_len;

      ret = fdt_setprop(fdt, target, name, prop, prop_len);
      if (ret)
         return ret;
   }

   fdt_for_each_subnode(subnode, fdto, node) {
      const char *name = fdt_get_name(fdto, subnode, NULL);
      int nnode;
      int ret;

      nnode = fdt_add_subnode(fdt, target, name);
      if (nnode == -FDT_ERR_EXISTS) {
         nnode = fdt_subnode_offset(fdt, target, name);
         if (nnode == -FDT_ERR_NOTFOUND)
            return -FDT_ERR_INTERNAL;
      }

      if (nnode < 0)
         return nnode;

      ret = overlay_apply_node(fdt, nnode, fdto, subnode);
      if (ret)
         return ret;
   }

   return 0;

}

Quoted 10 lines

Regards
/Ilias

Quoted 7 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Simon

--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog

--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog

#61 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Ilias,

Quoted 4 lines · Ilias Apalodimas

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer?

We'll probably need something stronger to sort this out :)

Quoted 68 lines

I am replying to this but I don't think it
is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 4 lines

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

I am not sure I am following you here or why binman is relevant to this discussion. If the boot process doesn't require a FIP (e.g SPL
+ U-Boot proper or SPL -> EL3 -> U-Boot proper or TF-A + U-Boot) then using binman makes a lot of sense. If the boot process is TF-A -> U-Boot and requires a FIP, TF-A has it's own set of tools for preparing that [1] [2] , why would we want to teach binman FIP packaging? And if we do are you willing to keep it up to date with everything they come up with? IOW packaging the firmware is not U-Boot's responsibility, it's the vendors. Why should he not be able to choose FIP? (ST already changed that in u-boot btw).

Quoted 5 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

It doesn't, but the point here is entirely different. Today there's a number of U-Boot DTBs that are unable to boot a kernel. The direction we would like to is have the firmware provide a DTB that's usable for the kernel. Yes I know vendors mess things up and there's a correlation of the DTB and the kernel version, but let's set that aside for a moment. If we want to use a 'generic' DT then we have to make sure that whoever packages it knows what to put in there. That's why for me, it's very important to only allow *upstreamed only* DT properties for whoever ends up being responsible for the packaging. In that case you can demand TF-A to bundle U-Boot nodes in the DTB it produces if the board is supposed to use U-Boot. If those are internal only to U-Boot and not upstreamed this makes little sense to me and I don't see why people will agree to that.

Quoted 33 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 10 lines
Quoted 9 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

Quoted 5 lines
Quoted 2 lines

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

The keyword here is the definition of 'standard'. If standard means upstreamed to DT spec, as I said before I don't see any problem. By unusable I was referring to the QEMU DTs you are trying to push into U-Boot or the RPI one. It doesn't scale because you have to maintain and upstream all the DTs in the U-Boot tree. The story so far is merge and forget for a big number of DTs, so I find it hard to believe that everyone will start behaving and sync up their DTs. I'd much rather prefer having a central repo and force people to use that.

Quoted 27 lines
Quoted 17 lines
Quoted 9 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

Quoted 5 lines

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Again if we are talking about bindings that are upstream in the spec, then we agree. Depending on the SRAM limitation we can even do (a). If the vendor messes up the DT backwards compatibility then we can do (b). If you expect TF-A and FIP to go pick up the special bindings U-Boot needs, then we disagree.

Quoted 47 lines
Quoted 29 lines
Quoted 25 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

Quoted 7 lines

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

Again I am repeating myself so here's a tl;dr of how I view this:
1. All DT bindings u-boot expect become part of the DT spec -- I am fine with whatever, since at this point it makes sense to say "You are booting u-boot go add whatever it expects, it's part of the spec". The prior stage boot loader can then obviously merge the DT fragments and everyone will be happy.
2. For the bindings that are not upstreamed, I'd prefer having u-boot do the fixup. Alternatively, we could provide fragments that are easy for TF-A to merge? By easy I don't mean read U-Boot code, it's .dts files, find the fragments you need and add them manually...

[...]

[1] https://wiki.st.com/stm32mpu/wiki/How_to_configure_TF-A_FW_CONFIG
[2] https://trustedfirmware-a.readthedocs.io/en/latest/design/trusted-board-boot-build.html

Regards

/Ilias

#62 lore raw

Hi,

Quoted 3 lines · Simon Glass
Quoted 2 lines

On Tue, 26 Oct 2021 at 00:46, Ilias Apalodimas
<[email protected]> wrote:

..

Quoted 7 lines
Quoted 7 lines

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

Quoted 8 lines
Quoted 2 lines

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Again if we are talking about bindings that are upstream in the spec, then we agree. Depending on the SRAM limitation we can even do (a). If the vendor messes up the DT backwards compatibility then we can do (b). If you expect TF-A and FIP to go pick up the special bindings U-Boot needs, then we disagree.

*puts developer at board vendor hat on* Sometimes (personally I'd say usually) it isn't possible to have a backwards compatible tree. Also, like it or not, in the device tree there *are* configuration options which are not hardware dependent (eg. internal ethernet connection on the ls1028a). So a vendor doesn't necessarily need to "mess things up" to need (b). And as you know, my point is, that this device tree has to come from the distribution, it must not be compiled in into the firmware.

I feel like I've repeated this far too many times. Therefore, this will be my last comment about it and I would really like to see that this - very real - scenario is treated as a valid use case and will be supported in your systemready vision.

-michael

#63 lore raw
Quoted 25 lines · Michael Walle

Hi,

Quoted 3 lines · Simon Glass
Quoted 2 lines

On Tue, 26 Oct 2021 at 00:46, Ilias Apalodimas
<[email protected]> wrote:

..

Quoted 6 lines
Quoted 6 lines

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to

Linux

Quoted 9 lines
Quoted 3 lines

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Again if we are talking about bindings that are upstream in the spec, then we agree. Depending on the SRAM limitation we can even do (a). If the vendor messes up the DT backwards compatibility then we can do (b). If you expect TF-A and FIP to go pick up the special bindings U-Boot needs, then we disagree.

Quoted 5 lines

*puts developer at board vendor hat on* Sometimes (personally I'd say usually) it isn't possible to have a backwards compatible tree. Also, like it or not, in the device tree there *are* configuration options which are not hardware dependent (eg. internal ethernet connection on the ls1028a).

Are you referring to DPAA2 configuration to create the ethernet port itself ?
This is indeed configuration. There are many ways to handle those ones. As well as SerDes configuration to make PCI lanes or MDIO lanes. Yet the two are different in nature: SerDes configuration must match board layout,
so it is about "no user choice" configuration. This configuration could be statically
defined and attached with the board. But it there is a SoM with a carrier board,
we may need to compose that at runtime for development, or make it static build
for product packaging.
DPAA2 configuration is user choice driven. Those choices can be merged in the DT
to be passed to the OS at runtime. There are multiple ways to deal with that, from DT overlays
to U-Boot DPAA2 command line extensions that would inject the DT necessary nodes.

Quoted 5 lines

So a vendor doesn't necessarily need to "mess things up" to need (b). And as you know, my point is, that this device tree has to come from the distribution, it must not be compiled in into the firmware.

I wouldn't bet that all distro providers will always come with a DT...

Quoted 6 lines

I feel like I've repeated this far too many times. Therefore, this will be my last comment about it and I would really like to see that this - very real - scenario is treated as a valid use case and will be supported in your systemready vision.

I have been building (shared it on the list) a deck to go into those details. I am almost ready to talk to it.

Quoted 3 lines

-michael

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#64 lore raw
In reply to Ilias Apalodimas

Hi Ilias,

Quoted 10 lines · Ilias Apalodimas

Hi Simon,

Quoted 6 lines · Simon Glass

Hi Ilias,

Quoted 1 line · Ilias Apalodimas
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Hi Simon,

A bit late to the party, sorry!

(Did you remember the beer?

We'll probably need something stronger to sort this out :)

Yes I agree!

Quoted 74 lines
Quoted 69 lines

I am replying to this but I don't think it
is all that helpful for me to reply to a lot of things on this thread, since I would not be adding much to my cover letter and patches)

Quoted 51 lines

[...]

Quoted 44 lines
Quoted 11 lines

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 3 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Quoted 12 lines

Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards.
The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all.

Quoted 4 lines

I think the solution here may be the binman image packer. It works from a description of the image (i.e. is data-driver) and can collect all the pieces together. The U-Boot properties (and the ones required by TF-A, etc.) can be added at package time.

Quoted 10 lines

I am not sure I am following you here or why binman is relevant to this discussion. If the boot process doesn't require a FIP (e.g SPL
+ U-Boot proper or SPL -> EL3 -> U-Boot proper or TF-A + U-Boot) then using binman makes a lot of sense. If the boot process is TF-A -> U-Boot and requires a FIP, TF-A has it's own set of tools for preparing that [1] [2] , why would we want to teach binman FIP packaging? And if we do are you willing to keep it up to date with everything they come up with? IOW packaging the firmware is not U-Boot's responsibility, it's the vendors. Why should he not be able to choose FIP? (ST already changed that in u-boot btw).

Binman is a firmware packager. It seems to be the one that is used last, to produce the final image, although I am not sure as this seems quite complicated.

My view on firmware is that we should build it step by step with individual projects but then package it all at the end and Binman is designed to do the packaging.

https://u-boot.readthedocs.io/en/latest/develop/package/binman.html#motivation

So I am not sure what problem FIP solves, or why it was invented, Did we need another firmware format?

But if FIP is important, then yes I think support for it should be added to Binman. It will make packaging a lot easier.

Quoted 7 lines
Quoted 6 lines

If you think about it, it doesn't matter what properties are in the DT that is put into the firmware image. TF-A, for example, is presumably reading a devicetree from flash, so what does it care if it has some U-Boot properties in it?

Quoted 13 lines

It doesn't, but the point here is entirely different. Today there's a number of U-Boot DTBs that are unable to boot a kernel. The direction we would like to is have the firmware provide a DTB that's usable for the kernel. Yes I know vendors mess things up and there's a correlation of the DTB and the kernel version, but let's set that aside for a moment. If we want to use a 'generic' DT then we have to make sure that whoever packages it knows what to put in there. That's why for me, it's very important to only allow *upstreamed only* DT properties for whoever ends up being responsible for the packaging. In that case you can demand TF-A to bundle U-Boot nodes in the DTB it produces if the board is supposed to use U-Boot. If those are internal only to U-Boot and not upstreamed this makes little sense to me and I don't see why people will agree to that.

Well I think all of this is taking too much energy...I have stated my position. U-Boot needs its nodes and properties.

Quoted 40 lines
Quoted 34 lines

As to syncing, we have solved this using u-boot.dtsi files in U-Boot, so I think this can be dealt with.

Quoted 11 lines
Quoted 10 lines

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

Quoted 5 lines

Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash).

I think you are at step 2. See above for my response.

Quoted 10 lines
Quoted 9 lines

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business.

Quoted 5 lines
Quoted 2 lines

And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot.

In what way does this not scale? How are the DTs unusable? If there is a standard binding, we should be fine.

Quoted 8 lines

The keyword here is the definition of 'standard'. If standard means upstreamed to DT spec, as I said before I don't see any problem. By unusable I was referring to the QEMU DTs you are trying to push into U-Boot or the RPI one. It doesn't scale because you have to maintain and upstream all the DTs in the U-Boot tree. The story so far is merge and forget for a big number of DTs, so I find it hard to believe that everyone will start behaving and sync up their DTs. I'd much rather prefer having a central repo and force people to use that.

Well let's see how it goes. If we can get some validation in place, then the picture should get better.

Quoted 31 lines
Quoted 31 lines
Quoted 18 lines
Quoted 10 lines

We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 7 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG.

Quoted 5 lines

No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with.

Linux actually doesn't care if the U-Boot properties are in the tree, so long as we have proper bindings. My point here is we only need either:

a. one devicetree, shared with Linux and U-Boot (and TF-A?) b. two devicetrees, one for use in firmware and one for passing to Linux

Quoted 8 lines
Quoted 2 lines

We don't need to separate out the U-Boot properties into a second (or third) devicetree. There just isn't any point.

Again if we are talking about bindings that are upstream in the spec, then we agree. Depending on the SRAM limitation we can even do (a). If the vendor messes up the DT backwards compatibility then we can do (b). If you expect TF-A and FIP to go pick up the special bindings U-Boot needs, then we disagree.

I would certainly prefer to be talking about bindings that are upstreamed, if they can be upstreamed. I sent a patch with a start on that and then a PR to the repo here:

https://github.com/devicetree-org/dt-schema/pull/62

So perhaps we should hold off on this and see how progress is in a month or so.

Quoted 56 lines
Quoted 48 lines
Quoted 30 lines
Quoted 26 lines

b) Well then
U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

Quoted 5 lines

We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall.

I know you would prefer that, but does it really matter in practice? What is the objection, actually?

As I mentioned on the call, I think the prior stage should do any merging or fixing up. Trying to do that sort of thing in 'early' code in U-Boot (or any other program, including Linux) is such a pain. With U-Boot, for example, we don't even have any RAM available to do it with half the time and it would dramatically increase the amount of memory needed prior to relocation. It just isn't a very good idea to try to do this in early code. It is also completely unnecessary, once you get past the philosophical objections.

Quoted 7 lines

If TF-A wants to be in the picture, let it deal with the implications and responsibility thus incurred. TF-A has no right to tell U-Boot how to handle its config. TF-A is 0.5m LOC, i.e. a lot, almost a quarter of the size of U-Boot. It duplicates loads of things in there. No one will even *notice* an FDT merge function, which is actually only 70 LOC:

Quoted 10 lines

Again I am repeating myself so here's a tl;dr of how I view this:
1. All DT bindings u-boot expect become part of the DT spec -- I am fine with whatever, since at this point it makes sense to say "You are booting u-boot go add whatever it expects, it's part of the spec". The prior stage boot loader can then obviously merge the DT fragments and everyone will be happy.
2. For the bindings that are not upstreamed, I'd prefer having u-boot do the fixup. Alternatively, we could provide fragments that are easy for TF-A to merge? By easy I don't mean read U-Boot code, it's .dts files, find the fragments you need and add them manually...

OK, well then I don't think we have anything of concern here, so long as we can get the bindings agreed. Let's see how it goes.

Regards,
Simon

Quoted 9 lines

[...]

[1] https://wiki.st.com/stm32mpu/wiki/How_to_configure_TF-A_FW_CONFIG
[2] https://trustedfirmware-a.readthedocs.io/en/latest/design/trusted-board-boot-build.html

Regards

/Ilias

#65 lore raw
In reply to Simon Glass
Quoted 199 lines · Simon Glass

Hi all,

Quoted 171 lines · Tom Rini
Quoted 143 lines · Simon Glass

Hi Tom,

Quoted 132 lines · Tom Rini
Quoted 130 lines · Simon Glass

Hi François,

Quoted 119 lines · François Ozog

Hi Simon

Quoted 66 lines · Simon Glass

Hi Tom, Bin,François,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 22 lines · Simon Glass

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 are documented at [1].

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.

Quoted 5 lines

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 series makes this change, adding various missing devicetree files (and placeholders) to make the build work.

Adding device trees that are never used sounds like a hack to me.

For QEMU, device tree is dynamically generated on the fly based on command line parameters, and the device tree you put in this series has various hardcoded <phandle> values which normally do not show up in hand-written dts files.

Quoted 5 lines
Quoted 1 line

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding device trees for platforms that are capable of and can / do have a device tree to give us at run time.

(I'll just reply to this one email, since the same points applies to all replies I think)

I have been thinking about this and discussing it with people for a few months now. I've been signalling a change like this for over a month now, on U-Boot contributor calls and in discussions with Linaro people. I sent a patch (below) to try to explain things. I hope it is not a surprise!

The issue here is that we need a devicetree in-tree in U-Boot, to avoid the mess that has been created by OF_PRIOR_STAGE, OF_BOARD, BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE. Between Ilias' series and this one we can get ourselves on a stronger footing. There is just OF_SEPARATE, with OF_EMBED for debugging/ELF use. For more context:

Quoted 6 lines

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

BTW I did suggest to QEMU ARM that they support a way of adding the u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for booting Linux directly!)

i understand their point of view and agree with it.

Quoted 10 lines

But in any case it doesn't really help U-Boot. I
think the path forward might be to run QEMU twice, once to get its generated tree and once to give the 'merged' tree with the U-Boot properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time option, not a build-time one. It creates all sorts of problems and obscurity which have taken months to unpick. See the above patch for the rationale.

Quoted 10 lines

To add to that rationale, OF_BOARD needs to be an option available to any board. At some point in the future it may become a common way things are done, e.g. TF-A calling U-Boot and providing a devicetree to it. It doesn't make any sense to have people decide whether or not to set OF_BOARD at build time, thus affecting how the image is put together. We'll end up with different U-Boot build targets like capricorn, capricorn_of_board and the like. It should be obvious where that will lead. Instead, OF_BOARD needs to become a commonly used option, perhaps enabled by most/all boards, so that this sort of build explosion is not needed.

If you mean that when boards are by construction providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 11 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which it finds itself.

Also as binman is pressed into service more and more to build the complex firmware images that are becoming fashionable, it needs a definition (in the devicetree) that describes how to create the image. We can't support that unless we are building a devicetree, nor can the running program access the image layout without that information.

Quoted 7 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since OF_BOARD is, still, enabled. We already use OF_BOARD for various boards that include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for example (as I said in the cover letter "Most boards do provide one, but some don't."). So this series is just completing the picture by enforcing that *some sort* of devicetree is always present.

Quoted 1 line

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on this issue, is that OF_BOARD needs to be a run-time option. At present it has build-time effects and this is quite wrong. If you go through all the material I have written on this I think I have motivated that very clearly.

Quoted 7 lines
Quoted 3 lines

Another big issue is that I believe we need ONE devicetree for U-Boot, not two that get merged by U-Boot. Again I have gone through that in a lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that U-Boot needs to support being passed a device tree to use, at run time, yes?

Quoted 6 lines

Yes. The OF_BOARD feature provides this.

Quoted 2 lines

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 9 lines
Quoted 4 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device tree at run time (think BeagleBone Black) and one where we will always be given one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may want to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not have to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Quoted 4 lines

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

See below.

Quoted 11 lines
Quoted 6 lines

I believe we have got unstuck because OF_BOARD (perhaps inadvertently) provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could then kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

Quoted 6 lines

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Quoted 10 lines

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

Yes, it's Not Great. I don't like my handful of build-BOARD.sh scripts that know where to grab other known-good binaries of varying licenses that are needed to assemble something that boots.

Quoted 8 lines

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Quoted 7 lines

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT. It is an abuse of the devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying

Yes, we need to have properties present in the device tree, and just like how "linux," is a valid vendor prefix for the linux kernel (but not used I would expect by the BSD families) we have cases that need "u-boot," properties.

Quoted 5 lines

it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

No, we can't / shouldn't assume we need this everywhere. A lot of places? Yes. But some features are going to be optional. A valid must be supported use case is something like a Pi where the hardware gives us a device tree, the tree is correct and some features in U-Boot aren't needed (SPL) nor possibly supported immediately (verified boot). We can go off on a tangent about how useful it would be to have HW platforms that are both common and can demonstrate a number of features, but that's its own problem to solve.

Quoted 26 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business. We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Quoted 14 lines

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG. b) Well then U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient. It means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

How the nodes should get there is how the rest of the nodes in a system get there. Bindings are submitted and reviewed. The authoritative source of the dtses in question then has them, like any other property.

Quoted 14 lines

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

These last two paragraphs condense what I think is honestly close to a decade of debate / discussion down to a fiat "U-Boot will have the DTS files". I don't want that. I don't think any of the other projects that want to leverage DTS files want that.

Quoted 5 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Sure, it could. But that doesn't mean that U-Boot is where the dts files live.

Signature · 1 line
Tom
#66 lore raw

Hi,

Quoted 287 lines · Tom Rini
Quoted 13 lines · Simon Glass

Hi all,

Quoted 10 lines · Tom Rini
Quoted 8 lines · Simon Glass

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 3 lines · Simon Glass

Hi François,

On Wed, 13 Oct 2021 at 11:35, François Ozog <

Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Simon

Le mer. 13 oct. 2021 à 16:49, Simon Glass <[email protected]>

Quoted 4 lines · a écrit :
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Tom, Bin,François,

On Tue, 12 Oct 2021 at 19:34, Tom Rini <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Bin Meng
Quoted 3 lines

Hi Simon,

On Wed, Oct 13, 2021 at 9:01 AM Simon Glass <

Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

With Ilias' efforts we have dropped OF_PRIOR_STAGE and

OF_HOSTFILE so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

there are only three ways to obtain a devicetree:

- OF_SEPARATE - the normal way, where the devicetree

is built and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

appended to U-Boot
- OF_EMBED - for development purposes, the

devicetree is embedded in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in the U-Boot tree. Most boards do provide one, but

some don't. Some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't even provide instructions on how to boot on the

board.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The problems with this approach are documented at [1].

In practice, OF_BOARD is not really distinct from

OF_SEPARATE. Any board

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can obtain its devicetree at runtime, even it is has a

devicetree built

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in U-Boot. This is because U-Boot may be a second-stage

bootloader and its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware

available in the machine.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

option, available with either OF_SEPARATE or OF_EMBED.

This series makes this change, adding various missing

devicetree files

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

(and placeholders) to make the build work.

Adding device trees that are never used sounds like a

hack to me.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For QEMU, device tree is dynamically generated on the fly

based on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

command line parameters, and the device tree you put in

this series

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has various hardcoded <phandle> values which normally do

not show up

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

in hand-written dts files.

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding

device trees for

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

platforms that are capable of and can / do have a device

tree to give us

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

at run time.

(I'll just reply to this one email, since the same points

applies to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

all replies I think)

I have been thinking about this and discussing it with people

for a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

few months now. I've been signalling a change like this for

over a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

month now, on U-Boot contributor calls and in discussions

with Linaro

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

people. I sent a patch (below) to try to explain things. I

hope it is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

not a surprise!

The issue here is that we need a devicetree in-tree in

U-Boot, to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

avoid the mess that has been created by OF_PRIOR_STAGE,

OF_BOARD,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE.

Between

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Ilias' series and this one we can get ourselves on a stronger

footing.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

There is just OF_SEPARATE, with OF_EMBED for debugging/ELF

use.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

For more context:

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

BTW I did suggest to QEMU ARM that they support a way of

adding the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for

booting

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Linux directly!)

i understand their point of view and agree with it.

Quoted 3 lines

But in any case it doesn't really help U-Boot. I think the path forward might be to run QEMU twice, once to

get its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

generated tree and once to give the 'merged' tree with the

U-Boot

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time

option, not a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

build-time one. It creates all sorts of problems and

obscurity which

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have taken months to unpick. See the above patch for the

rationale.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

To add to that rationale, OF_BOARD needs to be an option

available to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

any board. At some point in the future it may become a common

way

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

things are done, e.g. TF-A calling U-Boot and providing a

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to it. It doesn't make any sense to have people decide

whether or not

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to set OF_BOARD at build time, thus affecting how the image

is put

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

together. We'll end up with different U-Boot build targets

like

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

capricorn, capricorn_of_board and the like. It should be

obvious where

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that will lead. Instead, OF_BOARD needs to become a commonly

used

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

option, perhaps enabled by most/all boards, so that this sort

of build

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

explosion is not needed.

If you mean that when boards are by construction providing a

DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which

it finds

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

itself.

Also as binman is pressed into service more and more to build

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

complex firmware images that are becoming fashionable, it

needs a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

definition (in the devicetree) that describes how to create

the image.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We can't support that unless we are building a devicetree,

nor can the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

running program access the image layout without that

information.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since

OF_BOARD

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is, still, enabled. We already use OF_BOARD for various

boards that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for

example

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(as I said in the cover letter "Most boards do provide one,

but some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't."). So this series is just completing the picture by

enforcing

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

that *some sort* of devicetree is always present.

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on

this

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

issue, is that OF_BOARD needs to be a run-time option. At

present it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has build-time effects and this is quite wrong. If you go

through all

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the material I have written on this I think I have motivated

that very

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

clearly.

Another big issue is that I believe we need ONE devicetree for

U-Boot,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

not two that get merged by U-Boot. Again I have gone through

that in a

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that

U-Boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

needs to support being passed a device tree to use, at run time,

yes?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Yes. The OF_BOARD feature provides this.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 2 lines
Quoted 2 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device

tree at

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

run time (think BeagleBone Black) and one where we will always be

given

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may

want

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not

have

Quoted 4 lines
Quoted 4 lines

to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Quoted 9 lines
Quoted 4 lines

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

See below.

Quoted 2 lines
Quoted 2 lines

I believe we have got unstuck because OF_BOARD (perhaps

inadvertently)

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could

then

Quoted 10 lines
Quoted 9 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Quoted 10 lines

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

Quoted 14 lines

Yes, it's Not Great. I don't like my handful of build-BOARD.sh scripts that know where to grab other known-good binaries of varying licenses that are needed to assemble something that boots.

Quoted 10 lines

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT.

In my view U-Boot shall be able to leverage device tree format (source and binary) to store its own data.
When you say "the" DT, I always think this is "the" DT that is passed to OS and in "that" DT, there should be no U-Boot entries. As stated in another mail thread, I also refer to a place in a FIP where that dynamic config DT is meant to be stored: NT_FW_CONFIG.
But there can be U-Boot defined bindings in "a" control/dynamic config DT; Trusted Firmware does that.

Quoted 18 lines

It is an abuse of the

Quoted 5 lines

devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying

Yes, we need to have properties present in the device tree, and just like how "linux," is a valid vendor prefix for the linux kernel (but not used I would expect by the BSD families) we have cases that need "u-boot," properties.

Quoted 5 lines

it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 44 lines

No, we can't / shouldn't assume we need this everywhere. A lot of places? Yes. But some features are going to be optional. A valid must be supported use case is something like a Pi where the hardware gives us a device tree, the tree is correct and some features in U-Boot aren't needed (SPL) nor possibly supported immediately (verified boot). We can go off on a tangent about how useful it would be to have HW platforms that are both common and can demonstrate a number of features, but that's its own problem to solve.

Quoted 35 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business. We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG. b) Well then U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient.

Does not need to merge the two. hence it does not have any influence on efficiency.
For properties access, trusted firmware has defined an abstract way to get them:
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
.
The properties are currently implemented as DT but TF.ORG could decide to move to CBOR.
The API will remain so that a change in backend will not influence existing code.
I think you are too focused on "THE" device tree. "THE" device tree that is passed to the OS
shall be hardware description and not a hacky place to fit any piece of metadata.
I would argue that /chosen shall not even be there as most if not all information can be passed as OS command line. And actually for the UEFI contract, /chosen should go empty.

Quoted 25 lines

It

Quoted 5 lines

means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

How the nodes should get there is how the rest of the nodes in a system get there. Bindings are submitted and reviewed. The authoritative source of the dtses in question then has them, like any other property.

Quoted 14 lines

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 5 lines
Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

For SystemReady compliant boards, this has to come much faster.

Do you think distros will keep providing DTs for ever? I bet not.

Quoted 17 lines

These last two paragraphs condense what I think is honestly close to a decade of debate / discussion down to a fiat "U-Boot will have the DTS files". I don't want that. I don't think any of the other projects that want to leverage DTS files want that.

Quoted 5 lines

To repeat, if we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS. I feel this will set us up very well to deal with the complexity that is coming.

Sure, it could. But that doesn't mean that U-Boot is where the dts files live.

--
Tom

Signature · 3 lines
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
#67 lore raw
Quoted 336 lines · François Ozog

Hi,

On Wed, 27 Oct 2021 at 14:48, Tom Rini <[email protected] <mailto:[email protected]>> wrote:

On Fri, Oct 15, 2021 at 12:03:44PM -0600, Simon Glass wrote:
> Hi all,
>
> On Thu, 14 Oct 2021 at 09:28, Tom Rini <[email protected]
<mailto:[email protected]>> wrote:
> >
> > On Thu, Oct 14, 2021 at 09:17:52AM -0600, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Thu, 14 Oct 2021 at 08:56, Tom Rini <[email protected]
<mailto:[email protected]>> wrote:
> > > >
> > > > On Wed, Oct 13, 2021 at 12:06:02PM -0600, Simon Glass wrote:
> > > > > Hi François,
> > > > >
> > > > > On Wed, 13 Oct 2021 at 11:35, François Ozog
<[email protected] <mailto:[email protected]>> wrote:
> > > > > >
> > > > > > Hi Simon
> > > > > >
> > > > > > Le mer. 13 oct. 2021 à 16:49, Simon Glass
<[email protected] <mailto:[email protected]>> a écrit :
> > > > > >>
> > > > > >> Hi Tom, Bin,François,
> > > > > >>
> > > > > >> On Tue, 12 Oct 2021 at 19:34, Tom Rini
<[email protected] <mailto:[email protected]>> wrote:
> > > > > >> >
> > > > > >> > On Wed, Oct 13, 2021 at 09:29:14AM +0800, Bin Meng
wrote:
> > > > > >> > > Hi Simon,
> > > > > >> > >
> > > > > >> > > On Wed, Oct 13, 2021 at 9:01 AM Simon Glass
<[email protected] <mailto:[email protected]>> wrote:
> > > > > >> > > >
> > > > > >> > > > 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 are documented
at [1].
> > > > > >> > > >
> > > > > >> > > > 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 series makes this change, adding various
missing devicetree files
> > > > > >> > > > (and placeholders) to make the build work. > > > > > >> > >
> > > > > >> > > Adding device trees that are never used sounds
like a hack to me.
> > > > > >> > >
> > > > > >> > > For QEMU, device tree is dynamically generated on
the fly based on
> > > > > >> > > command line parameters, and the device tree you
put in this series
> > > > > >> > > has various hardcoded <phandle> values which
normally do not show up
> > > > > >> > > in hand-written dts files.
> > > > > >> > >
> > > > > >> > > I am not sure I understand the whole point of this. > > > > > >> >
> > > > > >> > I am also confused and do not like the idea of
adding device trees for
> > > > > >> > platforms that are capable of and can / do have a
device tree to give us
> > > > > >> > at run time.
> > > > > >>
> > > > > >> (I'll just reply to this one email, since the same
points applies to
> > > > > >> all replies I think)
> > > > > >>
> > > > > >> I have been thinking about this and discussing it with
people for a
> > > > > >> few months now. I've been signalling a change like
this for over a
> > > > > >> month now, on U-Boot contributor calls and in
discussions with Linaro
> > > > > >> people. I sent a patch (below) to try to explain
things. I hope it is
> > > > > >> not a surprise!
> > > > > >>
> > > > > >> The issue here is that we need a devicetree in-tree in
U-Boot, to
> > > > > >> avoid the mess that has been created by
OF_PRIOR_STAGE, OF_BOARD,
> > > > > >> BINMAN_STANDALONE_FDT and to a lesser extent,
OF_HOSTFILE. Between
> > > > > >> Ilias' series and this one we can get ourselves on a
stronger footing.
> > > > > >> There is just OF_SEPARATE, with OF_EMBED for
debugging/ELF use.
> > > > > >> For more context:
> > > > > >>
> > > > > >>
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
<http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/>
> > > > > >>
> > > > > >> BTW I did suggest to QEMU ARM that they support a way
of adding the
> > > > > >> u-boot.dtsi but there was not much interest there (in
fact the
> > > > > >> maintainer would prefer there was no special support
even for booting
> > > > > >> Linux directly!)
> > > > > >
> > > > > > i understand their point of view and agree with it. > > > > > >>
> > > > > >> But in any case it doesn't really help U-Boot. I > > > > > >> think the path forward might be to run QEMU twice,
once to get its
> > > > > >> generated tree and once to give the 'merged' tree with
the U-Boot
> > > > > >> properties in it, if people want to use U-Boot features. > > > > > >>
> > > > > >> I do strongly believe that OF_BOARD must be a run-time
option, not a
> > > > > >> build-time one. It creates all sorts of problems and
obscurity which
> > > > > >> have taken months to unpick. See the above patch for
the rationale.
> > > > > >>
> > > > > >> To add to that rationale, OF_BOARD needs to be an
option available to
> > > > > >> any board. At some point in the future it may become a
common way
> > > > > >> things are done, e.g. TF-A calling U-Boot and
providing a devicetree
> > > > > >> to it. It doesn't make any sense to have people decide
whether or not
> > > > > >> to set OF_BOARD at build time, thus affecting how the
image is put
> > > > > >> together. We'll end up with different U-Boot build
targets like
> > > > > >> capricorn, capricorn_of_board and the like. It should
be obvious where
> > > > > >> that will lead. Instead, OF_BOARD needs to become a
commonly used
> > > > > >> option, perhaps enabled by most/all boards, so that
this sort of build
> > > > > >> explosion is not needed.
> > > > > >
> > > > > > If you mean that when boards are by construction
providing a DTB to U-Boot then I agree very much. But I don’t understand how the patch set  supports it as it puts dts files for those boards to be built.
> > > > > >>
> > > > > >> U-Boot needs to be flexible enough to
> > > > > >> function correctly in whatever runtime environment in
which it finds
> > > > > >> itself.
> > > > > >>
> > > > > >> Also as binman is pressed into service more and more
to build the
> > > > > >> complex firmware images that are becoming fashionable,
it needs a
> > > > > >> definition (in the devicetree) that describes how to
create the image.
> > > > > >> We can't support that unless we are building a
devicetree, nor can the
> > > > > >> running program access the image layout without that
information.
> > > > > >>
> > > > > >> François's point about 'don't use this with any kernel' is > > > > > >> germane...but of course I am not suggesting doing
that, since OF_BOARD
> > > > > >> is, still, enabled. We already use OF_BOARD for
various boards that
> > > > > >> include an in-tree devicetree - Raspberry Pi 1, 2 and
3, for example
> > > > > >> (as I said in the cover letter "Most boards do provide
one, but some
> > > > > >> don't."). So this series is just completing the
picture by enforcing
> > > > > >> that *some sort* of devicetree is always present. > > > > > >
> > > > > > That seems inconsistent with the OF_BOARD becomes the
default.
> > > > >
> > > > > I think the key point that will get you closer to where I
am on this
> > > > > issue, is that OF_BOARD needs to be a run-time option. At
present it
> > > > > has build-time effects and this is quite wrong. If you go
through all
> > > > > the material I have written on this I think I have
motivated that very
> > > > > clearly.
> > > > >
> > > > > Another big issue is that I believe we need ONE
devicetree for U-Boot,
> > > > > not two that get merged by U-Boot. Again I have gone
through that in a
> > > > > lot of detail.
> > > >
> > > > I have a long long reply to your first reply here saved,
but, maybe
> > > > here's the biggest sticking point.  To be clear, you agree
that U-Boot
> > > > needs to support being passed a device tree to use, at run
time, yes?
> > >
> > > Yes. The OF_BOARD feature provides this.
> > >
> > > >
> > > > And in that case, would not be using the "fake" tree we
built in?
> > >
> > > Not at runtime.
> >
> > OK.
> >
> > > > So is the sticking point here that we really have two
classes of
> > > > devices, one class where we will never ever be given the
device tree at
> > > > run time (think BeagleBone Black) and one where we will
always be given
> > > > one at run time (think Raspberry Pi) ?
> > >
> > > I'm not sure it will be that black and white. I suspect there
will be
> > > (many) boards which can boot happily with the U-Boot
devicetree but
> > > can also accept one at runtime, if provided. For example, you
may want
> > > to boot with or without TF-A or some other, earlier stage. > >
> > I'm not sure I see the value in making this a gray area.
There's very
> > much a class of "never" boards.  There's also the class of
"can" today.
> > Maybe as part of a developer iterative flow it would be nice to
not have
> > to re-flash the prior stage to change a DT, and just do it in
U-Boot
> > until things are happy, but I'm not sure what the use case is for > > overriding the previous stage.
> >
> > Especially since the pushback on this series I think has all
been "why
> > are we copying in a tree to build with?  We don't want to use
it at run
> > time!".  And then softer push back like "Well, U-Boot says we
have to
> > include the device tree file here, but we won't use it...". >
> See below.
>
> >
> > > I believe we have got unstuck because OF_BOARD (perhaps
inadvertently)
> > > provided a way to entirely omit a devicetree from U-Boot,
thus making
> > > things like binman and U-Boot /config impossible, for
example. So I
> > > want to claw that back, so there is always some sort of
devicetree in
> > > U-Boot, as we have for rpi_3, etc.
> >
> > I really want to see what the binary case looks like since we
could then
> > kill off rpi_{3,3_b,4}_defconfig and I would need to see if we
could
> > then also do a rpi_arm32_defconfig too.
> >
> > I want to see less device trees in U-Boot sources, if they can come > > functionally correct from the hardware/our caller.
> >
> > And I'm not seeing how we make use of "U-Boot /config" if we
also don't
> > use the device tree from build time at run time, ignoring the
device
> > tree provided to us at run time by the caller.
>
> Firstly I should say that I find building firmware very messy and > confusing these days. Lots of things to build and it's hard to find > the instructions. It doesn't have to be that way, but if we carry on > as we are, it will continue to be messy and in five years you will > need a Ph.D and a lucky charm to boot on any modern board. My > objective here is to simplify things, bringing some consistency
to the
> different components. Binman was one effort there. I feel that
putting
> at least the U-Boot house in order, in my role as devicetree > maintainer (and as author of devicetree support in U-Boot back in > 2011), is the next step.

Yes, it's Not Great.  I don't like my handful of build-BOARD.sh scripts that know where to grab other known-good binaries of varying licenses that are needed to assemble something that boots.

> If we set things up correctly and agree on the bindings, devicetree > can be the unifying configuration mechanism through the whole of > firmware (except for very early bits) and into the OS, this will set > us up very well to deal with the complexity that is coming. >
> Anyway, here are the mental steps that I've gone through over the
past
> two months:
>
> Step 1: At present, some people think U-Boot is not even allowed to > have its own nodes/properties in the DT.

Quoted 3 lines

In my view U-Boot shall be able to leverage device tree format (source and binary) to store its own data.
When you say "the" DT, I always think this is "the" DT that is passed to OS and in "that" DT, there should be no U-Boot entries. As stated in another mail thread, I also refer to a place in a FIP where that dynamic config DT is meant to be stored: NT_FW_CONFIG. But there can be U-Boot defined bindings in "a" control/dynamic config DT; Trusted Firmware does that.

It ends up in that we need two separate devicetrees.

One passed to U-Boot for fixups and further passed to the OS. This devicetree may originate from a prior boot stage, from a file loaded by U-Boot, or from a later bootstage, e.g systemd-boot's devicetree command. This devicetree will not contain any U-Boot specific information.

A second devicetree to hold everything that U-Boot needs for its internal purposes.

Best regards

Heinrich

Quoted 141 lines

It is an abuse of the
> devicetree standard, like the /chosen node but with less history. We > should sacrifice efficiency, expedience and expandability on the
altar
> of 'devicetree is a hardware description'. How do we get over that > one? Wel, I just think we need to accept that U-Boot uses devicetree > for its own purposes, as well as for booting the OS. I am not saying

Yes, we need to have properties present in the device tree, and just like how "linux," is a valid vendor prefix for the linux kernel (but not used I would expect by the BSD families) we have cases that need "u-boot," properties.

> it always has to have those properties, but with existing features > like verified boot, SPL as well as complex firmware images where > U-Boot needs to be able to find things in the image, it is essential. > So let's just assume that we need this everywhere, since we certainly > need it in at least some places.

No, we can't / shouldn't assume we need this everywhere.  A lot of places? Yes.  But some features are going to be optional.  A valid must be supported use case is something like a Pi where the hardware gives us a device tree, the tree is correct and some features in U-Boot aren't needed (SPL) nor possibly supported immediately (verified boot).  We can go off on a tangent about how useful it would be to have HW platforms that are both common and can demonstrate a number of features, but that's its own problem to solve.

> (stop reading here if you disagree, because nothing below will make > any sense...you can still use U-Boot v2011.06 which doesn't have > OF_CONTROL :-)
>
> Step 2: Assume U-Boot has its own nodes/properties. How do they get > there? Well, we have u-boot.dtsi files for that (the 2016 patch > "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we > have binman definitions, etc. So we need a way to overlay those
things
> into the DT. We already support this for in-tree DTs, so IMO this is > easy. Just require every board to have an in-tree DT. It helps with > discoverability and documentation, anyway. That is this series. >
> (I think most of us are at the beginning of step 2, unsure about it > and worried about step 3)
>
> Step 3: Ah, but there are flows (i.e. boards that use a particular > flow only, or boards that sometimes use a flow) which need the DT to > come from a prior stage. How to handle that? IMO that is only
going to
> grow as every man and his dog get into the write-a-bootloader > business. We need a way to provide the U-Boot nodes/properties in a > form that the prior stage can consume and integrate with its build > system. Is TF-A the only thing being discussed here? If so, let's
just
> do it. We have the u-boot.dtsi and we can use binman to put the image > together, for example. Or we can get clever and create some sort of > overlay dtb.
>
> Step 3a. But I don't want to do that. a) If U-Boot needs this stuff > then it will need to build it in and use two devicetrees, one
internal
> and one from the prior stage....well that is not very efficient
and it
> is going to be confusing for people to figure out what U-Boot is > actually doing. But we actually already do that in a lot of cases > where U-Boot passes a DT to the kernel which is different to the one > it uses. So perhaps we have three devicetrees? OMG. b) Well then > U-Boot can have its own small devicetree with its bits and then
U-Boot
> can merge the two when it starts. Again that is not very efficient.

Does not need to merge the two. hence it does not have any influence on efficiency.
For properties access, trusted firmware has defined an abstract way to get them:
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html <https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html>.

The properties are currently implemented as DT but TF.ORG <http://TF.ORG> could decide to move to CBOR.
The API will remain so that a change in backend will not influence existing code.
I think you are too focused on "THE" device tree. "THE" device tree that is passed to the OS
shall be hardware description and not a hacky place to fit any piece of metadata.
I would argue that /chosen shall not even be there as most if not all information can be passed as OS command line. And actually for the UEFI contract, /chosen should go empty.

It
> means that U-Boot cannot be controlled by the prior stage (e.g.
to get
> its public key from there or to enable/disable the console), so > unified firmware config is not possible. It will get very confusing, > particularly for debugging U-Boot. c) Some other scheme to avoid > accepting step 3...please stop!

How the nodes should get there is how the rest of the nodes in a system get there.  Bindings are submitted and reviewed.  The authoritative source of the dtses in question then has them, like any other property.

> Step 4: Yes, but there is QEMU, which makes the devicetree up out of > whole cloth. What about that? Well, we are just going to have to deal > with that. We can easily merge in the U-Boot nodes/properties and > update the U-Boot CI scripts to do this, as needed, e.g. with > qemu-riscv64_spl. It's only one use case, although Xen might do > something similar.
>
> To my mind, that deals with both the build-time and run-time issues. > We have a discoverable DT in U-Boot, which should be considered the > source of truth for most boards. We can sync it with Linux > automatically with the tooling that I hope Rob Herring will come up > with. We can use an empty one where there really is no default, > although I'd argue that is making perfect an enemy of the good. >
> Step 5: If we get clever and want to remove them from the U-Boot tree > and pick them up from somewhere else, we can do that with sufficient > tooling. Perhaps we should set a timeline for that? A year? Two? Six?

For SystemReady compliant boards, this has to come much faster. Do you think distros will keep providing DTs for ever? I bet not.

These last two paragraphs condense what I think is honestly close to a decade of debate / discussion down to a fiat "U-Boot will have the DTS files".  I don't want that.  I don't think any of the other projects that want to leverage DTS files want that.

> To repeat, if we set things up correctly and agree on the bindings, > devicetree can be the unifying configuration mechanism through the > whole of firmware (except for very early bits) and into the OS. I
feel
> this will set us up very well to deal with the complexity that is > coming.

Sure, it could.  But that doesn't mean that U-Boot is where the dts files live.

--
Tom

Signature · 3 lines
François-Frédéric Ozog | /Director Business Development/
T: +33.67221.6485
[email protected] <mailto:[email protected]> | Skype: ffozog
#68 lore raw

On Wed, Oct 27, 2021 at 03:23:01PM +0200, Heinrich Schuchardt wrote:

[snip]

Quoted 3 lines

One passed to U-Boot for fixups and further passed to the OS. This devicetree may originate from a prior boot stage, from a file loaded by U-Boot, or from a later bootstage, e.g systemd-boot's devicetree command.

I assume systemd-boot is implementing the same logic that extlinux.conf has used for forever, yes?

Quoted 1 line

This devicetree will not contain any U-Boot specific information.

To repeat, it must only have official bindings, yes, regardless of what project they come from.

Signature · 1 line
Tom
#69 lore raw
Quoted 9 lines · Tom Rini

On Wed, Oct 27, 2021 at 03:23:01PM +0200, Heinrich Schuchardt wrote:

[snip]

Quoted 3 lines

One passed to U-Boot for fixups and further passed to the OS. This devicetree may originate from a prior boot stage, from a file loaded by U-Boot, or from a later bootstage, e.g systemd-boot's devicetree command.

I assume systemd-boot is implementing the same logic that extlinux.conf has used for forever, yes?

It is loading the file and then calls U-Boot's implementation of the EFI Device Tree Fixup Protocol for fixups before passing the device-tree to the OS.

Quoted 6 lines
Quoted 2 lines

This devicetree will not contain any U-Boot specific information.

To repeat, it must only have official bindings, yes, regardless of what project they come from.

Don't expect prior firmware stages to provide any U-Boot specific stuff whatever official or non-official U-Boot specific bindings exist.

Best regards

Heinrich

#70 lore raw
Quoted 8 lines · Heinrich Schuchardt
Quoted 7 lines · Tom Rini

On Wed, Oct 27, 2021 at 03:23:01PM +0200, Heinrich Schuchardt wrote:

[snip]

Quoted 3 lines

One passed to U-Boot for fixups and further passed to the OS. This devicetree may originate from a prior boot stage, from a file loaded by U-Boot, or from a later bootstage, e.g systemd-boot's devicetree command.

Quoted 6 lines
Quoted 2 lines

I assume systemd-boot is implementing the same logic that extlinux.conf has used for forever, yes?

It is loading the file and then calls U-Boot's implementation of the EFI Device Tree Fixup Protocol for fixups before passing the device-tree to the OS.

So it's using https://systemd.io/BOOT_LOADER_SPECIFICATION/ OK.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This devicetree will not contain any U-Boot specific information.

To repeat, it must only have official bindings, yes, regardless of what project they come from.

Don't expect prior firmware stages to provide any U-Boot specific stuff whatever official or non-official U-Boot specific bindings exist.

Failure to implement official bindings may result in failure to boot, which would be pretty silly.

Signature · 1 line
Tom
#71 lore raw
In reply to François Ozog
Quoted 303 lines · François Ozog

Hi,

Quoted 299 lines · Tom Rini
Quoted 13 lines · Simon Glass

Hi all,

Quoted 10 lines · Tom Rini
Quoted 8 lines · Simon Glass

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 3 lines · Simon Glass

Hi François,

On Wed, 13 Oct 2021 at 11:35, François Ozog <

Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Simon

Le mer. 13 oct. 2021 à 16:49, Simon Glass <[email protected]>

Quoted 4 lines · a écrit :
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Tom, Bin,François,

On Tue, 12 Oct 2021 at 19:34, Tom Rini <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Bin Meng
Quoted 3 lines

Hi Simon,

On Wed, Oct 13, 2021 at 9:01 AM Simon Glass <

Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

With Ilias' efforts we have dropped OF_PRIOR_STAGE and

OF_HOSTFILE so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

there are only three ways to obtain a devicetree:

- OF_SEPARATE - the normal way, where the devicetree

is built and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

appended to U-Boot
- OF_EMBED - for development purposes, the

devicetree is embedded in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in the U-Boot tree. Most boards do provide one, but

some don't. Some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't even provide instructions on how to boot on the

board.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The problems with this approach are documented at [1].

In practice, OF_BOARD is not really distinct from

OF_SEPARATE. Any board

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can obtain its devicetree at runtime, even it is has a

devicetree built

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in U-Boot. This is because U-Boot may be a second-stage

bootloader and its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware

available in the machine.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

option, available with either OF_SEPARATE or OF_EMBED.

This series makes this change, adding various missing

devicetree files

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

(and placeholders) to make the build work.

Adding device trees that are never used sounds like a

hack to me.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For QEMU, device tree is dynamically generated on the fly

based on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

command line parameters, and the device tree you put in

this series

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has various hardcoded <phandle> values which normally do

not show up

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

in hand-written dts files.

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding

device trees for

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

platforms that are capable of and can / do have a device

tree to give us

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

at run time.

(I'll just reply to this one email, since the same points

applies to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

all replies I think)

I have been thinking about this and discussing it with people

for a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

few months now. I've been signalling a change like this for

over a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

month now, on U-Boot contributor calls and in discussions

with Linaro

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

people. I sent a patch (below) to try to explain things. I

hope it is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

not a surprise!

The issue here is that we need a devicetree in-tree in

U-Boot, to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

avoid the mess that has been created by OF_PRIOR_STAGE,

OF_BOARD,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE.

Between

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Ilias' series and this one we can get ourselves on a stronger

footing.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

There is just OF_SEPARATE, with OF_EMBED for debugging/ELF

use.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

For more context:

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

BTW I did suggest to QEMU ARM that they support a way of

adding the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for

booting

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Linux directly!)

i understand their point of view and agree with it.

Quoted 3 lines

But in any case it doesn't really help U-Boot. I think the path forward might be to run QEMU twice, once to

get its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

generated tree and once to give the 'merged' tree with the

U-Boot

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time

option, not a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

build-time one. It creates all sorts of problems and

obscurity which

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have taken months to unpick. See the above patch for the

rationale.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

To add to that rationale, OF_BOARD needs to be an option

available to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

any board. At some point in the future it may become a common

way

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

things are done, e.g. TF-A calling U-Boot and providing a

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to it. It doesn't make any sense to have people decide

whether or not

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to set OF_BOARD at build time, thus affecting how the image

is put

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

together. We'll end up with different U-Boot build targets

like

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

capricorn, capricorn_of_board and the like. It should be

obvious where

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that will lead. Instead, OF_BOARD needs to become a commonly

used

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

option, perhaps enabled by most/all boards, so that this sort

of build

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

explosion is not needed.

If you mean that when boards are by construction providing a

DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which

it finds

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

itself.

Also as binman is pressed into service more and more to build

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

complex firmware images that are becoming fashionable, it

needs a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

definition (in the devicetree) that describes how to create

the image.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We can't support that unless we are building a devicetree,

nor can the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

running program access the image layout without that

information.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since

OF_BOARD

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is, still, enabled. We already use OF_BOARD for various

boards that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for

example

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(as I said in the cover letter "Most boards do provide one,

but some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't."). So this series is just completing the picture by

enforcing

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

that *some sort* of devicetree is always present.

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on

this

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

issue, is that OF_BOARD needs to be a run-time option. At

present it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has build-time effects and this is quite wrong. If you go

through all

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the material I have written on this I think I have motivated

that very

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

clearly.

Another big issue is that I believe we need ONE devicetree for

U-Boot,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

not two that get merged by U-Boot. Again I have gone through

that in a

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that

U-Boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

needs to support being passed a device tree to use, at run time,

yes?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Yes. The OF_BOARD feature provides this.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 2 lines
Quoted 2 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device

tree at

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

run time (think BeagleBone Black) and one where we will always be

given

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may

want

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not

have

Quoted 4 lines
Quoted 4 lines

to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Quoted 9 lines
Quoted 4 lines

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

See below.

Quoted 2 lines
Quoted 2 lines

I believe we have got unstuck because OF_BOARD (perhaps

inadvertently)

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could

then

Quoted 10 lines
Quoted 9 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Quoted 10 lines

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

Yes, it's Not Great. I don't like my handful of build-BOARD.sh scripts that know where to grab other known-good binaries of varying licenses that are needed to assemble something that boots.

Quoted 8 lines

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT.

In my view U-Boot shall be able to leverage device tree format (source and binary) to store its own data.
When you say "the" DT, I always think this is "the" DT that is passed to OS and in "that" DT, there should be no U-Boot entries. As stated in another

I would (and I know I'm repeating myself and emails have crossed, etc, but for future clarity) say it's that no un-official nodes/properties should be passed from one piece of software to another. I mean hell, "u-boot,bootcount" MUST get passed to the OS, so has some idea how many times the system has booted. It's just a long standing item to get that bootcount driver / binding unblocked and merged finally. But that's a different tangent to get lost on.

Quoted 4 lines

mail thread, I also refer to a place in a FIP where that dynamic config DT is meant to be stored: NT_FW_CONFIG.
But there can be U-Boot defined bindings in "a" control/dynamic config DT; Trusted Firmware does that.

Maybe I just need to come out and say if "everyone" has decided how U-Boot needs to work, but also myself (head custodian) and Simon (head DM custodian, device tree in U-Boot custodian) aren't 100% on board with everything, maybe some step back and re-evaluation needs to be taken? And I'm not saying we're the final word only here either, there has been and needs to continue to be good faith discussions. It should also be clear at this point that he and I aren't on the same page on everything, for example :)

Quoted 63 lines
Quoted 18 lines

It is an abuse of the

Quoted 5 lines

devicetree standard, like the /chosen node but with less history. We should sacrifice efficiency, expedience and expandability on the altar of 'devicetree is a hardware description'. How do we get over that one? Wel, I just think we need to accept that U-Boot uses devicetree for its own purposes, as well as for booting the OS. I am not saying

Yes, we need to have properties present in the device tree, and just like how "linux," is a valid vendor prefix for the linux kernel (but not used I would expect by the BSD families) we have cases that need "u-boot," properties.

Quoted 5 lines

it always has to have those properties, but with existing features like verified boot, SPL as well as complex firmware images where U-Boot needs to be able to find things in the image, it is essential. So let's just assume that we need this everywhere, since we certainly need it in at least some places.

Quoted 44 lines

No, we can't / shouldn't assume we need this everywhere. A lot of places? Yes. But some features are going to be optional. A valid must be supported use case is something like a Pi where the hardware gives us a device tree, the tree is correct and some features in U-Boot aren't needed (SPL) nor possibly supported immediately (verified boot). We can go off on a tangent about how useful it would be to have HW platforms that are both common and can demonstrate a number of features, but that's its own problem to solve.

Quoted 35 lines

(stop reading here if you disagree, because nothing below will make any sense...you can still use U-Boot v2011.06 which doesn't have OF_CONTROL :-)

Step 2: Assume U-Boot has its own nodes/properties. How do they get there? Well, we have u-boot.dtsi files for that (the 2016 patch "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we have binman definitions, etc. So we need a way to overlay those things into the DT. We already support this for in-tree DTs, so IMO this is easy. Just require every board to have an in-tree DT. It helps with discoverability and documentation, anyway. That is this series.

(I think most of us are at the beginning of step 2, unsure about it and worried about step 3)

Step 3: Ah, but there are flows (i.e. boards that use a particular flow only, or boards that sometimes use a flow) which need the DT to come from a prior stage. How to handle that? IMO that is only going to grow as every man and his dog get into the write-a-bootloader business. We need a way to provide the U-Boot nodes/properties in a form that the prior stage can consume and integrate with its build system. Is TF-A the only thing being discussed here? If so, let's just do it. We have the u-boot.dtsi and we can use binman to put the image together, for example. Or we can get clever and create some sort of overlay dtb.

Step 3a. But I don't want to do that. a) If U-Boot needs this stuff then it will need to build it in and use two devicetrees, one internal and one from the prior stage....well that is not very efficient and it is going to be confusing for people to figure out what U-Boot is actually doing. But we actually already do that in a lot of cases where U-Boot passes a DT to the kernel which is different to the one it uses. So perhaps we have three devicetrees? OMG. b) Well then U-Boot can have its own small devicetree with its bits and then U-Boot can merge the two when it starts. Again that is not very efficient.

Quoted 5 lines

Does not need to merge the two. hence it does not have any influence on efficiency.
For properties access, trusted firmware has defined an abstract way to get them:
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html

That's interesting, but I also think fconf_load_config(), etc are the efficiency and additional overhead Simon is talking about being worried about.

Quoted 8 lines

The properties are currently implemented as DT but TF.ORG could decide to move to CBOR.
The API will remain so that a change in backend will not influence existing code.
I think you are too focused on "THE" device tree. "THE" device tree that is passed to the OS
shall be hardware description and not a hacky place to fit any piece of metadata.

No, but it is the place to put well defined metadata.

Quoted 3 lines

I would argue that /chosen shall not even be there as most if not all information can be passed as OS command line. And actually for the UEFI contract, /chosen should go empty.

Shoving a bunch of stuff to the kernel command line sounds pretty hacky to me. But I'll just assume it's already been given the official Not Hacky stamp of approval since after all, there's not a long standing cleaner path to do anything like that on x86, and we must all mirror the x86 world.

Quoted 25 lines
Quoted 25 lines

It

Quoted 5 lines

means that U-Boot cannot be controlled by the prior stage (e.g. to get its public key from there or to enable/disable the console), so unified firmware config is not possible. It will get very confusing, particularly for debugging U-Boot. c) Some other scheme to avoid accepting step 3...please stop!

How the nodes should get there is how the rest of the nodes in a system get there. Bindings are submitted and reviewed. The authoritative source of the dtses in question then has them, like any other property.

Quoted 14 lines

Step 4: Yes, but there is QEMU, which makes the devicetree up out of whole cloth. What about that? Well, we are just going to have to deal with that. We can easily merge in the U-Boot nodes/properties and update the U-Boot CI scripts to do this, as needed, e.g. with qemu-riscv64_spl. It's only one use case, although Xen might do something similar.

To my mind, that deals with both the build-time and run-time issues. We have a discoverable DT in U-Boot, which should be considered the source of truth for most boards. We can sync it with Linux automatically with the tooling that I hope Rob Herring will come up with. We can use an empty one where there really is no default, although I'd argue that is making perfect an enemy of the good.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Step 5: If we get clever and want to remove them from the U-Boot tree and pick them up from somewhere else, we can do that with sufficient tooling. Perhaps we should set a timeline for that? A year? Two? Six?

For SystemReady compliant boards, this has to come much faster.

Do you think distros will keep providing DTs for ever? I bet not.

Since it seems like it'll be a long time before people stop producing SBCs that lack on-board flash storage for the world firmware, yeah, I don't know when distributions will stop shipping DTBs. Maybe a year or two after the last popular SBC comes out and distros are comfortable shoving people that have that hardware off to some other community to support?

Signature · 1 line
Tom
#72 lore raw
In reply to François Ozog
Quoted 306 lines

From: François Ozog <[email protected]>
Date: Wed, 27 Oct 2021 15:15:01 +0200

Hi,

Quoted 299 lines · Tom Rini
Quoted 13 lines · Simon Glass

Hi all,

Quoted 10 lines · Tom Rini
Quoted 8 lines · Simon Glass

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 3 lines · Simon Glass

Hi François,

On Wed, 13 Oct 2021 at 11:35, François Ozog <

Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Simon

Le mer. 13 oct. 2021 à 16:49, Simon Glass <[email protected]>

Quoted 4 lines · a écrit :
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hi Tom, Bin,François,

On Tue, 12 Oct 2021 at 19:34, Tom Rini <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Bin Meng
Quoted 3 lines

Hi Simon,

On Wed, Oct 13, 2021 at 9:01 AM Simon Glass <

Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

With Ilias' efforts we have dropped OF_PRIOR_STAGE and

OF_HOSTFILE so

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

there are only three ways to obtain a devicetree:

- OF_SEPARATE - the normal way, where the devicetree

is built and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

appended to U-Boot
- OF_EMBED - for development purposes, the

devicetree is embedded in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in the U-Boot tree. Most boards do provide one, but

some don't. Some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't even provide instructions on how to boot on the

board.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The problems with this approach are documented at [1].

In practice, OF_BOARD is not really distinct from

OF_SEPARATE. Any board

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can obtain its devicetree at runtime, even it is has a

devicetree built

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in U-Boot. This is because U-Boot may be a second-stage

bootloader and its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

caller may have a better idea about the hardware

available in the machine.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

option, available with either OF_SEPARATE or OF_EMBED.

This series makes this change, adding various missing

devicetree files

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

(and placeholders) to make the build work.

Adding device trees that are never used sounds like a

hack to me.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For QEMU, device tree is dynamically generated on the fly

based on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

command line parameters, and the device tree you put in

this series

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has various hardcoded <phandle> values which normally do

not show up

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

in hand-written dts files.

I am not sure I understand the whole point of this.

I am also confused and do not like the idea of adding

device trees for

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

platforms that are capable of and can / do have a device

tree to give us

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

at run time.

(I'll just reply to this one email, since the same points

applies to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

all replies I think)

I have been thinking about this and discussing it with people

for a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

few months now. I've been signalling a change like this for

over a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

month now, on U-Boot contributor calls and in discussions

with Linaro

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

people. I sent a patch (below) to try to explain things. I

hope it is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

not a surprise!

The issue here is that we need a devicetree in-tree in

U-Boot, to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

avoid the mess that has been created by OF_PRIOR_STAGE,

OF_BOARD,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

BINMAN_STANDALONE_FDT and to a lesser extent, OF_HOSTFILE.

Between

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Ilias' series and this one we can get ourselves on a stronger

footing.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

There is just OF_SEPARATE, with OF_EMBED for debugging/ELF

use.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

For more context:

http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

BTW I did suggest to QEMU ARM that they support a way of

adding the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

u-boot.dtsi but there was not much interest there (in fact the maintainer would prefer there was no special support even for

booting

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Linux directly!)

i understand their point of view and agree with it.

Quoted 3 lines

But in any case it doesn't really help U-Boot. I think the path forward might be to run QEMU twice, once to

get its

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

generated tree and once to give the 'merged' tree with the

U-Boot

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

properties in it, if people want to use U-Boot features.

I do strongly believe that OF_BOARD must be a run-time

option, not a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

build-time one. It creates all sorts of problems and

obscurity which

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have taken months to unpick. See the above patch for the

rationale.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

To add to that rationale, OF_BOARD needs to be an option

available to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

any board. At some point in the future it may become a common

way

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

things are done, e.g. TF-A calling U-Boot and providing a

devicetree

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to it. It doesn't make any sense to have people decide

whether or not

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to set OF_BOARD at build time, thus affecting how the image

is put

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

together. We'll end up with different U-Boot build targets

like

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

capricorn, capricorn_of_board and the like. It should be

obvious where

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that will lead. Instead, OF_BOARD needs to become a commonly

used

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

option, perhaps enabled by most/all boards, so that this sort

of build

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

explosion is not needed.

If you mean that when boards are by construction providing a

DTB to U-Boot then I agree very much. But I don’t understand how the patch set supports it as it puts dts files for those boards to be built.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot needs to be flexible enough to
function correctly in whatever runtime environment in which

it finds

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

itself.

Also as binman is pressed into service more and more to build

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

complex firmware images that are becoming fashionable, it

needs a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

definition (in the devicetree) that describes how to create

the image.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We can't support that unless we are building a devicetree,

nor can the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

running program access the image layout without that

information.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

François's point about 'don't use this with any kernel' is germane...but of course I am not suggesting doing that, since

OF_BOARD

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is, still, enabled. We already use OF_BOARD for various

boards that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

include an in-tree devicetree - Raspberry Pi 1, 2 and 3, for

example

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

(as I said in the cover letter "Most boards do provide one,

but some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

don't."). So this series is just completing the picture by

enforcing

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

that *some sort* of devicetree is always present.

That seems inconsistent with the OF_BOARD becomes the default.

I think the key point that will get you closer to where I am on

this

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

issue, is that OF_BOARD needs to be a run-time option. At

present it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

has build-time effects and this is quite wrong. If you go

through all

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the material I have written on this I think I have motivated

that very

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

clearly.

Another big issue is that I believe we need ONE devicetree for

U-Boot,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

not two that get merged by U-Boot. Again I have gone through

that in a

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

lot of detail.

I have a long long reply to your first reply here saved, but, maybe here's the biggest sticking point. To be clear, you agree that

U-Boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

needs to support being passed a device tree to use, at run time,

yes?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Yes. The OF_BOARD feature provides this.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

And in that case, would not be using the "fake" tree we built in?

Not at runtime.

OK.

Quoted 2 lines
Quoted 2 lines

So is the sticking point here that we really have two classes of devices, one class where we will never ever be given the device

tree at

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

run time (think BeagleBone Black) and one where we will always be

given

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

one at run time (think Raspberry Pi) ?

I'm not sure it will be that black and white. I suspect there will be (many) boards which can boot happily with the U-Boot devicetree but can also accept one at runtime, if provided. For example, you may

want

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

to boot with or without TF-A or some other, earlier stage.

I'm not sure I see the value in making this a gray area. There's very much a class of "never" boards. There's also the class of "can" today. Maybe as part of a developer iterative flow it would be nice to not

have

Quoted 4 lines
Quoted 4 lines

to re-flash the prior stage to change a DT, and just do it in U-Boot until things are happy, but I'm not sure what the use case is for overriding the previous stage.

Quoted 9 lines
Quoted 4 lines

Especially since the pushback on this series I think has all been "why are we copying in a tree to build with? We don't want to use it at run time!". And then softer push back like "Well, U-Boot says we have to include the device tree file here, but we won't use it...".

See below.

Quoted 2 lines
Quoted 2 lines

I believe we have got unstuck because OF_BOARD (perhaps

inadvertently)

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

provided a way to entirely omit a devicetree from U-Boot, thus making things like binman and U-Boot /config impossible, for example. So I want to claw that back, so there is always some sort of devicetree in U-Boot, as we have for rpi_3, etc.

I really want to see what the binary case looks like since we could

then

Quoted 10 lines
Quoted 9 lines

kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could then also do a rpi_arm32_defconfig too.

I want to see less device trees in U-Boot sources, if they can come functionally correct from the hardware/our caller.

And I'm not seeing how we make use of "U-Boot /config" if we also don't use the device tree from build time at run time, ignoring the device tree provided to us at run time by the caller.

Quoted 10 lines

Firstly I should say that I find building firmware very messy and confusing these days. Lots of things to build and it's hard to find the instructions. It doesn't have to be that way, but if we carry on as we are, it will continue to be messy and in five years you will need a Ph.D and a lucky charm to boot on any modern board. My objective here is to simplify things, bringing some consistency to the different components. Binman was one effort there. I feel that putting at least the U-Boot house in order, in my role as devicetree maintainer (and as author of devicetree support in U-Boot back in 2011), is the next step.

Yes, it's Not Great. I don't like my handful of build-BOARD.sh scripts that know where to grab other known-good binaries of varying licenses that are needed to assemble something that boots.

Quoted 8 lines

If we set things up correctly and agree on the bindings, devicetree can be the unifying configuration mechanism through the whole of firmware (except for very early bits) and into the OS, this will set us up very well to deal with the complexity that is coming.

Anyway, here are the mental steps that I've gone through over the past two months:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Step 1: At present, some people think U-Boot is not even allowed to have its own nodes/properties in the DT.

In my view U-Boot shall be able to leverage device tree format (source and binary) to store its own data.
When you say "the" DT, I always think this is "the" DT that is passed to OS and in "that" DT, there should be no U-Boot entries.

Why not? As long as the device tree validates, it is perfectly fine to have additional nodes and properties present. The propertiesand nodes will be simply ignored by the OS.

OpenBSD will print:

"binman" not configured

for the binman node that some of the U-Boot board targets now have, but it doesn't really make a difference. If there is a proper binding for that node, I could simply filter it out. Or we have U-Boot filter it out before the DT gets passed along like Tom suggests.