Merge branch '2023-03-02-kconfig-and-CONFIG-cleanups' into next

- Partial merge of a series of mine to select some framework options
  that shouldn't be prompted for (and remove some unused code related to
  that), and a partial merge of a series from Simon to remove some dead
  code and address various CONFIG_IS_ENABLED/IS_ENABLED issues in code.
diff --git a/Makefile b/Makefile
index 700be23..e575061 100644
--- a/Makefile
+++ b/Makefile
@@ -957,7 +957,6 @@
 # Always append INPUTS so that arch config.mk's can add custom ones
 INPUTS-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
 
-INPUTS-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
 ifeq ($(CONFIG_SPL_FSL_PBL),y)
 INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin
 else
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bd7fffc..c51f15f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -588,6 +588,7 @@
 
 config ARCH_MVEBU
 	bool "Marvell MVEBU family (Armada XP/375/38x/3700/7K/8K)"
+	select ARCH_EARLY_INIT_R if ARM64
 	select DM
 	select DM_SERIAL
 	select DM_SPI
@@ -1208,6 +1209,7 @@
 config ARCH_ZYNQ
 	bool "Xilinx Zynq based platform"
 	select ARM_TWD_TIMER
+	select ARCH_EARLY_INIT_R if FPGA || (SPL && SPL_FPGA)
 	select CLK
 	select CLK_ZYNQ
 	select CPU_V7A
@@ -1229,7 +1231,6 @@
 	select SPL_TIMER if SPL
 	select SUPPORT_SPL
 	select TIMER
-	imply ARCH_EARLY_INIT_R
 	imply BOARD_LATE_INIT
 	imply CMD_CLK
 	imply CMD_DM
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c
index 599b7e1..a5c5c78 100644
--- a/arch/arm/cpu/armv7/ls102xa/fdt.c
+++ b/arch/arm/cpu/armv7/ls102xa/fdt.c
@@ -25,11 +25,7 @@
 
 void ft_fixup_enet_phy_connect_type(void *fdt)
 {
-#ifdef CONFIG_DM_ETH
 	struct udevice *dev;
-#else
-	struct eth_device *dev;
-#endif
 	struct tsec_private *priv;
 	const char *enet_path, *phy_path;
 	char enet[16];
@@ -37,12 +33,8 @@
 	int phy_node;
 	int i = 0;
 	uint32_t ph;
-#ifdef CONFIG_DM_ETH
 	char *name[3] = { "ethernet@2d10000", "ethernet@2d50000",
 			  "ethernet@2d90000" };
-#else
-	char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" };
-#endif
 
 	for (; i < ARRAY_SIZE(name); i++) {
 		dev = eth_get_dev_by_name(name[i]);
@@ -53,11 +45,7 @@
 			continue;
 		}
 
-#ifdef CONFIG_DM_ETH
 		priv = dev_get_priv(dev);
-#else
-		priv = dev->priv;
-#endif
 		if (priv->flags & TSEC_SGMII)
 			continue;
 
diff --git a/arch/arm/cpu/armv7/s5p4418/cpu.c b/arch/arm/cpu/armv7/s5p4418/cpu.c
index fcaafc0..8febfe5 100644
--- a/arch/arm/cpu/armv7/s5p4418/cpu.c
+++ b/arch/arm/cpu/armv7/s5p4418/cpu.c
@@ -84,10 +84,3 @@
 	/* Enable D-cache. I-cache is already enabled in start.S */
 	dcache_enable();
 }
-
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	return 0;
-}
-#endif	/* CONFIG_ARCH_MISC_INIT */
diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index 797d7a8..a16e22e 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -208,11 +208,6 @@
 	return 0;
 }
 
-int arch_misc_init(void)
-{
-	return 0;
-}
-
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
 	return 0;
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index cdb1776..fb3cff4 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -5,7 +5,6 @@
 
 config ARMADA_32BIT
 	bool
-	select ARCH_MISC_INIT
 	select BOARD_EARLY_INIT_F
 	select CPU_V7A
 	select SPL_DM if SPL
diff --git a/arch/arm/mach-mvebu/alleycat5/soc.c b/arch/arm/mach-mvebu/alleycat5/soc.c
index efbef23..dc69f46 100644
--- a/arch/arm/mach-mvebu/alleycat5/soc.c
+++ b/arch/arm/mach-mvebu/alleycat5/soc.c
@@ -287,12 +287,3 @@
 
 	return 0;
 }
-
-int arch_misc_init(void)
-{
-	u32 type, rev;
-
-	get_soc_type_rev(&type, &rev);
-
-	return 0;
-}
diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index bbe167e..56999f6 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -523,17 +523,6 @@
 		  NAND_ECC_DIVCKL_RATIO_MASK) >> NAND_ECC_DIVCKL_RATIO_OFFS);
 }
 
