OF_HOSTFILE is used on sandbox configs only. Although it's pretty
unique and not causing any confusions, we are better of having simpler
config options for the DTB.
So let's replace that with the existing OF_BOARD. U-Boot would then
have only three config options for the DTB origin.
- OF_SEPARATE, build separately from U-Boot
- OF_BOARD, board specific way of providing the DTB
- OF_EMBED embedded in the u-boot binary(should not be used in production
Signed-off-by: Ilias Apalodimas
---
Note that this must be applied on top of
https://lore.kernel.org/u-boot/20210930071800.443059-1-ilias.apalodi...@linaro.org/
Changes since v1:
- Added internal error value on board_fdt_blob_setup(). Arguably
we can just check against NULL and simplify this even more if we
don't care about the errno
- OF_BOARD is now default for sandbox builds
Makefile| 6 ++---
arch/arm/mach-stm32mp/boot_params.c | 3 ++-
arch/sandbox/cpu/cpu.c | 27 +
arch/sandbox/include/asm/u-boot-sandbox.h | 8 --
board/AndesTech/ax25-ae350/ax25-ae350.c | 4 ++-
board/Marvell/octeontx/board-fdt.c | 3 ++-
board/Marvell/octeontx2/board-fdt.c | 3 ++-
board/Marvell/octeontx2/board.c | 3 ++-
board/armltd/vexpress64/vexpress64.c| 7 --
board/broadcom/bcmstb/bcmstb.c | 3 ++-
board/emulation/qemu-arm/qemu-arm.c | 3 ++-
board/emulation/qemu-ppce500/qemu-ppce500.c | 3 ++-
board/emulation/qemu-riscv/qemu-riscv.c | 3 ++-
board/highbank/highbank.c | 3 ++-
board/raspberrypi/rpi/rpi.c | 8 --
board/sifive/unleashed/unleashed.c | 3 ++-
board/sifive/unmatched/unmatched.c | 3 ++-
board/socrates/socrates.c | 4 ++-
board/xen/xenguest_arm64/xenguest_arm64.c | 7 --
board/xilinx/common/board.c | 3 ++-
configs/sandbox64_defconfig | 1 -
configs/sandbox_defconfig | 1 -
configs/sandbox_flattree_defconfig | 1 -
configs/sandbox_noinst_defconfig| 1 -
configs/sandbox_spl_defconfig | 1 -
configs/tools-only_defconfig| 1 -
doc/develop/devicetree/control.rst | 7 +++---
dts/Kconfig | 10 +---
include/fdtdec.h| 4 ++-
lib/fdtdec.c| 14 +--
scripts/Makefile.spl| 4 +--
31 files changed, 82 insertions(+), 70 deletions(-)
diff --git a/Makefile b/Makefile
index 3014788e14e8..cf3d98d00a62 100644
--- a/Makefile
+++ b/Makefile
@@ -957,7 +957,7 @@ INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb
ifeq ($(CONFIG_SPL_FRAMEWORK),y)
INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
endif
-INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
+INPUTS-$(CONFIG_SANDBOX) += u-boot.dtb
ifneq ($(CONFIG_SPL_TARGET),)
INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
endif
@@ -1423,7 +1423,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_OF_HOSTFILE)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb)
\
+ $(if
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb)
\
,$(UBOOT_BIN)) FORCE
$(call if_changed,mkimage)
$(BOARD_SIZE_CHECK)
@@ -1437,7 +1437,7 @@ MKIMAGEFLAGS_u-boot.itb += -B 0x8
ifdef U_BOOT_ITS
u-boot.itb: u-boot-nodtb.bin \
- $(if
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \
+ $(if
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \
$(U_BOOT_ITS) FORCE
$(call if_changed,mkfitimage)
$(BOARD_SIZE_CHECK)
diff --git a/arch/arm/mach-stm32mp/boot_params.c
b/arch/arm/mach-stm32mp/boot_params.c
index 84647e70398b..e91ef1b2fc70 100644
--- a/arch/arm/mach-stm32mp/boot_params.c
+++ b/arch/arm/mach-stm32mp/boot_params.c
@@ -33,10 +33,11 @@ void save_boot_params(unsigned long r0, unsigned long r1,
unsigned long r2,
* Use the saved FDT address provided by TF-A at boot time (NT_FW_CONFIG =
* Non Trusted Firmware configuration file) when the pointer is valid
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
log_debug("%s: nt_fw_dtb=%lx\n", __func__, nt_fw_dtb);
+ *err = 0;
/* use external device tree only if address is valid */
if (nt_fw_dtb >= STM32_DDR_BASE) {
if (fdt_magic(nt_fw_dtb) == FDT_MAGIC)
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 48636ab63919..9887d09272a3 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -291,44 +291,51 @@ void