fdt: Make OF_BOARD a boolean option
Subsystems (13)
v8 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 were covered in another patch[1], since removed from this series.
In practice, OF_BOARD is not really distinct from OF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.
So it makes no sense to have OF_BOARD as a 'choice'. It should be an option, available with either OF_SEPARATE or OF_EMBED. This would allow rpi3, for example, to run with the devicetree provided by the prior bootloader.
This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
To make the 'prior stage' side of things more deterministic, a new OF_HAS_PRIOR_STAGE is added, which cannot be disabled by updated a board's defconfig. This should help to prevent mistakes.
It also adds a run-time message showing where the devicetree came from, as well as warnings if the board's expected flow is not being used. This comes originally from the 'standard passage' series, which depends on this series.
It also provides a few qemu clean-ups discovered along the way. The qemu-riscv64_spl problem is fixed.
Please see [2] for discussion on the v6 series.
I put Heinrich's Tested-by tag[3] for the series onto the three devicetree patches (ARM and RISC-V) that I think it most affects. It isn't possible to apply a tag to a whole series at present and in any case there are changes in v7.
This series is available at u-boot-dm/ofb-working
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://lore.kernel.org/u-boot/20211205133207.GW1220664@bill-the-cat/T/#mcd8c0258827fbc1bb3000b7ff9ba0929df1ddcb2
[3] https://lore.kernel.org/u-boot/[email protected]/raw
Changes in v8:
- Add a new patch to make it easier to debug u-boot.dtsi files
- Add an fdt: tag
- Add new patch to ensure that OF_BOARD is used when needed
- Drop documentation patches
- Drop the build-time warning, since people may ignore it
- Drop the devicetree docs in the README
- Enable the flash as suggested by Linus Walleij
- Fix devicetree logic so that just u-boot.dtb is omitted
- Mention that this is empty, rather than a dummy file
- Mention the follower patch
- Move board-config changes to a separate patch
- Rebase patch
- Reword commit message to mention the dynamic devicetree
- Use an empty tree due to maintainer objections
Changes in v7:
- Add new patch to add a Kconfig for boards with a prior stage
- Bring in files from Linux instead
- Drop FDTSRC_PASSAGE for now
- Fix 'Is' typo in commit message
- Reword commit message
- Rewrite the commit message
- Switch to using an empty file for qemu virt
- Use 'empty' instead of 'fake'
Changes in v6:
- Expand the commit message based on comments
Changes in v5:
- Add new patches to clean up fdtdec_setup() and surrounds
- Merge RISC-V and ARM patches since they are similar
Simon Glass (32):
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file for qemu_arm
arm: qemu: Add a devicetree file for qemu_arm64 virt
riscv: qemu: Split devicetree files for qemu_riscv32/64
arm: rpi: Sync rpi dts files from Linux
arm: vexpress: Add a devicetree files for juno
arm: xenguest_arm64: Add a empty devicetree file
arm: octeontx: Add an empty devicetree file
arm: xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add devicetree files
fdt: Make OF_BOARD a bool option
fdt: Drop CONFIG_BINMAN_STANDALONE_FDT
fdt: Make it easier to debug u-boot.dtsi files
fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
fdt: Drop #ifdefs with MULTI_DTB_FIT
fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
fdt: Drop #ifdef around board_fdt_blob_setup()
fdt: Use if() for fdtcontroladdr check
fdt: Drop OF_CONTROL check in fdtdec_setup()
fdt: Drop remaining preprocessor macros in fdtdec_setup()
fdt: Don't call board_fdt_blob_setup() without OF_BOARD
dm: core: Allow getting some basic stats
fdt: Record where the devicetree came from
fdt: Report the devicetree source
fdt: Add a Kconfig for boards with a prior stage
fdt: Enable OF_HAS_PRIOR_STAGE for most boards with OF_BOARD
fdt: Makefile: Ensure that OF_BOARD is used when needed
fdt: Avoid emitting an device tree when not needed
fdt: Show a runtime warning based on devicetree source
Makefile | 16 +-
README | 29 -
arch/arm/Kconfig | 12 +-
arch/arm/dts/Makefile | 20 +-
arch/arm/dts/bcm2711-rpi-4-b.dts | 262 ++++
arch/arm/dts/bcm2711-rpi.dtsi | 74 ++
arch/arm/dts/bcm2711.dtsi | 1100 +++++++++++++++++
arch/arm/dts/bcm2835-common.dtsi | 207 ++++
arch/arm/dts/bcm2835-rpi-a-plus.dts | 18 +-
arch/arm/dts/bcm2835-rpi-a.dts | 16 +-
arch/arm/dts/bcm2835-rpi-b-plus.dts | 18 +-
arch/arm/dts/bcm2835-rpi-b-rev2.dts | 16 +-
arch/arm/dts/bcm2835-rpi-b.dts | 16 +-
arch/arm/dts/bcm2835-rpi-cm1-io1.dts | 9 +
arch/arm/dts/bcm2835-rpi-cm1.dtsi | 7 +-
arch/arm/dts/bcm2835-rpi-common.dtsi | 12 +
arch/arm/dts/bcm2835-rpi-zero-w.dts | 20 +-
arch/arm/dts/bcm2835-rpi-zero.dts | 16 +-
arch/arm/dts/bcm2835-rpi.dtsi | 35 +-
arch/arm/dts/bcm2835.dtsi | 2 +
arch/arm/dts/bcm2836-rpi-2-b.dts | 14 +-
arch/arm/dts/bcm2836.dtsi | 2 +
arch/arm/dts/bcm2837-rpi-3-a-plus.dts | 9 +-
arch/arm/dts/bcm2837-rpi-3-b-plus.dts | 9 +-
arch/arm/dts/bcm2837-rpi-3-b.dts | 5 +-
arch/arm/dts/bcm2837-rpi-cm3-io3.dts | 9 +
arch/arm/dts/bcm2837-rpi-cm3.dtsi | 9 +
arch/arm/dts/bcm2837.dtsi | 2 +
arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi | 7 +
arch/arm/dts/bcm283x.dtsi | 224 +---
arch/arm/dts/bcm7xxx.dts | 15 +
arch/arm/dts/highbank.dts | 9 +
arch/arm/dts/juno-base.dtsi | 831 +++++++++++++
arch/arm/dts/juno-clocks.dtsi | 46 +
arch/arm/dts/juno-cs-r1r2.dtsi | 85 ++
arch/arm/dts/juno-motherboard.dtsi | 303 +++++
arch/arm/dts/juno-r2-u-boot.dtsi | 20 +
arch/arm/dts/juno-r2.dts | 322 +++++
arch/arm/dts/octeontx.dts | 14 +
arch/arm/dts/qemu-arm.dts | 11 +
arch/arm/dts/qemu-arm64.dts | 11 +
arch/arm/dts/xenguest-arm64.dts | 15 +
arch/arm/dts/xilinx-versal-virt.dts | 11 +
arch/arm/mach-bcm283x/Kconfig | 1 +
arch/powerpc/cpu/mpc85xx/Kconfig | 1 +
arch/powerpc/dts/Makefile | 1 +
arch/powerpc/dts/qemu-ppce500.dts | 10 +
arch/riscv/dts/Makefile | 2 +-
.../dts/{qemu-virt.dts => qemu-virt32.dts} | 3 +
arch/riscv/dts/qemu-virt64.dts | 11 +
board/emulation/qemu-riscv/Kconfig | 1 +
cmd/bdinfo.c | 2 +
common/board_r.c | 24 +
configs/ae350_rv32_defconfig | 1 -
configs/ae350_rv32_spl_defconfig | 1 -
configs/ae350_rv32_spl_xip_defconfig | 1 -
configs/ae350_rv64_defconfig | 1 -
configs/ae350_rv64_spl_defconfig | 1 -
configs/ae350_rv64_spl_xip_defconfig | 1 -
configs/bcm7260_defconfig | 2 +-
configs/bcm7445_defconfig | 2 +-
configs/highbank_defconfig | 2 +-
configs/octeontx2_95xx_defconfig | 2 +-
configs/octeontx2_96xx_defconfig | 2 +-
configs/octeontx_81xx_defconfig | 2 +-
configs/octeontx_83xx_defconfig | 2 +-
configs/qemu-ppce500_defconfig | 3 +-
configs/qemu-riscv32_defconfig | 2 +-
configs/qemu-riscv32_smode_defconfig | 2 +-
configs/qemu-riscv32_spl_defconfig | 5 +-
configs/qemu-riscv64_defconfig | 2 +-
configs/qemu-riscv64_smode_defconfig | 2 +-
configs/qemu-riscv64_spl_defconfig | 4 +-
configs/qemu_arm64_defconfig | 2 +-
configs/qemu_arm_defconfig | 2 +-
configs/rpi_4_32b_defconfig | 2 +-
configs/rpi_4_defconfig | 2 +-
configs/rpi_arm64_defconfig | 2 +-
configs/vexpress_aemv8a_juno_defconfig | 2 +-
configs/xenguest_arm64_defconfig | 3 +-
configs/xilinx_versal_virt_defconfig | 1 +
doc/board/emulation/qemu-arm.rst | 10 +-
doc/board/emulation/qemu-riscv.rst | 3 +
doc/develop/devicetree/dt_qemu.rst | 48 +
doc/develop/devicetree/index.rst | 1 +
drivers/core/device.c | 11 +
drivers/core/root.c | 7 +
drivers/core/uclass.c | 13 +
dts/Kconfig | 65 +-
include/asm-generic/global_data.h | 12 +
include/dm/device.h | 11 +-
include/dm/root.h | 8 +
include/dm/uclass-internal.h | 7 +
include/dt-bindings/clock/bcm2835.h | 2 +
include/fdtdec.h | 53 +-
lib/fdtdec.c | 141 ++-
scripts/Makefile.lib | 4 +-
scripts/check-of.sh | 42 +
scripts/of_whitelist.txt | 1 +
test/dm/core.c | 41 +
tools/binman/binman.rst | 34 +-
101 files changed, 4082 insertions(+), 432 deletions(-)
create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
create mode 100644 arch/arm/dts/bcm2711-rpi.dtsi
create mode 100644 arch/arm/dts/bcm2711.dtsi
create mode 100644 arch/arm/dts/bcm2835-common.dtsi
create mode 100644 arch/arm/dts/bcm2835-rpi-common.dtsi
create mode 100644 arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi
create mode 100644 arch/arm/dts/bcm7xxx.dts
create mode 100644 arch/arm/dts/highbank.dts
create mode 100644 arch/arm/dts/juno-base.dtsi
create mode 100644 arch/arm/dts/juno-clocks.dtsi
create mode 100644 arch/arm/dts/juno-cs-r1r2.dtsi
create mode 100644 arch/arm/dts/juno-motherboard.dtsi
create mode 100644 arch/arm/dts/juno-r2-u-boot.dtsi
create mode 100644 arch/arm/dts/juno-r2.dts
create mode 100644 arch/arm/dts/octeontx.dts
create mode 100644 arch/arm/dts/qemu-arm.dts
create mode 100644 arch/arm/dts/qemu-arm64.dts
create mode 100644 arch/arm/dts/xenguest-arm64.dts
create mode 100644 arch/arm/dts/xilinx-versal-virt.dts
create mode 100644 arch/powerpc/dts/qemu-ppce500.dts
rename arch/riscv/dts/{qemu-virt.dts => qemu-virt32.dts} (94%)
create mode 100644 arch/riscv/dts/qemu-virt64.dts
create mode 100644 doc/develop/devicetree/dt_qemu.rst
create mode 100755 scripts/check-of.sh
create mode 100644 scripts/of_whitelist.txtSignature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 1/32 arm: qemu: Mention -nographic in the docs
Without this option QEMU appears to hang. Add it to avoid confusion.
---
(no changes since v1)
doc/board/emulation/qemu-arm.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
doc/board/emulation/qemu-arm.rst +4 -3
@@ -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.34.1.173.g76aa8bc2d0-goog
Re: [PATCH v8 01/32] arm: qemu: Mention -nographic in the docs
Quoted 4 lines · Simon Glass
Without this option QEMU appears to hang. Add it to avoid confusion.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Heinrich Schuchardt <[email protected]>
For the series, applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v8 2/32 arm: riscv: qemu: Explain how to extract the generated dt
In reply to Simon GlassQEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.
Also explain how to merge it to produce a devicetree with the U-Boot features included.
---
Changes in v8:
- Rebase patch
Changes in v5:
- Merge RISC-V and ARM patches since they are similar
doc/board/emulation/qemu-arm.rst | 3 ++ doc/board/emulation/qemu-riscv.rst | 3 ++ doc/develop/devicetree/dt_qemu.rst | 48 ++++++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 4 files changed, 55 insertions(+) create mode 100644 doc/develop/devicetree/dt_qemu.rst
doc/board/emulation/qemu-arm.rst +3 -0
@@ -21,6 +21,9 @@ The 'virt' platform provides the following as the basic functionality: Additionally, a number of optional peripherals can be added to the PCI bus. +See :doc:`../../develop/devicetree/dt_qemu` for information on how to see +the devicetree actually generated by QEMU. + Building U-Boot --------------- Set the CROSS_COMPILE environment variable as usual, and run:
doc/board/emulation/qemu-riscv.rst +3 -0
@@ -13,6 +13,9 @@ The QEMU virt machine models a generic RISC-V virtual machine with support for the VirtIO standard networking and block storage devices. It has CLINT, PLIC, 16550A UART devices in addition to VirtIO and it also uses device-tree to pass configuration information to guest software. It implements RISC-V privileged + +See :doc:`../../develop/devicetree/dt_qemu` for information on how to see +the devicetree actually generated by QEMU. architecture spec v1.10. Building U-Boot
doc/develop/devicetree/dt_qemu.rst new file +48 -0
48 lines not on this page · raw message
doc/develop/devicetree/index.rst +1 -0
@@ -11,3 +11,4 @@ build-time and runtime configuration. intro control + dt_qemu
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 3/32 arm: qemu: Add a devicetree file for qemu_arm
In reply to Simon GlassThis uses QEMU virt which creates its own devicetree.
Add an empty version of this file, so that we can at least build this board when devicetrees are required.
---
(no changes since v7)
Changes in v7:
- Switch to using an empty file for qemu virt
Changes in v6:
- Expand the commit message based on comments
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/qemu-arm.dts | 11 +++++++++++ configs/qemu_arm_defconfig | 1 + 3 files changed, 14 insertions(+) create mode 100644 arch/arm/dts/qemu-arm.dts
arch/arm/dts/Makefile +2 -0
@@ -1162,6 +1162,8 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) += imx8mm-cl-iot-gate-optee.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 +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Empty device tree for qemu_arm + + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/qemu_arm_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x1000000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x40000 CONFIG_ENV_SECT_SIZE=0x40000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-arm" CONFIG_TARGET_QEMU_ARM_32BIT=y CONFIG_DEBUG_UART_BASE=0x9000000 CONFIG_DEBUG_UART_CLOCK=0
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 4/32 arm: qemu: Add a devicetree file for qemu_arm64 virt
In reply to Simon GlassThis uses QEMU virt which creates its own devicetree.
Add an empty version of this file, so that we can at least build this board when devicetrees are required.
---
(no changes since v7)
Changes in v7:
- Switch to using an empty file for qemu virt
Changes in v6:
- Expand the commit message based on comments
arch/arm/dts/Makefile | 2 +- arch/arm/dts/qemu-arm64.dts | 11 +++++++++++ configs/qemu_arm64_defconfig | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/qemu-arm64.dts
arch/arm/dts/Makefile +1 -1
@@ -1162,7 +1162,7 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) += imx8mm-cl-iot-gate-optee.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 +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Empty device tree for qemu_arm64 + + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/qemu_arm64_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x1000000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x40000 CONFIG_ENV_SECT_SIZE=0x40000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-arm64" CONFIG_DEBUG_UART_BASE=0x9000000 CONFIG_DEBUG_UART_CLOCK=0 CONFIG_DEBUG_UART=y
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 5/32 riscv: qemu: Split devicetree files for qemu_riscv32/64
In reply to Simon GlassThis uses QEMU virt which creates its own devicetree.
Copy the existing empty version of this file, so splitting the existing qemu-virt into two, since anyone actually trying to use this will need a different devicetree for 32- and 64-bit machines.
---
(no changes since v7)
Changes in v7:
- Reword commit message
- Switch to using an empty file for qemu virt
arch/riscv/dts/Makefile | 2 +-
arch/riscv/dts/{qemu-virt.dts => qemu-virt32.dts} | 3 +++
arch/riscv/dts/qemu-virt64.dts | 11 +++++++++++
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 +-
9 files changed, 21 insertions(+), 3 deletions(-)
rename arch/riscv/dts/{qemu-virt.dts => qemu-virt32.dts} (94%)
create mode 100644 arch/riscv/dts/qemu-virt64.dtsarch/riscv/dts/Makefile +1 -1
@@ -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-virt32.dts renamed from arch/riscv/dts/qemu-virt.dts +3 -0
@@ -6,3 +6,6 @@ /dts-v1/; #include "binman.dtsi" + +/ { +};
arch/riscv/dts/qemu-virt64.dts new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021, Bin Meng <[email protected]> + */ + +/dts-v1/; + +#include "binman.dtsi" + +/ { +};
configs/qemu-riscv32_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 +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
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 +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
@@ -2,7 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 -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
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 +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
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 +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
@@ -2,7 +2,7 @@ CONFIG_RISCV=y CONFIG_SYS_MALLOC_LEN=0x800000 CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 -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.34.1.173.g76aa8bc2d0-goog
PATCH v8 6/32 arm: rpi: Sync rpi dts files from Linux
In reply to Simon GlassSync these files, obtained from Linux v5.15.
This adds a devicetree file for rpi_4 which was not there before.
Testing shows no change so far as I can see:
- boots to U-Boot prompt on rpi0, rpi2
- boots to distro on rpi3
- boots to distro on rpi4
I am assuming that syncing with Linux is safe, but the maintainer should know for sure.
---
(no changes since v7)
Changes in v7:
- Bring in files from Linux instead
arch/arm/dts/Makefile | 3 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 262 +++++ arch/arm/dts/bcm2711-rpi.dtsi | 74 ++ arch/arm/dts/bcm2711.dtsi | 1100 ++++++++++++++++++ arch/arm/dts/bcm2835-common.dtsi | 207 ++++ arch/arm/dts/bcm2835-rpi-a-plus.dts | 18 +- arch/arm/dts/bcm2835-rpi-a.dts | 16 +- arch/arm/dts/bcm2835-rpi-b-plus.dts | 18 +- arch/arm/dts/bcm2835-rpi-b-rev2.dts | 16 +- arch/arm/dts/bcm2835-rpi-b.dts | 16 +- arch/arm/dts/bcm2835-rpi-cm1-io1.dts | 9 + arch/arm/dts/bcm2835-rpi-cm1.dtsi | 7 +- arch/arm/dts/bcm2835-rpi-common.dtsi | 12 + arch/arm/dts/bcm2835-rpi-zero-w.dts | 20 +- arch/arm/dts/bcm2835-rpi-zero.dts | 16 +- arch/arm/dts/bcm2835-rpi.dtsi | 35 +- arch/arm/dts/bcm2835.dtsi | 2 + arch/arm/dts/bcm2836-rpi-2-b.dts | 14 +- arch/arm/dts/bcm2836.dtsi | 2 + arch/arm/dts/bcm2837-rpi-3-a-plus.dts | 9 +- arch/arm/dts/bcm2837-rpi-3-b-plus.dts | 9 +- arch/arm/dts/bcm2837-rpi-3-b.dts | 5 +- arch/arm/dts/bcm2837-rpi-cm3-io3.dts | 9 + arch/arm/dts/bcm2837-rpi-cm3.dtsi | 9 + arch/arm/dts/bcm2837.dtsi | 2 + arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi | 7 + arch/arm/dts/bcm283x.dtsi | 224 +--- configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + include/dt-bindings/clock/bcm2835.h | 2 + 31 files changed, 1878 insertions(+), 248 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm2711-rpi.dtsi create mode 100644 arch/arm/dts/bcm2711.dtsi create mode 100644 arch/arm/dts/bcm2835-common.dtsi create mode 100644 arch/arm/dts/bcm2835-rpi-common.dtsi create mode 100644 arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi
arch/arm/dts/Makefile +2 -1
@@ -1077,7 +1077,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 +262 -0
262 lines not on this page · raw message
arch/arm/dts/bcm2711-rpi.dtsi new file +74 -0
74 lines not on this page · raw message
arch/arm/dts/bcm2711.dtsi new file +1100 -0
1,100 lines not on this page · raw message
arch/arm/dts/bcm2835-common.dtsi new file +207 -0
207 lines not on this page · raw message
arch/arm/dts/bcm2835-rpi-a-plus.dts +16 -2
@@ -8,12 +8,17 @@ compatible = "raspberrypi,model-a-plus", "brcm,bcm2835"; model = "Raspberry Pi Model A+"; + memory@0 { + device_type = "memory"; + reg = <0 0x10000000>; + }; + leds { - act { + led-act { gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; }; - pwr { + led-pwr { label = "PWR"; gpios = <&gpio 35 GPIO_ACTIVE_HIGH>; default-state = "keep";
@@ -99,6 +104,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -107,6 +114,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2835-rpi-a.dts +15 -1
@@ -8,8 +8,13 @@ compatible = "raspberrypi,model-a", "brcm,bcm2835"; model = "Raspberry Pi Model A"; + memory@0 { + device_type = "memory"; + reg = <0 0x10000000>; + }; + leds { - act { + led-act { gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; };
@@ -94,6 +99,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -102,6 +109,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2835-rpi-b-plus.dts +16 -2
@@ -9,12 +9,17 @@ compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; model = "Raspberry Pi Model B+"; + memory@0 { + device_type = "memory"; + reg = <0 0x20000000>; + }; + leds { - act { + led-act { gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; }; - pwr { + led-pwr { label = "PWR"; gpios = <&gpio 35 GPIO_ACTIVE_HIGH>; default-state = "keep";
@@ -101,6 +106,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -109,6 +116,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2835-rpi-b-rev2.dts +15 -1
@@ -9,8 +9,13 @@ compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835"; model = "Raspberry Pi Model B rev2"; + memory@0 { + device_type = "memory"; + reg = <0 0x10000000>; + }; + leds { - act { + led-act { gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; };
@@ -94,6 +99,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -102,6 +109,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2835-rpi-b.dts +15 -1
@@ -9,8 +9,13 @@ compatible = "raspberrypi,model-b", "brcm,bcm2835"; model = "Raspberry Pi Model B"; + memory@0 { + device_type = "memory"; + reg = <0 0x10000000>; + }; + leds { - act { + led-act { gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; };
@@ -89,6 +94,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -97,6 +104,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2835-rpi-cm1-io1.dts +9 -0
@@ -79,6 +79,15 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; +}; + +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; }; &uart0 {
arch/arm/dts/bcm2835-rpi-cm1.dtsi +6 -1
@@ -5,11 +5,16 @@ / { leds { - act { + led-act { gpios = <&gpio 47 GPIO_ACTIVE_LOW>; }; }; + memory@0 { + device_type = "memory"; + reg = <0 0x20000000>; + }; + reg_3v3: fixed-regulator { compatible = "regulator-fixed"; regulator-name = "3V3";
arch/arm/dts/bcm2835-rpi-common.dtsi new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This include file covers the common peripherals and configuration between + * bcm2835, bcm2836 and bcm2837 implementations that interact with RPi's + * firmware interface. + */ + +#include <dt-bindings/power/raspberrypi-power.h> + +&v3d { + power-domains = <&power RPI_POWER_DOMAIN_V3D>; +};
arch/arm/dts/bcm2835-rpi-zero-w.dts +18 -2
@@ -12,14 +12,19 @@ compatible = "raspberrypi,model-zero-w", "brcm,bcm2835"; model = "Raspberry Pi Zero W"; + memory@0 { + device_type = "memory"; + reg = <0 0x20000000>; + }; + chosen { /* 8250 auxiliary UART instead of pl011 */ stdout-path = "serial1:115200n8"; }; leds { - act { - gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + led-act { + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; }; };
@@ -100,12 +105,16 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &sdhci { #address-cells = <1>; #size-cells = <0>; + pinctrl-names = "default"; pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; + bus-width = <4>; mmc-pwrseq = <&wifi_pwrseq>; non-removable; status = "okay";
@@ -116,6 +125,13 @@ }; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>;
arch/arm/dts/bcm2835-rpi-zero.dts +15 -1
@@ -12,8 +12,13 @@ compatible = "raspberrypi,model-zero", "brcm,bcm2835"; model = "Raspberry Pi Zero"; + memory@0 { + device_type = "memory"; + reg = <0 0x20000000>; + }; + leds { - act { + led-act { gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; }; };
@@ -96,6 +101,15 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; +}; + +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; }; &uart0 {
arch/arm/dts/bcm2835-rpi.dtsi +6 -29
@@ -1,15 +1,10 @@ #include <dt-bindings/power/raspberrypi-power.h> / { - memory@0 { - device_type = "memory"; - reg = <0 0x10000000>; - }; - leds { compatible = "gpio-leds"; - act { + led-act { label = "ACT"; default-state = "keep"; linux,default-trigger = "heartbeat";
@@ -18,8 +13,12 @@ soc { firmware: firmware { - compatible = "raspberrypi,bcm2835-firmware", "simple-bus"; + compatible = "raspberrypi,bcm2835-firmware", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; + mboxes = <&mailbox>; + dma-ranges; }; power: power {
@@ -64,32 +63,10 @@ clock-frequency = <100000>; }; -&i2c2 { - status = "okay"; -}; - -&sdhci { - pinctrl-names = "default"; - pinctrl-0 = <&emmc_gpio48>; - bus-width = <4>; -}; - -&sdhost { - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_gpio48>; - status = "okay"; - bus-width = <4>; -}; - &usb { power-domains = <&power RPI_POWER_DOMAIN_USB>; }; -&hdmi { - power-domains = <&power RPI_POWER_DOMAIN_HDMI>; - status = "okay"; -}; - &vec { power-domains = <&power RPI_POWER_DOMAIN_VEC>; status = "okay";
arch/arm/dts/bcm2835.dtsi +2 -0
@@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm283x.dtsi" +#include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2835";
arch/arm/dts/bcm2836-rpi-2-b.dts +12 -2
@@ -10,15 +10,16 @@ model = "Raspberry Pi 2 Model B"; memory@0 { + device_type = "memory"; reg = <0 0x40000000>; }; leds { - act { + led-act { gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; }; - pwr { + led-pwr { label = "PWR"; gpios = <&gpio 35 GPIO_ACTIVE_HIGH>; default-state = "keep";
@@ -105,6 +106,8 @@ &hdmi { hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
@@ -113,6 +116,13 @@ status = "okay"; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio14>;
arch/arm/dts/bcm2836.dtsi +2 -0
@@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm283x.dtsi" +#include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2836";
arch/arm/dts/bcm2837-rpi-3-a-plus.dts +7 -2
@@ -14,17 +14,20 @@ }; memory@0 { + device_type = "memory"; reg = <0 0x20000000>; }; leds { - act { + led-act { gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; }; - pwr { + led-pwr { label = "PWR"; gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; }; }; };
@@ -117,6 +120,8 @@ &hdmi { hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
arch/arm/dts/bcm2837-rpi-3-b-plus.dts +7 -2
@@ -15,17 +15,20 @@ }; memory@0 { + device_type = "memory"; reg = <0 0x40000000>; }; leds { - act { + led-act { gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; }; - pwr { + led-pwr { label = "PWR"; gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; }; };
@@ -124,6 +127,8 @@ &hdmi { hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; &pwm {
arch/arm/dts/bcm2837-rpi-3-b.dts +4 -1
@@ -15,11 +15,12 @@ }; memory@0 { + device_type = "memory"; reg = <0 0x40000000>; }; leds { - act { + led-act { gpios = <&expgpio 2 GPIO_ACTIVE_HIGH>; }; };
@@ -125,6 +126,8 @@ &hdmi { hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; }; /* uart0 communicates with the BT module */
arch/arm/dts/bcm2837-rpi-cm3-io3.dts +9 -0
@@ -78,6 +78,15 @@ &hdmi { hpd-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; + power-domains = <&power RPI_POWER_DOMAIN_HDMI>; + status = "okay"; +}; + +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + status = "okay"; }; &uart0 {
arch/arm/dts/bcm2837-rpi-cm3.dtsi +9 -0
@@ -5,9 +5,18 @@ / { memory@0 { + device_type = "memory"; reg = <0 0x40000000>; }; + leds { + /* + * Since there is no upstream GPIO driver yet, + * remove the incomplete node. + */ + /delete-node/ led-act; + }; + reg_3v3: fixed-regulator { compatible = "regulator-fixed"; regulator-name = "3V3";
arch/arm/dts/bcm2837.dtsi +2 -0
@@ -1,4 +1,6 @@ #include "bcm283x.dtsi" +#include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2837";
arch/arm/dts/bcm283x-rpi-usb-peripheral.dtsi new file +7 -0
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 +&usb { + dr_mode = "peripheral"; + g-rx-fifo-size = <256>; + g-np-tx-fifo-size = <32>; + g-tx-fifo-size = <256 256 512 512 512 768 768>; +};
arch/arm/dts/bcm283x.dtsi +24 -200
355 lines not on this page · raw message
configs/rpi_4_32b_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_RPI_4_32B=y 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
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_RPI_4=y 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
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_RPI_ARM64=y 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
include/dt-bindings/clock/bcm2835.h +2 -0
@@ -58,3 +58,5 @@#define BCM2835_CLOCK_DSI1E 48#define BCM2835_CLOCK_DSI0P 49#define BCM2835_CLOCK_DSI1P 50 + +#define BCM2711_CLOCK_EMMC2 51
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 7/32 arm: vexpress: Add a devicetree files for juno
In reply to Simon GlassSync these file, obtained from Linux v5.15.
Add a note for the maintainer, and SPDX lines where they are missing. The added lines are:
SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
Note, this matches the text in those files, but is not the same as the GPL-2.0 of some files.
[1] https://releases.linaro.org/android/reference-lcr/juno/7.1-17.05/
---
Changes in v8:
- Enable the flash as suggested by Linus Walleij
Changes in v7:
- Bring in files from Linux instead
- Rewrite the commit message
arch/arm/dts/Makefile | 3 + arch/arm/dts/juno-base.dtsi | 831 +++++++++++++++++++++++++ arch/arm/dts/juno-clocks.dtsi | 46 ++ arch/arm/dts/juno-cs-r1r2.dtsi | 85 +++ arch/arm/dts/juno-motherboard.dtsi | 303 +++++++++ arch/arm/dts/juno-r2-u-boot.dtsi | 20 + arch/arm/dts/juno-r2.dts | 322 ++++++++++ configs/vexpress_aemv8a_juno_defconfig | 1 + 8 files changed, 1611 insertions(+) create mode 100644 arch/arm/dts/juno-base.dtsi create mode 100644 arch/arm/dts/juno-clocks.dtsi create mode 100644 arch/arm/dts/juno-cs-r1r2.dtsi create mode 100644 arch/arm/dts/juno-motherboard.dtsi create mode 100644 arch/arm/dts/juno-r2-u-boot.dtsi create mode 100644 arch/arm/dts/juno-r2.dts
arch/arm/dts/Makefile +3 -0
@@ -1149,7 +1149,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-base.dtsi new file +831 -0
831 lines not on this page · raw message
arch/arm/dts/juno-clocks.dtsi new file +46 -0
46 lines not on this page · raw message
arch/arm/dts/juno-cs-r1r2.dtsi new file +85 -0
85 lines not on this page · raw message
arch/arm/dts/juno-motherboard.dtsi new file +303 -0
303 lines not on this page · raw message
arch/arm/dts/juno-r2-u-boot.dtsi new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * ARM Juno Platform additions for U-Boot + */ + +/ { + bus@8000000 { + motherboard-bus@8000000 { + /* + * This should not be marked "disabled" in U-Boot. The + * boot loader is not using some CPU idle states and + * hotplug but may be very interested in accessing the + * flash. + */ + flash@0 { + status = "okay"; + }; + }; + }; +};
arch/arm/dts/juno-r2.dts new file +322 -0
322 lines not on this page · raw message
configs/vexpress_aemv8a_juno_defconfig +1 -0
@@ -8,6 +8,7 @@ CONFIG_SYS_MEMTEST_START=0x80000000 CONFIG_SYS_MEMTEST_END=0xff000000 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_SECT_SIZE=0x10000 +CONFIG_DEFAULT_DEVICE_TREE="juno-r2" CONFIG_IDENT_STRING=" vexpress_aemv8a" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x90000000
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
Re: [PATCH v8 07/32] arm: vexpress: Add a devicetree files for juno
Quoted 10 lines · Simon Glass
Sync these file, obtained from Linux v5.15.
Add a note for the maintainer, and SPDX lines where they are missing. The added lines are:
SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
Note, this matches the text in those files, but is not the same as the GPL-2.0 of some files.
Quoted 7 lines
[1] https://releases.linaro.org/android/reference-lcr/juno/7.1-17.05/
Signed-off-by Simon Glass <[email protected]>---
Changes in v8:
- Enable the flash as suggested by Linus Walleij
Yours,
Linus Walleij
PATCH v8 8/32 arm: xenguest_arm64: Add a empty devicetree file
In reply to Simon GlassAdd an empty version of this file, so that we can at least build this board when devicetrees are required.
The real devicetree is created by the Xen project on-the-fly.
---
Changes in v8:
- Reword commit message to mention the dynamic devicetree
Changes in v7:
- Use 'empty' instead of 'fake'
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/xenguest-arm64.dts | 15 +++++++++++++++ configs/xenguest_arm64_defconfig | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/xenguest-arm64.dts
arch/arm/dts/Makefile +2 -0
@@ -1140,6 +1140,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
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Empty devicetree 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 -1
@@ -3,7 +3,7 @@ CONFIG_POSITION_INDEPENDENT=y CONFIG_TARGET_XENGUEST_ARM64=y CONFIG_SYS_TEXT_BASE=0x40080000 CONFIG_SYS_MALLOC_LEN=0x2000000 -CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_DEFAULT_DEVICE_TREE="xenguest-arm64" CONFIG_IDENT_STRING=" xenguest" CONFIG_SYS_LOAD_ADDR=0x40000000 CONFIG_BOOTDELAY=10
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 9/32 arm: octeontx: Add an empty devicetree file
In reply to Simon GlassAdd 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.
---
(no changes since v7)
Changes in v7:
- Use 'empty' instead of 'fake'
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
@@ -1142,6 +1142,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
@@ -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
@@ -12,6 +12,7 @@ CONFIG_ENV_OFFSET=0xF00000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX2_95XX=y 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
@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0xF00000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX2_96XX=y 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
@@ -12,6 +12,7 @@ CONFIG_ENV_OFFSET=0xF00000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX_81XX=y 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
@@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0xF00000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX_83XX=y 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.34.1.173.g76aa8bc2d0-goog
PATCH v8 10/32 arm: xilinx_versal_virt: Add a devicetree file
In reply to Simon GlassAdd an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.
---
(no changes since v1)
arch/arm/dts/Makefile | 3 ++- arch/arm/dts/xilinx-versal-virt.dts | 11 +++++++++++ configs/xilinx_versal_virt_defconfig | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/xilinx-versal-virt.dts
arch/arm/dts/Makefile +2 -1
@@ -360,7 +360,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 +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Empty device tree for versal-virt board + * + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
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
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 11/32 arm: bcm7xxx: Add a devicetree file
In reply to Simon GlassAdd an empty 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.
---
Changes in v8:
- Mention that this is empty, rather than a dummy file
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
@@ -1092,6 +1092,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
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Empty 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
@@ -7,6 +7,7 @@ CONFIG_TARGET_BCM7260=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x814800 +CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx" CONFIG_ENV_OFFSET_REDUND=0x824800 CONFIG_SYS_LOAD_ADDR=0x02000000 CONFIG_FIT=y
configs/bcm7445_defconfig +1 -0
@@ -8,6 +8,7 @@ CONFIG_NR_DRAM_BANKS=3 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x1E0000 CONFIG_ENV_SECT_SIZE=0x10000 +CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx" CONFIG_ENV_OFFSET_REDUND=0x1F0000 CONFIG_SYS_LOAD_ADDR=0x02000000 CONFIG_FIT=y
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 12/32 arm: qemu-ppce500: Add a devicetree file
In reply to Simon GlassThis uses QEMU virt which creates its own devicetree.
Add an empty version of this file, so that we can at least build this board when devicetrees are required.
---
(no changes since v7)
Changes in v7:
- Switch to using an empty file for qemu virt
arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 10 ++++++++++ configs/qemu-ppce500_defconfig | 1 + 3 files changed, 12 insertions(+) create mode 100644 arch/powerpc/dts/qemu-ppce500.dts
arch/powerpc/dts/Makefile +1 -0
@@ -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 +10 -0
@@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * Empty device tree for qemu-ppce400 + * + * Copyright 2021 Google LLC + */ +/dts-v1/; + +/ { +};
configs/qemu-ppce500_defconfig +1 -0
@@ -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.34.1.173.g76aa8bc2d0-goog
PATCH v8 13/32 arm: highbank: Add devicetree files
In reply to Simon GlassAdd an empty version of this file, so that we can at least build this board when devicetrees are required.
---
Changes in v8:
- Use an empty tree due to maintainer objections
Changes in v7:
- Bring in files from Linux instead
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/highbank.dts | 9 +++++++++ configs/highbank_defconfig | 1 + 3 files changed, 12 insertions(+) create mode 100644 arch/arm/dts/highbank.dts
arch/arm/dts/Makefile +2 -0
@@ -871,6 +871,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 +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Empty devicetree for highbank/midway + */ + +/dts-v1/; + +/ { +};
configs/highbank_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000 CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_NR_DRAM_BANKS=2 CONFIG_ENV_SIZE=0x2000 +CONFIG_DEFAULT_DEVICE_TREE="highbank" CONFIG_SYS_BOOTCOUNT_ADDR=0xfff3cf0c CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y CONFIG_DISTRO_DEFAULTS=y
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 14/32 fdt: Make OF_BOARD a bool option
In reply to Simon GlassThis 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.
---
(no changes since v1)
configs/qemu-ppce500_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 2 ++ configs/qemu-riscv64_spl_defconfig | 1 + dts/Kconfig | 11 ++++++----- 4 files changed, 10 insertions(+), 5 deletions(-)
configs/qemu-ppce500_defconfig +1 -0
@@ -56,4 +56,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
@@ -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
@@ -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 +6 -5
@@ -97,11 +97,9 @@ config OF_LIVE choice prompt "Provider of DTB for DT control" depends on OF_CONTROL - default OF_BOARD if SANDBOX 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.
@@ -114,14 +112,17 @@ 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" + default y if SANDBOX 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.34.1.173.g76aa8bc2d0-goog
PATCH v8 15/32 fdt: Drop CONFIG_BINMAN_STANDALONE_FDT
In reply to Simon GlassThis 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.
---
Changes in v8:
- Add an fdt: tag
Makefile | 3 +-- dts/Kconfig | 18 ------------------ tools/binman/binman.rst | 20 -------------------- 3 files changed, 1 insertion(+), 40 deletions(-)
Makefile +1 -2
@@ -953,7 +953,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
@@ -1427,7 +1426,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
@@ -16,24 +16,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
@@ -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.34.1.173.g76aa8bc2d0-goog
PATCH v8 16/32 fdt: Make it easier to debug u-boot.dtsi files
In reply to Simon GlassAt present one must hack the Makefile to see what is going on with these files. Also it doesn't quite work correctly.
Fix this by using an environment variable for debugging. Update the docs also.
---
Changes in v8:
- Add a new patch to make it easier to debug u-boot.dtsi files
scripts/Makefile.lib | 4 +++- tools/binman/binman.rst | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-)
scripts/Makefile.lib +3 -1
@@ -175,7 +175,9 @@ u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \ # Uncomment for debugging # This shows all the files that were considered and the one that we chose. -# u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw) +ifdef DEVICE_TREE_DEBUG +u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw)) +endif # We use the first match u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
tools/binman/binman.rst +8 -6
@@ -790,12 +790,14 @@ Binman will search for the following files in arch/<arch>/dts:: U-Boot will only use the first one that it finds. If you need to include a more general file you can do that from the more specific file using #include. -If you are having trouble figuring out what is going on, you can uncomment -the 'warning' line in scripts/Makefile.lib to see what it has found:: - - # Uncomment for debugging - # This shows all the files that were considered and the one that we chose. - # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw) +If you are having trouble figuring out what is going on, you can use +`DEVICE_TREE_DEBUG=1` with your build:: + + make DEVICE_TREE_DEBUG=1 + scripts/Makefile.lib:334: Automatic .dtsi inclusion: options: + arch/arm/dts/juno-r2-u-boot.dtsi arch/arm/dts/-u-boot.dtsi + arch/arm/dts/armv8-u-boot.dtsi arch/arm/dts/armltd-u-boot.dtsi + arch/arm/dts/u-boot.dtsi ... found: "arch/arm/dts/juno-r2-u-boot.dtsi" Updating an ELF file
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 17/32 fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
In reply to Simon GlassThis logic is a bit convoluted for one function. Move the mulit-FIT part into its own function.
---
(no changes since v1)
lib/fdtdec.c | 62 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 24 deletions(-)
lib/fdtdec.c +38 -24
@@ -1594,13 +1594,46 @@ __weak int fdtdec_board_setup(const void *fdt_blob)return 0 ; } +/** +* setup_multi_dtb_fit() - locate the correct dtb from a FIT +* +* This supports the CONFIG_MULTI_DTB_FIT feature, looking for the dtb in a +* supplied FIT +* +* It accepts the current value of gd->fdt_blob, which points to the FIT, then +* updates that gd->fdt_blob, to point to the chosen dtb so that U-Boot uses the +* correct one +*/ +static void setup_multi_dtb_fit (void ) +{ +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +void *blob; + +/* +* Try and uncompress the blob. +* Unfortunately there is no way to know how big the input blob really +* is. So let us set the maximum input size arbitrarily high. 16MB +* ought to be more than enough for packed DTBs. +*/ +if (uncompress_blob (gd->fdt_blob,0x1000000 , &blob) ==0 ) + gd->fdt_blob = blob; + +/* +* Check if blob is a FIT images containings DTBs. +* If so, pick the most relevant +*/ + blob =locate_dtb_in_fit (gd->fdt_blob); +if (blob) { + gd->multi_dtb_fit = gd->fdt_blob; + gd->fdt_blob = blob; + } +#endif /* # MULTI_DTB_FIT */ +} +int fdtdec_setup (void ) {int ret;#if CONFIG_IS_ENABLED (OF_CONTROL ) -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -void *fdt_blob; -# endif # ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ # ifdef CONFIG_SPL_BUILD
@@ -1621,27 +1654,8 @@ int fdtdec_setup(void) (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);# endif -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -/* -* Try and uncompress the blob. -* Unfortunately there is no way to know how big the input blob really -* is. So let us set the maximum input size arbitrarily high. 16MB -* ought to be more than enough for packed DTBs. -*/ -if (uncompress_blob (gd->fdt_blob,0x1000000 , &fdt_blob) ==0 ) - gd->fdt_blob = fdt_blob; - -/* -* Check if blob is a FIT images containings DTBs. -* If so, pick the most relevant -*/ - fdt_blob =locate_dtb_in_fit (gd->fdt_blob); -if (fdt_blob) { - gd->multi_dtb_fit = gd->fdt_blob; - gd->fdt_blob = fdt_blob; - } - -# endif +if (CONFIG_IS_ENABLED (MULTI_DTB_FIT )) +setup_multi_dtb_fit ();#endif ret =fdtdec_prepare_fdt ();
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 18/32 fdt: Drop #ifdefs with MULTI_DTB_FIT
In reply to Simon GlassRefactor the code to drop the #ifdefs for this feature.
---
(no changes since v1)
dts/Kconfig | 1 - include/asm-generic/global_data.h | 8 ++++++++ lib/fdtdec.c | 31 +++++++++++-------------------- 3 files changed, 19 insertions(+), 21 deletions(-)
dts/Kconfig +0 -1
@@ -177,7 +177,6 @@ endchoice config MULTI_DTB_FIT_UNCOMPRESS_SZ hex "Size of memory reserved to uncompress the DTBs" - depends on (MULTI_DTB_FIT_GZIP || MULTI_DTB_FIT_LZO) default 0x8000 help This is the size of this area where the DTBs are uncompressed.
include/asm-generic/global_data.h +8 -0
@@ -512,6 +512,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE);#define gd_acpi_ctx () NULL#endif +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +#define gd_multi_dtb_fit () gd->multi_dtb_fit +#define gd_set_multi_dtb_fit (_dtb) gd->multi_dtb_fit = _dtb +#else +#define gd_multi_dtb_fit () NULL +#define gd_set_multi_dtb_fit (_dtb) +#endif +/** * enum gd_flags - global data flags *
lib/fdtdec.c +11 -20
@@ -1146,11 +1146,10 @@ int fdtdec_setup_mem_size_base_lowest(void)return 0 ; } -#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) -# if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\ - CONFIG_IS_ENABLED(MULTI_DTB_FIT_LZO)static int uncompress_blob (const void *src,ulong sz_src,void **dstp) { +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT_GZIP ) ||\ +CONFIG_IS_ENABLED (MULTI_DTB_FIT_LZO )size_t sz_out =CONFIG_VAL (MULTI_DTB_FIT_UNCOMPRESS_SZ );bool gzip =0 , lzo =0 ;ulong sz_in = sz_src;
@@ -1175,11 +1174,11 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return -ENOMEM ; } }else { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) dst = (void *)CONFIG_VAL (MULTI_DTB_FIT_USER_DEF_ADDR ); -# else +# else return -ENOTSUPP ; -# endif +# endif }if (CONFIG_IS_ENABLED (GZIP ) && gzip)
@@ -1197,16 +1196,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) return -EBADMSG; } *dstp = dst; -return 0 ; -} -# else -static int uncompress_blob (const void *src,ulong sz_src,void **dstp) -{ +#else + *dstp = (void *)src; *dstp = (void *)src; +#endif return 0 ; } -# endif -#endif #if defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/*
@@ -1606,7 +1601,6 @@ __weak int fdtdec_board_setup(const void *fdt_blob)*/ static void setup_multi_dtb_fit (void ) { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT )void *blob;/*
@@ -1624,10 +1618,9 @@ static void setup_multi_dtb_fit(void)*/ blob =locate_dtb_in_fit (gd->fdt_blob);if (blob) { - gd->multi_dtb_fit = gd->fdt_blob; +gd_set_multi_dtb_fit (gd->fdt_blob); gd->fdt_blob = blob; } -#endif /* # MULTI_DTB_FIT */ }int fdtdec_setup (void )
@@ -1664,7 +1657,6 @@ int fdtdec_setup(void)return ret; } -#if CONFIG_IS_ENABLED (MULTI_DTB_FIT )int fdtdec_resetup (int *rescan) {void *fdt_blob;
@@ -1675,8 +1667,8 @@ int fdtdec_resetup(int *rescan)* FIT image stillpresent there. Save the time and space * required to uncompress it again. */ -if (gd->multi_dtb_fit) { - fdt_blob =locate_dtb_in_fit (gd->multi_dtb_fit); +if (gd_multi_dtb_fit ()) { + fdt_blob =locate_dtb_in_fit (gd_multi_dtb_fit ());if (fdt_blob == gd->fdt_blob) {/*
@@ -1700,7 +1692,6 @@ int fdtdec_resetup(int *rescan) *rescan =0 ;return 0 ; } -#endif int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, phys_addr_t *basep, phys_size_t *sizep,
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 19/32 fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
In reply to Simon GlassMove this to the header file to clean up the C code.
---
(no changes since v1)
include/fdtdec.h | 14 ++++++++++++++ lib/fdtdec.c | 6 +----- 2 files changed, 15 insertions(+), 5 deletions(-)
include/fdtdec.h +14 -0
@@ -111,6 +111,20 @@ struct fdt_pci_addr {extern u8 __dtb_dt_begin[];/* embedded device tree blob */ extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for SPL/TPL */ +/* Get a pointer to the embedded devicetree, if there is one, else NULL */ +static inline u8 *dtb_dt_embedded (void ) +{ +#ifdef CONFIG_OF_EMBED +# ifdef CONFIG_SPL_BUILD +return __dtb_dt_spl_begin; +# else +return __dtb_dt_begin; +# endif +#else +return NULL ; +#endif +} +/** * Compute the size of a resource. *
lib/fdtdec.c +1 -5
@@ -1629,11 +1629,7 @@ int fdtdec_setup(void)#if CONFIG_IS_ENABLED (OF_CONTROL )# ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ -# ifdef CONFIG_SPL_BUILD - gd->fdt_blob = __dtb_dt_spl_begin; -# else - gd->fdt_blob = __dtb_dt_begin; -# endif + gd->fdt_blob =dtb_dt_embedded ();# elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* Allow the board to override the fdt address. */ gd->fdt_blob =board_fdt_blob_setup (&ret);
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 20/32 fdt: Drop #ifdef around board_fdt_blob_setup()
In reply to Simon GlassThis serves no purpose. Drop it.
---
(no changes since v1)
lib/fdtdec.c | 2 -- 1 file changed, 2 deletions(-)
lib/fdtdec.c +0 -2
@@ -1203,7 +1203,6 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -#if defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* * For CONFIG_OF_SEPARATE, the board may optionally implement this to * provide and/or fixup the fdt.
@@ -1226,7 +1225,6 @@ __weak void *board_fdt_blob_setup(int *err)return fdt_blob; } -#endif int fdtdec_set_ethernet_mac_address (void *fdt,const u8 *mac,size_t size) {
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 21/32 fdt: Use if() for fdtcontroladdr check
In reply to Simon GlassChange this to use if() instead of #if
---
(no changes since v1)
lib/fdtdec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
lib/fdtdec.c +4 -5
@@ -1634,12 +1634,11 @@ int fdtdec_setup(void)if (ret)return ret;# endif -# ifndef CONFIG_SPL_BUILD -/* Allow the early environment to override the fdt address */ - gd->fdt_blob =map_sysmem - (env_get_ulong ("fdtcontroladdr" ,16 , +if (!IS_ENABLED (CONFIG_SPL_BUILD )) { +/* Allow the early environment to override the fdt address */ + gd->fdt_blob =map_sysmem (env_get_ulong ("fdtcontroladdr" ,16 , (unsigned long )map_to_sysmem (gd->fdt_blob)),0 ); -# endif + }if (CONFIG_IS_ENABLED (MULTI_DTB_FIT ))setup_multi_dtb_fit ();
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 22/32 fdt: Drop OF_CONTROL check in fdtdec_setup()
In reply to Simon GlassThis function should only be called when OF_CONTROL is enabled. It fails in fdtdec_prepare_fdt() anyway, since gd->fdt_blob stays as NULL if OF_CONTROL is not enabled.
Drop this useless check.
---
(no changes since v1)
lib/fdtdec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
lib/fdtdec.c +3 -5
@@ -1624,16 +1624,15 @@ static void setup_multi_dtb_fit(void)int fdtdec_setup (void ) {int ret; -#if CONFIG_IS_ENABLED(OF_CONTROL) -# ifdef CONFIG_OF_EMBED +#ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob =dtb_dt_embedded (); -# elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) +#elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* Allow the board to override the fdt address. */ gd->fdt_blob =board_fdt_blob_setup (&ret);if (ret)return ret; -# endif +#endif if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
@@ -1642,7 +1641,6 @@ int fdtdec_setup(void)if (CONFIG_IS_ENABLED (MULTI_DTB_FIT ))setup_multi_dtb_fit (); -#endif ret =fdtdec_prepare_fdt ();if (!ret)
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 23/32 fdt: Drop remaining preprocessor macros in fdtdec_setup()
In reply to Simon GlassWe only have two choices for obtaining the devicetree. Simplify the code to make that clear.
---
(no changes since v1)
lib/fdtdec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
lib/fdtdec.c +11 -9
@@ -1624,15 +1624,17 @@ static void setup_multi_dtb_fit(void)int fdtdec_setup (void ) {int ret; -#ifdef CONFIG_OF_EMBED -/* Get a pointer to the FDT */ - gd->fdt_blob =dtb_dt_embedded (); -#elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE ) -/* Allow the board to override the fdt address. */ - gd->fdt_blob =board_fdt_blob_setup (&ret); -if (ret) -return ret; -#endif + +/* The devicetree is typically appended to U-Boot */ +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) { +/* Allow the board to override the fdt address. */ + gd->fdt_blob =board_fdt_blob_setup (&ret); +if (ret) +return ret; + }else {/* embed dtb in ELF file for testing / development */ + gd->fdt_blob =dtb_dt_embedded (); + } +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 24/32 fdt: Don't call board_fdt_blob_setup() without OF_BOARD
In reply to Simon GlassAt present this override function is called even when OF_BOARD is not enabled. This makes it impossible to disable this feature and in fact makes the OF_BOARD option useless.
Reinstate its intended purpose, so that it is possible to switch between the appended devicetree and one provided by the board's custom function.
A follower patch adds warnings for this scenario, but for now we don't have a Kconfig that definitively tells us that OF_BOARD should be used.
---
Changes in v8:
- Mention the follower patch
Changes in v7:
- Fix 'Is' typo in commit message
Changes in v5:
- Add new patches to clean up fdtdec_setup() and surrounds
include/fdtdec.h | 7 +++++-- lib/fdtdec.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-)
include/fdtdec.h +5 -2
@@ -1170,10 +1170,13 @@ int fdtdec_resetup(int *rescan);/** * Board-specific FDT initialization. Returns the address to a device tree blob. -* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined -* and the board implements it. +* +* Called when CONFIG_OF_BOARD is defined. +* +* The existing devicetree is available at gd->fdt_blob * * @err internal error code if we fail to setup a DTB +* @returns new devicetree blob pointer */ void *board_fdt_blob_setup (int *err);
lib/fdtdec.c +12 -9
@@ -1203,15 +1203,15 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -/* -* For CONFIG_OF_SEPARATE, the board may optionally implement this to -* provide and/or fixup the fdt. +/** +* fdt_find_separate() - Find a devicetree at the end of the image +* +* @return pointer to FDT blob */ -__weak void *board_fdt_blob_setup (int *err) +static void *fdt_find_separate (void ) {void *fdt_blob =NULL ; - *err =0 ;#ifdef CONFIG_SPL_BUILD /* FDT is at end of BSS unless it is in a different memory region */ if (IS_ENABLED (CONFIG_SPL_SEPARATE_BSS ))
@@ -1626,13 +1626,16 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) { -/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_SEPARATE )) + gd->fdt_blob =fdt_find_separate (); +else /* embed dtb in ELF file for testing / development */ + gd->fdt_blob =dtb_dt_embedded (); + +/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_BOARD )) { gd->fdt_blob =board_fdt_blob_setup (&ret);if (ret)return ret; - }else {/* embed dtb in ELF file for testing / development */ - gd->fdt_blob =dtb_dt_embedded (); }if (!IS_ENABLED (CONFIG_SPL_BUILD )) {
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 25/32 dm: core: Allow getting some basic stats
In reply to Simon GlassAdd a function that returns some basic stats about driver model. For now we only have two.
---
(no changes since v1)
drivers/core/device.c | 11 ++++++++++ drivers/core/root.c | 7 ++++++ drivers/core/uclass.c | 13 ++++++++++++ include/dm/device.h | 11 +++++++++- include/dm/root.h | 8 +++++++ include/dm/uclass-internal.h | 7 ++++++ test/dm/core.c | 41 ++++++++++++++++++++++++++++++++++++ 7 files changed, 97 insertions(+), 1 deletion(-)
drivers/core/device.c +11 -0
@@ -739,6 +739,17 @@ int device_get_child_count(const struct udevice *parent)return count; } +int device_get_decendent_count (const struct udevice *parent) +{ +const struct udevice *dev; +int count =1 ; + +list_for_each_entry (dev, &parent->child_head, sibling_node) + count +=device_get_decendent_count (dev); + +return count; +} +int device_find_child_by_seq (const struct udevice *parent,int seq,struct udevice **devp) {
drivers/core/root.c +7 -0
@@ -26,6 +26,7 @@#include <dm/read.h> #include <dm/root.h> #include <dm/uclass.h> +#include <dm/uclass-internal.h> #include <dm/util.h> #include <linux/list.h>
@@ -407,6 +408,12 @@ int dm_init_and_scan(bool pre_reloc_only)return 0 ; } +void dm_get_stats (int *device_countp,int *uclass_countp) +{ + *device_countp =device_get_decendent_count (gd->dm_root); + *uclass_countp =uclass_get_count (); +} +#ifdef CONFIG_ACPIGEN static int root_acpi_get_name (const struct udevice *dev,char *out_name) {
drivers/core/uclass.c +13 -0
@@ -643,6 +643,19 @@ int uclass_next_device_check(struct udevice **devp)return device_probe (*devp); } +int uclass_get_count (void ) +{ +const struct uclass *uc; +int count =0 ; + +if (gd->dm_root) { +list_for_each_entry (uc, gd->uclass_root, sibling_node) + count++; + } + +return count; +} +int uclass_first_device_drvdata (enum uclass_id id,ulong driver_data,struct udevice **devp) {
include/dm/device.h +10 -1
@@ -593,7 +593,7 @@ int device_get_child(const struct udevice *parent, int index, struct udevice **devp);/** -* device_get_child_count() - Get the available child count of a device +* device_get_child_count() - Get the child count of a device * * Returns the number of children to a device. *
@@ -601,6 +601,15 @@ int device_get_child(const struct udevice *parent, int index,*/ int device_get_child_count (const struct udevice *parent); +/** +* device_get_decendent_count() - Get the total number of decendents of a device +* +* Returns the total number of decendents, including all children +* +* @parent: Parent device to check +*/ +int device_get_decendent_count (const struct udevice *parent); +/** * device_find_child_by_seq() - Find a child device based on a sequence *
include/dm/root.h +8 -0
@@ -131,4 +131,12 @@ int dm_remove_devices_flags(uint flags);static inline int dm_remove_devices_flags (uint flags) {return 0 ; }#endif +/** +* dm_get_stats() - Get some stats for driver mode +* +* @device_countp: Returns total number of devices that are bound +* @uclass_countp: Returns total number of uclasses in use +*/ +void dm_get_stats (int *device_countp,int *uclass_countp); +#endif
include/dm/uclass-internal.h +7 -0
@@ -306,6 +306,13 @@ int uclass_pre_remove_device(struct udevice *dev);static inline int uclass_pre_remove_device (struct udevice *dev) {return 0 ; }#endif +/** +* uclass_get_count() - Get the number of uclasses +* +* Returns the number of uclasses instantiated in driver model +*/ +int uclass_get_count (void ); +/** * uclass_find() - Find uclass by its id *
test/dm/core.c +41 -0
84 lines not on this page · raw message
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 26/32 fdt: Record where the devicetree came from
In reply to Simon GlassKeep track of where the devicetree came from, so we can report this later.
---
(no changes since v7)
Changes in v7:
- Drop FDTSRC_PASSAGE for now
include/asm-generic/global_data.h | 4 ++++ include/fdtdec.h | 32 +++++++++++++++++++++++++++++++ lib/fdtdec.c | 20 ++++++++++++++----- 3 files changed, 51 insertions(+), 5 deletions(-)
include/asm-generic/global_data.h +4 -0
@@ -244,6 +244,10 @@ struct global_data {* @fdt_size: space reserved for relocated device space */ unsigned long fdt_size; +/** +* @fdt_src: Source of FDT +*/ +enum fdt_source_t fdt_src;#if CONFIG_IS_ENABLED (OF_LIVE )/** * @of_root: root node of the live tree
include/fdtdec.h +32 -0
@@ -55,6 +55,31 @@ struct bd_info;#define SPL_BUILD 0#endif +/** +* enum fdt_source_t - indicates where the devicetree came from +* +* These are listed in approximate order of desirability after FDTSRC_NONE +* +* @FDTSRC_SEPARATE: Appended to U-Boot. This is the normal approach if U-Boot +* is the only firmware being booted +* @FDTSRC_FIT: Found in a multi-dtb FIT. This should be used when U-Boot must +* select a devicetree from many options +* @FDTSRC_BOARD: Located by custom board code. This should only be used when +* the prior stage does not support FDTSRC_PASSAGE +* @FDTSRC_EMBED: Embedded into U-Boot executable. This should onyl be used when +* U-Boot is packaged as an ELF file, e.g. for debugging purposes +* @FDTSRC_ENV: Provided by the fdtcontroladdr environment variable. This should +* be used for debugging/development only +* @FDTSRC_NONE: No devicetree at all +*/ +enum fdt_source_t { +FDTSRC_SEPARATE , +FDTSRC_FIT , +FDTSRC_BOARD , +FDTSRC_EMBED , +FDTSRC_ENV , +}; +/* * Information about a resource. start is the first address of the resource * and end is the last address (inclusive). The length of the resource will
@@ -1215,4 +1240,11 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, phys_addr_t *basep, phys_size_t *sizep, struct bd_info *bd); +/** +* fdtdec_get_srcname() - Get the name of where the devicetree comes from +* +* @return source name +*/ +const char *fdtdec_get_srcname (void ); +#endif
lib/fdtdec.c +15 -5
@@ -1618,6 +1618,7 @@ static void setup_multi_dtb_fit(void)if (blob) {gd_set_multi_dtb_fit (gd->fdt_blob); gd->fdt_blob = blob; + gd->fdt_src =FDTSRC_FIT ; } }
@@ -1626,22 +1627,31 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE )) +if (IS_ENABLED (CONFIG_OF_SEPARATE )) { gd->fdt_blob =fdt_find_separate (); -else /* embed dtb in ELF file for testing / development */ + gd->fdt_src =FDTSRC_SEPARATE ; + }else {/* embed dtb in ELF file for testing / development */ gd->fdt_blob =dtb_dt_embedded (); + gd->fdt_src =FDTSRC_EMBED ; + }/* Allow the board to override the fdt address. */ if (IS_ENABLED (CONFIG_OF_BOARD )) { gd->fdt_blob =board_fdt_blob_setup (&ret);if (ret)return ret; + gd->fdt_src =FDTSRC_BOARD ; } +/* Allow the early environment to override the fdt address */ if (!IS_ENABLED (CONFIG_SPL_BUILD )) { -/* Allow the early environment to override the fdt address */ - gd->fdt_blob =map_sysmem (env_get_ulong ("fdtcontroladdr" ,16 , - (unsigned long )map_to_sysmem (gd->fdt_blob)),0 ); +ulong addr; + + addr =env_get_hex ("fdtcontroladdr" ,0 ); +if (addr) { + gd->fdt_blob =map_sysmem (addr,0 ); + gd->fdt_src =FDTSRC_ENV ; + } }if (CONFIG_IS_ENABLED (MULTI_DTB_FIT ))
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 27/32 fdt: Report the devicetree source
In reply to Simon GlassIt can be confusing to figure out where the devicetree came from. It seems important enough to warrant a message during boot. Add information about the number of devices and uclasses too since it is helpful to have some idea what is going on with driver model.
Report the devicetree source in bdinfo too.
This looks something like this, with > marking the new line.
U-Boot 2021.10-00190 (Oct 30 2021 - 09:01:29 -0600)
DRAM: 128 MiB
Quoted 1 line
Core: 42 devices, 11 uclasses, devicetree: passage
Flash: 64 MiB
---
(no changes since v7)
Changes in v7:
- Drop FDTSRC_PASSAGE for now
cmd/bdinfo.c | 2 ++ common/board_r.c | 18 ++++++++++++++++++ lib/fdtdec.c | 13 +++++++++++++ 3 files changed, 33 insertions(+)
cmd/bdinfo.c +2 -0
@@ -128,6 +128,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])lmb_init_and_reserve (&lmb, gd->bd, (void *)gd->fdt_blob);lmb_dump_all_force (&lmb); +if (IS_ENABLED (CONFIG_OF_REAL )) +printf ("devicetree = %s\n" ,fdtdec_get_srcname ()); }arch_print_bdinfo ();
common/board_r.c +18 -0
@@ -586,6 +586,23 @@ int initr_mem(void) }#endif +static int dm_announce (void ) +{ +int device_count; +int uclass_count; + +if (IS_ENABLED (CONFIG_DM )) { +dm_get_stats (&device_count, &uclass_count); +printf ("Core: %d devices, %d uclasses" , device_count, + uclass_count); +if (CONFIG_IS_ENABLED (OF_REAL )) +printf (", devicetree: %s" ,fdtdec_get_srcname ()); +printf ("\n" ); + } + +return 0 ; +} +static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX
@@ -661,6 +678,7 @@ static init_fnc_t init_sequence_r[] = { stdio_init_tables, serial_initialize, initr_announce, + dm_announce, #if CONFIG_IS_ENABLED(WDT) initr_watchdog, #endif
lib/fdtdec.c +13 -0
@@ -76,6 +76,19 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(ALTERA_SOCFPGA_CLK_INIT, "altr,socfpga-a10-clk-init") }; +static const char *const fdt_src_name[] = { + [FDTSRC_SEPARATE ] ="separate" , + [FDTSRC_FIT ] ="fit" , + [FDTSRC_BOARD ] ="board" , + [FDTSRC_EMBED ] ="embed" , + [FDTSRC_ENV ] ="env" , +}; + +const char *fdtdec_get_srcname (void ) +{ +return fdt_src_name[gd->fdt_src]; +} +const char *fdtdec_get_compatible (enum fdt_compat_id id) {/* We allow reading of the 'unknown' ID for testing purposes */
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 28/32 fdt: Add a Kconfig for boards with a prior stage
In reply to Simon GlassWhen U-Boot is started from another firmware program, not just a prior phase of U-Boot, special behaviour is typically used. In particular, the device tree may come from that prior stage.
At present this is sort-of indicated by OF_BOARD, although the correlation is not 1:1, since that option simply means that the board has a custom mechanism for obtaining the device tree. For example, sandbox defines OF_BOARD. Also the board_fdt_blob_setup() function can in fact make use of the devicetree in U-Boot if it wishes, as used by dragonboard410c until very recently.
Add an explicit Kconfig for this situation. Update the OF_BOARD option to more-accurately reflect what it is doing, e.g. for sandbox.
Drop the docs in the README as it is out of date.
---
Changes in v8:
- Drop the devicetree docs in the README
- Move board-config changes to a separate patch
Changes in v7:
- Add new patch to add a Kconfig for boards with a prior stage
README | 29 ----------------------------- dts/Kconfig | 33 ++++++++++++++++++++++++++++----- lib/fdtdec.c | 1 + 3 files changed, 29 insertions(+), 34 deletions(-)
README +0 -29
@@ -646,35 +646,6 @@ The following options need to be configured: which adds regex support to some commands, as for example "env grep" and "setexpr". -- Device tree: - CONFIG_OF_CONTROL - If this variable is defined, U-Boot will use a device tree - to configure its devices, instead of relying on statically - compiled #defines in the board file. This option is - experimental and only available on a few boards. The device - tree is available in the global data as gd->fdt_blob. - - U-Boot needs to get its device tree from somewhere. This can - be done using one of the three options below: - - CONFIG_OF_SEPARATE - If this variable is defined, U-Boot will build a device tree - binary. It will be called u-boot.dtb. Architecture-specific - code will locate it at run-time. Generally this works by: - - cat u-boot.bin u-boot.dtb >image.bin - - and in fact, U-Boot does this for you, creating a file called - u-boot-dtb.bin which is useful in the common case. You can - still use the individual files if you need something more - exotic. - - CONFIG_OF_BOARD - If this variable is defined, U-Boot will use the device tree - provided by the board at runtime instead of embedding one with - the image. Only boards defining board_fdt_blob_setup() support - this option (see include/fdtdec.h file). - - Watchdog: CONFIG_WATCHDOG If this variable is defined, it enables watchdog
dts/Kconfig +28 -5
@@ -98,13 +98,36 @@ endchoice config OF_BOARD bool "Provided by the board (e.g a previous loader) at runtime" - default y if SANDBOX + default y if SANDBOX || OF_HAS_PRIOR_STAGE help - If this option is enabled, the device tree will be provided by - the board at runtime if the board supports it. The device tree bundled - with the image (if any) will be overridden / ignored. + If this option is enabled, the device tree is provided at runtime by + a custom function called board_fdt_blob_setup(). The board must + implement this function if it wishes to provide special behaviour. - A device tree file must be provided in the tree. + With this option, the device tree build by U-Boot may be overridden or + ignored. See OF_HAS_PRIOR_STAGE. + + Note: Boards which use this to handle a device tree passed from an + earlier stage should enable OF_HAS_PRIOR_STAGE. + +config OF_HAS_PRIOR_STAGE + bool + help + Indicates that a prior stage of the firmware (before U-Boot proper) + makes use of device tree and this board normally boots with that prior + stage, that provides a devicetree to U-Boot. + + This means that the device tree built in U-Boot should not be packaged + in the firmware image. Instead, the prior stage's device tree should + be so packaged. At runtime, the prior stage reads this, does any + necessary fix-ups, then passes it to U-Boot. See OF_BOARD. + + This option does not preclude using the U-Boot device tree, e.g. for + development purposes, but it is not recommended, and likely will not + even work, for production systems. + + Note: This option must be set in Kconfig and cannot be enabled or + disabled in the board's defconfig file. config DEFAULT_DEVICE_TREE string "Default Device Tree for DT control"
lib/fdtdec.c +1 -0
@@ -1595,6 +1595,7 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name,return 0 ; } +/* TODO([email protected]): This function should not be weak */ __weak int fdtdec_board_setup (const void *fdt_blob) {return 0 ;
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 29/32 fdt: Enable OF_HAS_PRIOR_STAGE for most boards with OF_BOARD
In reply to Simon GlassUse this new Kconfig instead of OF_BOARD, so we know for sure which boards obtain their devicetree from a prior stage. Leave sandbox alone since it does not. Also don't touch xilinx_versal_virt since it does not have a specific TARGET Kconfig.
This option implies OF_BOARD for now, but with future work standard passage may be used instead.
---
Changes in v8:
- Move board-config changes to a separate patch
arch/arm/Kconfig | 12 +++++++++--- arch/arm/mach-bcm283x/Kconfig | 1 + arch/powerpc/cpu/mpc85xx/Kconfig | 1 + board/emulation/qemu-riscv/Kconfig | 1 + configs/ae350_rv32_defconfig | 1 - configs/ae350_rv32_spl_defconfig | 1 - configs/ae350_rv32_spl_xip_defconfig | 1 - configs/ae350_rv64_defconfig | 1 - configs/ae350_rv64_spl_defconfig | 1 - configs/ae350_rv64_spl_xip_defconfig | 1 - configs/bcm7260_defconfig | 1 - configs/bcm7445_defconfig | 1 - configs/highbank_defconfig | 1 - configs/octeontx2_95xx_defconfig | 1 - configs/octeontx2_96xx_defconfig | 1 - configs/octeontx_81xx_defconfig | 1 - configs/octeontx_83xx_defconfig | 1 - configs/qemu-ppce500_defconfig | 1 - configs/qemu-riscv32_defconfig | 1 - configs/qemu-riscv32_smode_defconfig | 1 - configs/qemu-riscv32_spl_defconfig | 1 - configs/qemu-riscv64_defconfig | 1 - configs/qemu-riscv64_smode_defconfig | 1 - configs/qemu-riscv64_spl_defconfig | 1 - 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 - 31 files changed, 12 insertions(+), 30 deletions(-)
arch/arm/Kconfig +9 -3
@@ -635,6 +635,7 @@ config ARCH_BCMSTB select GPIO_EXTRA_HEADER select OF_CONTROL imply CMD_DM + imply OF_HAS_PRIOR_STAGE help This enables support for Broadcom ARM-based set-top box chipsets, including the 7445 family of chips.
@@ -707,12 +708,12 @@ config ARCH_HIGHBANK select DM select DM_SERIAL select OF_CONTROL - select OF_BOARD select CLK select CLK_CCF select AHCI select DM_ETH select PHYS_64BIT + imply OF_HAS_PRIOR_STAGE config ARCH_INTEGRATOR bool "ARM Ltd. Integrator family"
@@ -935,13 +936,13 @@ config ARCH_APPLE select IOMMU select LINUX_KERNEL_IMAGE_HEADER select OF_CONTROL - select OF_BOARD select PINCTRL select POSITION_INDEPENDENT select USB imply CMD_DM imply CMD_GPT imply DISTRO_DEFAULTS + imply OF_HAS_PRIOR_STAGE config ARCH_OWL bool "Actions Semi OWL SoCs"
@@ -966,6 +967,7 @@ config ARCH_QEMU imply DM_RNG imply DM_RTC imply RTC_PL031 + imply OF_HAS_PRIOR_STAGE config ARCH_RMOBILE bool "Renesas ARM SoCs"
@@ -1243,7 +1245,6 @@ config TARGET_VEXPRESS64_JUNO select PL01X_SERIAL select DM select OF_CONTROL - select OF_BOARD select CLK select DM_SERIAL select ARM_PSCI_FW
@@ -1251,6 +1252,7 @@ config TARGET_VEXPRESS64_JUNO select DM_ETH select BLK select USB + imply OF_HAS_PRIOR_STAGE config TARGET_TOTAL_COMPUTE bool "Support Total Compute Platform"
@@ -1907,6 +1909,7 @@ config ARCH_OCTEONTX select OF_LIVE select BOARD_LATE_INIT select SYS_CACHE_SHIFT_7 + imply OF_HAS_PRIOR_STAGE config ARCH_OCTEONTX2 bool "Support OcteonTX2 SoCs"
@@ -1918,6 +1921,7 @@ config ARCH_OCTEONTX2 select OF_LIVE select BOARD_LATE_INIT select SYS_CACHE_SHIFT_7 + imply OF_HAS_PRIOR_STAGE config TARGET_THUNDERX_88XX bool "Support ThunderX 88xx"
@@ -1954,6 +1958,8 @@ config TARGET_XENGUEST_ARM64 select LINUX_KERNEL_IMAGE_HEADER select XEN_SERIAL select SSCANF + imply OF_HAS_PRIOR_STAGE + endchoice config SUPPORT_PASSING_ATAGS
arch/arm/mach-bcm283x/Kconfig +1 -0
@@ -188,6 +188,7 @@ config TARGET_RPI_4 This option creates a build targeting the ARMv8/AArch64 ISA. select BCM2711_64B + imply OF_HAS_PRIOR_STAGE config TARGET_RPI_ARM64 bool "Raspberry Pi one binary 64-bit build"
arch/powerpc/cpu/mpc85xx/Kconfig +1 -0
@@ -109,6 +109,7 @@ config TARGET_QEMU_PPCE500 bool "Support qemu-ppce500" select ARCH_QEMU_E500 select PHYS_64BIT + imply OF_HAS_PRIOR_STAGE config TARGET_T1024RDB bool "Support T1024RDB"
board/emulation/qemu-riscv/Kconfig +1 -0
@@ -65,5 +65,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIRTIO_BLK imply MTD_NOR_FLASH imply CFI_FLASH + imply OF_HAS_PRIOR_STAGE endif
configs/ae350_rv32_defconfig +0 -1
@@ -17,7 +17,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
configs/ae350_rv32_spl_defconfig +0 -1
@@ -21,7 +21,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_BOOTP_SEND_HOSTNAME=y
configs/ae350_rv32_spl_xip_defconfig +0 -1
@@ -23,7 +23,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_BOOTP_SEND_HOSTNAME=y
configs/ae350_rv64_defconfig +0 -1
@@ -18,7 +18,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
configs/ae350_rv64_spl_defconfig +0 -1
@@ -22,7 +22,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_BOOTP_SEND_HOSTNAME=y
configs/ae350_rv64_spl_xip_defconfig +0 -1
@@ -24,7 +24,6 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_BOOTP_SEND_HOSTNAME=y
configs/bcm7260_defconfig +0 -1
@@ -27,7 +27,6 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_FS_GENERIC=y CONFIG_DOS_PARTITION=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
configs/bcm7445_defconfig +0 -1
@@ -28,7 +28,6 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_FS_GENERIC=y CONFIG_DOS_PARTITION=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
configs/highbank_defconfig +0 -1
@@ -22,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
configs/octeontx2_95xx_defconfig +0 -1
@@ -64,7 +64,6 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_BUS=y
configs/octeontx2_96xx_defconfig +0 -1
@@ -65,7 +65,6 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_BUS=y
configs/octeontx_81xx_defconfig +0 -1
@@ -66,7 +66,6 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_BUS=y
configs/octeontx_83xx_defconfig +0 -1
@@ -63,7 +63,6 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_USE_ENV_SPI_BUS=y
configs/qemu-ppce500_defconfig +0 -1
@@ -27,7 +27,6 @@ CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_DOS_PARTITION=y CONFIG_OF_CONTROL=y -CONFIG_OF_BOARD=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y
configs/qemu-riscv32_defconfig +0 -1
@@ -12,6 +12,5 @@ CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y
configs/qemu-riscv32_smode_defconfig +0 -1
@@ -13,7 +13,6 @@ CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y
configs/qemu-riscv32_spl_defconfig +0 -1
@@ -15,7 +15,6 @@ CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_SBI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y
configs/qemu-riscv64_defconfig +0 -1
@@ -13,6 +13,5 @@ CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y
configs/qemu-riscv64_smode_defconfig +0 -1
@@ -16,7 +16,6 @@ CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_NVEDIT_EFI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y
configs/qemu-riscv64_spl_defconfig +0 -1
@@ -15,7 +15,6 @@ CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_CMD_SBI=y # CONFIG_CMD_MII is not set -CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y
configs/qemu_arm64_defconfig +0 -1
@@ -28,7 +28,6 @@ CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_MTDPARTS=y -CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x4000000 CONFIG_SCSI_AHCI=y
configs/qemu_arm_defconfig +0 -1
@@ -30,7 +30,6 @@ CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_MTDPARTS=y -CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x4000000 CONFIG_SCSI_AHCI=y
configs/rpi_4_32b_defconfig +0 -1
@@ -21,7 +21,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_FS_UUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_4_defconfig +0 -1
@@ -21,7 +21,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_FS_UUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_arm64_defconfig +0 -1
@@ -20,7 +20,6 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_FS_UUID=y -CONFIG_OF_BOARD=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_TFTP_TSIZE=y
configs/vexpress_aemv8a_juno_defconfig +0 -1
@@ -33,7 +33,6 @@ CONFIG_CMD_USB=y CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_CMD_UBI=y -CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0xBFC0000 CONFIG_SATA_SIL=y
configs/xenguest_arm64_defconfig +0 -1
@@ -33,7 +33,6 @@ CONFIG_CMD_PVBLOCK=y # CONFIG_CMD_SLEEP is not set CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y -CONFIG_OF_BOARD=y CONFIG_DM=y # CONFIG_MMC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 30/32 fdt: Makefile: Ensure that OF_BOARD is used when needed
In reply to Simon GlassBoards which define OF_HAS_PRIOR_STAGE must define OF_BOARD at present, since a custom function is the only way to obtain the devicetree at runtime.
Add a build error when this requirement is not met, to avoid accepting any patches which break this requirement.
Add a whitelist for boards which use it, currently none. This whitelist can be updated for local development, if needed.
---
Changes in v8:
- Add new patch to ensure that OF_BOARD is used when needed
Makefile | 7 +++++++ scripts/check-of.sh | 42 ++++++++++++++++++++++++++++++++++++++++ scripts/of_whitelist.txt | 1 + 3 files changed, 50 insertions(+) create mode 100755 scripts/check-of.sh create mode 100644 scripts/of_whitelist.txt
Makefile +7 -0
@@ -1061,6 +1061,10 @@ quiet_cmd_cfgcheck = CFGCHK $2 cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \ $(srctree)/scripts/config_whitelist.txt $(srctree) +quiet_cmd_ofcheck = OFCHK $2 +cmd_ofcheck = $(srctree)/scripts/check-of.sh $2 \ + $(srctree)/scripts/of_whitelist.txt + # Concat the value of all the CONFIGs (result is 'y' or 'yy', etc. ) got = $(foreach cfg,$(1),$($(cfg)))
@@ -1139,6 +1143,9 @@ endif @# know about unless they are in Kconfig. All the existing CONFIG @# options are whitelisted, so new ones should not be added. $(call cmd,cfgcheck,u-boot.cfg) + @# Check that this build does not override OF_HAS_PRIOR_STAGE by + @# disabling OF_BOARD. + $(call cmd,ofcheck,$(KCONFIG_CONFIG)) PHONY += dtbs dtbs: dts/dt.dtb
scripts/check-of.sh new file +42 -0
42 lines not on this page · raw message
scripts/of_whitelist.txt new file +1 -0
@@ -0,0 +1 @@ +# List of boards which are permitted to use OF_HAS_PRIOR_STAGE without OF_BOARD
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
Re: [PATCH v8 30/32] fdt: Makefile: Ensure that OF_BOARD is used when needed
Quoted 7 lines · Simon Glass
Boards which define
OF_HAS_PRIOR_STAGEmust defineOF_BOARDat present, since a custom function is the only way to obtain the devicetree at runtime.Add a build error when this requirement is not met, to avoid accepting any patches which break this requirement.
Quoted 6 lines
Add an allowlist for boards which use it, currently none. This allowlist can be updated for local development, if needed.
Signed-off-by Simon Glass <[email protected]>[trini: change of_whitelist to of_allowlist]Signed-off-by Tom Rini <[email protected]>
(My changes for the email record, the rest of the series was taken as-is)
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v8 31/32 fdt: Avoid emitting an device tree when not needed
In reply to Simon GlassU-Boot always needs some sort of a device tree in the build. Some boards never actually use this, at least in production systems, since a prior firmware stage sets one up and passes it to U-Boot. At present the only mechanism to do that is with custom function (OF_BOARD), but future work will include a standard way of doing this ('standard passage').
It can be confusing to see a device tree emitted from the U-Boot build in this situation. Add an option to drop it.
---
Changes in v8:
- Fix devicetree logic so that just u-boot.dtb is omitted
Makefile | 6 ++++-- dts/Kconfig | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
Makefile +4 -2
@@ -952,7 +952,9 @@ INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img endif endif INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin -INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb + +# Allow omitting the .dtb output if it is not normally used +INPUTS-$(CONFIG_OF_SEPARATE) += $(if $(CONFIG_OF_OMIT_DTB),dts/dt.dtb,u-boot.dtb) ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif
@@ -1199,7 +1201,7 @@ u-boot.bin: u-boot-fit-dtb.bin FORCE u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat) -else ifeq ($(CONFIG_OF_SEPARATE),y) +else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.) u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat)
dts/Kconfig +10 -0
@@ -129,6 +129,16 @@ config OF_HAS_PRIOR_STAGE Note: This option must be set in Kconfig and cannot be enabled or disabled in the board's defconfig file. +config OF_OMIT_DTB + bool "Omit the device tree output when building" + default y if OF_HAS_PRIOR_STAGE && !BINMAN + help + As a special case, avoid writing a device tree file u-boot.dtb when + building. Also don't include that file in u-boot.bin + + This is used for boards which normally provide a devicetree via a + runtime mechanism (such as OF_BOARD), to avoid confusion. + config DEFAULT_DEVICE_TREE string "Default Device Tree for DT control" depends on OF_CONTROL
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog
PATCH v8 32/32 fdt: Show a runtime warning based on devicetree source
In reply to Simon GlassWhen running, if the devicetree failed to come from the expected source, show a warning, e.g:
U-Boot ...
DRAM: 128 MiB
Core: 42 devices, 11 uclasses, devicetree: separate
Warning: Unexpected devicetree source (not from a prior stage)
Warning: U-Boot may not function properly
Flash: 64 MiB
...
These warnings should only appear if the board config has been changed, or the prior stage is broken.
---
Changes in v8:
- Drop documentation patches
- Drop the build-time warning, since people may ignore it
common/board_r.c | 6 ++++++ 1 file changed, 6 insertions(+)
common/board_r.c +6 -0
@@ -598,6 +598,12 @@ static int dm_announce(void)if (CONFIG_IS_ENABLED (OF_REAL ))printf (", devicetree: %s" ,fdtdec_get_srcname ());printf ("\n" ); +if (IS_ENABLED (CONFIG_OF_HAS_PRIOR_STAGE ) && + (gd->fdt_src ==FDTSRC_SEPARATE || + gd->fdt_src ==FDTSRC_EMBED )) { +printf ("Warning: Unexpected devicetree source (not from a prior stage)" ); +printf ("Warning: U-Boot may not function properly\n" ); + } }return 0 ;
Signature · 1 line
2.34.1.173.g76aa8bc2d0-goog