-/*
- * SOC specific misc init
- */
-#if defined(CONFIG_ARCH_MISC_INIT)
-int arch_misc_init(void)
-{
-	/* Nothing yet, perhaps we need something here later */
-	return 0;
-}
-#endif /* CONFIG_ARCH_MISC_INIT */
-
 #if defined(CONFIG_MMC_SDHCI_MV) && !defined(CONFIG_DM_MMC)
 int board_mmc_init(struct bd_info *bis)
 {
diff --git a/arch/arm/mach-rockchip/rk3368/Kconfig b/arch/arm/mach-rockchip/rk3368/Kconfig
index c3249a7..3de6951 100644
--- a/arch/arm/mach-rockchip/rk3368/Kconfig
+++ b/arch/arm/mach-rockchip/rk3368/Kconfig
@@ -5,6 +5,7 @@
 
 config TARGET_LION_RK3368
         bool "Theobroma Systems RK3368-uQ7 (Lion) module"
+	select ARCH_EARLY_INIT_R
 	help
 	  The RK3368-uQ7 is a micro-Qseven form-factor (40mm x 70mm,
 	  MXM-230 connector) system-on-module designed by Theobroma
@@ -34,6 +35,7 @@
 
 config TARGET_EVB_PX5
         bool "Evb-PX5"
+	select ARCH_EARLY_INIT_R
         help
 	 PX5 EVB is designed by Rockchip for automotive field
          with integrated CVBS (TP2825) / MIPI DSI / CSI / LVDS
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index a4c1b8f..12d3eff 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -76,7 +76,7 @@
 		clock-frequency = <400000>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_i2c0>;
-		bootph-all;
+		bootph-pre-ram;
 	};
 
 	pcic: pci@0 {
@@ -103,6 +103,6 @@
 #include "cros-ec-keyboard.dtsi"
 #include "sandbox_pmic.dtsi"
 
-#ifdef CONFIG_SANDBOX_VPL
+#if IS_ENABLED(CONFIG_SUPPORT_VPL)
 #include "sandbox_vpl.dtsi"
 #endif
diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index 1f446e6..30a305c 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -115,7 +115,7 @@
 			reg = <0x43>;
 			compatible = "sandbox-rtc";
 			sandbox,emul = <&emul0>;
-			bootph-all;
+			bootph-pre-ram;
 		};
 		sandbox_pmic: sandbox_pmic {
 			reg = <0x40>;
@@ -126,7 +126,7 @@
 		};
 
 		i2c_emul: emul {
-			bootph-all;
+			bootph-pre-ram;
 			reg = <0xff>;
 			compatible = "sandbox,i2c-emul-parent";
 			emul_eeprom: emul-eeprom {
@@ -136,7 +136,7 @@
 				#emul-cells = <0>;
 			};
 			emul0: emul0 {
-				bootph-all;
+				bootph-pre-ram;
 				compatible = "sandbox,i2c-rtc-emul";
 				#emul-cells = <0>;
 			};
diff --git a/arch/sandbox/dts/sandbox_vpl.dtsi b/arch/sandbox/dts/sandbox_vpl.dtsi
index 1fba537..c7dc00a 100644
--- a/arch/sandbox/dts/sandbox_vpl.dtsi
+++ b/arch/sandbox/dts/sandbox_vpl.dtsi
@@ -17,8 +17,8 @@
 		 * provide plenty of space for ELF files with debug info so that
 		 * gdb can be used
 		 */
-		offset = <0x400000>;
-		size = <0xdffc00>;
+		offset = <0x800000>;
+		size = <0x2000000>;
 
 		fit {
 			fit,external-offset = <0>;
diff --git a/arch/sandbox/include/asm/rtc.h b/arch/sandbox/include/asm/rtc.h
index 025cd6c..bf3ac5e 100644
--- a/arch/sandbox/include/asm/rtc.h
+++ b/arch/sandbox/include/asm/rtc.h
@@ -40,7 +40,7 @@
  * @reg:		Register values
  */
 struct sandbox_i2c_rtc_plat_data {
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX)
 	struct dtd_sandbox_i2c_rtc_emul dtplat;
 #endif
 	long base_time;
diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c
index c4d86c2..e6fa7eb 100644
--- a/board/gateworks/venice/venice.c
+++ b/board/gateworks/venice/venice.c
@@ -41,8 +41,7 @@
 	return -1;
 }
 
-#if (IS_ENABLED(CONFIG_NET))
-static int setup_fec(void)
+static int __maybe_unused setup_fec(void)
 {
 	struct iomuxc_gpr_base_regs *gpr =
 		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
@@ -58,7 +57,7 @@
 	return 0;
 }
 
-static int setup_eqos(void)
+static int __maybe_unused setup_eqos(void)
 {
 	struct iomuxc_gpr_base_regs *gpr =
 		(struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR;
@@ -71,6 +70,7 @@
 	return set_clk_eqos(ENET_125MHZ);
 }
 
+#if (IS_ENABLED(CONFIG_NET))
 int board_phy_config(struct phy_device *phydev)
 {
 	unsigned short val;
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 8c282f9..991022a 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -78,7 +78,7 @@
 	return 0;
 }
 
-#if CONFIG_IS_ENABLED(PG_WCOM_UBOOT_UPDATE_SUPPORTED)
+#if IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED)
 #if   ((!IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \
 	!IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE)) ||     \
 	(IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 7c44379..cb14c2f 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -275,7 +275,7 @@
 {
 	setup_iomux_uart();
 
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_SATA
 	setup_sata();
 #endif
 	setup_fec();
diff --git a/boot/Kconfig b/boot/Kconfig
index 5f49162..d646369 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -385,7 +385,7 @@
 	    as well as the "boot_targets" environment variable
 
 config SPL_BOOTSTD
-	bool "Standard boot support in VPL"
+	bool "Standard boot support in SPL"
 	depends on SPL && SPL_DM && SPL_OF_CONTROL && SPL_BLK
 	default y if VPL
 	help
@@ -528,6 +528,26 @@
 
 if BOOTMETH_VBE
 
+config BOOTMETH_VBE_REQUEST
+	bool "Support for serving VBE OS requests"
+	default y
+	help
+	  Enables support for looking that the requests made by the
+	  Operating System being booted. These requests result in additions to
+	  the device tree /chosen node, added during the device tree fixup
+	  phase.
+
+config SPL_BOOTMETH_VBE_REQUEST
+	bool "Support for serving VBE OS requests (SPL)"
+	depends on SPL
+	help
+	  Enables support for looking that the requests made by the
+	  Operating System being booted. These requests result in additions to
+	  the device tree /chosen node, added during the device tree fixup
+	  phase.
+
+	  This is only useful if you are booting an OS direct from SPL.
+
 config BOOTMETH_VBE_SIMPLE
 	bool "Bootdev support for VBE 'simple' method"
 	default y
diff --git a/boot/Makefile b/boot/Makefile
index 5424b6f..88193a1 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -11,6 +11,7 @@
 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
 obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
+obj-$(CONFIG_QFW) += bootmeth_qfw.o
 
 endif
 
@@ -26,7 +27,6 @@
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o
-obj-$(CONFIG_$(SPL_TPL_)QFW) += bootmeth_qfw.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
 ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL
@@ -52,7 +52,8 @@
 
 obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo.o scene.o scene_menu.o
 
-obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o vbe_request.o
+obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o
+obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_REQUEST) += vbe_request.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_OS) += vbe_simple_os.o
diff --git a/boot/vbe_request.c b/boot/vbe_request.c
index 45f1d2b..312edfa 100644
--- a/boot/vbe_request.c
+++ b/boot/vbe_request.c
@@ -36,7 +36,7 @@
 	u32 size;
 	int ret;
 
-	if (!CONFIG_IS_ENABLED(DM_RNG))
+	if (!IS_ENABLED(CONFIG_DM_RNG))
 		return -ENOTSUPP;
 
 	if (ofnode_read_u32(node, "vbe,size", &size)) {
diff --git a/common/Kconfig b/common/Kconfig
index e3a5e1b..5c66fd9 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -551,12 +551,11 @@
 menu "Init options"
 
 config BOARD_TYPES
-	bool "Call get_board_type() to get and display the board type"
+	bool "Enable board_type entry in global data struct"
 	help
-	  If this option is enabled, checkboard() will call get_board_type()
-	  to get a string containing the board type and this will be
-	  displayed immediately after the model is shown on the console
-	  early in boot.
+	  If this option is enabled, a field will be added to the global
+	  data struct to store an unsigned long value for the type of
+	  platform that we have determined we are on, at run-time.
 
 config DISPLAY_CPUINFO
 	bool "Display information about the CPU during start up"
@@ -631,10 +630,30 @@
 	  events, such as event-type names. This adds to the code size of
 	  U-Boot so can be turned off for production builds.
 
+config SPL_EVENT
+	bool  # General-purpose event-handling mechanism in SPL
+	depends on SPL
+	help
+	  This adds a framework for general purpose sending and processing of
+	  events, to allow interested parties to be alerted when something
+	  happens. This is an attempt to stem the flow of weak functions,
+	  hooks, functions in board_f.c and board_r.c and the Kconfig options
+	  below.
+
+	  See doc/develop/event.rst for more information.
+
+config SPL_EVENT_DYNAMIC
+	bool
+	depends on SPL_EVENT && EVENT_DYNAMIC
+	help
+	  Enable this to support adding an event spy at runtime, without adding
+	  it to the EVENT_SPY() linker list. This increases code size slightly
+	  but provides more flexibility for boards and subsystems that need it.
+
 endif # EVENT
 
 config ARCH_EARLY_INIT_R
-	bool "Call arch-specific init soon after relocation"
+	bool
 	help
 	  With this option U-Boot will call arch_early_init_r() soon after
 	  relocation. Driver model is running by this point, and the cache
@@ -1043,7 +1062,7 @@
 	prompt "Bloblist location in TPL"
 	help
 	  Select the location of the bloblist, via various means. Typically
-	  you should use the same value for SPL as for U-Boot, since they need
+	  you should use the same value for TPL as for U-Boot, since they need
 	  to look in the same place. But if BLOBLIST_ALLOC is used, then a
 	  fresh bloblist will be created each time, since there is no shared
 	  address (between phases) for the bloblist.
@@ -1066,6 +1085,35 @@
 
 endif # TPL_BLOBLIST
 
+if VPL_BLOBLIST
+
+choice
+	prompt "Bloblist location in VPL"
+	help
+	  Select the location of the bloblist, via various means. Typically
+	  you should use the same value for VPL as for U-Boot, since they need
+	  to look in the same place. But if BLOBLIST_ALLOC is used, then a
+	  fresh bloblist will be created each time, since there is no shared
+	  address (between phases) for the bloblist.
+
+config VPL_BLOBLIST_FIXED
+	bool "Place bloblist at a fixed address in memory"
+	help
+	  Select this to used a fixed memory address for the bloblist. If the
+	  bloblist exists at this address from a previous phase, it used as is.
+	  If not it is created at this address in VPL.
+
+config VPL_BLOBLIST_ALLOC
+	bool "Allocate bloblist"
+	help
+	  Allocate the bloblist using malloc(). This avoids the need to
+	  specify a fixed address on systems where this is unknown or can
+	  change at runtime.
+
+endchoice
+
+endif # VPL_BLOBLIST
+
 endmenu
 
 source "common/spl/Kconfig"
diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig
index 401506e..f5995f2 100644
--- a/configs/chromebook_coral_defconfig
+++ b/configs/chromebook_coral_defconfig
@@ -87,6 +87,7 @@
 CONFIG_USE_ROOTPATH=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+CONFIG_TPL_SIMPLE_BUS=y
 CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_LBA48=y
 CONFIG_SYS_64BIT_LBA=y
@@ -96,6 +97,8 @@
 CONFIG_MISC=y
 CONFIG_CROS_EC=y
 CONFIG_CROS_EC_LPC=y
+CONFIG_SPL_P2SB=y
+CONFIG_TPL_P2SB=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_X86_PCH7 is not set
 # CONFIG_X86_PCH9 is not set
diff --git a/configs/imx93_11x11_evk_defconfig b/configs/imx93_11x11_evk_defconfig
index 477fb25..93c478c 100644
--- a/configs/imx93_11x11_evk_defconfig
+++ b/configs/imx93_11x11_evk_defconfig
@@ -26,7 +26,6 @@
 CONFIG_REMAKE_ELF=y
 CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_DEFAULT_FDT_FILE="imx93-11x11-evk.dtb"
-CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x26000
diff --git a/configs/mvebu_ac5_rd_defconfig b/configs/mvebu_ac5_rd_defconfig
index 8e7d306..3b94767 100644
--- a/configs/mvebu_ac5_rd_defconfig
+++ b/configs/mvebu_ac5_rd_defconfig
@@ -22,7 +22,6 @@
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_ARCH_EARLY_INIT_R=y
-CONFIG_ARCH_MISC_INIT=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=10
 CONFIG_CMD_MEMTEST=y
diff --git a/configs/s5p4418_nanopi2_defconfig b/configs/s5p4418_nanopi2_defconfig
index 12688e1..5356161 100644
--- a/configs/s5p4418_nanopi2_defconfig
+++ b/configs/s5p4418_nanopi2_defconfig
@@ -29,7 +29,6 @@
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=1
-CONFIG_ARCH_MISC_INIT=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=1050
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig
index e418e4d..41dace8 100644
--- a/configs/wandboard_defconfig
+++ b/configs/wandboard_defconfig
@@ -70,6 +70,7 @@
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC=y
 CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_SCSI=y
 CONFIG_DM_SERIAL=y
diff --git a/disk/Kconfig b/disk/Kconfig
index c9b9dba..817b7c8 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -149,6 +149,7 @@
 	bool "Enable support of UUID for partition in SPL"
 	depends on SPL_PARTITIONS
 	default y if SPL_EFI_PARTITION
+	select SPL_LIB_UUID
 
 config PARTITION_TYPE_GUID
 	bool "Enable support of GUID for partition type"
@@ -157,4 +158,11 @@
 	  Activate the configuration of GUID type
 	  for EFI partition
 
+config SPL_PARTITION_TYPE_GUID
+	bool "Enable support of GUID for partition type (SPL)"
+	depends on SPL_EFI_PARTITION
+	help
+	  Activate the configuration of GUID type
+	  for EFI partition
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 15d19d0..58be410 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -18,7 +18,6 @@
 obj-$(CONFIG_$(SPL_TPL_)LED) += led/
 obj-$(CONFIG_$(SPL_TPL_)MMC) += mmc/
 obj-y += mtd/
-obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux/
 obj-$(CONFIG_$(SPL_TPL_)ETH) += net/
 obj-$(CONFIG_$(SPL_TPL_)PCH) += pch/
 obj-$(CONFIG_$(SPL_TPL_)PCI) += pci/
@@ -87,6 +86,7 @@
 obj-$(CONFIG_FWU_MDATA) += fwu-mdata/
 obj-y += misc/
 obj-$(CONFIG_MMC) += mmc/
+obj-$(CONFIG_MULTIPLEXER) += mux/
 obj-$(CONFIG_NVME) += nvme/
 obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/
 obj-y += dfu/
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 6fc8854..0f755aa 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -301,6 +301,13 @@
 	  Supports the 'simple-bus' driver, which is used on some systems
 	  in SPL.
 
+config TPL_SIMPLE_BUS
+	bool "Support simple-bus driver in TPL"
+	depends on TPL_DM && TPL_OF_CONTROL
+	help
+	  Supports the 'simple-bus' driver, which is used on some systems
+	  in TPL.
+
 config SIMPLE_BUS_CORRECT_RANGE
 	bool "Decode the 'simple-bus' <range> by honoring the #address-cells and #size-cells"
 	depends on SIMPLE_BUS
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 3279fef..1077c33 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -47,6 +47,16 @@
 	  device (bus child) info is kept as parent platdata. The interface
 	  is defined in include/i2c.h.
 
+config TPL_DM_I2C
+	bool "Enable Driver Model for I2C drivers in TPL"
+	depends on TPL_DM && DM_I2C
+	help
+	  Enable driver model for I2C. The I2C uclass interface: probe, read,
+	  write and speed, is implemented with the bus drivers operations,
+	  which provide methods for bus setting and data transfer. Each chip
+	  device (bus child) info is kept as parent platdata. The interface
+	  is defined in include/i2c.h.
+
 config VPL_DM_I2C
 	bool "Enable Driver Model for I2C drivers in VPL"
 	depends on VPL_DM && DM_I2C
@@ -508,6 +518,16 @@
 config SYS_I2C_SANDBOX
 	bool "Sandbox I2C driver"
 	depends on SANDBOX && DM_I2C
+	default y
+	help
+	  Enable I2C support for sandbox. This is an emulation of a real I2C
+	  bus. Devices can be attached to the bus using the device tree
+	  which specifies the driver to use.  See sandbox.dts as an example.
+
+config SPL_SYS_I2C_SANDBOX
+	bool "Sandbox I2C driver (SPL)"
+	depends on SPL && SANDBOX && DM_I2C
+	default y
 	help
 	  Enable I2C support for sandbox. This is an emulation of a real I2C
 	  bus. Devices can be attached to the bus using the device tree
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 14c0ea7..71f315a 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -14,5 +14,4 @@
 obj-$(CONFIG_I8042_KEYB) += i8042.o
 obj-$(CONFIG_TEGRA_KEYBOARD) += input.o tegra-kbc.o
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
-obj-$(CONFIG_TWL6030_INPUT) += twl6030.o
 endif
diff --git a/drivers/input/twl6030.c b/drivers/input/twl6030.c
deleted file mode 100644
index 76bd348..0000000
--- a/drivers/input/twl6030.c
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * TWL6030 input
- *
- * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
- */
-
-#include <twl6030.h>
-
-int twl6030_input_power_button(void)
-{
-	u8 value;
-
-	twl6030_i2c_read_u8(TWL6030_CHIP_PM, TWL6030_STS_HW_CONDITIONS, &value);
-
-	/* Power button is active low. */
-	if (value & TWL6030_STS_HW_CONDITIONS_PWRON)
-		return 0;
-
-	return 1;
-}
-
-int twl6030_input_charger(void)
-{
-	u8 value;
-
-	twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1,
-		&value);
-
-	if (value & TWL6030_CONTROLLER_STAT1_VAC_DET)
-		return 1;
-
-	return 0;
-}
-
-int twl6030_input_usb(void)
-{
-	u8 value;
-
-	twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1,
-		&value);
-
-	if (value & TWL6030_CONTROLLER_STAT1_VBUS_DET)
-		return 1;
-
-	return 0;
-}
diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index 666323e..add2b4c 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -56,7 +56,6 @@
 obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o
 obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
-obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o
 obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o
diff --git a/drivers/mtd/nand/raw/kb9202_nand.c b/drivers/mtd/nand/raw/kb9202_nand.c
deleted file mode 100644
index 9d26532..0000000
--- a/drivers/mtd/nand/raw/kb9202_nand.c
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2006
- * KwikByte <kb9200_dev@kwikbyte.com>
- *
- * (C) Copyright 2009
- * Matthias Kaehlcke <matthias@kaehlcke.net>
- */
-
-#include <common.h>
-#include <linux/mtd/rawnand.h>
-#include <asm/io.h>
-#include <asm/arch/AT91RM9200.h>
-#include <asm/arch/hardware.h>
-
-#include <nand.h>
-
-/*
- *      hardware specific access to control-lines
- */
-
-#define MASK_ALE        (1 << 22)       /* our ALE is A22 */
-#define MASK_CLE        (1 << 21)       /* our CLE is A21 */
-
-#define KB9202_NAND_NCE (1 << 28) /* EN* on D28 */
-#define KB9202_NAND_BUSY (1 << 29) /* RB* on D29 */
-
-#define KB9202_SMC2_NWS (1 << 2)
-#define KB9202_SMC2_TDF (1 << 8)
-#define KB9202_SMC2_RWSETUP (1 << 24)
-#define KB9202_SMC2_RWHOLD (1 << 29)
-
-/*
- *	Board-specific function to access device control signals
- */
-static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
-{
-	struct nand_chip *this = mtd_to_nand(mtd);
-
-	if (ctrl & NAND_CTRL_CHANGE) {
-		ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
-
-		/* clear ALE and CLE bits */
-		IO_ADDR_W &= ~(MASK_ALE | MASK_CLE);
-
-		if (ctrl & NAND_CLE)
-			IO_ADDR_W |= MASK_CLE;
-
-		if (ctrl & NAND_ALE)
-			IO_ADDR_W |= MASK_ALE;
-
-		this->IO_ADDR_W = (void *) IO_ADDR_W;
-
-		if (ctrl & NAND_NCE)
-			writel(KB9202_NAND_NCE, AT91C_PIOC_CODR);
-		else
-			writel(KB9202_NAND_NCE, AT91C_PIOC_SODR);
-	}
-
-	if (cmd != NAND_CMD_NONE)
-		writeb(cmd, this->IO_ADDR_W);
-}
-
-
-/*
- * Board-specific function to access the device ready signal.
- */
-static int kb9202_nand_ready(struct mtd_info *mtd)
-{
-	return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY;
-}
-
-
-/*
- * Board-specific NAND init.  Copied from include/linux/mtd/nand.h for reference.
- *
- * struct nand_chip - NAND Private Flash Chip Data
- * @IO_ADDR_R:		[BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
- * @IO_ADDR_W:		[BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
- * @hwcontrol:		[BOARDSPECIFIC] hardwarespecific function for accesing control-lines
- * @dev_ready:		[BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line
- *			If set to NULL no access to ready/busy is available and the ready/busy information
- *			is read from the chip status register
- * @enable_hwecc:	[BOARDSPECIFIC] function to enable (reset) hardware ecc generator. Must only
- *			be provided if a hardware ECC is available
- * @eccmode:		[BOARDSPECIFIC] mode of ecc, see defines
- * @chip_delay:		[BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
- * @options:		[BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
- *			special functionality. See the defines for further explanation
-*/
-/*
- * This routine initializes controller and GPIOs.
- */
-int board_nand_init(struct nand_chip *nand)
-{
-	unsigned int value;
-
-	nand->ecc.mode = NAND_ECC_SOFT;
-	nand->cmd_ctrl = kb9202_nand_hwcontrol;
-	nand->dev_ready = kb9202_nand_ready;
-
-	/* in case running outside of bootloader */
-	writel(1 << AT91C_ID_PIOC, AT91C_PMC_PCER);
-
-	/* setup nand flash access (allow ample margin) */
-	/* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
-	writel(AT91C_SMC2_WSEN | KB9202_SMC2_NWS | KB9202_SMC2_TDF |
-		AT91C_SMC2_DBW_8 | KB9202_SMC2_RWSETUP | KB9202_SMC2_RWHOLD,
-		AT91C_SMC_CSR3);
-
-	/* enable internal NAND controller */
-	value = readl(AT91C_EBI_CSA);
-	value |= AT91C_EBI_CS3A_SMC_SmartMedia;
-	writel(value, AT91C_EBI_CSA);
-
-	/* enable SMOE/SMWE */
-	writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_ASR);
-	writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_PDR);
-	writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_OER);
-
-	/* set NCE to high */
-	writel(KB9202_NAND_NCE, AT91C_PIOC_SODR);
-
-	/* disable output on pin connected to the busy line of the NAND */
-	writel(KB9202_NAND_BUSY, AT91C_PIOC_ODR);
-
-	/* enable the PIO to control NCE and BUSY */
-	writel(KB9202_NAND_NCE | KB9202_NAND_BUSY, AT91C_PIOC_PER);
-
-	/* enable output for NCE */
-	writel(KB9202_NAND_NCE, AT91C_PIOC_OER);
-
-	return (0);
-}
diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile
index 78ebf04..d4e2478 100644
--- a/drivers/mux/Makefile
+++ b/drivers/mux/Makefile
@@ -3,5 +3,5 @@
 # (C) Copyright 2019
 # Jean-Jacques Hiblot <jjhiblot@ti.com>
 
-obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o
+obj-$(CONFIG_MULTIPLEXER) += mux-uclass.o
 obj-$(CONFIG_$(SPL_)MUX_MMIO) += mmio.o
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 0fbfad1..2493347 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -815,7 +815,7 @@
 	mvreg_write(pp, MVNETA_SDMA_CONFIG, val);
 
 	/* Enable PHY polling in hardware if not in fixed-link mode */
-	if (!CONFIG_IS_ENABLED(PHY_FIXED) ||
+	if (!IS_ENABLED(CONFIG_PHY_FIXED) ||
 	    pp->phydev->phy_id != PHY_FIXED_ID) {
 		mvreg_write(pp, MVNETA_PHY_ADDR, pp->phydev->addr);
 
@@ -1176,7 +1176,7 @@
 		 * be added). Also, why is ADVERT_FC enabled if we don't enable
 		 * inband AN at all?
 		 */
-		if (CONFIG_IS_ENABLED(PHY_FIXED) &&
+		if (IS_ENABLED(CONFIG_PHY_FIXED) &&
 		    pp->phydev->phy_id == PHY_FIXED_ID)
 			val = MVNETA_GMAC_IB_BYPASS_AN_EN |
 			      MVNETA_GMAC_SET_FC_EN |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 5eaff05..6806e3c 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -106,6 +106,9 @@
 config PHY_ATHEROS
 	bool "Atheros Ethernet PHYs support"
 
+config SPL_PHY_ATHEROS
+	bool "Atheros Ethernet PHYs support (SPL)"
+
 config PHY_BROADCOM
 	bool "Broadcom Ethernet PHYs support"
 
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 35b6ed4..fcfda28 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -231,6 +231,24 @@
 	  Enable driver for ST's M41T62 compatible RTC devices (like RV-4162).
 	  It is a serial (I2C) real-time clock (RTC) with alarm.
 
+config RTC_SANDBOX
+	bool "Enable sandbox RTC driver"
+	depends on SANDBOX && DM_RTC
+	default y
+	help
+	  Enable the sandbox RTC driver. This driver connects to the RTC
+	  emulator and is used to test the RTC uclasses and associated code,
+	  as well as the I2C subsystem.
+
+config SPL_RTC_SANDBOX
+	bool "Enable sandbox RTC driver (SPL)"
+	depends on SANDBOX && SPL_DM_RTC
+	default y
+	help
+	  Enable the sandbox RTC driver. This driver connects to the RTC
+	  emulator and is used to test the RTC uclasses and associated code,
+	  as well as the I2C subsystem.
+
 config RTC_STM32
 	bool "Enable STM32 RTC driver"
 	depends on DM_RTC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 447551e..b6c9029 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -16,7 +16,7 @@
 obj-$(CONFIG_RTC_DS3232) += ds3232.o
 obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o
 obj-$(CONFIG_RTC_HT1380) += ht1380.o
-obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o
+obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += i2c_rtc_emul.o
 obj-$(CONFIG_RTC_ISL1208) += isl1208.o
 obj-$(CONFIG_RTC_M41T62) += m41t62.o
 obj-$(CONFIG_RTC_MC13XXX) += mc13xxx-rtc.o
@@ -35,6 +35,6 @@
 obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o
 obj-$(CONFIG_RTC_S35392A) += s35392a.o
 obj-$(CONFIG_RTC_STM32) += stm32_rtc.o
-obj-$(CONFIG_SANDBOX) += sandbox_rtc.o
+obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += sandbox_rtc.o
 obj-$(CONFIG_RTC_ABX80X) += abx80x.o
 obj-$(CONFIG_RTC_ZYNQMP) += zynqmp_rtc.o
diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c
index c9a0326..ca48328 100644
--- a/drivers/sysreset/sysreset_mpc83xx.c
+++ b/drivers/sysreset/sysreset_mpc83xx.c
@@ -107,7 +107,7 @@
 	if (!force && !gd->arch.arbiter_event_address)
 		return 0;
 
-	if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL)) {
+	if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL)) {
 		res = snprintf(buf, size,
 			       "Arbiter Event Status:\n"
 			       "    %s: 0x%08lX\n"
@@ -184,7 +184,7 @@
 	 * TODO(mario.six@gdsys.cc): Move this into a dedicated
 	 *			     arbiter driver
 	 */
-	if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL) ||
+	if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL) ||
 	    IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) {
 		/*
 		 * If there was a bus monitor reset event, we force the arbiter
diff --git a/env/Kconfig b/env/Kconfig
index 6e24eee..2bbe4c4 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -860,6 +860,16 @@
 
 endif
 
+if VPL_ENV_SUPPORT
+
+config VPL_ENV_IS_NOWHERE
+	bool "VPL Environment is not stored"
+	default y if ENV_IS_NOWHERE
+	help
+	  Similar to ENV_IS_NOWHERE, used for VPL environment.
+
+endif  # VPL_ENV_SUPPORT
+
 config USE_BOOTFILE
 	bool "Add a 'bootfile' environment variable"
 	help
diff --git a/include/command.h b/include/command.h
index 0db4898..1b018cb 100644
--- a/include/command.h
+++ b/include/command.h
@@ -376,7 +376,7 @@
 	U_BOOT_SUBCMDS_DO_CMD(_cmdname)					\
 	U_BOOT_SUBCMDS_COMPLETE(_cmdname)
 
-#ifdef CONFIG_CMDLINE
+#if CONFIG_IS_ENABLED(CMDLINE)
 #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep,		\
 				     _usage, _help, _comp)		\
 		{ #_name, _maxargs, _cmd_rep, cmd_discard_repeatable,	\
diff --git a/include/mux.h b/include/mux.h
index 9f80991..c92d887 100644
--- a/include/mux.h
+++ b/include/mux.h
@@ -23,7 +23,7 @@
 struct udevice;
 struct mux_control;
 
-#if CONFIG_IS_ENABLED(MULTIPLEXER)
+#if IS_ENABLED(CONFIG_MULTIPLEXER)
 /**
  * mux_control_states() - Query the number of multiplexer states.
  * @mux: The mux-control to query.
diff --git a/lib/Kconfig b/lib/Kconfig
index 83e5edd..4278b24 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -74,6 +74,10 @@
 config LIB_UUID
 	bool
 
+config SPL_LIB_UUID
+	depends on SPL
+	bool
+
 config SEMIHOSTING
 	bool "Support semihosting"
 	depends on ARM || RISCV
@@ -579,6 +583,26 @@
 
 endif
 
+config VPL_SHA1
+	bool "Enable SHA1 support in VPL"
+	depends on VPL
+	default y if SHA1
+	help
+	  This option enables support of hashing using SHA1 algorithm.
+	  The hash is calculated in software.
+	  The SHA1 algorithm produces a 160-bit (20-byte) hash value
+	  (digest).
+
+config VPL_SHA256
+	bool "Enable SHA256 support in VPL"
+	depends on VPL
+	default y if SHA256
+	help
+	  This option enables support of hashing using SHA256 algorithm.
+	  The hash is calculated in software.
+	  The SHA256 algorithm produces a 256-bit (32-byte) hash value
+	  (digest).
+
 if SHA_HW_ACCEL
 
 config SHA512_HW_ACCEL
@@ -727,6 +751,12 @@
 
 endif
 
+config SPL_BZIP2
+	bool "Enable bzip2 decompression support for SPL build"
+	depends on SPL
+	help
+	  This enables support for bzip2 compression algorithm for SPL boot.
+
 config SPL_LZ4
 	bool "Enable LZ4 decompression support in SPL"
 	depends on SPL
diff --git a/lib/Makefile b/lib/Makefile
index a282e40..10aa7ac 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -127,7 +127,7 @@
 obj-$(CONFIG_LIB_RAND) += rand.o
 obj-y += panic.o
 
-ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y)
+ifeq ($(CONFIG_SPL_BUILD),y)
 # SPL U-Boot may use full-printf, tiny-printf or none at all
 ifdef CONFIG_$(SPL_TPL_)USE_TINY_PRINTF
 obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index d80037d..e758cc6 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -175,7 +175,7 @@
 	struct phy_device *phy;
 	ofnode phynode;
 
-	if (CONFIG_IS_ENABLED(PHY_FIXED) &&
+	if (IS_ENABLED(CONFIG_PHY_FIXED) &&
 	    ofnode_phy_is_fixed_link(dev_ofnode(ethdev), &phynode)) {
 		phy = phy_connect(NULL, 0, ethdev, interface);
 		goto out;
diff --git a/test/test-main.c b/test/test-main.c
index ea959f4..b3c30d9 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -46,14 +46,14 @@
  */
 static enum fdtchk_t fdt_action(void)
 {
-	/* Do a copy for sandbox (but only the U-Boot build, not SPL) */
-	if (CONFIG_IS_ENABLED(SANDBOX))
-		return FDTCHK_COPY;
-
 	/* For sandbox SPL builds, do nothing */
-	if (IS_ENABLED(CONFIG_SANDBOX))
+	if (IS_ENABLED(CONFIG_SANDBOX) && IS_ENABLED(CONFIG_SPL_BUILD))
 		return FDTCHK_NONE;
 
+	/* Do a copy for sandbox (but only the U-Boot build, not SPL) */
+	if (IS_ENABLED(CONFIG_SANDBOX))
+		return FDTCHK_COPY;
+
 	/* For all other boards, do a checksum */
 	return FDTCHK_CHECKSUM;
 }