Skip to contentSkip to conversation

spl: mmc: Some tweaks for SPL, particularly with MMC

PATCH Superseded Simon Glass 4 participants 34 messages Jul 20, 2024 – Jul 21, 2024

Subsystems (9)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover spl: mmc: Some tweaks for SPL, particularly with MMC

This series includes various minor fixes and tweaks found when trying to reduce the size of MMC code in SPL.

Simon Glass (14):
rockchip: Move the default timer init to a common file
spl: Correct use of CMD_BOOTI and CMD_BOOTZ
spl: Remove some #ifdefs in spl_parse_image_header()
spl: Remove remaining #ifdef in spl_parse_image_header()
mmc: Use logging instead of printf()
mmc: Use logging instead of pr_err()
log: Avoid including function names by default
spl: mmc: Drop checks for CONFIG_SPL_LIBCOMMON_SUPPORT
spl: mmc: Handle error codes consistently
spl: mmc: Adjust args of spl_mmc_find_device()
spl: mmc: Try to clean up raw-mode options
spl: Use unified inline functions for spl_load_info
spl: Create a function to init spl_load_info
blk: Correct comment for blk_get_devnum_by_uclass_idname()

 arch/arm/include/asm/arch-rockchip/timer.h    |   3 +
 arch/arm/mach-imx/imx8m/soc.c                 |   2 +
 arch/arm/mach-imx/spl_imx_romapi.c            |  27 +--
 arch/arm/mach-rockchip/Makefile               |   4 +-
 arch/arm/mach-rockchip/spl.c                  |  21 +--
 arch/arm/mach-rockchip/spl_common.c           |  36 ++++
 arch/arm/mach-rockchip/tpl.c                  |  30 +---
 arch/arm/mach-sunxi/spl_spi_sunxi.c           |   3 +-
 .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       |   4 +-
 common/log_console.c                          |   4 +-
 common/spl/Kconfig                            |  52 +++---
 common/spl/spl.c                              |  35 ++--
 common/spl/spl_blk_fs.c                       |   9 +-
 common/spl/spl_ext.c                          |   3 +-
 common/spl/spl_fat.c                          |  10 +-
 common/spl/spl_mmc.c                          | 159 ++++++++----------
 common/spl/spl_nand.c                         |   4 +-
 common/spl/spl_net.c                          |   3 +-
 common/spl/spl_nor.c                          |   6 +-
 common/spl/spl_ram.c                          |   3 +-
 common/spl/spl_semihosting.c                  |   4 +-
 common/spl/spl_spi.c                          |   4 +-
 common/spl/spl_ymodem.c                       |   4 +-
 configs/am335x_guardian_defconfig             |   2 +-
 configs/am335x_pdu001_defconfig               |   2 +-
 configs/am3517_evm_defconfig                  |   2 +-
 configs/am62ax_evm_a53_defconfig              |   1 +
 configs/am62ax_evm_r5_defconfig               |   1 +
 configs/am62px_evm_a53_defconfig              |   1 +
 configs/am62px_evm_r5_defconfig               |   1 +
 configs/am62x_beagleplay_a53_defconfig        |   1 +
 configs/am62x_beagleplay_r5_defconfig         |   1 +
 configs/am62x_evm_a53_defconfig               |   1 +
 configs/am62x_evm_r5_defconfig                |   1 +
 configs/am64x_evm_a53_defconfig               |   1 +
 configs/am64x_evm_r5_defconfig                |   1 +
 configs/am65x_evm_a53_defconfig               |   1 +
 configs/am65x_evm_r5_defconfig                |   1 +
 configs/brppt2_defconfig                      |   2 +-
 configs/brsmarc1_defconfig                    |   2 +-
 configs/cgtqmx8_defconfig                     |   1 +
 configs/chromebit_mickey_defconfig            |   2 +-
 configs/chromebook_jerry_defconfig            |   2 +-
 configs/chromebook_minnie_defconfig           |   2 +-
 configs/chromebook_speedy_defconfig           |   2 +-
 configs/ci20_mmc_defconfig                    |   1 +
 configs/da850evm_defconfig                    |   2 +-
 configs/da850evm_nand_defconfig               |   2 +-
 configs/deneb_defconfig                       |   1 +
 configs/display5_defconfig                    |   2 +-
 configs/display5_factory_defconfig            |   2 +-
 configs/draco-rastaban_defconfig              |   2 +-
 configs/draco-thuban_defconfig                |   2 +-
 .../gardena-smart-gateway-at91sam_defconfig   |   2 +-
 configs/giedi_defconfig                       |   1 +
 configs/imx28_xea_defconfig                   |   1 +
 configs/imx28_xea_sb_defconfig                |   1 +
 configs/imx6q_logic_defconfig                 |   2 +-
 configs/imx8mm-cl-iot-gate-optee_defconfig    |   1 +
 configs/imx8mm-cl-iot-gate_defconfig          |   1 +
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |   1 +
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |   1 +
 configs/imx8mm-mx8menlo_defconfig             |   1 +
 configs/imx8mm-phygate-tauri-l_defconfig      |   1 +
 configs/imx8mm_beacon_defconfig               |   1 +
 configs/imx8mm_beacon_fspi_defconfig          |   1 +
 configs/imx8mm_data_modul_edm_sbc_defconfig   |   1 +
 configs/imx8mm_evk_defconfig                  |   1 +
 configs/imx8mm_evk_fspi_defconfig             |   1 +
 configs/imx8mm_phg_defconfig                  |   1 +
 configs/imx8mm_venice_defconfig               |   1 +
 configs/imx8mn_beacon_2g_defconfig            |   1 +
 configs/imx8mn_beacon_defconfig               |   1 +
 configs/imx8mn_beacon_fspi_defconfig          |   1 +
 configs/imx8mn_bsh_smm_s2_defconfig           |   1 +
 configs/imx8mn_bsh_smm_s2pro_defconfig        |   1 +
 configs/imx8mn_ddr4_evk_defconfig             |   1 +
 configs/imx8mn_evk_defconfig                  |   1 +
 configs/imx8mn_var_som_defconfig              |   1 +
 configs/imx8mn_venice_defconfig               |   1 +
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig |   1 +
 configs/imx8mp_beacon_defconfig               |   1 +
 configs/imx8mp_data_modul_edm_sbc_defconfig   |   1 +
 configs/imx8mp_debix_model_a_defconfig        |   1 +
 configs/imx8mp_dhcom_pdk2_defconfig           |   1 +
 configs/imx8mp_dhcom_pdk3_defconfig           |   1 +
 configs/imx8mp_evk_defconfig                  |   1 +
 configs/imx8mp_rsb3720a1_4G_defconfig         |   2 +
 configs/imx8mp_rsb3720a1_6G_defconfig         |   1 +
 configs/imx8mp_venice_defconfig               |   1 +
 configs/imx8mq_cm_defconfig                   |   1 +
 configs/imx8mq_evk_defconfig                  |   1 +
 configs/imx8mq_phanbell_defconfig             |   1 +
 configs/imx8mq_reform2_defconfig              |   1 +
 configs/imx8qm_mek_defconfig                  |   1 +
 configs/imx8qxp_mek_defconfig                 |   1 +
 configs/imx8ulp_evk_defconfig                 |   1 +
 configs/imx93-phyboard-segin_defconfig        |   1 +
 configs/imx93_11x11_evk_defconfig             |   1 +
 configs/imx93_11x11_evk_ld_defconfig          |   1 +
 configs/imx93_var_som_defconfig               |   1 +
 configs/imxrt1020-evk_defconfig               |   1 +
 configs/imxrt1050-evk_defconfig               |   1 +
 configs/imxrt1050-evk_fspi_defconfig          |   1 +
 configs/imxrt1170-evk_defconfig               |   1 +
 configs/iot2050_defconfig                     |   1 +
 configs/j7200_evm_a72_defconfig               |   1 +
 configs/j7200_evm_r5_defconfig                |   1 +
 configs/j721e_beagleboneai64_a72_defconfig    |   1 +
 configs/j721e_beagleboneai64_r5_defconfig     |   1 +
 configs/j721e_evm_a72_defconfig               |   1 +
 configs/j721e_evm_r5_defconfig                |   1 +
 configs/j721s2_evm_a72_defconfig              |   1 +
 configs/j721s2_evm_r5_defconfig               |   1 +
 configs/j722s_evm_a53_defconfig               |   1 +
 configs/j722s_evm_r5_defconfig                |   1 +
 configs/j784s4_evm_a72_defconfig              |   1 +
 configs/j784s4_evm_r5_defconfig               |   1 +
 configs/kontron-sl-mx8mm_defconfig            |   1 +
 configs/kontron_pitx_imx8m_defconfig          |   1 +
 configs/kontron_sl28_defconfig                |   1 +
 configs/librem5_defconfig                     |   1 +
 configs/ls1021aiot_sdcard_defconfig           |   1 +
 configs/ls1021aqds_nand_defconfig             |   1 +
 configs/ls1021aqds_sdcard_ifc_defconfig       |   1 +
 configs/ls1021aqds_sdcard_qspi_defconfig      |   1 +
 configs/ls1021atsn_sdcard_defconfig           |   1 +
 ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |   1 +
 configs/ls1021atwr_sdcard_ifc_defconfig       |   1 +
 configs/ls1021atwr_sdcard_qspi_defconfig      |   1 +
 configs/msc_sm2s_imx8mp_defconfig             |   1 +
 configs/omap35_logic_defconfig                |   2 +-
 configs/omap35_logic_somlv_defconfig          |   2 +-
 configs/omap3_logic_defconfig                 |   2 +-
 configs/omap3_logic_somlv_defconfig           |   2 +-
 configs/phycore-imx8mm_defconfig              |   1 +
 configs/phycore-imx8mp_defconfig              |   1 +
 configs/phycore_am62x_a53_defconfig           |   1 +
 configs/phycore_am62x_r5_defconfig            |   1 +
 configs/phycore_am64x_a53_defconfig           |   1 +
 configs/phycore_am64x_r5_defconfig            |   1 +
 configs/pico-imx8mq_defconfig                 |   1 +
 configs/sama5d27_wlsom1_ek_mmc_defconfig      |   2 +-
 .../sama5d27_wlsom1_ek_qspiflash_defconfig    |   2 +-
 configs/sama5d2_icp_mmc_defconfig             |   2 +-
 configs/sandbox_defconfig                     |   1 +
 configs/sandbox_noinst_defconfig              |   1 +
 configs/sniper_defconfig                      |   2 +-
 configs/socfpga_secu1_defconfig               |   2 +-
 configs/verdin-am62_a53_defconfig             |   1 +
 configs/verdin-am62_r5_defconfig              |   1 +
 configs/verdin-imx8mm_defconfig               |   1 +
 configs/verdin-imx8mp_defconfig               |   1 +
 drivers/mmc/mmc.c                             |  49 +++---
 drivers/mmc/sdhci.c                           |  46 +++--
 drivers/usb/gadget/f_sdp.c                    |   8 +-
 include/blk.h                                 |   4 +-
 include/log.h                                 |  18 +-
 include/spl.h                                 |  60 ++++---
 test/cmd/pinmux.c                             |   8 +-
 test/image/spl_load.c                         |   4 +-
 test/image/spl_load_os.c                      |   6 +-
 test/log/log_test.c                           |   4 +-
 163 files changed, 434 insertions(+), 360 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/spl_common.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/14 rockchip: Move the default timer init to a common file

Rather than repeating the same code in two files (SPL and TPL), move it to a shared filed.

---

 arch/arm/include/asm/arch-rockchip/timer.h |  3 ++
 arch/arm/mach-rockchip/Makefile            |  4 +--
 arch/arm/mach-rockchip/spl.c               | 21 +------------
 arch/arm/mach-rockchip/spl_common.c        | 36 ++++++++++++++++++++++
 arch/arm/mach-rockchip/tpl.c               | 30 +-----------------
 5 files changed, 43 insertions(+), 51 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/spl_common.c
arch/arm/include/asm/arch-rockchip/timer.h +3 -0
index 77b54220447..b5fc738c98c 100644
@@ -15,4 +15,7 @@ struct rk_timer {
 	u32 timer_int_status;
 };
 
+/** rockchip_stimer_init() - Set up the timer ready for use */
+void rockchip_stimer_init(void);
+
 #endif
arch/arm/mach-rockchip/Makefile +2 -2
index c07bdaee4c3..3b13891ec24 100644
@@ -8,9 +8,9 @@
 # inaccessible/protected memory (and the bootrom-helper assumes that
 # the stack-pointer is valid before switching to the U-Boot stack).
 obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
-obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o
+obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o spl_common.o
 obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
-obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o
+obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o
 obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
 
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
arch/arm/mach-rockchip/spl.c +1 -20
index 3ce7e792b5a..bbd223bc524 100644
@@ -13,6 +13,7 @@
 #include <ram.h>
 #include <spl.h>
 #include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/timer.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
@@ -86,26 +87,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 #define	TIMER_FMODE	BIT(0)
 #define	TIMER_RMODE	BIT(1)
 
-__weak void rockchip_stimer_init(void)
-{
-#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
-	/* If Timer already enabled, don't re-init it */
-	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-
-	if (reg & TIMER_EN)
-		return;
-#ifndef CONFIG_ARM64
-	asm volatile("mcr p15, 0, %0, c14, c0, 0"
-		     : : "r"(CONFIG_COUNTER_FREQUENCY));
-#endif
-	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
-	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
-	       TIMER_CONTROL_REG);
-#endif
-}
-
 __weak int board_early_init_f(void)
 {
 	return 0;
arch/arm/mach-rockchip/spl_common.c new file +36 -0
new file mode 100644
index 00000000000..b29f33448ab
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#include <asm/io.h>
+#include <linux/bitops.h>
+
+#define TIMER_LOAD_COUNT_L	0x00
+#define TIMER_LOAD_COUNT_H	0x04
+#define TIMER_CONTROL_REG	0x10
+#define TIMER_EN	0x1
+#define	TIMER_FMODE	BIT(0)
+#define	TIMER_RMODE	BIT(1)
+
+__weak void rockchip_stimer_init(void)
+{
+#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
+	/* If Timer already enabled, don't re-init it */
+	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
+
+	if (reg & TIMER_EN)
+		return;
+
+#ifndef CONFIG_ARM64
+	asm volatile("mcr p15, 0, %0, c14, c0, 0"
+		     : : "r"(CONFIG_COUNTER_FREQUENCY));
+#endif
+
+	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
+	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
+	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
+	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
+	       TIMER_CONTROL_REG);
+#endif
+}
arch/arm/mach-rockchip/tpl.c +1 -29
index 50f04f9474a..0e1da8c1c89 100644
@@ -14,41 +14,13 @@
 #include <version.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/timer.h>
 #include <linux/bitops.h>
 
 #if CONFIG_IS_ENABLED(BANNER_PRINT)
 #include <timestamp.h>
 #endif
 
-#define TIMER_LOAD_COUNT_L	0x00
-#define TIMER_LOAD_COUNT_H	0x04
-#define TIMER_CONTROL_REG	0x10
-#define TIMER_EN	0x1
-#define	TIMER_FMODE	BIT(0)
-#define	TIMER_RMODE	BIT(1)
-
-__weak void rockchip_stimer_init(void)
-{
-#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
-	/* If Timer already enabled, don't re-init it */
-	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-
-	if (reg & TIMER_EN)
-		return;
-
-#ifndef CONFIG_ARM64
-	asm volatile("mcr p15, 0, %0, c14, c0, 0"
-		     : : "r"(CONFIG_COUNTER_FREQUENCY));
-#endif
-
-	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
-	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
-	       TIMER_CONTROL_REG);
-#endif
-}
-
 void board_init_f(ulong dummy)
 {
 	struct udevice *dev;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/14
#2 lore raw

Re: [PATCH 01/14] rockchip: Move the default timer init to a common file

Hello Simon,

Quoted 4 lines · Simon Glass

Rather than repeating the same code in two files (SPL and TPL), move it to a shared filed.

Looking good to me. Thanks for the patch.

Quoted 170 lines

---

 arch/arm/include/asm/arch-rockchip/timer.h |  3 ++
 arch/arm/mach-rockchip/Makefile            |  4 +--
 arch/arm/mach-rockchip/spl.c               | 21 +------------
 arch/arm/mach-rockchip/spl_common.c        | 36 ++++++++++++++++++++++
 arch/arm/mach-rockchip/tpl.c               | 30 +-----------------
 5 files changed, 43 insertions(+), 51 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/spl_common.c
arch/arm/include/asm/arch-rockchip/timer.h +3 -0
index 77b54220447..b5fc738c98c 100644
@@ -15,4 +15,7 @@ struct rk_timer {
 	u32 timer_int_status;
 };
 
+/** rockchip_stimer_init() - Set up the timer ready for use */
+void rockchip_stimer_init(void);
+
 #endif
arch/arm/mach-rockchip/Makefile +1 -1
index c07bdaee4c3..3b13891ec24 100644
@@ -8,9 +8,9 @@
 # inaccessible/protected memory (and the bootrom-helper assumes that
 # the stack-pointer is valid before switching to the U-Boot stack).
 obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
-obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o
+obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o

spl_common.o
obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o

arch/arm/mach-rockchip/Makefile +1 -1
-obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o
+obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o
 obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
 
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
arch/arm/mach-rockchip/spl.c +1 -20
index 3ce7e792b5a..bbd223bc524 100644
@@ -13,6 +13,7 @@
 #include <ram.h>
 #include <spl.h>
 #include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/timer.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
@@ -86,26 +87,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 
 boot_device)
 #define	TIMER_FMODE	BIT(0)
 #define	TIMER_RMODE	BIT(1)
 
-__weak void rockchip_stimer_init(void)
-{
-#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
-	/* If Timer already enabled, don't re-init it */
-	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-
-	if (reg & TIMER_EN)
-		return;
-#ifndef CONFIG_ARM64
-	asm volatile("mcr p15, 0, %0, c14, c0, 0"
-		     : : "r"(CONFIG_COUNTER_FREQUENCY));
-#endif
-	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
-	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
-	       TIMER_CONTROL_REG);
-#endif
-}
-
 __weak int board_early_init_f(void)
 {
arch/arm/mach-rockchip/spl.c +0 -0
 	return 0;
arch/arm/mach-rockchip/spl_common.c new file +36 -0
new file mode 100644
index 00000000000..b29f33448ab
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#include <asm/io.h>
+#include <linux/bitops.h>
+
+#define TIMER_LOAD_COUNT_L	0x00
+#define TIMER_LOAD_COUNT_H	0x04
+#define TIMER_CONTROL_REG	0x10
+#define TIMER_EN	0x1
+#define	TIMER_FMODE	BIT(0)
+#define	TIMER_RMODE	BIT(1)
+
+__weak void rockchip_stimer_init(void)
+{
+#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
+	/* If Timer already enabled, don't re-init it */
+	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
+
+	if (reg & TIMER_EN)
+		return;
+
+#ifndef CONFIG_ARM64
+	asm volatile("mcr p15, 0, %0, c14, c0, 0"
+		     : : "r"(CONFIG_COUNTER_FREQUENCY));
+#endif
+
+	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
+	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
+	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
+	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
+	       TIMER_CONTROL_REG);
+#endif
+}
arch/arm/mach-rockchip/tpl.c +1 -29
index 50f04f9474a..0e1da8c1c89 100644
@@ -14,41 +14,13 @@
 #include <version.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
+#include <asm/arch-rockchip/timer.h>
 #include <linux/bitops.h>
 
 #if CONFIG_IS_ENABLED(BANNER_PRINT)
 #include <timestamp.h>
 #endif
 
-#define TIMER_LOAD_COUNT_L	0x00
-#define TIMER_LOAD_COUNT_H	0x04
-#define TIMER_CONTROL_REG	0x10
-#define TIMER_EN	0x1
-#define	TIMER_FMODE	BIT(0)
-#define	TIMER_RMODE	BIT(1)
-
-__weak void rockchip_stimer_init(void)
-{
-#if defined(CONFIG_ROCKCHIP_STIMER_BASE)
-	/* If Timer already enabled, don't re-init it */
-	u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-
-	if (reg & TIMER_EN)
-		return;
-
-#ifndef CONFIG_ARM64
-	asm volatile("mcr p15, 0, %0, c14, c0, 0"
-		     : : "r"(CONFIG_COUNTER_FREQUENCY));
-#endif
-
-	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
-	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
-	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
-	       TIMER_CONTROL_REG);
-#endif
-}
-
 void board_init_f(ulong dummy)
 {
 	struct udevice *dev;
#3 lore raw

PATCH 2/14 spl: Correct use of CMD_BOOTI and CMD_BOOTZ

In reply to Simon Glass

These should have a CONFIG_ prefix. Add it.

Fixes 7a0d88076b9 ("Add in the ability to load and boot an uncompr...")

---

 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +2 -2
index 7794ddccade..6f4a8bfb3f4 100644
@@ -322,7 +322,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 #endif
 
 #if CONFIG_IS_ENABLED(OS_BOOT)
-#if defined(CMD_BOOTI)
+#if defined(CONFIG_CMD_BOOTI)
 		ulong start, size;
 
 		if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -336,7 +336,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
-#elif defined(CMD_BOOTZ)
+#elif defined(CONFIG_CMD_BOOTZ)
 		ulong start, end;
 
 		if (!bootz_setup((ulong)header, &start, &end)) {
Signature · 1 line
2.34.1
Reviewed-by on v1 2/14
#4 lore raw

Re: [PATCH 02/14] spl: Correct use of CMD_BOOTI and CMD_BOOTZ

Quoted 23 lines · Simon Glass

These should have a CONFIG_ prefix. Add it.

Fixes 7a0d88076b9 ("Add in the ability to load and boot an uncompr...")

---

  common/spl/spl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index 7794ddccade..6f4a8bfb3f4 100644
@@ -322,7 +322,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  #endif
 
  #if CONFIG_IS_ENABLED(OS_BOOT)
-#if defined(CMD_BOOTI)
+#if defined(CONFIG_CMD_BOOTI)
  		ulong start, size;
 
  		if (!booti_setup((ulong)header, &start, &size, 0)) {

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 342

Quoted 8 lines
common/spl/spl.c +1 -1
@@ -336,7 +336,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  			      spl_image->load_addr, spl_image->size);
  			return 0;
  		}
-#elif defined(CMD_BOOTZ)
+#elif defined(CONFIG_CMD_BOOTZ)
  		ulong start, end;
 
  		if (!bootz_setup((ulong)header, &start, &end)) {
#5 lore raw

PATCH 3/14 spl: Remove some #ifdefs in spl_parse_image_header()

In reply to Simon Glass

This function has a number of unnecessary #ifdefs so remove them.

---

 common/spl/spl.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
common/spl/spl.c +11 -11
index 6f4a8bfb3f4..02567e766f1 100644
@@ -308,8 +308,10 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		ret = spl_parse_legacy_header(spl_image, header);
 		if (ret)
 			return ret;
-	} else {
-#ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE
+		return 0;
+	}
+
+	if (IS_ENABLED(CONFIG_SPL_PANIC_ON_RAW_IMAGE)) {
 		/*
 		 * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the
 		 * code which loads images in SPL cannot guarantee that
@@ -319,10 +321,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		 * is bad, and thus should be skipped silently.
 		 */
 		panic("** no mkimage signature but raw image not supported");
-#endif
+	}
 
-#if CONFIG_IS_ENABLED(OS_BOOT)
-#if defined(CONFIG_CMD_BOOTI)
+	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI)) {
 		ulong start, size;
 
 		if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -336,7 +337,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
-#elif defined(CONFIG_CMD_BOOTZ)
+	} else if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTZ)) {
 		ulong start, end;
 
 		if (!bootz_setup((ulong)header, &start, &end)) {
@@ -350,11 +351,11 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
-#endif
-#endif
+	}
 
-		if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header)))
-			return 0;
+	if (!spl_parse_board_header(spl_image, bootdev, (const void *)header,
+				    sizeof(*header)))
+		return 0;
 
 #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
 		/* Signature not found - assume u-boot.bin */
@@ -366,7 +367,6 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		debug("Raw boot image support not enabled, proceeding to other boot methods\n");
 		return -EINVAL;
 #endif
-	}
 
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 3/14
#6 lore raw

Re: [PATCH 03/14] spl: Remove some #ifdefs in spl_parse_image_header()

Quoted 26 lines · Simon Glass

This function has a number of unnecessary #ifdefs so remove them.

---

  common/spl/spl.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
common/spl/spl.c +4 -2
index 6f4a8bfb3f4..02567e766f1 100644
@@ -308,8 +308,10 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  		ret = spl_parse_legacy_header(spl_image, header);
  		if (ret)
  			return ret;
-	} else {
-#ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE
+		return 0;
+	}
+
+	if (IS_ENABLED(CONFIG_SPL_PANIC_ON_RAW_IMAGE)) {
  		/*
  		 * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the
  		 * code which loads images in SPL cannot guarantee that

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 326

Quoted 9 lines
common/spl/spl.c +2 -3
@@ -319,10 +321,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  		 * is bad, and thus should be skipped silently.
  		 */
  		panic("** no mkimage signature but raw image not supported");
-#endif
+	}
 
-#if CONFIG_IS_ENABLED(OS_BOOT)
-#if defined(CONFIG_CMD_BOOTI)
+	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI)) {

Maybe this should be IS_ENABLED(CONFIG_SPL_OS_BOOT) since this file cannot be compiled except in SPL.

Quoted 29 lines
common/spl/spl.c +5 -5
  		ulong start, size;
 
  		if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -336,7 +337,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  			      spl_image->load_addr, spl_image->size);
  			return 0;
  		}
-#elif defined(CONFIG_CMD_BOOTZ)
+	} else if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTZ)) {
  		ulong start, end;
 
  		if (!bootz_setup((ulong)header, &start, &end)) {
@@ -350,11 +351,11 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  			      spl_image->load_addr, spl_image->size);
  			return 0;
  		}
-#endif
-#endif
+	}
 
-		if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header)))
-			return 0;
+	if (!spl_parse_board_header(spl_image, bootdev, (const void *)header,
+				    sizeof(*header)))
+		return 0;
 
  #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
  		/* Signature not found - assume u-boot.bin */

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 372

Quoted 7 lines
common/spl/spl.c +0 -1
@@ -366,7 +367,6 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  		debug("Raw boot image support not enabled, proceeding to other boot methods\n");
  		return -EINVAL;
  #endif
-	}
 
  	return 0;
  }
#7 lore raw

Re: [PATCH 03/14] spl: Remove some #ifdefs in spl_parse_image_header()

Hi Sean,

Quoted 34 lines · Sean Anderson
Quoted 32 lines · Simon Glass

This function has a number of unnecessary #ifdefs so remove them.

---

  common/spl/spl.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
common/spl/spl.c +5 -3
index 6f4a8bfb3f4..02567e766f1 100644
@@ -308,8 +308,10 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
              ret = spl_parse_legacy_header(spl_image, header);
              if (ret)
                      return ret;
-     } else {
-#ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE
+             return 0;
+     }
+
+     if (IS_ENABLED(CONFIG_SPL_PANIC_ON_RAW_IMAGE)) {
              /*
               * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the
               * code which loads images in SPL cannot guarantee that
@@ -319,10 +321,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
               * is bad, and thus should be skipped silently.
               */
              panic("** no mkimage signature but raw image not supported");
-#endif
+     }
 
Quoted 5 lines

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 326

Quoted 3 lines
common/spl/spl.c +1 -2
-#if CONFIG_IS_ENABLED(OS_BOOT)
-#if defined(CONFIG_CMD_BOOTI)
+     if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI)) {

Maybe this should be IS_ENABLED(CONFIG_SPL_OS_BOOT) since this file cannot be compiled except in SPL.

We do compile it with tpl though, so we want to avoid enabling this option in that case.

Quoted 35 lines
Quoted 35 lines
common/spl/spl.c +5 -6
              ulong start, size;
 
              if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -336,7 +337,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
                            spl_image->load_addr, spl_image->size);
                      return 0;
              }
-#elif defined(CONFIG_CMD_BOOTZ)
+     } else if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTZ)) {
              ulong start, end;
 
              if (!bootz_setup((ulong)header, &start, &end)) {
@@ -350,11 +351,11 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
                            spl_image->load_addr, spl_image->size);
                      return 0;
              }
-#endif
-#endif
+     }
 
-             if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header)))
-                     return 0;
+     if (!spl_parse_board_header(spl_image, bootdev, (const void *)header,
+                                 sizeof(*header)))
+             return 0;
 
  #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
              /* Signature not found - assume u-boot.bin */
@@ -366,7 +367,6 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
              debug("Raw boot image support not enabled, proceeding to other boot methods\n");
              return -EINVAL;
  #endif
-     }
 
Quoted 4 lines

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 372

Quoted 2 lines
common/spl/spl.c +0 -0
      return 0;
  }

Thanks for all your reviews!

Regards,
Simon

#8 lore raw

PATCH 4/14 spl: Remove remaining #ifdef in spl_parse_image_header()

In reply to Simon Glass

Define spl_set_header_raw_uboot() always so we can drop the last #ifdef in this function.

---

 common/spl/spl.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
common/spl/spl.c +8 -7
index 02567e766f1..745efdd9b28 100644
@@ -245,7 +245,6 @@ __weak struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 	return map_sysmem(CONFIG_TEXT_BASE + offset, 0);
 }
 
-#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
 void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 {
 	ulong u_boot_pos = spl_get_image_pos();
@@ -273,7 +272,6 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 	spl_image->os = IH_OS_U_BOOT;
 	spl_image->name = "U-Boot";
 }
-#endif
 
 __weak int spl_parse_board_header(struct spl_image_info *spl_image,
 				  const struct spl_boot_device *bootdev,
@@ -357,16 +355,19 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 				    sizeof(*header)))
 		return 0;
 
-#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
+	if (IS_ENABLED(CONFIG_SPL_RAW_IMAGE_SUPPORT)) {
 		/* Signature not found - assume u-boot.bin */
 		debug("mkimage signature not found - ih_magic = %x\n",
-			header->ih_magic);
+		      header->ih_magic);
 		spl_set_header_raw_uboot(spl_image);
-#else
-		/* RAW image not supported, proceed to other boot methods. */
+	} else {
+		/*
+		 * RAW image not supported, proceed to other boot
+		 * methods
+		 */
 		debug("Raw boot image support not enabled, proceeding to other boot methods\n");
 		return -EINVAL;
-#endif
+	}
 
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 4/14
#9 lore raw

Re: [PATCH 04/14] spl: Remove remaining #ifdef in spl_parse_image_header()

Quoted 37 lines · Simon Glass

Define spl_set_header_raw_uboot() always so we can drop the last #ifdef in this function.

---

  common/spl/spl.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)
common/spl/spl.c +1 -3
index 02567e766f1..745efdd9b28 100644
@@ -245,7 +245,6 @@ __weak struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
  	return map_sysmem(CONFIG_TEXT_BASE + offset, 0);
  }
 
-#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
  void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
  {
  	ulong u_boot_pos = spl_get_image_pos();
@@ -273,7 +272,6 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
  	spl_image->os = IH_OS_U_BOOT;
  	spl_image->name = "U-Boot";
  }
-#endif
 
  __weak int spl_parse_board_header(struct spl_image_info *spl_image,
  				  const struct spl_boot_device *bootdev,
@@ -357,16 +355,19 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
  				    sizeof(*header)))
  		return 0;
 
-#ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
+	if (IS_ENABLED(CONFIG_SPL_RAW_IMAGE_SUPPORT)) {
  		/* Signature not found - assume u-boot.bin */
  		debug("mkimage signature not found - ih_magic = %x\n",

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 367

Quoted 10 lines
common/spl/spl.c +6 -3
-			header->ih_magic);
+		      header->ih_magic);
  		spl_set_header_raw_uboot(spl_image);
-#else
-		/* RAW image not supported, proceed to other boot methods. */
+	} else {
+		/*
+		 * RAW image not supported, proceed to other boot
+		 * methods
+		 */

nit: leave this comment as-is, since it is under 80 columns

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 373

Quoted 7 lines
common/spl/spl.c +1 -1
  		debug("Raw boot image support not enabled, proceeding to other boot methods\n");
  		return -EINVAL;
-#endif
+	}
 
  	return 0;
  }
#10 lore raw

PATCH 5/14 mmc: Use logging instead of printf()

In reply to Simon Glass

The code makes quite a few uses of __func__ which puts the function name into the resulting SPL image. Use the log subsystem instead, to reduce size.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

---

 drivers/mmc/sdhci.c | 46 +++++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)
drivers/mmc/sdhci.c +19 -27
index 560b7e889c7..24998233543 100644
@@ -32,8 +32,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
 	while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
 		if (timeout == 0) {
-			printf("%s: Reset 0x%x never completed.\n",
-			       __func__, (int)mask);
+			log_warning("Reset %x never completed\n", (int)mask);
 			return;
 		}
 		timeout--;
@@ -139,8 +138,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 	do {
 		stat = sdhci_readl(host, SDHCI_INT_STATUS);
 		if (stat & SDHCI_INT_ERROR) {
-			pr_debug("%s: Error detected in status(0x%X)!\n",
-				 __func__, stat);
+			log_debug("Error detected in status(%x)!\n", stat);
 			return -EIO;
 		}
 		if (!transfer_done && (stat & rdy)) {
@@ -173,7 +171,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
 		if (timeout-- > 0)
 			udelay(10);
 		else {
-			printf("%s: Transfer data timeout\n", __func__);
+			log_err("Transfer data timeout\n");
 			return -ETIMEDOUT;
 		}
 	} while (!(stat & SDHCI_INT_DATA_END));
@@ -232,7 +230,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 
 	while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
 		if (time >= cmd_timeout) {
-			printf("%s: MMC: %d busy ", __func__, mmc_dev);
+			log_warning("MMC: %d busy ", mmc_dev);
 			if (2 * cmd_timeout <= SDHCI_CMD_MAX_TIMEOUT) {
 				cmd_timeout += cmd_timeout;
 				printf("timeout increasing to: %u ms.\n",
@@ -316,8 +314,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 		}
 
 		if (get_timer(start) >= SDHCI_READ_STATUS_TIMEOUT) {
-			printf("%s: Timeout for status update: %08x %08x\n",
-			       __func__, stat, mask);
+			log_warning("Timeout for status update: %08x %08x\n",
+				    stat, mask);
 			return -ETIMEDOUT;
 		}
 	} while ((stat & mask) != mask);
@@ -358,7 +356,7 @@ static int sdhci_execute_tuning(struct udevice *dev, uint opcode)
 	struct mmc *mmc = mmc_get_mmc_dev(dev);
 	struct sdhci_host *host = mmc->priv;
 
-	debug("%s\n", __func__);
+	log_debug("tuning\n");
 
 	if (host->ops && host->ops->platform_execute_tuning) {
 		err = host->ops->platform_execute_tuning(mmc, opcode);
@@ -380,8 +378,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	while (sdhci_readl(host, SDHCI_PRESENT_STATE) &
 			   (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)) {
 		if (timeout == 0) {
-			printf("%s: Timeout to wait cmd & data inhibit\n",
-			       __func__);
+			log_err("Timeout to wait cmd & data inhibit\n");
 			return -EBUSY;
 		}
 
@@ -397,7 +394,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	if (host->ops && host->ops->set_delay) {
 		ret = host->ops->set_delay(host);
 		if (ret) {
-			printf("%s: Error while setting tap delay\n", __func__);
+			log_err("Error while setting tap delay\n");
 			return ret;
 		}
 	}
@@ -405,7 +402,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	if (host->ops && host->ops->config_dll) {
 		ret = host->ops->config_dll(host, clock, false);
 		if (ret) {
-			printf("%s: Error while configuring dll\n", __func__);
+			log_err("Error configuring dll\n");
 			return ret;
 		}
 	}
@@ -456,7 +453,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	if (host->ops && host->ops->config_dll) {
 		ret = host->ops->config_dll(host, clock, true);
 		if (ret) {
-			printf("%s: Error while configuring dll\n", __func__);
+			log_err("Error configuring dll\n");
 			return ret;
 		}
 	}
@@ -472,8 +469,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
 		& SDHCI_CLOCK_INT_STABLE)) {
 		if (timeout == 0) {
-			printf("%s: Internal clock never stabilised.\n",
-			       __func__);
+			log_err("Internal clock never stabilised.\n");
 			return -EBUSY;
 		}
 		timeout--;
@@ -738,8 +734,7 @@ static int sdhci_init(struct mmc *mmc)
 	if (host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) {
 		host->align_buffer = memalign(8, 512 * 1024);
 		if (!host->align_buffer) {
-			printf("%s: Aligned buffer alloc failed!!!\n",
-			       __func__);
+			log_err("Aligned buffer alloc failed\n");
 			return -ENOMEM;
 		}
 	}
@@ -881,20 +876,18 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 #else
 	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
 #endif
-	debug("%s, caps: 0x%x\n", __func__, caps);
+	log_debug("caps: 0x%x\n", caps);
 
 #if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
 	if ((caps & SDHCI_CAN_DO_SDMA)) {
 		host->flags |= USE_SDMA;
 	} else {
-		debug("%s: Your controller doesn't support SDMA!!\n",
-		      __func__);
+		log_debug("Controller doesn't support SDMA\n");
 	}
 #endif
 #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
 	if (!(caps & SDHCI_CAN_DO_ADMA2)) {
-		printf("%s: Your controller doesn't support ADMA!!\n",
-		       __func__);
+		log_err("Controller doesn't support ADMA\n");
 		return -EINVAL;
 	}
 	if (!host->adma_desc_table) {
@@ -927,7 +920,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 #else
 		caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
 #endif
-		debug("%s, caps_1: 0x%x\n", __func__, caps_1);
+		log_debug("caps_1: %x\n", caps_1);
 		host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
 				SDHCI_CLOCK_MUL_SHIFT;
 
@@ -953,8 +946,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 			host->max_clk *= host->clk_mul;
 	}
 	if (host->max_clk == 0) {
-		printf("%s: Hardware doesn't specify base clock frequency\n",
-		       __func__);
+		log_err("Hardware doesn't specify base clock frequency\n");
 		return -EINVAL;
 	}
 	if (f_max && (f_max < host->max_clk))
@@ -1047,7 +1039,7 @@ int add_sdhci(struct sdhci_host *host, u32 f_max, u32 f_min)
 
 	host->mmc = mmc_create(&host->cfg, host);
 	if (host->mmc == NULL) {
-		printf("%s: mmc create fail!\n", __func__);
+		log_err("mmc create fail\n");
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH 05/14] mmc: Use logging instead of printf()

Quoted 17 lines · Simon Glass

The code makes quite a few uses of __func__ which puts the function name into the resulting SPL image. Use the log subsystem instead, to reduce size.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

---

  drivers/mmc/sdhci.c | 46 +++++++++++++++++++--------------------------
  1 file changed, 19 insertions(+), 27 deletions(-)
drivers/mmc/sdhci.c +0 -0
index 560b7e889c7..24998233543 100644

drivers/mmc/sdhci.c static void sdhci_reset(struct sdhci_host *host, u8 mask) · line 35

Quoted 6 lines
drivers/mmc/sdhci.c +1 -2
@@ -32,8 +32,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
  	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
  	while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
  		if (timeout == 0) {
-			printf("%s: Reset 0x%x never completed.\n",
-			       __func__, (int)mask);
+			log_warning("Reset %x never completed\n", (int)mask);

I think this cast can be removed too

Quoted 23 lines
drivers/mmc/sdhci.c +2 -3
  			return;
  		}
  		timeout--;
@@ -139,8 +138,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
  	do {
  		stat = sdhci_readl(host, SDHCI_INT_STATUS);
  		if (stat & SDHCI_INT_ERROR) {
-			pr_debug("%s: Error detected in status(0x%X)!\n",
-				 __func__, stat);
+			log_debug("Error detected in status(%x)!\n", stat);
  			return -EIO;
  		}
  		if (!transfer_done && (stat & rdy)) {
@@ -173,7 +171,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
  		if (timeout-- > 0)
  			udelay(10);
  		else {
-			printf("%s: Transfer data timeout\n", __func__);
+			log_err("Transfer data timeout\n");
  			return -ETIMEDOUT;
  		}
  	} while (!(stat & SDHCI_INT_DATA_END));

drivers/mmc/sdhci.c static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, · line 233

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -232,7 +230,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 
  	while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
  		if (time >= cmd_timeout) {
-			printf("%s: MMC: %d busy ", __func__, mmc_dev);
+			log_warning("MMC: %d busy ", mmc_dev);

Maybe this should be "mmc%d busy\n"

Quoted 15 lines
drivers/mmc/sdhci.c +2 -2
  			if (2 * cmd_timeout <= SDHCI_CMD_MAX_TIMEOUT) {
  				cmd_timeout += cmd_timeout;
  				printf("timeout increasing to: %u ms.\n",
@@ -316,8 +314,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
  		}
 
  		if (get_timer(start) >= SDHCI_READ_STATUS_TIMEOUT) {
-			printf("%s: Timeout for status update: %08x %08x\n",
-			       __func__, stat, mask);
+			log_warning("Timeout for status update: %08x %08x\n",
+				    stat, mask);
  			return -ETIMEDOUT;
  		}
  	} while ((stat & mask) != mask);

drivers/mmc/sdhci.c static int sdhci_execute_tuning(struct udevice *dev, uint opcode) · line 359

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -358,7 +356,7 @@ static int sdhci_execute_tuning(struct udevice *dev, uint opcode)
  	struct mmc *mmc = mmc_get_mmc_dev(dev);
  	struct sdhci_host *host = mmc->priv;
 
-	debug("%s\n", __func__);
+	log_debug("tuning\n");

I think this one should be left as-is. Or at least given something more descriptive.

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 381

Quoted 10 lines
drivers/mmc/sdhci.c +1 -2
  	if (host->ops && host->ops->platform_execute_tuning) {
  		err = host->ops->platform_execute_tuning(mmc, opcode);
@@ -380,8 +378,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
  	while (sdhci_readl(host, SDHCI_PRESENT_STATE) &
  			   (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)) {
  		if (timeout == 0) {
-			printf("%s: Timeout to wait cmd & data inhibit\n",
-			       __func__);
+			log_err("Timeout to wait cmd & data inhibit\n");

Might as well fix the grammar while we're at it

log_err("Timeout waiting for cmd & data inhibit\n");

Quoted 13 lines
drivers/mmc/sdhci.c +1 -1
  			return -EBUSY;
  		}
 
@@ -397,7 +394,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
  	if (host->ops && host->ops->set_delay) {
  		ret = host->ops->set_delay(host);
  		if (ret) {
-			printf("%s: Error while setting tap delay\n", __func__);
+			log_err("Error while setting tap delay\n");
  			return ret;
  		}
  	}

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 405

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -405,7 +402,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
  	if (host->ops && host->ops->config_dll) {
  		ret = host->ops->config_dll(host, clock, false);
  		if (ret) {
-			printf("%s: Error while configuring dll\n", __func__);
+			log_err("Error configuring dll\n");

To distinguish these, can we say "Error while disabling dll"

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 456

Quoted 9 lines
drivers/mmc/sdhci.c +1 -1
  			return ret;
  		}
  	}
@@ -456,7 +453,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
  	if (host->ops && host->ops->config_dll) {
  		ret = host->ops->config_dll(host, clock, true);
  		if (ret) {
-			printf("%s: Error while configuring dll\n", __func__);
+			log_err("Error configuring dll\n");

and "Error while enabling dll"

I know this grows .data a bit...

Quoted 75 lines
drivers/mmc/sdhci.c +8 -13
  			return ret;
  		}
  	}
@@ -472,8 +469,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
  	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
  		& SDHCI_CLOCK_INT_STABLE)) {
  		if (timeout == 0) {
-			printf("%s: Internal clock never stabilised.\n",
-			       __func__);
+			log_err("Internal clock never stabilised.\n");
  			return -EBUSY;
  		}
  		timeout--;
@@ -738,8 +734,7 @@ static int sdhci_init(struct mmc *mmc)
  	if (host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) {
  		host->align_buffer = memalign(8, 512 * 1024);
  		if (!host->align_buffer) {
-			printf("%s: Aligned buffer alloc failed!!!\n",
-			       __func__);
+			log_err("Aligned buffer alloc failed\n");
  			return -ENOMEM;
  		}
  	}
@@ -881,20 +876,18 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
  #else
  	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
  #endif
-	debug("%s, caps: 0x%x\n", __func__, caps);
+	log_debug("caps: 0x%x\n", caps);
 
  #if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
  	if ((caps & SDHCI_CAN_DO_SDMA)) {
  		host->flags |= USE_SDMA;
  	} else {
-		debug("%s: Your controller doesn't support SDMA!!\n",
-		      __func__);
+		log_debug("Controller doesn't support SDMA\n");
  	}
  #endif
  #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
  	if (!(caps & SDHCI_CAN_DO_ADMA2)) {
-		printf("%s: Your controller doesn't support ADMA!!\n",
-		       __func__);
+		log_err("Controller doesn't support ADMA\n");
  		return -EINVAL;
  	}
  	if (!host->adma_desc_table) {
@@ -927,7 +920,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
  #else
  		caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
  #endif
-		debug("%s, caps_1: 0x%x\n", __func__, caps_1);
+		log_debug("caps_1: %x\n", caps_1);
  		host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
  				SDHCI_CLOCK_MUL_SHIFT;
 
@@ -953,8 +946,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
  			host->max_clk *= host->clk_mul;
  	}
  	if (host->max_clk == 0) {
-		printf("%s: Hardware doesn't specify base clock frequency\n",
-		       __func__);
+		log_err("Hardware doesn't specify base clock frequency\n");
  		return -EINVAL;
  	}
  	if (f_max && (f_max < host->max_clk))
@@ -1047,7 +1039,7 @@ int add_sdhci(struct sdhci_host *host, u32 f_max, u32 f_min)
 
  	host->mmc = mmc_create(&host->cfg, host);
  	if (host->mmc == NULL) {
-		printf("%s: mmc create fail!\n", __func__);
+		log_err("mmc create fail\n");
  		return -ENOMEM;
  	}
 
#12 lore raw

Re: [PATCH 05/14] mmc: Use logging instead of printf()

Hi Sean,

Quoted 77 lines · Sean Anderson
Quoted 17 lines · Simon Glass

The code makes quite a few uses of __func__ which puts the function name into the resulting SPL image. Use the log subsystem instead, to reduce size.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

---

  drivers/mmc/sdhci.c | 46 +++++++++++++++++++--------------------------
  1 file changed, 19 insertions(+), 27 deletions(-)
drivers/mmc/sdhci.c +0 -0
index 560b7e889c7..24998233543 100644

drivers/mmc/sdhci.c static void sdhci_reset(struct sdhci_host *host, u8 mask) · line 35

Quoted 6 lines
drivers/mmc/sdhci.c +1 -2
@@ -32,8 +32,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
      sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
      while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
              if (timeout == 0) {
-                     printf("%s: Reset 0x%x never completed.\n",
-                            __func__, (int)mask);
+                     log_warning("Reset %x never completed\n", (int)mask);

I think this cast can be removed too

Quoted 23 lines
drivers/mmc/sdhci.c +2 -3
                      return;
              }
              timeout--;
@@ -139,8 +138,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
      do {
              stat = sdhci_readl(host, SDHCI_INT_STATUS);
              if (stat & SDHCI_INT_ERROR) {
-                     pr_debug("%s: Error detected in status(0x%X)!\n",
-                              __func__, stat);
+                     log_debug("Error detected in status(%x)!\n", stat);
                      return -EIO;
              }
              if (!transfer_done && (stat & rdy)) {
@@ -173,7 +171,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
              if (timeout-- > 0)
                      udelay(10);
              else {
-                     printf("%s: Transfer data timeout\n", __func__);
+                     log_err("Transfer data timeout\n");
                      return -ETIMEDOUT;
              }
      } while (!(stat & SDHCI_INT_DATA_END));

drivers/mmc/sdhci.c static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, · line 233

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -232,7 +230,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 
      while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
              if (time >= cmd_timeout) {
-                     printf("%s: MMC: %d busy ", __func__, mmc_dev);
+                     log_warning("MMC: %d busy ", mmc_dev);

Maybe this should be "mmc%d busy\n"

Quoted 18 lines
drivers/mmc/sdhci.c +2 -2
                      if (2 * cmd_timeout <= SDHCI_CMD_MAX_TIMEOUT) {
                              cmd_timeout += cmd_timeout;
                              printf("timeout increasing to: %u ms.\n",
@@ -316,8 +314,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
              }
 
              if (get_timer(start) >= SDHCI_READ_STATUS_TIMEOUT) {
-                     printf("%s: Timeout for status update: %08x %08x\n",
-                            __func__, stat, mask);
+                     log_warning("Timeout for status update: %08x %08x\n",
+                                 stat, mask);
                      return -ETIMEDOUT;
              }
      } while ((stat & mask) != mask);
@@ -358,7 +356,7 @@ static int sdhci_execute_tuning(struct udevice *dev, uint opcode)
      struct mmc *mmc = mmc_get_mmc_dev(dev);
      struct sdhci_host *host = mmc->priv;
 
Quoted 4 lines

drivers/mmc/sdhci.c static int sdhci_execute_tuning(struct udevice *dev, uint opcode) · line 359

Quoted 2 lines
drivers/mmc/sdhci.c +1 -1
-     debug("%s\n", __func__);
+     log_debug("tuning\n");

I think this one should be left as-is. Or at least given something more descriptive.

I'll add sdhci in there.

Quoted 49 lines

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 381

Quoted 11 lines
drivers/mmc/sdhci.c +1 -2
      if (host->ops && host->ops->platform_execute_tuning) {
              err = host->ops->platform_execute_tuning(mmc, opcode);
@@ -380,8 +378,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
      while (sdhci_readl(host, SDHCI_PRESENT_STATE) &
                         (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)) {
              if (timeout == 0) {
-                     printf("%s: Timeout to wait cmd & data inhibit\n",
-                            __func__);
+                     log_err("Timeout to wait cmd & data inhibit\n");

Might as well fix the grammar while we're at it

log_err("Timeout waiting for cmd & data inhibit\n");

Quoted 13 lines
drivers/mmc/sdhci.c +1 -1
                      return -EBUSY;
              }
 
@@ -397,7 +394,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
      if (host->ops && host->ops->set_delay) {
              ret = host->ops->set_delay(host);
              if (ret) {
-                     printf("%s: Error while setting tap delay\n", __func__);
+                     log_err("Error while setting tap delay\n");
                      return ret;
              }
      }

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 405

Quoted 5 lines
drivers/mmc/sdhci.c +1 -1
@@ -405,7 +402,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
      if (host->ops && host->ops->config_dll) {
              ret = host->ops->config_dll(host, clock, false);
              if (ret) {
-                     printf("%s: Error while configuring dll\n", __func__);
+                     log_err("Error configuring dll\n");

To distinguish these, can we say "Error while disabling dll"

drivers/mmc/sdhci.c int sdhci_set_clock(struct mmc *mmc, unsigned int clock) · line 456

Quoted 9 lines
drivers/mmc/sdhci.c +1 -1
                      return ret;
              }
      }
@@ -456,7 +453,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
      if (host->ops && host->ops->config_dll) {
              ret = host->ops->config_dll(host, clock, true);
              if (ret) {
-                     printf("%s: Error while configuring dll\n", __func__);
+                     log_err("Error configuring dll\n");

and "Error while enabling dll"

Quoted 1 line

I know this grows .data a bit...

I'll drop the 'while' since error messages mostly assume that.

Quoted 69 lines
Quoted 69 lines
drivers/mmc/sdhci.c +7 -12
                      return ret;
              }
      }
@@ -472,8 +469,7 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
      while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
              & SDHCI_CLOCK_INT_STABLE)) {
              if (timeout == 0) {
-                     printf("%s: Internal clock never stabilised.\n",
-                            __func__);
+                     log_err("Internal clock never stabilised.\n");
                      return -EBUSY;
              }
              timeout--;
@@ -738,8 +734,7 @@ static int sdhci_init(struct mmc *mmc)
      if (host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) {
              host->align_buffer = memalign(8, 512 * 1024);
              if (!host->align_buffer) {
-                     printf("%s: Aligned buffer alloc failed!!!\n",
-                            __func__);
+                     log_err("Aligned buffer alloc failed\n");
                      return -ENOMEM;
              }
      }
@@ -881,20 +876,18 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
  #else
      caps = sdhci_readl(host, SDHCI_CAPABILITIES);
  #endif
-     debug("%s, caps: 0x%x\n", __func__, caps);
+     log_debug("caps: 0x%x\n", caps);
 
  #if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
      if ((caps & SDHCI_CAN_DO_SDMA)) {
              host->flags |= USE_SDMA;
      } else {
-             debug("%s: Your controller doesn't support SDMA!!\n",
-                   __func__);
+             log_debug("Controller doesn't support SDMA\n");
      }
  #endif
  #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
      if (!(caps & SDHCI_CAN_DO_ADMA2)) {
-             printf("%s: Your controller doesn't support ADMA!!\n",
-                    __func__);
+             log_err("Controller doesn't support ADMA\n");
              return -EINVAL;
      }
      if (!host->adma_desc_table) {
@@ -927,7 +920,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
  #else
              caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
  #endif
-             debug("%s, caps_1: 0x%x\n", __func__, caps_1);
+             log_debug("caps_1: %x\n", caps_1);
              host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
                              SDHCI_CLOCK_MUL_SHIFT;
 
@@ -953,8 +946,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
                      host->max_clk *= host->clk_mul;
      }
      if (host->max_clk == 0) {
-             printf("%s: Hardware doesn't specify base clock frequency\n",
-                    __func__);
+             log_err("Hardware doesn't specify base clock frequency\n");
              return -EINVAL;
      }
      if (f_max && (f_max < host->max_clk))
@@ -1047,7 +1039,7 @@ int add_sdhci(struct sdhci_host *host, u32 f_max, u32 f_min)
 
Quoted 8 lines

drivers/mmc/sdhci.c int add_sdhci(struct sdhci_host *host, u32 f_max, u32 f_min) · line 1045

Quoted 7 lines
drivers/mmc/sdhci.c +1 -1
      host->mmc = mmc_create(&host->cfg, host);
      if (host->mmc == NULL) {
-             printf("%s: mmc create fail!\n", __func__);
+             log_err("mmc create fail\n");
              return -ENOMEM;
      }
 

Regards,
Simon

#13 lore raw

PATCH 6/14 mmc: Use logging instead of pr_err()

In reply to Simon Glass

Use the log subsystem instead of dev, to avoid including function names in the code.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

---

 drivers/mmc/mmc.c | 49 ++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
drivers/mmc/mmc.c +25 -24
index b18dc331f78..b0105afe5d6 100644
@@ -294,7 +294,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
 		if (status & MMC_STATUS_MASK) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			pr_err("Status Error: 0x%08x\n", status);
+			log_err("Status Error: %08x\n", status);
 #endif
 			return -ECOMM;
 		}
@@ -307,7 +307,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
 	if (timeout_ms <= 0) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("Timeout waiting card ready\n");
+		log_err("Timeout waiting card ready\n");
 #endif
 		return -ETIMEDOUT;
 	}
@@ -449,7 +449,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
 	if (blkcnt > 1) {
 		if (mmc_send_stop_transmission(mmc, false)) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			pr_err("mmc fail to send stop cmd\n");
+			log_err("mmc fail to send stop cmd\n");
 #endif
 			return 0;
 		}
@@ -500,8 +500,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 
 	if ((start + blkcnt) > block_dev->lba) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
-		       start + blkcnt, block_dev->lba);
+		log_err("MMC: block number " LBAF " exceeds max(" LBAF ")\n",
+			start + blkcnt, block_dev->lba);
 #endif
 		return 0;
 	}
@@ -997,7 +997,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
 		return 0;
 
 	if (!ext_csd) {
-		pr_err("No ext_csd found!\n"); /* this should enver happen */
+		log_err("No ext_csd found!\n"); /* this should enver happen */
 		return -ENOTSUPP;
 	}
 
@@ -1109,17 +1109,17 @@ int mmc_hwpart_config(struct mmc *mmc,
 		return -EINVAL;
 
 	if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) {
-		pr_err("eMMC >= 4.4 required for enhanced user data area\n");
+		log_err("eMMC >= 4.4 required for enhanced user data area\n");
 		return -EMEDIUMTYPE;
 	}
 
 	if (!(mmc->part_support & PART_SUPPORT)) {
-		pr_err("Card does not support partitioning\n");
+		log_err("Card does not support partitioning\n");
 		return -EMEDIUMTYPE;
 	}
 
 	if (!mmc->hc_wp_grp_size) {
-		pr_err("Card does not define HC WP group size\n");
+		log_err("Card does not define HC WP group size\n");
 		return -EMEDIUMTYPE;
 	}
 
@@ -1127,8 +1127,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 	if (conf->user.enh_size) {
 		if (conf->user.enh_size % mmc->hc_wp_grp_size ||
 		    conf->user.enh_start % mmc->hc_wp_grp_size) {
-			pr_err("User data enhanced area not HC WP group "
-			       "size aligned\n");
+			log_err("User data enhanced area not HC WP group size aligned\n");
 			return -EINVAL;
 		}
 		part_attrs |= EXT_CSD_ENH_USR;
@@ -1146,8 +1145,8 @@ int mmc_hwpart_config(struct mmc *mmc,
 
 	for (pidx = 0; pidx < 4; pidx++) {
 		if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) {
-			pr_err("GP%i partition not HC WP group size "
-			       "aligned\n", pidx+1);
+			log_err("GP%i partition not HC WP group-size aligned\n",
+				pidx + 1);
 			return -EINVAL;
 		}
 		gp_size_mult[pidx] = conf->gp_part[pidx].size / mmc->hc_wp_grp_size;
@@ -1158,7 +1157,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 	}
 
 	if (part_attrs && ! (mmc->part_support & ENHNCD_SUPPORT)) {
-		pr_err("Card does not support enhanced attribute\n");
+		log_err("Card does not support enhanced attribute\n");
 		return -EMEDIUMTYPE;
 	}
 
@@ -1171,8 +1170,8 @@ int mmc_hwpart_config(struct mmc *mmc,
 		(ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+1] << 8) +
 		ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT];
 	if (tot_enh_size_mult > max_enh_size_mult) {
-		pr_err("Total enhanced size exceeds maximum (%u > %u)\n",
-		       tot_enh_size_mult, max_enh_size_mult);
+		log_err("Total enhanced size exceeds maximum (%x > %x)\n",
+			tot_enh_size_mult, max_enh_size_mult);
 		return -EMEDIUMTYPE;
 	}
 
@@ -1205,7 +1204,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 
 	if (ext_csd[EXT_CSD_PARTITION_SETTING] &
 	    EXT_CSD_PARTITION_SETTING_COMPLETED) {
-		pr_err("Card already partitioned\n");
+		log_err("Card already partitioned\n");
 		return -EPERM;
 	}
 
@@ -1876,7 +1875,7 @@ error:
 		}
 	}
 
-	pr_err("unable to select a mode\n");
+	log_err("unable to select a mode\n");
 	return -ENOTSUPP;
 }
 
@@ -2254,7 +2253,7 @@ error:
 		}
 	}
 
-	pr_err("unable to select a mode : %d\n", err);
+	log_err("unable to select a mode: %d\n", err);
 
 	return -ENOTSUPP;
 }
@@ -2921,8 +2920,10 @@ retry:
 
 		if (err) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			if (!quiet)
-				pr_err("Card did not respond to voltage select! : %d\n", err);
+			if (!quiet) {
+				log_err("Card did not respond to voltage select! : %d\n",
+					err);
+			}
 #endif
 			return -EOPNOTSUPP;
 		}
@@ -2955,7 +2956,7 @@ int mmc_start_init(struct mmc *mmc)
 						   | MMC_CAP(MMC_LEGACY) |
 						   MMC_MODE_1BIT);
 			} else {
-				pr_err("bus_mode requested is not supported\n");
+				log_err("bus_mode requested is not supported\n");
 				return -EINVAL;
 			}
 		}
@@ -2975,7 +2976,7 @@ int mmc_start_init(struct mmc *mmc)
 	if (no_card) {
 		mmc->has_init = 0;
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("MMC: no card present\n");
+		log_err("MMC: no card present\n");
 #endif
 		return -ENOMEDIUM;
 	}
@@ -3104,7 +3105,7 @@ static int mmc_probe(struct bd_info *bis)
 	uclass_foreach_dev(dev, uc) {
 		ret = device_probe(dev);
 		if (ret)
-			pr_err("%s - probe failed: %d\n", dev->name, ret);
+			log_err("%s - probe failed: %d\n", dev->name, ret);
 	}
 
 	return 0;
Signature · 1 line
2.34.1
Reviewed-by on v1 6/14
#14 lore raw

Re: [PATCH 06/14] mmc: Use logging instead of pr_err()

Quoted 183 lines · Simon Glass

Use the log subsystem instead of dev, to avoid including function names in the code.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

---

  drivers/mmc/mmc.c | 49 ++++++++++++++++++++++++-----------------------
  1 file changed, 25 insertions(+), 24 deletions(-)
drivers/mmc/mmc.c +24 -23
index b18dc331f78..b0105afe5d6 100644
@@ -294,7 +294,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
  		if (status & MMC_STATUS_MASK) {
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			pr_err("Status Error: 0x%08x\n", status);
+			log_err("Status Error: %08x\n", status);
  #endif
  			return -ECOMM;
  		}
@@ -307,7 +307,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
  	if (timeout_ms <= 0) {
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("Timeout waiting card ready\n");
+		log_err("Timeout waiting card ready\n");
  #endif
  		return -ETIMEDOUT;
  	}
@@ -449,7 +449,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
  	if (blkcnt > 1) {
  		if (mmc_send_stop_transmission(mmc, false)) {
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			pr_err("mmc fail to send stop cmd\n");
+			log_err("mmc fail to send stop cmd\n");
  #endif
  			return 0;
  		}
@@ -500,8 +500,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 
  	if ((start + blkcnt) > block_dev->lba) {
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
-		       start + blkcnt, block_dev->lba);
+		log_err("MMC: block number " LBAF " exceeds max(" LBAF ")\n",
+			start + blkcnt, block_dev->lba);
  #endif
  		return 0;
  	}
@@ -997,7 +997,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
  		return 0;
 
  	if (!ext_csd) {
-		pr_err("No ext_csd found!\n"); /* this should enver happen */
+		log_err("No ext_csd found!\n"); /* this should enver happen */
  		return -ENOTSUPP;
  	}
 
@@ -1109,17 +1109,17 @@ int mmc_hwpart_config(struct mmc *mmc,
  		return -EINVAL;
 
  	if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) {
-		pr_err("eMMC >= 4.4 required for enhanced user data area\n");
+		log_err("eMMC >= 4.4 required for enhanced user data area\n");
  		return -EMEDIUMTYPE;
  	}
 
  	if (!(mmc->part_support & PART_SUPPORT)) {
-		pr_err("Card does not support partitioning\n");
+		log_err("Card does not support partitioning\n");
  		return -EMEDIUMTYPE;
  	}
 
  	if (!mmc->hc_wp_grp_size) {
-		pr_err("Card does not define HC WP group size\n");
+		log_err("Card does not define HC WP group size\n");
  		return -EMEDIUMTYPE;
  	}
 
@@ -1127,8 +1127,7 @@ int mmc_hwpart_config(struct mmc *mmc,
  	if (conf->user.enh_size) {
  		if (conf->user.enh_size % mmc->hc_wp_grp_size ||
  		    conf->user.enh_start % mmc->hc_wp_grp_size) {
-			pr_err("User data enhanced area not HC WP group "
-			       "size aligned\n");
+			log_err("User data enhanced area not HC WP group size aligned\n");
  			return -EINVAL;
  		}
  		part_attrs |= EXT_CSD_ENH_USR;
@@ -1146,8 +1145,8 @@ int mmc_hwpart_config(struct mmc *mmc,
 
  	for (pidx = 0; pidx < 4; pidx++) {
  		if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) {
-			pr_err("GP%i partition not HC WP group size "
-			       "aligned\n", pidx+1);
+			log_err("GP%i partition not HC WP group-size aligned\n",
+				pidx + 1);
  			return -EINVAL;
  		}
  		gp_size_mult[pidx] = conf->gp_part[pidx].size / mmc->hc_wp_grp_size;
@@ -1158,7 +1157,7 @@ int mmc_hwpart_config(struct mmc *mmc,
  	}
 
  	if (part_attrs && ! (mmc->part_support & ENHNCD_SUPPORT)) {
-		pr_err("Card does not support enhanced attribute\n");
+		log_err("Card does not support enhanced attribute\n");
  		return -EMEDIUMTYPE;
  	}
 
@@ -1171,8 +1170,8 @@ int mmc_hwpart_config(struct mmc *mmc,
  		(ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+1] << 8) +
  		ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT];
  	if (tot_enh_size_mult > max_enh_size_mult) {
-		pr_err("Total enhanced size exceeds maximum (%u > %u)\n",
-		       tot_enh_size_mult, max_enh_size_mult);
+		log_err("Total enhanced size exceeds maximum (%x > %x)\n",
+			tot_enh_size_mult, max_enh_size_mult);
  		return -EMEDIUMTYPE;
  	}
 
@@ -1205,7 +1204,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 
  	if (ext_csd[EXT_CSD_PARTITION_SETTING] &
  	    EXT_CSD_PARTITION_SETTING_COMPLETED) {
-		pr_err("Card already partitioned\n");
+		log_err("Card already partitioned\n");
  		return -EPERM;
  	}
 
@@ -1876,7 +1875,7 @@ error:
  		}
  	}
 
-	pr_err("unable to select a mode\n");
+	log_err("unable to select a mode\n");
  	return -ENOTSUPP;
  }
 
@@ -2254,7 +2253,7 @@ error:
  		}
  	}
 
-	pr_err("unable to select a mode : %d\n", err);
+	log_err("unable to select a mode: %d\n", err);
 
  	return -ENOTSUPP;
  }
@@ -2921,8 +2920,10 @@ retry:
 
  		if (err) {
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-			if (!quiet)
-				pr_err("Card did not respond to voltage select! : %d\n", err);
+			if (!quiet) {
+				log_err("Card did not respond to voltage select! : %d\n",
+					err);
+			}
  #endif
  			return -EOPNOTSUPP;
  		}
@@ -2955,7 +2956,7 @@ int mmc_start_init(struct mmc *mmc)
  						   | MMC_CAP(MMC_LEGACY) |
  						   MMC_MODE_1BIT);
  			} else {
-				pr_err("bus_mode requested is not supported\n");
+				log_err("bus_mode requested is not supported\n");
  				return -EINVAL;
  			}
  		}
@@ -2975,7 +2976,7 @@ int mmc_start_init(struct mmc *mmc)
  	if (no_card) {
  		mmc->has_init = 0;
  #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		pr_err("MMC: no card present\n");
+		log_err("MMC: no card present\n");
  #endif
  		return -ENOMEDIUM;
  	}

drivers/mmc/mmc.c static int mmc_probe(struct bd_info *bis) · line 3111

Quoted 8 lines
drivers/mmc/mmc.c +1 -1
@@ -3104,7 +3105,7 @@ static int mmc_probe(struct bd_info *bis)
  	uclass_foreach_dev(dev, uc) {
  		ret = device_probe(dev);
  		if (ret)
-			pr_err("%s - probe failed: %d\n", dev->name, ret);
+			log_err("%s - probe failed: %d\n", dev->name, ret);
  	}
 
  	return 0;
#15 lore raw

PATCH 7/14 log: Avoid including function names by default

In reply to Simon Glass

Unless function names are requested, the logging system should not compile these into the code. Adjust the macros to handle this.

Enable CONFIG_LOGF_FUNC logging for sandbox since the tests expect the function names to be included. Fix up the pinmux test which checks a logging statement.

---

 common/log_console.c      |  4 ++--
 configs/sandbox_defconfig |  1 +
 include/log.h             | 18 ++++++++++++------
 test/cmd/pinmux.c         |  8 +++++++-
 test/log/log_test.c       |  4 ++--
 5 files changed, 24 insertions(+), 11 deletions(-)
common/log_console.c +2 -2
index c27101b8fe2..9376baad664 100644
@@ -38,10 +38,10 @@ static int log_console_emit(struct log_device *ldev, struct log_rec *rec)
 			printf("%d-", rec->line);
 		if (fmt & BIT(LOGF_FUNC)) {
 			if (CONFIG_IS_ENABLED(USE_TINY_PRINTF)) {
-				printf("%s()", rec->func);
+				printf("%s()", rec->func ?: "?");
 			} else {
 				printf("%*s()", CONFIG_LOGF_FUNC_PAD,
-				       rec->func);
+				       rec->func ?: "?");
 			}
 		}
 	}
configs/sandbox_defconfig +1 -0
index e2db66d4a25..d43d92d0cf2 100644
@@ -38,6 +38,7 @@ CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_LOG=y
 CONFIG_LOG_MAX_LEVEL=9
 CONFIG_LOG_DEFAULT_LEVEL=6
+CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_STACKPROTECTOR=y
 CONFIG_ANDROID_AB=y
include/log.h +12 -6
index fc0d5984472..67b6fd70050 100644
@@ -125,7 +125,7 @@ static inline int log_uc_cat(enum uclass_id id)
  * @level: Level of log record (indicating its severity)
  * @file: File name of file where log record was generated
  * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
  * @fmt: printf() format string for log record
  * @...: Optional parameters, according to the format string @fmt
  * Return: 0 if log record was emitted, -ve on error
@@ -141,7 +141,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
  * @level: Level of log record (indicating its severity)
  * @file: File name of file where log record was generated
  * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
  * @addr:	Starting address to display at start of line
  * @data:	pointer to data buffer
  * @width:	data value width.  May be 1, 2, or 4.
@@ -193,6 +193,12 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 #define _LOG_DEBUG	0
 #endif
 
+#ifdef CONFIG_LOGF_FUNC
+#define _log_func	__func__
+#else
+#define _log_func	NULL
+#endif
+
 #if CONFIG_IS_ENABLED(LOG)
 
 /* Emit a log record if the level is less that the maximum */
@@ -201,7 +207,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 	if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
 		_log((enum log_category_t)(_cat), \
 		     (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-		     __LINE__, __func__, \
+		     __LINE__, _log_func, \
 		      pr_fmt(_fmt), ##_args); \
 	})
 
@@ -211,7 +217,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 	if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
 		_log_buffer((enum log_category_t)(_cat), \
 			    (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-			    __LINE__, __func__, _addr, _data, \
+			    __LINE__, _log_func, _addr, _data, \
 			    _width, _count, _linelen); \
 	})
 #else
@@ -302,7 +308,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
  */
 #define assert(x) \
 	({ if (!(x) && _DEBUG) \
-		__assert_fail(#x, __FILE__, __LINE__, __func__); })
+		__assert_fail(#x, __FILE__, __LINE__, _log_func); })
 
 /*
  * This one actually gets compiled in even without DEBUG. It doesn't include the
@@ -314,7 +320,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
 #define assert_noisy(x) \
 	({ bool _val = (x); \
 	if (!_val) \
-		__assert_fail(#x, "?", __LINE__, __func__); \
+		__assert_fail(#x, "?", __LINE__, _log_func); \
 	_val; \
 	})
 
test/cmd/pinmux.c +7 -1
index 4253baa5646..7ab7004b684 100644
@@ -30,7 +30,13 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
 
 	console_record_reset();
 	run_command("pinmux status P9", 0);
-	ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width");
+	if (IS_ENABLED(CONFIG_LOGF_FUNC)) {
+		ut_assert_nextlinen(
+			"   single_of_to_plat() single-pinctrl pinctrl-single-no-width: missing register width");
+	} else {
+		ut_assert_nextlinen(
+			"single-pinctrl pinctrl-single-no-width: missing register width");
+	}
 	ut_assert_nextlinen("P9 not found");
 	ut_assert_console_end();
 
test/log/log_test.c +2 -2
index 855353a9c40..d756b96dbac 100644
@@ -452,8 +452,8 @@ int log_test_buffer(struct unit_test_state *uts)
 	/* This one should product no output due to the debug level */
 	log_buffer(LOGC_BOOT, LOGL_DEBUG, 0, buf, 1, 0x12, 0);
 
-	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
-	ut_assert_nextline("00000010: 10 00                                            ..");
+	ut_assert_nextline("     log_test_buffer() 00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
+	ut_assert_nextline("     log_test_buffer() 00000010: 10 00                                            ..");
 	ut_assert_console_end();
 	free(buf);
 
Signature · 1 line
2.34.1
#16 lore raw

Re: [PATCH 07/14] log: Avoid including function names by default

Quoted 100 lines · Simon Glass

Unless function names are requested, the logging system should not compile these into the code. Adjust the macros to handle this.

Enable CONFIG_LOGF_FUNC logging for sandbox since the tests expect the function names to be included. Fix up the pinmux test which checks a logging statement.

---

  common/log_console.c      |  4 ++--
  configs/sandbox_defconfig |  1 +
  include/log.h             | 18 ++++++++++++------
  test/cmd/pinmux.c         |  8 +++++++-
  test/log/log_test.c       |  4 ++--
  5 files changed, 24 insertions(+), 11 deletions(-)
common/log_console.c +2 -2
index c27101b8fe2..9376baad664 100644
@@ -38,10 +38,10 @@ static int log_console_emit(struct log_device *ldev, struct log_rec *rec)
  			printf("%d-", rec->line);
  		if (fmt & BIT(LOGF_FUNC)) {
  			if (CONFIG_IS_ENABLED(USE_TINY_PRINTF)) {
-				printf("%s()", rec->func);
+				printf("%s()", rec->func ?: "?");
  			} else {
  				printf("%*s()", CONFIG_LOGF_FUNC_PAD,
-				       rec->func);
+				       rec->func ?: "?");
  			}
  		}
  	}
configs/sandbox_defconfig +1 -0
index e2db66d4a25..d43d92d0cf2 100644
@@ -38,6 +38,7 @@ CONFIG_PRE_CONSOLE_BUFFER=y
  CONFIG_LOG=y
  CONFIG_LOG_MAX_LEVEL=9
  CONFIG_LOG_DEFAULT_LEVEL=6
+CONFIG_LOGF_FUNC=y
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_STACKPROTECTOR=y
  CONFIG_ANDROID_AB=y
include/log.h +10 -4
index fc0d5984472..67b6fd70050 100644
@@ -125,7 +125,7 @@ static inline int log_uc_cat(enum uclass_id id)
   * @level: Level of log record (indicating its severity)
   * @file: File name of file where log record was generated
   * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
   * @fmt: printf() format string for log record
   * @...: Optional parameters, according to the format string @fmt
   * Return: 0 if log record was emitted, -ve on error
@@ -141,7 +141,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
   * @level: Level of log record (indicating its severity)
   * @file: File name of file where log record was generated
   * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
   * @addr:	Starting address to display at start of line
   * @data:	pointer to data buffer
   * @width:	data value width.  May be 1, 2, or 4.
@@ -193,6 +193,12 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
  #define _LOG_DEBUG	0
  #endif
 
+#ifdef CONFIG_LOGF_FUNC
+#define _log_func	__func__
+#else
+#define _log_func	NULL
+#endif
+
  #if CONFIG_IS_ENABLED(LOG)
 
  /* Emit a log record if the level is less that the maximum */
@@ -201,7 +207,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
  	if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
  		_log((enum log_category_t)(_cat), \
  		     (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-		     __LINE__, __func__, \
+		     __LINE__, _log_func, \
  		      pr_fmt(_fmt), ##_args); \
  	})
 
@@ -211,7 +217,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
  	if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
  		_log_buffer((enum log_category_t)(_cat), \
  			    (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-			    __LINE__, __func__, _addr, _data, \
+			    __LINE__, _log_func, _addr, _data, \
  			    _width, _count, _linelen); \
  	})
  #else

include/log.h void __assert_fail(const char *assertion, const char *file, unsigned int line, · line 311

Quoted 5 lines
include/log.h +1 -1
@@ -302,7 +308,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
   */
  #define assert(x) \
  	({ if (!(x) && _DEBUG) \
-		__assert_fail(#x, __FILE__, __LINE__, __func__); })
+		__assert_fail(#x, __FILE__, __LINE__, _log_func); })

Can we keep this one in? It's only compiled for debug and we are including file/line anyway.

Quoted 35 lines
include/log.h +1 -1
  /*
   * This one actually gets compiled in even without DEBUG. It doesn't include the
@@ -314,7 +320,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
  #define assert_noisy(x) \
  	({ bool _val = (x); \
  	if (!_val) \
-		__assert_fail(#x, "?", __LINE__, __func__); \
+		__assert_fail(#x, "?", __LINE__, _log_func); \
  	_val; \
  	})
 
test/cmd/pinmux.c +7 -1
index 4253baa5646..7ab7004b684 100644
@@ -30,7 +30,13 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
 
  	console_record_reset();
  	run_command("pinmux status P9", 0);
-	ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width");
+	if (IS_ENABLED(CONFIG_LOGF_FUNC)) {
+		ut_assert_nextlinen(
+			"   single_of_to_plat() single-pinctrl pinctrl-single-no-width: missing register width");
+	} else {
+		ut_assert_nextlinen(
+			"single-pinctrl pinctrl-single-no-width: missing register width");
+	}
  	ut_assert_nextlinen("P9 not found");
  	ut_assert_console_end();
 
test/log/log_test.c +0 -0
index 855353a9c40..d756b96dbac 100644

test/log/log_test.c int log_test_buffer(struct unit_test_state *uts) · line 459

Quoted 10 lines
test/log/log_test.c +2 -2
@@ -452,8 +452,8 @@ int log_test_buffer(struct unit_test_state *uts)
  	/* This one should product no output due to the debug level */
  	log_buffer(LOGC_BOOT, LOGL_DEBUG, 0, buf, 1, 0x12, 0);
 
-	ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
-	ut_assert_nextline("00000010: 10 00                                            ..");
+	ut_assert_nextline("     log_test_buffer() 00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff  ..\"3DUfw........");
+	ut_assert_nextline("     log_test_buffer() 00000010: 10 00                                            ..");
  	ut_assert_console_end();
  	free(buf);
 

Anyway, the rest looks fine. This probably breaks the use case of someone turning on function names at runtime, so maybe we will need to split this config if someone cares.

--Sean

#17 lore raw

PATCH 8/14 spl: mmc: Drop checks for CONFIG_SPL_LIBCOMMON_SUPPORT

In reply to Simon Glass

This check is not needed now, since printf() resolved to nothing if not available. Drop the #ifdefs

---

 common/spl/spl_mmc.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
common/spl/spl_mmc.c +1 -19
index ccab0be4be2..ddc85aaeda7 100644
@@ -51,9 +51,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 	load.read = h_spl_load_read;
 	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
 	if (ret) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		puts("mmc_load_image_raw_sector: mmc block read error\n");
-#endif
 		return -1;
 	}
 
@@ -70,9 +68,7 @@ static int spl_mmc_get_device_index(u32 boot_device)
 		return 1;
 	}
 
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	printf("spl: unsupported mmc boot device.\n");
-#endif
 
 	return -ENODEV;
 }
@@ -91,18 +87,14 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
 	err = mmc_initialize(NULL);
 #endif /* DM_MMC */
 	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		printf("spl: could not initialize mmc. error: %d\n", err);
-#endif
 		return err;
 	}
 	*mmcp = find_mmc_device(mmc_dev);
 	err = *mmcp ? 0 : -ENODEV;
 	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		printf("spl: could not find mmc device %d. error: %d\n",
 		       mmc_dev, err);
-#endif
 		return err;
 	}
 
@@ -135,10 +127,8 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 
 	err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
 	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		puts("spl: partition error\n");
-#endif
-		return -1;
+		return -err;
 	}
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
@@ -164,9 +154,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 		CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
 		(void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
 	if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		puts("mmc_load_image_raw_os: mmc block read error\n");
-#endif
 		return -1;
 	}
 #endif	/* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
@@ -368,9 +356,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 		err = mmc_init(mmc);
 		if (err) {
 			mmc = NULL;
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 			printf("spl: mmc init failed with error: %d\n", err);
-#endif
 			return err;
 		}
 	}
@@ -387,9 +373,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
 
 		if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 			puts("spl: mmc partition switch failed\n");
-#endif
 			return err;
 		}
 		/* Fall through */
@@ -428,10 +412,8 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 
 		break;
 #endif
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	default:
 		puts("spl: mmc: wrong boot mode\n");
-#endif
 	}
 
 	return err;
Signature · 1 line
2.34.1
Reviewed-by on v1 8/14
#18 lore raw

Re: [PATCH 08/14] spl: mmc: Drop checks for CONFIG_SPL_LIBCOMMON_SUPPORT

Quoted 95 lines · Simon Glass

This check is not needed now, since printf() resolved to nothing if not available. Drop the #ifdefs

---

  common/spl/spl_mmc.c | 20 +-------------------
  1 file changed, 1 insertion(+), 19 deletions(-)
common/spl/spl_mmc.c +1 -17
index ccab0be4be2..ddc85aaeda7 100644
@@ -51,9 +51,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
  	load.read = h_spl_load_read;
  	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
  	if (ret) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  		puts("mmc_load_image_raw_sector: mmc block read error\n");
-#endif
  		return -1;
  	}
 
@@ -70,9 +68,7 @@ static int spl_mmc_get_device_index(u32 boot_device)
  		return 1;
  	}
 
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  	printf("spl: unsupported mmc boot device.\n");
-#endif
 
  	return -ENODEV;
  }
@@ -91,18 +87,14 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
  	err = mmc_initialize(NULL);
  #endif /* DM_MMC */
  	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  		printf("spl: could not initialize mmc. error: %d\n", err);
-#endif
  		return err;
  	}
  	*mmcp = find_mmc_device(mmc_dev);
  	err = *mmcp ? 0 : -ENODEV;
  	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  		printf("spl: could not find mmc device %d. error: %d\n",
  		       mmc_dev, err);
-#endif
  		return err;
  	}
 
@@ -135,10 +127,8 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 
  	err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
  	if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  		puts("spl: partition error\n");
-#endif
-		return -1;
+		return -err;
  	}
 
  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
@@ -164,9 +154,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
  		CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
  		(void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
  	if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  		puts("mmc_load_image_raw_os: mmc block read error\n");
-#endif
  		return -1;
  	}
  #endif	/* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
@@ -368,9 +356,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
  		err = mmc_init(mmc);
  		if (err) {
  			mmc = NULL;
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  			printf("spl: mmc init failed with error: %d\n", err);
-#endif
  			return err;
  		}
  	}
@@ -387,9 +373,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
  			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
 
  		if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  			puts("spl: mmc partition switch failed\n");
-#endif
  			return err;
  		}
  		/* Fall through */

common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info *spl_image, · line 419

Quoted 10 lines
common/spl/spl_mmc.c +0 -2
@@ -428,10 +412,8 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 
  		break;
  #endif
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  	default:
  		puts("spl: mmc: wrong boot mode\n");
-#endif
  	}
 
  	return err;
#19 lore raw

PATCH 9/14 spl: mmc: Handle error codes consistently

In reply to Simon Glass

Use 'ret' as the return code, since it may not be an error and this is the common name in U-Boot. Make sure to return the error code when given, rather than transforming it into -1 (-EPERM).

---

 common/spl/spl_mmc.c | 129 ++++++++++++++++++++++---------------------
 1 file changed, 65 insertions(+), 64 deletions(-)
common/spl/spl_mmc.c +65 -64
index ddc85aaeda7..70e376c0ed8 100644
@@ -52,7 +52,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
 	if (ret) {
 		puts("mmc_load_image_raw_sector: mmc block read error\n");
-		return -1;
+		return ret;
 	}
 
 	return 0;
@@ -75,27 +75,27 @@ static int spl_mmc_get_device_index(u32 boot_device)
 
 static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
 {
-	int err, mmc_dev;
+	int ret, mmc_dev;
 
 	mmc_dev = spl_mmc_get_device_index(boot_device);
 	if (mmc_dev < 0)
 		return mmc_dev;
 
 #if CONFIG_IS_ENABLED(DM_MMC)
-	err = mmc_init_device(mmc_dev);
+	ret = mmc_init_device(mmc_dev);
 #else
-	err = mmc_initialize(NULL);
+	ret = mmc_initialize(NULL);
 #endif /* DM_MMC */
-	if (err) {
-		printf("spl: could not initialize mmc. error: %d\n", err);
-		return err;
+	if (ret) {
+		printf("spl: could not initialize mmc. error: %d\n", ret);
+		return ret;
 	}
 	*mmcp = find_mmc_device(mmc_dev);
-	err = *mmcp ? 0 : -ENODEV;
-	if (err) {
+	ret = *mmcp ? 0 : -ENODEV;
+	if (ret) {
 		printf("spl: could not find mmc device %d. error: %d\n",
-		       mmc_dev, err);
-		return err;
+		       mmc_dev, ret);
+		return ret;
 	}
 
 	return 0;
@@ -108,14 +108,14 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 					unsigned long sector)
 {
 	struct disk_partition info;
-	int err;
+	int ret;
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
 	int type_part;
 	/* Only support MBR so DOS_ENTRY_NUMBERS */
 	for (type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
-		err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
-		if (err)
+		ret = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
+		if (ret)
 			continue;
 		if (info.sys_ind ==
 			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE) {
@@ -125,10 +125,10 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 	}
 #endif
 
-	err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
-	if (err) {
+	ret = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
+	if (ret) {
 		puts("spl: partition error\n");
-		return -err;
+		return ret;
 	}
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
@@ -155,7 +155,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 		(void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
 	if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
 		puts("mmc_load_image_raw_os: mmc block read error\n");
-		return -1;
+		return -EIO;
 	}
 #endif	/* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
 
@@ -193,7 +193,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
 			      struct mmc *mmc,
 			      const char *filename)
 {
-	int err = -ENOSYS;
+	int ret = -ENOSYS;
 
 	__maybe_unused int partition = CONFIG_SYS_MMCSD_FS_BOOT_PARTITION;
 
@@ -202,8 +202,8 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
 		struct disk_partition info;
 		debug("Checking for the first MBR bootable partition\n");
 		for (int type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
-			err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
-			if (err)
+			ret = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
+			if (ret)
 				continue;
 			debug("Partition %d is of type %d and bootable=%d\n", type_part, info.sys_ind, info.bootable);
 			if (info.bootable != 0) {
@@ -221,40 +221,40 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
 
 #ifdef CONFIG_SPL_FS_FAT
 	if (!spl_start_uboot()) {
-		err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
-			partition);
-		if (!err)
-			return err;
+		ret = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
+					    partition);
+		if (!ret)
+			return ret;
 	}
 #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-	err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
+	ret = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
 				 partition,
 				 filename);
-	if (!err)
-		return err;
+	if (!ret)
+		return ret;
 #endif
 #endif
 #ifdef CONFIG_SPL_FS_EXT4
 	if (!spl_start_uboot()) {
-		err = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
-			partition);
-		if (!err)
-			return err;
+		ret = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
+					    partition);
+		if (!ret)
+			return ret;
 	}
 #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-	err = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
+	ret = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
 				 partition,
 				 filename);
-	if (!err)
-		return err;
+	if (!ret)
+		return ret;
 #endif
 #endif
 
 #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
-	err = -ENOENT;
+	ret = -ENOENT;
 #endif
 
-	return err;
+	return ret;
 }
 #endif
 
@@ -342,73 +342,74 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 		 unsigned long raw_sect)
 {
 	u32 boot_mode;
-	int err = 0;
+	int ret = 0;
 	__maybe_unused int part = 0;
 	int mmc_dev;
 
 	/* Perform peripheral init only once for an mmc device */
 	mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
 	if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
-		err = spl_mmc_find_device(&mmc, bootdev->boot_device);
-		if (err)
-			return err;
+		ret = spl_mmc_find_device(&mmc, bootdev->boot_device);
+		if (ret)
+			return ret;
 
-		err = mmc_init(mmc);
-		if (err) {
+		ret = mmc_init(mmc);
+		if (ret) {
 			mmc = NULL;
-			printf("spl: mmc init failed with error: %d\n", err);
-			return err;
+			printf("spl: mmc init failed with error: %d\n", ret);
+			return ret;
 		}
 	}
 
 	boot_mode = spl_mmc_boot_mode(mmc, bootdev->boot_device);
-	err = -EINVAL;
+	ret = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
 		part = spl_mmc_emmc_boot_partition(mmc);
 
 		if (CONFIG_IS_ENABLED(MMC_TINY))
-			err = mmc_switch_part(mmc, part);
+			ret = mmc_switch_part(mmc, part);
 		else
-			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+			ret = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
 
-		if (err) {
+		if (ret) {
 			puts("spl: mmc partition switch failed\n");
-			return err;
+			return ret;
 		}
 		/* Fall through */
 	case MMCSD_MODE_RAW:
 		debug("spl: mmc boot mode: raw\n");
 
 		if (!spl_start_uboot()) {
-			err = mmc_load_image_raw_os(spl_image, bootdev, mmc);
-			if (!err)
-				return err;
+			ret = mmc_load_image_raw_os(spl_image, bootdev, mmc);
+			if (!ret)
+				return ret;
 		}
 
 		raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-		err = mmc_load_image_raw_partition(spl_image, bootdev,
+		ret = mmc_load_image_raw_partition(spl_image, bootdev,
 						   mmc, raw_part,
 						   raw_sect);
-		if (!err)
-			return err;
+		if (!ret)
+			return ret;
 #endif
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
-		err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
-				raw_sect + spl_mmc_raw_uboot_offset(part));
-		if (!err)
-			return err;
+		ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
+						raw_sect +
+						spl_mmc_raw_uboot_offset(part));
+		if (!ret)
+			return ret;
 #endif
 		/* If RAW mode fails, try FS mode. */
 #ifdef CONFIG_SYS_MMCSD_FS_BOOT
 	case MMCSD_MODE_FS:
 		debug("spl: mmc boot mode: fs\n");
 
-		err = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename);
-		if (!err)
-			return err;
+		ret = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename);
+		if (!ret)
+			return ret;
 
 		break;
 #endif
@@ -416,7 +417,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 		puts("spl: mmc: wrong boot mode\n");
 	}
 
-	return err;
+	return ret;
 }
 
 int spl_mmc_load_image(struct spl_image_info *spl_image,
Signature · 1 line
2.34.1
#20 lore raw

Re: [PATCH 09/14] spl: mmc: Handle error codes consistently

Quoted 3 lines · Simon Glass

Use 'ret' as the return code, since it may not be an error and this is the common name in U-Boot. Make sure to return the error code when given, rather than transforming it into -1 (-EPERM).

Does this transformation affect code size?

Quoted 120 lines

---

  common/spl/spl_mmc.c | 129 ++++++++++++++++++++++---------------------
  1 file changed, 65 insertions(+), 64 deletions(-)
common/spl/spl_mmc.c +21 -21
index ddc85aaeda7..70e376c0ed8 100644
@@ -52,7 +52,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
  	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
  	if (ret) {
  		puts("mmc_load_image_raw_sector: mmc block read error\n");
-		return -1;
+		return ret;
  	}
 
  	return 0;
@@ -75,27 +75,27 @@ static int spl_mmc_get_device_index(u32 boot_device)
 
  static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
  {
-	int err, mmc_dev;
+	int ret, mmc_dev;
 
  	mmc_dev = spl_mmc_get_device_index(boot_device);
  	if (mmc_dev < 0)
  		return mmc_dev;
 
  #if CONFIG_IS_ENABLED(DM_MMC)
-	err = mmc_init_device(mmc_dev);
+	ret = mmc_init_device(mmc_dev);
  #else
-	err = mmc_initialize(NULL);
+	ret = mmc_initialize(NULL);
  #endif /* DM_MMC */
-	if (err) {
-		printf("spl: could not initialize mmc. error: %d\n", err);
-		return err;
+	if (ret) {
+		printf("spl: could not initialize mmc. error: %d\n", ret);
+		return ret;
  	}
  	*mmcp = find_mmc_device(mmc_dev);
-	err = *mmcp ? 0 : -ENODEV;
-	if (err) {
+	ret = *mmcp ? 0 : -ENODEV;
+	if (ret) {
  		printf("spl: could not find mmc device %d. error: %d\n",
-		       mmc_dev, err);
-		return err;
+		       mmc_dev, ret);
+		return ret;
  	}
 
  	return 0;
@@ -108,14 +108,14 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
  					unsigned long sector)
  {
  	struct disk_partition info;
-	int err;
+	int ret;
 
  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
  	int type_part;
  	/* Only support MBR so DOS_ENTRY_NUMBERS */
  	for (type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
-		err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
-		if (err)
+		ret = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
+		if (ret)
  			continue;
  		if (info.sys_ind ==
  			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE) {
@@ -125,10 +125,10 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
  	}
  #endif
 
-	err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
-	if (err) {
+	ret = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
+	if (ret) {
  		puts("spl: partition error\n");
-		return -err;
+		return ret;
  	}
 
  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
@@ -155,7 +155,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
  		(void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
  	if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
  		puts("mmc_load_image_raw_os: mmc block read error\n");
-		return -1;
+		return -EIO;
  	}
  #endif	/* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
 
@@ -193,7 +193,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
  			      struct mmc *mmc,
  			      const char *filename)
  {
-	int err = -ENOSYS;
+	int ret = -ENOSYS;
 
  	__maybe_unused int partition = CONFIG_SYS_MMCSD_FS_BOOT_PARTITION;
 
@@ -202,8 +202,8 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
  		struct disk_partition info;
  		debug("Checking for the first MBR bootable partition\n");
  		for (int type_part = 1; type_part <= DOS_ENTRY_NUMBERS; type_part++) {
-			err = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
-			if (err)
+			ret = part_get_info(mmc_get_blk_desc(mmc), type_part, &info);
+			if (ret)
  				continue;
  			debug("Partition %d is of type %d and bootable=%d\n", type_part, info.sys_ind, info.bootable);
  			if (info.bootable != 0) {
@@ -221,40 +221,40 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
 

common/spl/spl_mmc.c static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, · line 227

Quoted 10 lines
common/spl/spl_mmc.c +4 -4
  #ifdef CONFIG_SPL_FS_FAT
  	if (!spl_start_uboot()) {
-		err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
-			partition);
-		if (!err)
-			return err;
+		ret = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
+					    partition);
+		if (!ret)
+			return ret;

Should be return 0 for clarity. And the same for the other instances of this pattern.

Quoted 155 lines
common/spl/spl_mmc.c +40 -39
  	}
  #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-	err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
+	ret = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc),
  				 partition,
  				 filename);
-	if (!err)
-		return err;
+	if (!ret)
+		return ret;
  #endif
  #endif
  #ifdef CONFIG_SPL_FS_EXT4
  	if (!spl_start_uboot()) {
-		err = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
-			partition);
-		if (!err)
-			return err;
+		ret = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc),
+					    partition);
+		if (!ret)
+			return ret;
  	}
  #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
-	err = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
+	ret = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc),
  				 partition,
  				 filename);
-	if (!err)
-		return err;
+	if (!ret)
+		return ret;
  #endif
  #endif
 
  #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
-	err = -ENOENT;
+	ret = -ENOENT;
  #endif
 
-	return err;
+	return ret;
  }
  #endif
 
@@ -342,73 +342,74 @@ int spl_mmc_load(struct spl_image_info *spl_image,
  		 unsigned long raw_sect)
  {
  	u32 boot_mode;
-	int err = 0;
+	int ret = 0;
  	__maybe_unused int part = 0;
  	int mmc_dev;
 
  	/* Perform peripheral init only once for an mmc device */
  	mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
  	if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
-		err = spl_mmc_find_device(&mmc, bootdev->boot_device);
-		if (err)
-			return err;
+		ret = spl_mmc_find_device(&mmc, bootdev->boot_device);
+		if (ret)
+			return ret;
 
-		err = mmc_init(mmc);
-		if (err) {
+		ret = mmc_init(mmc);
+		if (ret) {
  			mmc = NULL;
-			printf("spl: mmc init failed with error: %d\n", err);
-			return err;
+			printf("spl: mmc init failed with error: %d\n", ret);
+			return ret;
  		}
  	}
 
  	boot_mode = spl_mmc_boot_mode(mmc, bootdev->boot_device);
-	err = -EINVAL;
+	ret = -EINVAL;
  	switch (boot_mode) {
  	case MMCSD_MODE_EMMCBOOT:
  		part = spl_mmc_emmc_boot_partition(mmc);
 
  		if (CONFIG_IS_ENABLED(MMC_TINY))
-			err = mmc_switch_part(mmc, part);
+			ret = mmc_switch_part(mmc, part);
  		else
-			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+			ret = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
 
-		if (err) {
+		if (ret) {
  			puts("spl: mmc partition switch failed\n");
-			return err;
+			return ret;
  		}
  		/* Fall through */
  	case MMCSD_MODE_RAW:
  		debug("spl: mmc boot mode: raw\n");
 
  		if (!spl_start_uboot()) {
-			err = mmc_load_image_raw_os(spl_image, bootdev, mmc);
-			if (!err)
-				return err;
+			ret = mmc_load_image_raw_os(spl_image, bootdev, mmc);
+			if (!ret)
+				return ret;
  		}
 
  		raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
 
  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-		err = mmc_load_image_raw_partition(spl_image, bootdev,
+		ret = mmc_load_image_raw_partition(spl_image, bootdev,
  						   mmc, raw_part,
  						   raw_sect);
-		if (!err)
-			return err;
+		if (!ret)
+			return ret;
  #endif
  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
-		err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
-				raw_sect + spl_mmc_raw_uboot_offset(part));
-		if (!err)
-			return err;
+		ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
+						raw_sect +
+						spl_mmc_raw_uboot_offset(part));
+		if (!ret)
+			return ret;
  #endif
  		/* If RAW mode fails, try FS mode. */
  #ifdef CONFIG_SYS_MMCSD_FS_BOOT
  	case MMCSD_MODE_FS:
  		debug("spl: mmc boot mode: fs\n");
 
-		err = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename);
-		if (!err)
-			return err;
+		ret = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename);
+		if (!ret)
+			return ret;
 
  		break;
  #endif
@@ -416,7 +417,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
  		puts("spl: mmc: wrong boot mode\n");
  	}
 
-	return err;
+	return ret;
  }
 
  int spl_mmc_load_image(struct spl_image_info *spl_image,
#21 lore raw

Re: [PATCH 09/14] spl: mmc: Handle error codes consistently

Hi Sean,

Quoted 7 lines · Sean Anderson
Quoted 3 lines · Simon Glass

Use 'ret' as the return code, since it may not be an error and this is the common name in U-Boot. Make sure to return the error code when given, rather than transforming it into -1 (-EPERM).

Does this transformation affect code size?

Not that I can see, e.g. for firefly-rk3288

Regards,
Simon

#22 lore raw

PATCH 10/14 spl: mmc: Adjust args of spl_mmc_find_device()

In reply to Simon Glass

At present spl_mmc_load() is the only caller of this function, passing it a boot_device, an index into the available MMC devices. Pass the device number instead, since it is known by the caller and simplifies the code.

---

 common/spl/spl_mmc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
common/spl/spl_mmc.c +4 -8
index 70e376c0ed8..3cb4b698f7f 100644
@@ -58,7 +58,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 	return 0;
 }
 
-static int spl_mmc_get_device_index(u32 boot_device)
+static int spl_mmc_get_device_index(int boot_device)
 {
 	switch (boot_device) {
 	case BOOT_DEVICE_MMC1:
@@ -73,13 +73,9 @@ static int spl_mmc_get_device_index(u32 boot_device)
 	return -ENODEV;
 }
 
-static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
+static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
 {
-	int ret, mmc_dev;
-
-	mmc_dev = spl_mmc_get_device_index(boot_device);
-	if (mmc_dev < 0)
-		return mmc_dev;
+	int ret;
 
 #if CONFIG_IS_ENABLED(DM_MMC)
 	ret = mmc_init_device(mmc_dev);
@@ -349,7 +345,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 	/* Perform peripheral init only once for an mmc device */
 	mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
 	if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
-		ret = spl_mmc_find_device(&mmc, bootdev->boot_device);
+		ret = spl_mmc_find_device(&mmc, mmc_dev);
 		if (ret)
 			return ret;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 10/14
#23 lore raw

Re: [PATCH 10/14] spl: mmc: Adjust args of spl_mmc_find_device()

Quoted 16 lines · Simon Glass

At present spl_mmc_load() is the only caller of this function, passing it a boot_device, an index into the available MMC devices. Pass the device number instead, since it is known by the caller and simplifies the code.

---

  common/spl/spl_mmc.c | 12 ++++--------
  1 file changed, 4 insertions(+), 8 deletions(-)
common/spl/spl_mmc.c +0 -0
index 70e376c0ed8..3cb4b698f7f 100644

common/spl/spl_mmc.c int mmc_load_image_raw_sector(struct spl_image_info *spl_image, · line 61

Quoted 5 lines
common/spl/spl_mmc.c +1 -1
@@ -58,7 +58,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
  	return 0;
  }
 
-static int spl_mmc_get_device_index(u32 boot_device)
+static int spl_mmc_get_device_index(int boot_device)

This should remain a u32 (or more properly a "uint"...)

Quoted 20 lines
common/spl/spl_mmc.c +2 -6
  {
  	switch (boot_device) {
  	case BOOT_DEVICE_MMC1:
@@ -73,13 +73,9 @@ static int spl_mmc_get_device_index(u32 boot_device)
  	return -ENODEV;
  }
 
-static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
+static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
  {
-	int ret, mmc_dev;
-
-	mmc_dev = spl_mmc_get_device_index(boot_device);
-	if (mmc_dev < 0)
-		return mmc_dev;
+	int ret;
 
  #if CONFIG_IS_ENABLED(DM_MMC)
  	ret = mmc_init_device(mmc_dev);

common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info *spl_image, · line 351

Quoted 8 lines
common/spl/spl_mmc.c +1 -1
@@ -349,7 +345,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
  	/* Perform peripheral init only once for an mmc device */
  	mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
  	if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
-		ret = spl_mmc_find_device(&mmc, bootdev->boot_device);
+		ret = spl_mmc_find_device(&mmc, mmc_dev);
  		if (ret)
  			return ret;
 

Aside from the above,

#24 lore raw

PATCH 11/14 spl: mmc: Try to clean up raw-mode options

In reply to Simon Glass

Make the raw-mode options depend on SPL_SYS_MMCSD_RAW_MODE in a more direct way. This makes it easier to understand the options with 'make menuconfig'.

There are three different ways of specifying the offset:

- sector offset
- partition number
- partition type

So make these a choice, so it is more obvious what is going on.

Update existing boards to enable SPL_SYS_MMCSD_RAW_MODE where needed.

---

 arch/arm/mach-imx/imx8m/soc.c                 |  2 +
 arch/arm/mach-imx/spl_imx_romapi.c            | 13 ++++-
 .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       |  4 +-
 common/spl/Kconfig                            | 52 +++++++++++--------
 configs/am335x_guardian_defconfig             |  2 +-
 configs/am335x_pdu001_defconfig               |  2 +-
 configs/am3517_evm_defconfig                  |  2 +-
 configs/am62ax_evm_a53_defconfig              |  1 +
 configs/am62ax_evm_r5_defconfig               |  1 +
 configs/am62px_evm_a53_defconfig              |  1 +
 configs/am62px_evm_r5_defconfig               |  1 +
 configs/am62x_beagleplay_a53_defconfig        |  1 +
 configs/am62x_beagleplay_r5_defconfig         |  1 +
 configs/am62x_evm_a53_defconfig               |  1 +
 configs/am62x_evm_r5_defconfig                |  1 +
 configs/am64x_evm_a53_defconfig               |  1 +
 configs/am64x_evm_r5_defconfig                |  1 +
 configs/am65x_evm_a53_defconfig               |  1 +
 configs/am65x_evm_r5_defconfig                |  1 +
 configs/brppt2_defconfig                      |  2 +-
 configs/brsmarc1_defconfig                    |  2 +-
 configs/cgtqmx8_defconfig                     |  1 +
 configs/chromebit_mickey_defconfig            |  2 +-
 configs/chromebook_jerry_defconfig            |  2 +-
 configs/chromebook_minnie_defconfig           |  2 +-
 configs/chromebook_speedy_defconfig           |  2 +-
 configs/ci20_mmc_defconfig                    |  1 +
 configs/da850evm_defconfig                    |  2 +-
 configs/da850evm_nand_defconfig               |  2 +-
 configs/deneb_defconfig                       |  1 +
 configs/display5_defconfig                    |  2 +-
 configs/display5_factory_defconfig            |  2 +-
 configs/draco-rastaban_defconfig              |  2 +-
 configs/draco-thuban_defconfig                |  2 +-
 .../gardena-smart-gateway-at91sam_defconfig   |  2 +-
 configs/giedi_defconfig                       |  1 +
 configs/imx28_xea_defconfig                   |  1 +
 configs/imx28_xea_sb_defconfig                |  1 +
 configs/imx6q_logic_defconfig                 |  2 +-
 configs/imx8mm-cl-iot-gate-optee_defconfig    |  1 +
 configs/imx8mm-cl-iot-gate_defconfig          |  1 +
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |  1 +
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |  1 +
 configs/imx8mm-mx8menlo_defconfig             |  1 +
 configs/imx8mm-phygate-tauri-l_defconfig      |  1 +
 configs/imx8mm_beacon_defconfig               |  1 +
 configs/imx8mm_beacon_fspi_defconfig          |  1 +
 configs/imx8mm_data_modul_edm_sbc_defconfig   |  1 +
 configs/imx8mm_evk_defconfig                  |  1 +
 configs/imx8mm_evk_fspi_defconfig             |  1 +
 configs/imx8mm_phg_defconfig                  |  1 +
 configs/imx8mm_venice_defconfig               |  1 +
 configs/imx8mn_beacon_2g_defconfig            |  1 +
 configs/imx8mn_beacon_defconfig               |  1 +
 configs/imx8mn_beacon_fspi_defconfig          |  1 +
 configs/imx8mn_bsh_smm_s2_defconfig           |  1 +
 configs/imx8mn_bsh_smm_s2pro_defconfig        |  1 +
 configs/imx8mn_ddr4_evk_defconfig             |  1 +
 configs/imx8mn_evk_defconfig                  |  1 +
 configs/imx8mn_var_som_defconfig              |  1 +
 configs/imx8mn_venice_defconfig               |  1 +
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig |  1 +
 configs/imx8mp_beacon_defconfig               |  1 +
 configs/imx8mp_data_modul_edm_sbc_defconfig   |  1 +
 configs/imx8mp_debix_model_a_defconfig        |  1 +
 configs/imx8mp_dhcom_pdk2_defconfig           |  1 +
 configs/imx8mp_dhcom_pdk3_defconfig           |  1 +
 configs/imx8mp_evk_defconfig                  |  1 +
 configs/imx8mp_rsb3720a1_4G_defconfig         |  2 +
 configs/imx8mp_rsb3720a1_6G_defconfig         |  1 +
 configs/imx8mp_venice_defconfig               |  1 +
 configs/imx8mq_cm_defconfig                   |  1 +
 configs/imx8mq_evk_defconfig                  |  1 +
 configs/imx8mq_phanbell_defconfig             |  1 +
 configs/imx8mq_reform2_defconfig              |  1 +
 configs/imx8qm_mek_defconfig                  |  1 +
 configs/imx8qxp_mek_defconfig                 |  1 +
 configs/imx8ulp_evk_defconfig                 |  1 +
 configs/imx93-phyboard-segin_defconfig        |  1 +
 configs/imx93_11x11_evk_defconfig             |  1 +
 configs/imx93_11x11_evk_ld_defconfig          |  1 +
 configs/imx93_var_som_defconfig               |  1 +
 configs/imxrt1020-evk_defconfig               |  1 +
 configs/imxrt1050-evk_defconfig               |  1 +
 configs/imxrt1050-evk_fspi_defconfig          |  1 +
 configs/imxrt1170-evk_defconfig               |  1 +
 configs/iot2050_defconfig                     |  1 +
 configs/j7200_evm_a72_defconfig               |  1 +
 configs/j7200_evm_r5_defconfig                |  1 +
 configs/j721e_beagleboneai64_a72_defconfig    |  1 +
 configs/j721e_beagleboneai64_r5_defconfig     |  1 +
 configs/j721e_evm_a72_defconfig               |  1 +
 configs/j721e_evm_r5_defconfig                |  1 +
 configs/j721s2_evm_a72_defconfig              |  1 +
 configs/j721s2_evm_r5_defconfig               |  1 +
 configs/j722s_evm_a53_defconfig               |  1 +
 configs/j722s_evm_r5_defconfig                |  1 +
 configs/j784s4_evm_a72_defconfig              |  1 +
 configs/j784s4_evm_r5_defconfig               |  1 +
 configs/kontron-sl-mx8mm_defconfig            |  1 +
 configs/kontron_pitx_imx8m_defconfig          |  1 +
 configs/kontron_sl28_defconfig                |  1 +
 configs/librem5_defconfig                     |  1 +
 configs/ls1021aiot_sdcard_defconfig           |  1 +
 configs/ls1021aqds_nand_defconfig             |  1 +
 configs/ls1021aqds_sdcard_ifc_defconfig       |  1 +
 configs/ls1021aqds_sdcard_qspi_defconfig      |  1 +
 configs/ls1021atsn_sdcard_defconfig           |  1 +
 ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
 configs/ls1021atwr_sdcard_ifc_defconfig       |  1 +
 configs/ls1021atwr_sdcard_qspi_defconfig      |  1 +
 configs/msc_sm2s_imx8mp_defconfig             |  1 +
 configs/omap35_logic_defconfig                |  2 +-
 configs/omap35_logic_somlv_defconfig          |  2 +-
 configs/omap3_logic_defconfig                 |  2 +-
 configs/omap3_logic_somlv_defconfig           |  2 +-
 configs/phycore-imx8mm_defconfig              |  1 +
 configs/phycore-imx8mp_defconfig              |  1 +
 configs/phycore_am62x_a53_defconfig           |  1 +
 configs/phycore_am62x_r5_defconfig            |  1 +
 configs/phycore_am64x_a53_defconfig           |  1 +
 configs/phycore_am64x_r5_defconfig            |  1 +
 configs/pico-imx8mq_defconfig                 |  1 +
 configs/sama5d27_wlsom1_ek_mmc_defconfig      |  2 +-
 .../sama5d27_wlsom1_ek_qspiflash_defconfig    |  2 +-
 configs/sama5d2_icp_mmc_defconfig             |  2 +-
 configs/sandbox_noinst_defconfig              |  1 +
 configs/sniper_defconfig                      |  2 +-
 configs/socfpga_secu1_defconfig               |  2 +-
 configs/verdin-am62_a53_defconfig             |  1 +
 configs/verdin-am62_r5_defconfig              |  1 +
 configs/verdin-imx8mm_defconfig               |  1 +
 configs/verdin-imx8mp_defconfig               |  1 +
 133 files changed, 175 insertions(+), 52 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +2 -0
index be38ca52885..f30178ae213 100644
@@ -735,6 +735,7 @@ int boot_mode_getprisec(void)
 #endif
 
 #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)
+#ifdef SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 #define IMG_CNTN_SET1_OFFSET	GENMASK(22, 19)
 unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 						unsigned long raw_sect)
@@ -769,6 +770,7 @@ unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 
 	return raw_sect;
 }
+#endif /* SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION */
 #endif
 
 bool is_usb_boot(void)
arch/arm/mach-imx/spl_imx_romapi.c +11 -2
index 9a86f5c133f..bdaea439d7f 100644
@@ -33,8 +33,17 @@ ulong spl_romapi_raw_seekable_read(u32 offset, u32 size, void *buf)
 
 ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev)
 {
-	return image_offset +
-		(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000);
+	u32 sector = 0;
+
+	/*
+	 * Some boards use this value even though MMC is not enabled in SPL, for
+	 * example imx8mn_bsh_smm_s2
+	 */
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+	sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
+#endif
+
+	return image_offset + sector * 512 - 0x8000;
 }
 
 static int is_boot_from_stream_device(u32 boot)
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +2 -2
index 070933fb54b..af083c3c38f 100644
@@ -190,7 +190,7 @@ int board_late_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_SPL_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 #define UBOOT_RAW_SECTOR_OFFSET 0x40
 unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 					   unsigned long raw_sector)
@@ -204,4 +204,4 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 		return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
 	}
 }
-#endif /* CONFIG_SPL_MMC */
+#endif /* CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR */
common/spl/Kconfig +30 -22

87 lines not on this page · raw message

configs/am335x_guardian_defconfig +1 -1
index 75138542431..14a14c257c2 100644
@@ -34,7 +34,7 @@ CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_ETH=y
 CONFIG_SPL_I2C=y
configs/am335x_pdu001_defconfig +1 -1
index febe5ebaabb..ddb7ee9239c 100644
@@ -26,7 +26,7 @@ CONFIG_BOOTCOMMAND="run eval_boot_device;part uuid mmc ${mmc_boot}:${root_fs_par
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_POWER=y
configs/am3517_evm_defconfig +1 -1
index 70498ca7fb2..b7cf55ae54b 100644
@@ -24,7 +24,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 CONFIG_SPL_MTD=y
configs/am62ax_evm_a53_defconfig +1 -0
index 4a351cd015a..b905ff74f2a 100644
@@ -30,6 +30,7 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62ax_evm_r5_defconfig +1 -0
index 44ccb6baa90..092d0830623 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/am62px_evm_a53_defconfig +1 -0
index 30d48340249..f367eb65031 100644
@@ -37,6 +37,7 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/am62px_evm_r5_defconfig +1 -0
index ace55696737..4f7be44cfba 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/am62x_beagleplay_a53_defconfig +1 -0
index 79c82d1ff7a..af54f9670a7 100644
@@ -40,6 +40,7 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62x_beagleplay_r5_defconfig +1 -0
index d0cc4f5b405..ee4c43ff97f 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DM_MAILBOX=y
configs/am62x_evm_a53_defconfig +1 -0
index ca993b427bd..0b7ee942a0a 100644
@@ -38,6 +38,7 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62x_evm_r5_defconfig +1 -0
index 4b2e57b13a0..78ed3f62d06 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DM_MAILBOX=y
configs/am64x_evm_a53_defconfig +1 -0
index 66792595711..9a70a304f2e 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
 CONFIG_SPL_DMA=y
configs/am64x_evm_r5_defconfig +1 -0
index 96475d4c1b8..1e83b7ff1fe 100644
@@ -50,6 +50,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_DMA=y
configs/am65x_evm_a53_defconfig +1 -0
index 925a88e2547..f22b9afdb3b 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/am65x_evm_r5_defconfig +1 -0
index 4fc9c39711c..1660bf93530 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/brppt2_defconfig +1 -1
index 47b37bbc807..2f29cb3dc46 100644
@@ -34,7 +34,7 @@ CONFIG_SYS_PBSIZE=532
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
configs/brsmarc1_defconfig +1 -1
index f584b8d30b1..5b9a822c9ae 100644
@@ -43,7 +43,7 @@ CONFIG_ARCH_MISC_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_I2C=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_DM_SPI_FLASH=y
configs/cgtqmx8_defconfig +1 -0
index 24dfdae11e3..a9283ad49ea 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=0
configs/chromebit_mickey_defconfig +1 -1
index e5d805d7da7..93bf4f5c592 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_CMD_GPIO=y
configs/chromebook_jerry_defconfig +1 -1
index 9bc59539dc8..a1df1f830f0 100644
@@ -37,7 +37,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_CMD_GPIO=y
configs/chromebook_minnie_defconfig +1 -1
index 26fa05e543b..03520b6af40 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_CMD_GPIO=y
configs/chromebook_speedy_defconfig +1 -1
index 5deb09b28ec..607fd288197 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
 CONFIG_CMD_GPIO=y
configs/ci20_mmc_defconfig +1 -0
index 39f33844e46..90574d2a157 100644
@@ -32,6 +32,7 @@ CONFIG_SYS_MALLOC_BOOTPARAMS=y
 CONFIG_SPL_MAX_SIZE=0x2e00
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 # CONFIG_SPL_BANNER_PRINT is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1c
 CONFIG_SPL_MMC_TINY=y
configs/da850evm_defconfig +1 -1
index 30d1a93fec3..d10faa5b275 100644
@@ -50,7 +50,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x8000
configs/da850evm_nand_defconfig +1 -1
index 62cbd02b69a..7e59b6ff876 100644
@@ -46,7 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
configs/deneb_defconfig +1 -0
index 4b9b0734c5a..4731e84e388 100644
@@ -55,6 +55,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
configs/display5_defconfig +1 -1
index 1d3336b8c6a..7463f4f52b5 100644
@@ -42,7 +42,7 @@ CONFIG_SYS_PBSIZE=2076
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_BOOTCOUNT_LIMIT=y
 CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SAVEENV=y
configs/display5_factory_defconfig +1 -1
index 7c681f095c5..59d0c5d0370 100644
@@ -39,7 +39,7 @@ CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2084
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_OS_BOOT=y
configs/draco-rastaban_defconfig +1 -1
index 43d29f5b11a..acba6f2b958 100644
@@ -35,7 +35,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
configs/draco-thuban_defconfig +1 -1
index b457b22fc64..dd4799f900a 100644
@@ -35,7 +35,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_NAND_DRIVERS=y
 CONFIG_SPL_NAND_ECC=y
configs/gardena-smart-gateway-at91sam_defconfig +1 -1
index 3b9466c830f..42f116fac13 100644
@@ -46,7 +46,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_SPL_NAND_RAW_ONLY=y
 CONFIG_SPL_NAND_DRIVERS=y
configs/giedi_defconfig +1 -0
index c7390d1d323..774ab647ccd 100644
@@ -55,6 +55,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
configs/imx28_xea_defconfig +1 -0
index 822a329187f..d1470014fd7 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x0
 CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
configs/imx28_xea_sb_defconfig +1 -0
index 8d48d8c5078..aa1116aa4b0 100644
@@ -29,6 +29,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0
 CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
configs/imx6q_logic_defconfig +1 -1
index 7203583003c..b893da6c92a 100644
@@ -30,7 +30,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SPL_RAW_IMAGE_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_DMA=y
 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
 CONFIG_SPL_I2C=y
configs/imx8mm-cl-iot-gate-optee_defconfig +1 -0
index f5bb50c5f39..0b7dd632b59 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm-cl-iot-gate_defconfig +1 -0
index b36ad7c867c..9312e9f72a7 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm-icore-mx8mm-ctouch2_defconfig +1 -0
index d4e9d9f342d..f37297cdbf7 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_POWER=y
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig +1 -0
index c85a14119e7..950246ecded 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_POWER=y
configs/imx8mm-mx8menlo_defconfig +1 -0
index 5e6bbb3e508..8644177a769 100644
@@ -52,6 +52,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm-phygate-tauri-l_defconfig +1 -0
index 41765f1ddc5..51a6c6ea320 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_beacon_defconfig +1 -0
index e3dcbfe0452..7f0cb9a06bf 100644
@@ -38,6 +38,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_beacon_fspi_defconfig +1 -0
index 0aca853afd9..354a671bafb 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_data_modul_edm_sbc_defconfig +1 -0
index f26a8791cd0..a78ae0c1eaa 100644
@@ -59,6 +59,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_evk_defconfig +1 -0
index ff33d1532a0..927b41c4cc2 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_evk_fspi_defconfig +1 -0
index a57dc47f26f..96c0a46bcec 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_phg_defconfig +1 -0
index e14dcdf9a3d..2fd319b3a6c 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mm_venice_defconfig +1 -0
index f4d999bfcef..fc3e3ec3779 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_beacon_2g_defconfig +1 -0
index 1129d8070cc..7a1931510e8 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_beacon_defconfig +1 -0
index f4af99847d1..eebfb0d7a7d 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_beacon_fspi_defconfig +1 -0
index cecde443367..6acbb8a0215 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_bsh_smm_s2_defconfig +1 -0
index b4351a392ef..29d7cdab922 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_DMA=y
configs/imx8mn_bsh_smm_s2pro_defconfig +1 -0
index 0faa3376fd3..151a9a520ab 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_ddr4_evk_defconfig +1 -0
index 82e3ce19480..93380a0ddde 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_evk_defconfig +1 -0
index 2402e9e8bfb..662703a312d 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_var_som_defconfig +1 -0
index 218415fad57..0155cb2044e 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mn_venice_defconfig +1 -0
index b65fef0a806..93e6a28535c 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp-icore-mx8mp-edimm2.2_defconfig +1 -0
index 05f68c7e2ae..497a908f7a7 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_beacon_defconfig +1 -0
index 3c337d4bd25..ba676c95467 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_data_modul_edm_sbc_defconfig +1 -0
index fe3e757eefd..c8948e85961 100644
@@ -66,6 +66,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_debix_model_a_defconfig +1 -0
index aa1de6d6909..c76ab232b12 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_dhcom_pdk2_defconfig +1 -0
index 79b3e96c8e3..f807b0cfc37 100644
@@ -64,6 +64,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 # CONFIG_SPL_FIT_IMAGE_TINY is not set
configs/imx8mp_dhcom_pdk3_defconfig +1 -0
index 8ef8bf4db27..05895d6dd6f 100644
@@ -66,6 +66,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 # CONFIG_SPL_FIT_IMAGE_TINY is not set
configs/imx8mp_evk_defconfig +1 -0
index f5ba022b075..fe05eeadd70 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_rsb3720a1_4G_defconfig +2 -0
index 54789365aa9..7a7f3907b06 100644
@@ -53,6 +53,8 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_rsb3720a1_6G_defconfig +1 -0
index 4b0b71d03d9..75d110f91d1 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mp_venice_defconfig +1 -0
index df93774b307..b08e4ae4e1f 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mq_cm_defconfig +1 -0
index 5eb96d3826a..ac45c3d669d 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mq_evk_defconfig +1 -0
index 3c1701a3768..2a51681c335 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mq_phanbell_defconfig +1 -0
index 3a3fb754fa4..4c36827b2ae 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8mq_reform2_defconfig +1 -0
index 1844e3c8b84..2a951f16de4 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/imx8qm_mek_defconfig +1 -0
index bf02d3e4f67..a96fb310cdd 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
configs/imx8qxp_mek_defconfig +1 -0
index d6b79f53893..56cc8347926 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_POWER_DOMAIN=y
configs/imx8ulp_evk_defconfig +1 -0
index b302df1f351..7e1a53f289a 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x22040000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_WATCHDOG=y
configs/imx93-phyboard-segin_defconfig +1 -0
index e3eb0029fa4..6e9e9c5a19b 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_LOAD_IMX_CONTAINER=y
 CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/container.cfg"
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
configs/imx93_11x11_evk_defconfig +1 -0
index 2246715d822..78efb7bae81 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
configs/imx93_11x11_evk_ld_defconfig +1 -0
index deed068550a..fd33fd54762 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
configs/imx93_var_som_defconfig +1 -0
index 94ce213f93a..14f220e8a3c 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
 CONFIG_SPL_LOAD_IMX_CONTAINER=y
 CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/container.cfg"
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_I2C=y
configs/imxrt1020-evk_defconfig +1 -0
index 80c8769926e..72bbd720153 100644
@@ -31,6 +31,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
 # CONFIG_BOOTM_NETBSD is not set
configs/imxrt1050-evk_defconfig +1 -0
index 086fc47ec27..fdbce8e6aa9 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
 CONFIG_SPL_NOR_SUPPORT=y
configs/imxrt1050-evk_fspi_defconfig +1 -0
index 4b252cfa5d0..03543ed0a30 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
 CONFIG_SPL_NOR_SUPPORT=y
configs/imxrt1170-evk_defconfig +1 -0
index 83825da6de9..fe0058aa5ce 100644
@@ -31,6 +31,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
 # CONFIG_BOOTM_NETBSD is not set
configs/iot2050_defconfig +1 -0
index 8654bf20865..2a7a958dec2 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DM_MAILBOX=y
configs/j7200_evm_a72_defconfig +1 -0
index fcfa9265996..137ca3f0d02 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
 CONFIG_SPL_DMA=y
configs/j7200_evm_r5_defconfig +1 -0
index e023af24674..774a9eff439 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
 CONFIG_SPL_DMA=y
configs/j721e_beagleboneai64_a72_defconfig +1 -0
index ead1d8389c6..b720c74999d 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_MAX_SIZE=0xc0000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/j721e_beagleboneai64_r5_defconfig +1 -0
index 314161b8a62..ce96e4921b8 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/j721e_evm_a72_defconfig +1 -0
index acb6e9c556e..c50e98391ff 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/j721e_evm_r5_defconfig +1 -0
index f1c9bbd3fa8..3b4a7c3c0ee 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/j721s2_evm_a72_defconfig +1 -0
index 5800e4be963..d78ebb5cfd4 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/j721s2_evm_r5_defconfig +1 -0
index d0af664a6b7..b6adb6a77d7 100644
@@ -50,6 +50,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/j722s_evm_a53_defconfig +1 -0
index 1675cedb25e..98620222a07 100644
@@ -37,6 +37,7 @@ CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_PAD_TO=0x0
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/j722s_evm_r5_defconfig +1 -0
index 8ba3916807d..e574be9e19d 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/j784s4_evm_a72_defconfig +1 -0
index c6dda6c06c7..966ccabec6a 100644
@@ -37,6 +37,7 @@ CONFIG_LOGLEVEL=7
 CONFIG_SPL_MAX_SIZE=0xc0000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/j784s4_evm_r5_defconfig +1 -0
index 7ace6615261..02963f6ce5a 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/kontron-sl-mx8mm_defconfig +1 -0
index f2570289298..9321a077260 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/kontron_pitx_imx8m_defconfig +1 -0
index c2133470fc9..52238831229 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/kontron_sl28_defconfig +1 -0
index a1d5f89b1ec..c4493e50a32 100644
@@ -51,6 +51,7 @@ CONFIG_SPL_MAX_SIZE=0x20000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x900
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
configs/librem5_defconfig +1 -0
index 6999a689e29..248fc1fdde4 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/ls1021aiot_sdcard_defconfig +1 -0
index 2354f4113ae..981093a9fb5 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82080000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_nand_defconfig +1 -0
index 136ca9a2670..4fc0e66e485 100644
@@ -60,6 +60,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_sdcard_ifc_defconfig +1 -0
index befb4ae442c..72632b87701 100644
@@ -59,6 +59,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_sdcard_qspi_defconfig +1 -0
index db06a03fe6b..78dce4dcbba 100644
@@ -58,6 +58,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atsn_sdcard_defconfig +1 -0
index e5d8eeb8a2f..0853bfbd3a0 100644
@@ -52,6 +52,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig +1 -0
index dc0e507263f..28434d8e191 100644
@@ -60,6 +60,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82104000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_ifc_defconfig +1 -0
index 9980d6106ec..b4348f12678 100644
@@ -61,6 +61,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_qspi_defconfig +1 -0
index ed92e34dccf..8d2c391f0e8 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FSL_PBL=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
 CONFIG_SPL_ENV_SUPPORT=y
configs/msc_sm2s_imx8mp_defconfig +1 -0
index 2e1d112a3e7..47ed5cfb214 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/omap35_logic_defconfig +1 -1
index 23b2e503385..a35c027f952 100644
@@ -28,7 +28,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 CONFIG_SPL_MTD=y
configs/omap35_logic_somlv_defconfig +1 -1
index a5f242ff40c..28e85bf5173 100644
@@ -29,7 +29,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 CONFIG_SPL_MTD=y
configs/omap3_logic_defconfig +1 -1
index d081d4e0fb4..045290838e4 100644
@@ -27,7 +27,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 CONFIG_SPL_MTD=y
configs/omap3_logic_somlv_defconfig +1 -1
index 68e89d245ee..583f79059a5 100644
@@ -29,7 +29,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 # CONFIG_SPL_FS_EXT4 is not set
 # CONFIG_SPL_I2C is not set
 CONFIG_SPL_MTD=y
configs/phycore-imx8mm_defconfig +1 -0
index f9fd7255df7..ce322887bae 100644
@@ -38,6 +38,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/phycore-imx8mp_defconfig +1 -0
index 8dd4963bdc0..a296d2e3a99 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 # CONFIG_SPL_CRYPTO is not set
configs/phycore_am62x_a53_defconfig +1 -0
index 39161b722b1..d8b129f7dd0 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_ENV_SUPPORT=y
configs/phycore_am62x_r5_defconfig +1 -0
index b7d0273dd74..7fc3abf1262 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_I2C=y
configs/phycore_am64x_a53_defconfig +1 -0
index 1af72e8bb32..5cf24b9debf 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/phycore_am64x_r5_defconfig +1 -0
index a0d78241928..72d10f76647 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_DMA=y
configs/pico-imx8mq_defconfig +1 -0
index cf91eb563b9..ef876abbd36 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/sama5d27_wlsom1_ek_mmc_defconfig +1 -1
index 89a5bcdfac8..25213af37c5 100644
@@ -48,7 +48,7 @@ CONFIG_SPL_MAX_SIZE=0x10000
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_AT91_MCK_BYPASS=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
configs/sama5d27_wlsom1_ek_qspiflash_defconfig +1 -1
index a07044578a8..5502858fead 100644
@@ -48,7 +48,7 @@ CONFIG_SPL_MAX_SIZE=0x10000
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_DM_SPI_FLASH=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000
configs/sama5d2_icp_mmc_defconfig +1 -1
index 6b9fa27de63..98b931c375d 100644
@@ -49,7 +49,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
 CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_AT91_MCK_BYPASS=y
configs/sandbox_noinst_defconfig +1 -0
index f37230151a0..bfd95e2398f 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xa000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x4000000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x0
 CONFIG_SPL_ENV_SUPPORT=y
configs/sniper_defconfig +1 -1
index 0243b15f31c..d0dbd105d0c 100644
@@ -22,7 +22,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
 # CONFIG_SPL_FS_EXT4 is not set
configs/socfpga_secu1_defconfig +1 -1
index a08ba22fdb5..3a3b8a77c22 100644
@@ -42,7 +42,7 @@ CONFIG_SPL_PAD_TO=0x10000
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x1
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE is not set
 CONFIG_SPL_MTD=y
configs/verdin-am62_a53_defconfig +1 -0
index 03730b498fd..f0ffaaad079 100644
@@ -51,6 +51,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
 CONFIG_SPL_DMA=y
configs/verdin-am62_r5_defconfig +1 -0
index 8266a7f6e8f..02c2f579e97 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
 CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
 CONFIG_SPL_I2C=y
configs/verdin-imx8mm_defconfig +1 -0
index ef7f3b1bc10..9ca205586a0 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
configs/verdin-imx8mp_defconfig +1 -0
index fca91f7b1ee..c74398f4f8b 100644
@@ -60,6 +60,7 @@ CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
 CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
 CONFIG_SPL_I2C=y
Signature · 1 line
2.34.1
Reviewed-by on v1 11/14
#25 lore raw

Re: [PATCH 11/14] spl: mmc: Try to clean up raw-mode options

Quoted 1,878 lines · Simon Glass

Make the raw-mode options depend on SPL_SYS_MMCSD_RAW_MODE in a more direct way. This makes it easier to understand the options with 'make menuconfig'.

There are three different ways of specifying the offset:

- sector offset
- partition number
- partition type

So make these a choice, so it is more obvious what is going on.

Update existing boards to enable SPL_SYS_MMCSD_RAW_MODE where needed.

---

  arch/arm/mach-imx/imx8m/soc.c                 |  2 +
  arch/arm/mach-imx/spl_imx_romapi.c            | 13 ++++-
  .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       |  4 +-
  common/spl/Kconfig                            | 52 +++++++++++--------
  configs/am335x_guardian_defconfig             |  2 +-
  configs/am335x_pdu001_defconfig               |  2 +-
  configs/am3517_evm_defconfig                  |  2 +-
  configs/am62ax_evm_a53_defconfig              |  1 +
  configs/am62ax_evm_r5_defconfig               |  1 +
  configs/am62px_evm_a53_defconfig              |  1 +
  configs/am62px_evm_r5_defconfig               |  1 +
  configs/am62x_beagleplay_a53_defconfig        |  1 +
  configs/am62x_beagleplay_r5_defconfig         |  1 +
  configs/am62x_evm_a53_defconfig               |  1 +
  configs/am62x_evm_r5_defconfig                |  1 +
  configs/am64x_evm_a53_defconfig               |  1 +
  configs/am64x_evm_r5_defconfig                |  1 +
  configs/am65x_evm_a53_defconfig               |  1 +
  configs/am65x_evm_r5_defconfig                |  1 +
  configs/brppt2_defconfig                      |  2 +-
  configs/brsmarc1_defconfig                    |  2 +-
  configs/cgtqmx8_defconfig                     |  1 +
  configs/chromebit_mickey_defconfig            |  2 +-
  configs/chromebook_jerry_defconfig            |  2 +-
  configs/chromebook_minnie_defconfig           |  2 +-
  configs/chromebook_speedy_defconfig           |  2 +-
  configs/ci20_mmc_defconfig                    |  1 +
  configs/da850evm_defconfig                    |  2 +-
  configs/da850evm_nand_defconfig               |  2 +-
  configs/deneb_defconfig                       |  1 +
  configs/display5_defconfig                    |  2 +-
  configs/display5_factory_defconfig            |  2 +-
  configs/draco-rastaban_defconfig              |  2 +-
  configs/draco-thuban_defconfig                |  2 +-
  .../gardena-smart-gateway-at91sam_defconfig   |  2 +-
  configs/giedi_defconfig                       |  1 +
  configs/imx28_xea_defconfig                   |  1 +
  configs/imx28_xea_sb_defconfig                |  1 +
  configs/imx6q_logic_defconfig                 |  2 +-
  configs/imx8mm-cl-iot-gate-optee_defconfig    |  1 +
  configs/imx8mm-cl-iot-gate_defconfig          |  1 +
  configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |  1 +
  configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |  1 +
  configs/imx8mm-mx8menlo_defconfig             |  1 +
  configs/imx8mm-phygate-tauri-l_defconfig      |  1 +
  configs/imx8mm_beacon_defconfig               |  1 +
  configs/imx8mm_beacon_fspi_defconfig          |  1 +
  configs/imx8mm_data_modul_edm_sbc_defconfig   |  1 +
  configs/imx8mm_evk_defconfig                  |  1 +
  configs/imx8mm_evk_fspi_defconfig             |  1 +
  configs/imx8mm_phg_defconfig                  |  1 +
  configs/imx8mm_venice_defconfig               |  1 +
  configs/imx8mn_beacon_2g_defconfig            |  1 +
  configs/imx8mn_beacon_defconfig               |  1 +
  configs/imx8mn_beacon_fspi_defconfig          |  1 +
  configs/imx8mn_bsh_smm_s2_defconfig           |  1 +
  configs/imx8mn_bsh_smm_s2pro_defconfig        |  1 +
  configs/imx8mn_ddr4_evk_defconfig             |  1 +
  configs/imx8mn_evk_defconfig                  |  1 +
  configs/imx8mn_var_som_defconfig              |  1 +
  configs/imx8mn_venice_defconfig               |  1 +
  configs/imx8mp-icore-mx8mp-edimm2.2_defconfig |  1 +
  configs/imx8mp_beacon_defconfig               |  1 +
  configs/imx8mp_data_modul_edm_sbc_defconfig   |  1 +
  configs/imx8mp_debix_model_a_defconfig        |  1 +
  configs/imx8mp_dhcom_pdk2_defconfig           |  1 +
  configs/imx8mp_dhcom_pdk3_defconfig           |  1 +
  configs/imx8mp_evk_defconfig                  |  1 +
  configs/imx8mp_rsb3720a1_4G_defconfig         |  2 +
  configs/imx8mp_rsb3720a1_6G_defconfig         |  1 +
  configs/imx8mp_venice_defconfig               |  1 +
  configs/imx8mq_cm_defconfig                   |  1 +
  configs/imx8mq_evk_defconfig                  |  1 +
  configs/imx8mq_phanbell_defconfig             |  1 +
  configs/imx8mq_reform2_defconfig              |  1 +
  configs/imx8qm_mek_defconfig                  |  1 +
  configs/imx8qxp_mek_defconfig                 |  1 +
  configs/imx8ulp_evk_defconfig                 |  1 +
  configs/imx93-phyboard-segin_defconfig        |  1 +
  configs/imx93_11x11_evk_defconfig             |  1 +
  configs/imx93_11x11_evk_ld_defconfig          |  1 +
  configs/imx93_var_som_defconfig               |  1 +
  configs/imxrt1020-evk_defconfig               |  1 +
  configs/imxrt1050-evk_defconfig               |  1 +
  configs/imxrt1050-evk_fspi_defconfig          |  1 +
  configs/imxrt1170-evk_defconfig               |  1 +
  configs/iot2050_defconfig                     |  1 +
  configs/j7200_evm_a72_defconfig               |  1 +
  configs/j7200_evm_r5_defconfig                |  1 +
  configs/j721e_beagleboneai64_a72_defconfig    |  1 +
  configs/j721e_beagleboneai64_r5_defconfig     |  1 +
  configs/j721e_evm_a72_defconfig               |  1 +
  configs/j721e_evm_r5_defconfig                |  1 +
  configs/j721s2_evm_a72_defconfig              |  1 +
  configs/j721s2_evm_r5_defconfig               |  1 +
  configs/j722s_evm_a53_defconfig               |  1 +
  configs/j722s_evm_r5_defconfig                |  1 +
  configs/j784s4_evm_a72_defconfig              |  1 +
  configs/j784s4_evm_r5_defconfig               |  1 +
  configs/kontron-sl-mx8mm_defconfig            |  1 +
  configs/kontron_pitx_imx8m_defconfig          |  1 +
  configs/kontron_sl28_defconfig                |  1 +
  configs/librem5_defconfig                     |  1 +
  configs/ls1021aiot_sdcard_defconfig           |  1 +
  configs/ls1021aqds_nand_defconfig             |  1 +
  configs/ls1021aqds_sdcard_ifc_defconfig       |  1 +
  configs/ls1021aqds_sdcard_qspi_defconfig      |  1 +
  configs/ls1021atsn_sdcard_defconfig           |  1 +
  ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig |  1 +
  configs/ls1021atwr_sdcard_ifc_defconfig       |  1 +
  configs/ls1021atwr_sdcard_qspi_defconfig      |  1 +
  configs/msc_sm2s_imx8mp_defconfig             |  1 +
  configs/omap35_logic_defconfig                |  2 +-
  configs/omap35_logic_somlv_defconfig          |  2 +-
  configs/omap3_logic_defconfig                 |  2 +-
  configs/omap3_logic_somlv_defconfig           |  2 +-
  configs/phycore-imx8mm_defconfig              |  1 +
  configs/phycore-imx8mp_defconfig              |  1 +
  configs/phycore_am62x_a53_defconfig           |  1 +
  configs/phycore_am62x_r5_defconfig            |  1 +
  configs/phycore_am64x_a53_defconfig           |  1 +
  configs/phycore_am64x_r5_defconfig            |  1 +
  configs/pico-imx8mq_defconfig                 |  1 +
  configs/sama5d27_wlsom1_ek_mmc_defconfig      |  2 +-
  .../sama5d27_wlsom1_ek_qspiflash_defconfig    |  2 +-
  configs/sama5d2_icp_mmc_defconfig             |  2 +-
  configs/sandbox_noinst_defconfig              |  1 +
  configs/sniper_defconfig                      |  2 +-
  configs/socfpga_secu1_defconfig               |  2 +-
  configs/verdin-am62_a53_defconfig             |  1 +
  configs/verdin-am62_r5_defconfig              |  1 +
  configs/verdin-imx8mm_defconfig               |  1 +
  configs/verdin-imx8mp_defconfig               |  1 +
  133 files changed, 175 insertions(+), 52 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +2 -0
index be38ca52885..f30178ae213 100644
@@ -735,6 +735,7 @@ int boot_mode_getprisec(void)
  #endif
 
  #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)
+#ifdef SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
  #define IMG_CNTN_SET1_OFFSET	GENMASK(22, 19)
  unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
  						unsigned long raw_sect)
@@ -769,6 +770,7 @@ unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 
  	return raw_sect;
  }
+#endif /* SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION */
  #endif
 
  bool is_usb_boot(void)
arch/arm/mach-imx/spl_imx_romapi.c +11 -2
index 9a86f5c133f..bdaea439d7f 100644
@@ -33,8 +33,17 @@ ulong spl_romapi_raw_seekable_read(u32 offset, u32 size, void *buf)
 
  ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev)
  {
-	return image_offset +
-		(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000);
+	u32 sector = 0;
+
+	/*
+	 * Some boards use this value even though MMC is not enabled in SPL, for
+	 * example imx8mn_bsh_smm_s2
+	 */
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+	sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
+#endif
+
+	return image_offset + sector * 512 - 0x8000;
  }
 
  static int is_boot_from_stream_device(u32 boot)
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +2 -2
index 070933fb54b..af083c3c38f 100644
@@ -190,7 +190,7 @@ int board_late_init(void)
  	return 0;
  }
 
-#ifdef CONFIG_SPL_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
  #define UBOOT_RAW_SECTOR_OFFSET 0x40
  unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
  					   unsigned long raw_sector)
@@ -204,4 +204,4 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
  		return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
  	}
  }
-#endif /* CONFIG_SPL_MMC */
+#endif /* CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR */
common/spl/Kconfig +30 -22
index af43b5f5d3c..55a42a3a7c7 100644
@@ -490,24 +490,45 @@ config SPL_DISPLAY_PRINT
  	  the board.
 
  config SPL_SYS_MMCSD_RAW_MODE
-	bool
-	help
-	  Support booting from an MMC without a filesystem.
-
-config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
-	bool "MMC raw mode: by sector"
+	bool "Use raw reads to locate the next boot phase"
+	depends on SPL_DM_MMC || SPL_MMC
  	default y if ARCH_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER || \
  		     ARCH_MX6 || ARCH_MX7 || \
  		     ARCH_ROCKCHIP || ARCH_MVEBU ||  ARCH_SOCFPGA || \
  		     ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
  		     OMAP44XX || OMAP54XX || AM33XX || AM43XX || \
  		     TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
+	help
+	  Support booting from an MMC without a filesystem.
+
+if SPL_SYS_MMCSD_RAW_MODE
+
+choice
+	prompt "Method for locating next phase of boot (e.g. U-Boot)"
+
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+	bool "MMC raw mode: by sector"
  	select SPL_LOAD_BLOCK if SPL_MMC
-	select SPL_SYS_MMCSD_RAW_MODE if SPL_MMC
  	help
  	  Use sector number for specifying U-Boot location on MMC/SD in
  	  raw mode.
 
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+	bool "MMC Raw mode: by partition"
+	select SPL_LOAD_BLOCK if SPL_MMC
+	help
+	  Use a partition for loading U-Boot when using MMC/SD in raw mode.
+
+config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
+	bool "MMC raw mode: by partition type"
+	depends on DOS_PARTITION && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+	help
+	  Use partition type for specifying U-Boot partition on MMC/SD in
+	  raw mode. U-Boot will be loaded from the first partition of this
+	  type to be found.
+
+endchoice
+
  config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
  	hex "Address on the MMC to load U-Boot from"
  	depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
@@ -538,13 +559,6 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
 
  	  If unsure, leave the default.
 
-config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-	bool "MMC Raw mode: by partition"
-	select SPL_LOAD_BLOCK if SPL_MMC
-	select SPL_SYS_MMCSD_RAW_MODE if SPL_MMC
-	help
-	  Use a partition for loading U-Boot when using MMC/SD in raw mode.
-
  config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
  	hex "Partition to use to load U-Boot from"
  	depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
@@ -553,14 +567,6 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
  	  Partition on the MMC to load U-Boot from when the MMC is being
  	  used in raw mode
 
-config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
-	bool "MMC raw mode: by partition type"
-	depends on DOS_PARTITION && SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
-	help
-	  Use partition type for specifying U-Boot partition on MMC/SD in
-	  raw mode. U-Boot will be loaded from the first partition of this
-	  type to be found.
-
  config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
  	hex "Partition Type on the MMC to load U-Boot from"
  	depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
@@ -568,6 +574,8 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE
  	  Partition Type on the MMC to load U-Boot from, when the MMC is being
  	  used in raw mode.
 
+endif # SPL_SYS_MMCSD_RAW_MODE
+
  config SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG
  	bool "Override eMMC EXT_CSC_PART_CONFIG by user defined partition"
  	depends on SUPPORT_EMMC_BOOT
configs/am335x_guardian_defconfig +1 -1
index 75138542431..14a14c257c2 100644
@@ -34,7 +34,7 @@ CONFIG_ARCH_MISC_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_ENV_SUPPORT=y
  CONFIG_SPL_ETH=y
  CONFIG_SPL_I2C=y
configs/am335x_pdu001_defconfig +1 -1
index febe5ebaabb..ddb7ee9239c 100644
@@ -26,7 +26,7 @@ CONFIG_BOOTCOMMAND="run eval_boot_device;part uuid mmc ${mmc_boot}:${root_fs_par
  CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_I2C=y
  # CONFIG_SPL_NAND_SUPPORT is not set
  CONFIG_SPL_POWER=y
configs/am3517_evm_defconfig +1 -1
index 70498ca7fb2..b7cf55ae54b 100644
@@ -24,7 +24,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  # CONFIG_SPL_FS_EXT4 is not set
  # CONFIG_SPL_I2C is not set
  CONFIG_SPL_MTD=y
configs/am62ax_evm_a53_defconfig +1 -0
index 4a351cd015a..b905ff74f2a 100644
@@ -30,6 +30,7 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_PAD_TO=0x0
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62ax_evm_r5_defconfig +1 -0
index 44ccb6baa90..092d0830623 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/am62px_evm_a53_defconfig +1 -0
index 30d48340249..f367eb65031 100644
@@ -37,6 +37,7 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_PAD_TO=0x0
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/am62px_evm_r5_defconfig +1 -0
index ace55696737..4f7be44cfba 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SEPARATE_BSS=y
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/am62x_beagleplay_a53_defconfig +1 -0
index 79c82d1ff7a..af54f9670a7 100644
@@ -40,6 +40,7 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62x_beagleplay_r5_defconfig +1 -0
index d0cc4f5b405..ee4c43ff97f 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DM_MAILBOX=y
configs/am62x_evm_a53_defconfig +1 -0
index ca993b427bd..0b7ee942a0a 100644
@@ -38,6 +38,7 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot.img"
configs/am62x_evm_r5_defconfig +1 -0
index 4b2e57b13a0..78ed3f62d06 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DM_MAILBOX=y
configs/am64x_evm_a53_defconfig +1 -0
index 66792595711..9a70a304f2e 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
  CONFIG_SPL_DMA=y
configs/am64x_evm_r5_defconfig +1 -0
index 96475d4c1b8..1e83b7ff1fe 100644
@@ -50,6 +50,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_DMA=y
configs/am65x_evm_a53_defconfig +1 -0
index 925a88e2547..f22b9afdb3b 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/am65x_evm_r5_defconfig +1 -0
index 4fc9c39711c..1660bf93530 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/brppt2_defconfig +1 -1
index 47b37bbc807..2f29cb3dc46 100644
@@ -34,7 +34,7 @@ CONFIG_SYS_PBSIZE=532
  CONFIG_BOARD_EARLY_INIT_F=y
  CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_I2C=y
  CONFIG_SPL_DM_SPI_FLASH=y
  CONFIG_SPL_SPI_LOAD=y
configs/brsmarc1_defconfig +1 -1
index f584b8d30b1..5b9a822c9ae 100644
@@ -43,7 +43,7 @@ CONFIG_ARCH_MISC_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_I2C=y
  # CONFIG_SPL_NAND_SUPPORT is not set
  CONFIG_SPL_DM_SPI_FLASH=y
configs/cgtqmx8_defconfig +1 -0
index 24dfdae11e3..a9283ad49ea 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=0
configs/chromebit_mickey_defconfig +1 -1
index e5d805d7da7..93bf4f5c592 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_NO_BSS_LIMIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
  CONFIG_CMD_GPIO=y
configs/chromebook_jerry_defconfig +1 -1
index 9bc59539dc8..a1df1f830f0 100644
@@ -37,7 +37,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_NO_BSS_LIMIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
  CONFIG_CMD_GPIO=y
configs/chromebook_minnie_defconfig +1 -1
index 26fa05e543b..03520b6af40 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_NO_BSS_LIMIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
  CONFIG_CMD_GPIO=y
configs/chromebook_speedy_defconfig +1 -1
index 5deb09b28ec..607fd288197 100644
@@ -38,7 +38,7 @@ CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_NO_BSS_LIMIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
  CONFIG_CMD_GPIO=y
configs/ci20_mmc_defconfig +1 -0
index 39f33844e46..90574d2a157 100644
@@ -32,6 +32,7 @@ CONFIG_SYS_MALLOC_BOOTPARAMS=y
  CONFIG_SPL_MAX_SIZE=0x2e00
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
  # CONFIG_SPL_BANNER_PRINT is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1c
  CONFIG_SPL_MMC_TINY=y
configs/da850evm_defconfig +1 -1
index 30d1a93fec3..d10faa5b275 100644
@@ -50,7 +50,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_DM_SPI_FLASH=y
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x8000
configs/da850evm_nand_defconfig +1 -1
index 62cbd02b69a..7e59b6ff876 100644
@@ -46,7 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xc0f70000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x110000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_NAND_SUPPORT=y
  CONFIG_SPL_NAND_DRIVERS=y
  CONFIG_SPL_NAND_ECC=y
configs/deneb_defconfig +1 -0
index 4b9b0734c5a..4731e84e388 100644
@@ -55,6 +55,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_POWER_DOMAIN=y
configs/display5_defconfig +1 -1
index 1d3336b8c6a..7463f4f52b5 100644
@@ -42,7 +42,7 @@ CONFIG_SYS_PBSIZE=2076
  CONFIG_MISC_INIT_R=y
  CONFIG_SPL_BOOTCOUNT_LIMIT=y
  CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_DMA=y
  CONFIG_SPL_ENV_SUPPORT=y
  CONFIG_SPL_SAVEENV=y
configs/display5_factory_defconfig +1 -1
index 7c681f095c5..59d0c5d0370 100644
@@ -39,7 +39,7 @@ CONFIG_SYS_CBSIZE=2048
  CONFIG_SYS_PBSIZE=2084
  CONFIG_MISC_INIT_R=y
  CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_DMA=y
  CONFIG_SPL_I2C=y
  CONFIG_SPL_OS_BOOT=y
configs/draco-rastaban_defconfig +1 -1
index 43d29f5b11a..acba6f2b958 100644
@@ -35,7 +35,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_I2C=y
  CONFIG_SPL_NAND_DRIVERS=y
  CONFIG_SPL_NAND_ECC=y
configs/draco-thuban_defconfig +1 -1
index b457b22fc64..dd4799f900a 100644
@@ -35,7 +35,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_I2C=y
  CONFIG_SPL_NAND_DRIVERS=y
  CONFIG_SPL_NAND_ECC=y
configs/gardena-smart-gateway-at91sam_defconfig +1 -1
index 3b9466c830f..42f116fac13 100644
@@ -46,7 +46,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_NAND_SUPPORT=y
  CONFIG_SPL_NAND_RAW_ONLY=y
  CONFIG_SPL_NAND_DRIVERS=y
configs/giedi_defconfig +1 -0
index c7390d1d323..774ab647ccd 100644
@@ -55,6 +55,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_POWER_DOMAIN=y
configs/imx28_xea_defconfig +1 -0
index 822a329187f..d1470014fd7 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x0
  CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
configs/imx28_xea_sb_defconfig +1 -0
index 8d48d8c5078..aa1116aa4b0 100644
@@ -29,6 +29,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0
  CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG=y
configs/imx6q_logic_defconfig +1 -1
index 7203583003c..b893da6c92a 100644
@@ -30,7 +30,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
  CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
  CONFIG_SPL_RAW_IMAGE_SUPPORT=y
  CONFIG_SPL_SYS_MALLOC=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_DMA=y
  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME="u-boot-dtb.img"
  CONFIG_SPL_I2C=y
configs/imx8mm-cl-iot-gate-optee_defconfig +1 -0
index f5bb50c5f39..0b7dd632b59 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm-cl-iot-gate_defconfig +1 -0
index b36ad7c867c..9312e9f72a7 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm-icore-mx8mm-ctouch2_defconfig +1 -0
index d4e9d9f342d..f37297cdbf7 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_POWER=y
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig +1 -0
index c85a14119e7..950246ecded 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_POWER=y
configs/imx8mm-mx8menlo_defconfig +1 -0
index 5e6bbb3e508..8644177a769 100644
@@ -52,6 +52,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm-phygate-tauri-l_defconfig +1 -0
index 41765f1ddc5..51a6c6ea320 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_beacon_defconfig +1 -0
index e3dcbfe0452..7f0cb9a06bf 100644
@@ -38,6 +38,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_beacon_fspi_defconfig +1 -0
index 0aca853afd9..354a671bafb 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_data_modul_edm_sbc_defconfig +1 -0
index f26a8791cd0..a78ae0c1eaa 100644
@@ -59,6 +59,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_evk_defconfig +1 -0
index ff33d1532a0..927b41c4cc2 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_evk_fspi_defconfig +1 -0
index a57dc47f26f..96c0a46bcec 100644
@@ -39,6 +39,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_phg_defconfig +1 -0
index e14dcdf9a3d..2fd319b3a6c 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mm_venice_defconfig +1 -0
index f4d999bfcef..fc3e3ec3779 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_beacon_2g_defconfig +1 -0
index 1129d8070cc..7a1931510e8 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_beacon_defconfig +1 -0
index f4af99847d1..eebfb0d7a7d 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_beacon_fspi_defconfig +1 -0
index cecde443367..6acbb8a0215 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_bsh_smm_s2_defconfig +1 -0
index b4351a392ef..29d7cdab922 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_DMA=y
configs/imx8mn_bsh_smm_s2pro_defconfig +1 -0
index 0faa3376fd3..151a9a520ab 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_ddr4_evk_defconfig +1 -0
index 82e3ce19480..93380a0ddde 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_evk_defconfig +1 -0
index 2402e9e8bfb..662703a312d 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_var_som_defconfig +1 -0
index 218415fad57..0155cb2044e 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mn_venice_defconfig +1 -0
index b65fef0a806..93e6a28535c 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp-icore-mx8mp-edimm2.2_defconfig +1 -0
index 05f68c7e2ae..497a908f7a7 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_beacon_defconfig +1 -0
index 3c337d4bd25..ba676c95467 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_data_modul_edm_sbc_defconfig +1 -0
index fe3e757eefd..c8948e85961 100644
@@ -66,6 +66,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_debix_model_a_defconfig +1 -0
index aa1de6d6909..c76ab232b12 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_BOOTROM_SUPPORT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_dhcom_pdk2_defconfig +1 -0
index 79b3e96c8e3..f807b0cfc37 100644
@@ -64,6 +64,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  # CONFIG_SPL_FIT_IMAGE_TINY is not set
configs/imx8mp_dhcom_pdk3_defconfig +1 -0
index 8ef8bf4db27..05895d6dd6f 100644
@@ -66,6 +66,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x4c000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  # CONFIG_SPL_FIT_IMAGE_TINY is not set
configs/imx8mp_evk_defconfig +1 -0
index f5ba022b075..fe05eeadd70 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_rsb3720a1_4G_defconfig +2 -0
index 54789365aa9..7a7f3907b06 100644
@@ -53,6 +53,8 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_rsb3720a1_6G_defconfig +1 -0
index 4b0b71d03d9..75d110f91d1 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mp_venice_defconfig +1 -0
index df93774b307..b08e4ae4e1f 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mq_cm_defconfig +1 -0
index 5eb96d3826a..ac45c3d669d 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mq_evk_defconfig +1 -0
index 3c1701a3768..2a51681c335 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mq_phanbell_defconfig +1 -0
index 3a3fb754fa4..4c36827b2ae 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8mq_reform2_defconfig +1 -0
index 1844e3c8b84..2a951f16de4 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/imx8qm_mek_defconfig +1 -0
index bf02d3e4f67..a96fb310cdd 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_POWER_DOMAIN=y
configs/imx8qxp_mek_defconfig +1 -0
index d6b79f53893..56cc8347926 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_POWER_DOMAIN=y
configs/imx8ulp_evk_defconfig +1 -0
index b302df1f351..7e1a53f289a 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x22040000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x8000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_WATCHDOG=y
configs/imx93-phyboard-segin_defconfig +1 -0
index e3eb0029fa4..6e9e9c5a19b 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
  CONFIG_SPL_LOAD_IMX_CONTAINER=y
  CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/container.cfg"
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
  CONFIG_SPL_I2C=y
configs/imx93_11x11_evk_defconfig +1 -0
index 2246715d822..78efb7bae81 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
  CONFIG_SPL_I2C=y
configs/imx93_11x11_evk_ld_defconfig +1 -0
index deed068550a..fd33fd54762 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x83200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
  CONFIG_SPL_I2C=y
configs/imx93_var_som_defconfig +1 -0
index 94ce213f93a..14f220e8a3c 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
  CONFIG_SPL_LOAD_IMX_CONTAINER=y
  CONFIG_IMX_CONTAINER_CFG="arch/arm/mach-imx/imx9/container.cfg"
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
  CONFIG_SPL_I2C=y
configs/imxrt1020-evk_defconfig +1 -0
index 80c8769926e..72bbd720153 100644
@@ -31,6 +31,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
  # CONFIG_BOOTM_NETBSD is not set
configs/imxrt1050-evk_defconfig +1 -0
index 086fc47ec27..fdbce8e6aa9 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
  CONFIG_SPL_NOR_SUPPORT=y
configs/imxrt1050-evk_fspi_defconfig +1 -0
index 4b252cfa5d0..03543ed0a30 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
  CONFIG_SPL_NOR_SUPPORT=y
configs/imxrt1170-evk_defconfig +1 -0
index 83825da6de9..fe0058aa5ce 100644
@@ -31,6 +31,7 @@ CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100
  # CONFIG_BOOTM_NETBSD is not set
configs/iot2050_defconfig +1 -0
index 8654bf20865..2a7a958dec2 100644
@@ -53,6 +53,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DM_MAILBOX=y
configs/j7200_evm_a72_defconfig +1 -0
index fcfa9265996..137ca3f0d02 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1800
  CONFIG_SPL_DMA=y
configs/j7200_evm_r5_defconfig +1 -0
index e023af24674..774a9eff439 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
  CONFIG_SPL_DMA=y
configs/j721e_beagleboneai64_a72_defconfig +1 -0
index ead1d8389c6..b720c74999d 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_MAX_SIZE=0xc0000
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/j721e_beagleboneai64_r5_defconfig +1 -0
index 314161b8a62..ce96e4921b8 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/j721e_evm_a72_defconfig +1 -0
index acb6e9c556e..c50e98391ff 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/j721e_evm_r5_defconfig +1 -0
index f1c9bbd3fa8..3b4a7c3c0ee 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/j721s2_evm_a72_defconfig +1 -0
index 5800e4be963..d78ebb5cfd4 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/j721s2_evm_r5_defconfig +1 -0
index d0af664a6b7..b6adb6a77d7 100644
@@ -50,6 +50,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/j722s_evm_a53_defconfig +1 -0
index 1675cedb25e..98620222a07 100644
@@ -37,6 +37,7 @@ CONFIG_BOARD_LATE_INIT=y
  CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_PAD_TO=0x0
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/j722s_evm_r5_defconfig +1 -0
index 8ba3916807d..e574be9e19d 100644
@@ -40,6 +40,7 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SEPARATE_BSS=y
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/j784s4_evm_a72_defconfig +1 -0
index c6dda6c06c7..966ccabec6a 100644
@@ -37,6 +37,7 @@ CONFIG_LOGLEVEL=7
  CONFIG_SPL_MAX_SIZE=0xc0000
  CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/j784s4_evm_r5_defconfig +1 -0
index 7ace6615261..02963f6ce5a 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SEPARATE_BSS=y
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/kontron-sl-mx8mm_defconfig +1 -0
index f2570289298..9321a077260 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/kontron_pitx_imx8m_defconfig +1 -0
index c2133470fc9..52238831229 100644
@@ -44,6 +44,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/kontron_sl28_defconfig +1 -0
index a1d5f89b1ec..c4493e50a32 100644
@@ -51,6 +51,7 @@ CONFIG_SPL_MAX_SIZE=0x20000
  CONFIG_SPL_BOARD_INIT=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
  CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x900
  CONFIG_SPL_MPC8XXX_INIT_DDR=y
configs/librem5_defconfig +1 -0
index 6999a689e29..248fc1fdde4 100644
@@ -46,6 +46,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/ls1021aiot_sdcard_defconfig +1 -0
index 2354f4113ae..981093a9fb5 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82080000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_nand_defconfig +1 -0
index 136ca9a2670..4fc0e66e485 100644
@@ -60,6 +60,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80200000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_sdcard_ifc_defconfig +1 -0
index befb4ae442c..72632b87701 100644
@@ -59,6 +59,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021aqds_sdcard_qspi_defconfig +1 -0
index db06a03fe6b..78dce4dcbba 100644
@@ -58,6 +58,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x820c0000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atsn_sdcard_defconfig +1 -0
index e5d8eeb8a2f..0853bfbd3a0 100644
@@ -52,6 +52,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig +1 -0
index dc0e507263f..28434d8e191 100644
@@ -60,6 +60,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82104000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_ifc_defconfig +1 -0
index 9980d6106ec..b4348f12678 100644
@@ -61,6 +61,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/ls1021atwr_sdcard_qspi_defconfig +1 -0
index ed92e34dccf..8d2c391f0e8 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FSL_PBL=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x82100000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
  CONFIG_SPL_ENV_SUPPORT=y
configs/msc_sm2s_imx8mp_defconfig +1 -0
index 2e1d112a3e7..47ed5cfb214 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/omap35_logic_defconfig +1 -1
index 23b2e503385..a35c027f952 100644
@@ -28,7 +28,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  # CONFIG_SPL_FS_EXT4 is not set
  # CONFIG_SPL_I2C is not set
  CONFIG_SPL_MTD=y
configs/omap35_logic_somlv_defconfig +1 -1
index a5f242ff40c..28e85bf5173 100644
@@ -29,7 +29,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  # CONFIG_SPL_FS_EXT4 is not set
  # CONFIG_SPL_I2C is not set
  CONFIG_SPL_MTD=y
configs/omap3_logic_defconfig +1 -1
index d081d4e0fb4..045290838e4 100644
@@ -27,7 +27,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  # CONFIG_SPL_FS_EXT4 is not set
  # CONFIG_SPL_I2C is not set
  CONFIG_SPL_MTD=y
configs/omap3_logic_somlv_defconfig +1 -1
index 68e89d245ee..583f79059a5 100644
@@ -29,7 +29,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  # CONFIG_SPL_FS_EXT4 is not set
  # CONFIG_SPL_I2C is not set
  CONFIG_SPL_MTD=y
configs/phycore-imx8mm_defconfig +1 -0
index f9fd7255df7..ce322887bae 100644
@@ -38,6 +38,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/phycore-imx8mp_defconfig +1 -0
index 8dd4963bdc0..a296d2e3a99 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  # CONFIG_SPL_CRYPTO is not set
configs/phycore_am62x_a53_defconfig +1 -0
index 39161b722b1..d8b129f7dd0 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_ENV_SUPPORT=y
configs/phycore_am62x_r5_defconfig +1 -0
index b7d0273dd74..7fc3abf1262 100644
@@ -48,6 +48,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_I2C=y
configs/phycore_am64x_a53_defconfig +1 -0
index 1af72e8bb32..5cf24b9debf 100644
@@ -45,6 +45,7 @@ CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/phycore_am64x_r5_defconfig +1 -0
index a0d78241928..72d10f76647 100644
@@ -49,6 +49,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_DMA=y
configs/pico-imx8mq_defconfig +1 -0
index cf91eb563b9..ef876abbd36 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/sama5d27_wlsom1_ek_mmc_defconfig +1 -1
index 89a5bcdfac8..25213af37c5 100644
@@ -48,7 +48,7 @@ CONFIG_SPL_MAX_SIZE=0x10000
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
  CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_AT91_MCK_BYPASS=y
  CONFIG_HUSH_PARSER=y
  CONFIG_CMD_BOOTZ=y
configs/sama5d27_wlsom1_ek_qspiflash_defconfig +1 -1
index a07044578a8..5502858fead 100644
@@ -48,7 +48,7 @@ CONFIG_SPL_MAX_SIZE=0x10000
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
  CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_DM_SPI_FLASH=y
  CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000
configs/sama5d2_icp_mmc_defconfig +1 -1
index 6b9fa27de63..98b931c375d 100644
@@ -49,7 +49,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
  CONFIG_SPL_DISPLAY_PRINT=y
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SPL_RAM_SUPPORT=y
  CONFIG_SPL_RAM_DEVICE=y
  CONFIG_SPL_AT91_MCK_BYPASS=y
configs/sandbox_noinst_defconfig +1 -0
index f37230151a0..bfd95e2398f 100644
@@ -43,6 +43,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xa000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x4000000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x0
  CONFIG_SPL_ENV_SUPPORT=y
configs/sniper_defconfig +1 -1
index 0243b15f31c..d0dbd105d0c 100644
@@ -22,7 +22,7 @@ CONFIG_SPL_MAX_SIZE=0xec00
  CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80208000
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=2
  # CONFIG_SPL_FS_EXT4 is not set
configs/socfpga_secu1_defconfig +1 -1
index a08ba22fdb5..3a3b8a77c22 100644
@@ -42,7 +42,7 @@ CONFIG_SPL_PAD_TO=0x10000
  CONFIG_SPL_NO_BSS_LIMIT=y
  CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x1
  # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE is not set
  CONFIG_SPL_MTD=y
configs/verdin-am62_a53_defconfig +1 -0
index 03730b498fd..f0ffaaad079 100644
@@ -51,6 +51,7 @@ CONFIG_SPL_MAX_SIZE=0x58000
  CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y
  CONFIG_SPL_BOARD_INIT=y
  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
  CONFIG_SPL_DMA=y
configs/verdin-am62_r5_defconfig +1 -0
index 8266a7f6e8f..02c2f579e97 100644
@@ -41,6 +41,7 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x84000000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000
  CONFIG_SPL_EARLY_BSS=y
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x400
  CONFIG_SPL_I2C=y
configs/verdin-imx8mm_defconfig +1 -0
index ef7f3b1bc10..9ca205586a0 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
configs/verdin-imx8mp_defconfig +0 -0
index fca91f7b1ee..c74398f4f8b 100644

configs/verdin-imx8mp_defconfig CONFIG_SPL_SYS_MALLOC=y · line 66

Quoted 7 lines
configs/verdin-imx8mp_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_SPL_SYS_MALLOC=y
  CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
  CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x42200000
  CONFIG_SPL_SYS_MALLOC_SIZE=0x80000
+CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
  CONFIG_SPL_I2C=y
#26 lore raw

PATCH 12/14 spl: Use unified inline functions for spl_load_info

In reply to Simon Glass

Rather than declaring completely separate functions, put the code for each case into the same function. This makes it easier to read.

---

 include/spl.h | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
include/spl.h +7 -11
index 5dfdf778d2d..2f6a3e64c10 100644
@@ -306,31 +306,27 @@ struct spl_load_info {
 		      void *buf);
 #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
 	int bl_len;
+#endif
 };
 
 static inline int spl_get_bl_len(struct spl_load_info *info)
 {
+#if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
 	return info->bl_len;
-}
-
-static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
-{
-	info->bl_len = bl_len;
-}
 #else
-};
-
-static inline int spl_get_bl_len(struct spl_load_info *info)
-{
 	return 1;
+#endif
 }
 
 static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
 {
+#if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
+	info->bl_len = bl_len;
+#else
 	if (bl_len != 1)
 		panic("CONFIG_SPL_LOAD_BLOCK not enabled");
-}
 #endif
+}
 
 /*
  * We need to know the position of U-Boot in memory so we can jump to it. We
Signature · 1 line
2.34.1
Reviewed-by on v1 12/14
#27 lore raw

Re: [PATCH 12/14] spl: Use unified inline functions for spl_load_info

Quoted 42 lines · Simon Glass

Rather than declaring completely separate functions, put the code for each case into the same function. This makes it easier to read.

---

  include/spl.h | 18 +++++++-----------
  1 file changed, 7 insertions(+), 11 deletions(-)
include/spl.h +4 -10
index 5dfdf778d2d..2f6a3e64c10 100644
@@ -306,31 +306,27 @@ struct spl_load_info {
  		      void *buf);
  #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
  	int bl_len;
+#endif
  };
 
  static inline int spl_get_bl_len(struct spl_load_info *info)
  {
+#if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
  	return info->bl_len;
-}
-
-static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
-{
-	info->bl_len = bl_len;
-}
  #else
-};
-
-static inline int spl_get_bl_len(struct spl_load_info *info)
-{
  	return 1;
+#endif
  }
 
  static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
  {
+#if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)

include/spl.h struct spl_load_info { · line 332

Quoted 10 lines
include/spl.h +3 -1
+	info->bl_len = bl_len;
+#else
  	if (bl_len != 1)
  		panic("CONFIG_SPL_LOAD_BLOCK not enabled");
-}
  #endif
+}
 
  /*
   * We need to know the position of U-Boot in memory so we can jump to it. We
#28 lore raw

PATCH 13/14 spl: Create a function to init spl_load_info

In reply to Simon Glass

Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited.

---

 arch/arm/mach-imx/spl_imx_romapi.c  | 14 ++-------
 arch/arm/mach-sunxi/spl_spi_sunxi.c |  3 +-
 common/spl/spl_blk_fs.c             |  9 ++----
 common/spl/spl_ext.c                |  3 +-
 common/spl/spl_fat.c                | 10 +++----
 common/spl/spl_mmc.c                |  4 +--
 common/spl/spl_nand.c               |  4 +--
 common/spl/spl_net.c                |  3 +-
 common/spl/spl_nor.c                |  6 ++--
 common/spl/spl_ram.c                |  3 +-
 common/spl/spl_semihosting.c        |  4 +--
 common/spl/spl_spi.c                |  4 +--
 common/spl/spl_ymodem.c             |  4 +--
 drivers/usb/gadget/f_sdp.c          |  8 ++----
 include/spl.h                       | 44 ++++++++++++++++++++---------
 test/image/spl_load.c               |  4 +--
 test/image/spl_load_os.c            |  6 +---
 17 files changed, 55 insertions(+), 78 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +3 -11
index bdaea439d7f..3982f4cca18 100644
@@ -108,18 +108,13 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
 	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) {
 		struct spl_load_info load;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, pagesize);
-		load.read = spl_romapi_read_seekable;
+		spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
 		return spl_load_simple_fit(spl_image, &load, offset, header);
 	} else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) &&
 		   valid_container_hdr((void *)header)) {
 		struct spl_load_info load;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, pagesize);
-		load.read = spl_romapi_read_seekable;
-
+		spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
 		ret = spl_load_imx_container(spl_image, &load, offset);
 	} else {
 		/* TODO */
@@ -341,10 +336,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
 		ss.end = p;
 		ss.pagesize = pagesize;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, 1);
-		load.read = spl_romapi_read_stream;
-		load.priv = &ss;
+		spl_load_init(&load, spl_romapi_read_stream, &ss, 1);
 
 		return spl_load_simple_fit(spl_image, &load, (ulong)phdr, phdr);
 	}
arch/arm/mach-sunxi/spl_spi_sunxi.c +1 -2
index d7abdc2e401..5f72e809952 100644
@@ -390,8 +390,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 		struct spl_load_info load;
 
 		debug("Found FIT image\n");
-		spl_set_bl_len(&load, 1);
-		load.read = spi_load_read;
+		spl_load_init(&load, spi_load_read, NULL, 1);
 		ret = spl_load_simple_fit(spl_image, &load,
 					  load_offset, header);
 	} else {
common/spl/spl_blk_fs.c +3 -6
index bc551c5c074..bbf90a9741e 100644
@@ -80,11 +80,8 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
 		return ret;
 	}
 
-	load.read = spl_fit_read;
-	if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-		spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-	else
-		spl_set_bl_len(&load, 1);
-	load.priv = &dev;
+	spl_load_init(&load, spl_fit_read, &dev,
+		      IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+		      ARCH_DMA_MINALIGN : 1);
 	return spl_load(spl_image, bootdev, &load, filesize, 0);
 }
common/spl/spl_ext.c +1 -2
index 76f49a5a8a6..c5478820a9b 100644
@@ -51,8 +51,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
 		goto end;
 	}
 
-	spl_set_bl_len(&load, 1);
-	load.read = spl_fit_read;
+	spl_load_init(&load, spl_fit_read, NULL, 1);
 	err = spl_load(spl_image, bootdev, &load, filelen, 0);
 
 end:
common/spl/spl_fat.c +4 -6
index bd8aab253a9..fce451b7664 100644
@@ -83,12 +83,10 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
 		size = 0;
 	}
 
-	load.read = spl_fit_read;
-	if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-		spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-	else
-		spl_set_bl_len(&load, 1);
-	load.priv = (void *)filename;
+	spl_load_init(&load, spl_fit_read, (void *)filename,
+		      IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+		      ARCH_DMA_MINALIGN : 1);
+
 	err = spl_load(spl_image, bootdev, &load, size, 0);
 
 end:
common/spl/spl_mmc.c +1 -3
index 3cb4b698f7f..22714bc4d90 100644
@@ -46,9 +46,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 	struct blk_desc *bd = mmc_get_blk_desc(mmc);
 	struct spl_load_info load;
 
-	load.priv = bd;
-	spl_set_bl_len(&load, bd->blksz);
-	load.read = h_spl_load_read;
+	spl_load_init(&load, h_spl_load_read, bd, bd->blksz);
 	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
 	if (ret) {
 		puts("mmc_load_image_raw_sector: mmc block read error\n");
common/spl/spl_nand.c +1 -3
index 5631fa6d563..22883f4e8b9 100644
@@ -71,9 +71,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
 {
 	struct spl_load_info load;
 
-	load.priv = &offset;
-	spl_set_bl_len(&load, 1);
-	load.read = spl_nand_read;
+	spl_load_init(&load, spl_nand_read, &offset, 1);
 	return spl_load(spl_image, bootdev, &load, 0, offset);
 }
 
common/spl/spl_net.c +1 -2
index be7278bb933..2be7b73ed35 100644
@@ -47,8 +47,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
 		return rv;
 	}
 
-	spl_set_bl_len(&load, 1);
-	load.read = spl_net_load_read;
+	spl_load_init(&load, spl_net_load_read, NULL, 1);
 	return spl_load(spl_image, bootdev, &load, 0, 0);
 }
 #endif
common/spl/spl_nor.c +2 -4
index ed76b5e1293..1021d933999 100644
@@ -49,8 +49,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 			int ret;
 
 			debug("Found FIT\n");
-			spl_set_bl_len(&load, 1);
-			load.read = spl_nor_load_read;
+			spl_load_init(&load, spl_nor_load_read, NULL, 1);
 
 			ret = spl_load_simple_fit(spl_image, &load,
 						  CONFIG_SYS_OS_BASE,
@@ -93,8 +92,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 	 * Load real U-Boot from its location in NOR flash to its
 	 * defined location in SDRAM
 	 */
-	spl_set_bl_len(&load, 1);
-	load.read = spl_nor_load_read;
+	spl_load_init(&load, spl_nor_load_read, NULL, 1);
 	return spl_load(spl_image, bootdev, &load, 0, spl_nor_get_uboot_base());
 }
 SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
common/spl/spl_ram.c +1 -2
index 5a23841f698..71b7a8374bb 100644
@@ -69,8 +69,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
 		struct spl_load_info load;
 
 		debug("Found FIT\n");
-		spl_set_bl_len(&load, 1);
-		load.read = spl_ram_load_read;
+		spl_load_init(&load, spl_ram_load_read, NULL, 1);
 		ret = spl_load_simple_fit(spl_image, &load, 0, header);
 	} else {
 		ulong u_boot_pos = spl_get_image_pos();
common/spl/spl_semihosting.c +1 -3
index 2047248f39b..f36863fe48d 100644
@@ -43,9 +43,7 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
 	}
 	len = ret;
 
-	load.read = smh_fit_read;
-	spl_set_bl_len(&load, 1);
-	load.priv = &fd;
+	spl_load_init(&load, smh_fit_read, &fd, 1);
 	ret = spl_load(spl_image, bootdev, &load, len, 0);
 	if (ret)
 		log_debug("could not read %s: %d\n", filename, ret);
common/spl/spl_spi.c +1 -3
index 8ab4803f7c4..691a431a926 100644
@@ -77,9 +77,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 		return -ENODEV;
 	}
 
-	load.priv = flash;
-	spl_set_bl_len(&load, 1);
-	load.read = spl_spi_fit_read;
+	spl_load_init(&load, spl_spi_fit_read, flash, 1);
 
 #if CONFIG_IS_ENABLED(OS_BOOT)
 	if (spl_start_uboot()) {
common/spl/spl_ymodem.c +1 -3
index 4c7222af612..2be957134c1 100644
@@ -132,11 +132,9 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
 		struct ymodem_fit_info info;
 
 		debug("Found FIT\n");
-		load.priv = (void *)&info;
-		spl_set_bl_len(&load, 1);
+		spl_load_init(&load, ymodem_read_fit, (void *)&info, 1);
 		info.buf = buf;
 		info.image_read = BUF_SIZE;
-		load.read = ymodem_read_fit;
 		ret = spl_load_simple_fit(spl_image, &load, 0, (void *)buf);
 		size = info.image_read;
 
drivers/usb/gadget/f_sdp.c +2 -6
index 89496917a61..8a962c038fe 100644
@@ -843,9 +843,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
 				struct spl_load_info load;
 
 				debug("Found FIT\n");
-				load.priv = header;
-				spl_set_bl_len(&load, 1);
-				load.read = sdp_load_read;
+				spl_load_init(&load, sdp_load_read, header, 1);
 				spl_load_simple_fit(spl_image, &load, 0,
 						    header);
 
@@ -856,9 +854,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
 			    valid_container_hdr((void *)header)) {
 				struct spl_load_info load;
 
-				load.priv = header;
-				spl_set_bl_len(&load, 1);
-				load.read = sdp_load_read;
+				spl_load_init(&load, sdp_load_read, header, 1);
 				spl_load_imx_container(spl_image, &load, 0);
 				return SDP_EXIT;
 			}
include/spl.h +30 -14

64 lines not on this page · raw message

test/image/spl_load.c +1 -3
index 7cbad40ea0c..3b6206955d3 100644
@@ -343,9 +343,7 @@ static int spl_test_image(struct unit_test_state *uts, const char *test_name,
 	} else {
 		struct spl_load_info load;
 
-		spl_set_bl_len(&load, 1);
-		load.priv = img;
-		load.read = spl_test_read;
+		spl_load_init(&load, spl_test_read, img, 1);
 		if (type == IMX8)
 			ut_assertok(spl_load_imx_container(&info_read, &load,
 							   0));
test/image/spl_load_os.c +1 -5
index 7d5fb9b07e0..dc09ba191bf 100644
@@ -49,9 +49,7 @@ static int spl_test_load(struct unit_test_state *uts)
 	int ret;
 	int fd;
 
-	memset(&load, '\0', sizeof(load));
-	spl_set_bl_len(&load, 512);
-	load.read = read_fit_image;
+	spl_load_init(&load, read_fit_image, &text_ctx, 512);
 
 	ret = sandbox_find_next_phase(fname, sizeof(fname), true);
 	if (ret)
@@ -64,8 +62,6 @@ static int spl_test_load(struct unit_test_state *uts)
 	ut_asserteq(512, os_read(fd, header, 512));
 	text_ctx.fd = fd;
 
-	load.priv = &text_ctx;
-
 	ut_assertok(spl_load_simple_fit(&image, &load, 0, header));
 
 	return 0;
Signature · 1 line
2.34.1
Reviewed-by on v1 13/14
#29 lore raw

Re: [PATCH 13/14] spl: Create a function to init spl_load_info

Hi

Quoted 397 lines · Simon Glass

Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited.

---

 arch/arm/mach-imx/spl_imx_romapi.c  | 14 ++-------
 arch/arm/mach-sunxi/spl_spi_sunxi.c |  3 +-
 common/spl/spl_blk_fs.c             |  9 ++----
 common/spl/spl_ext.c                |  3 +-
 common/spl/spl_fat.c                | 10 +++----
 common/spl/spl_mmc.c                |  4 +--
 common/spl/spl_nand.c               |  4 +--
 common/spl/spl_net.c                |  3 +-
 common/spl/spl_nor.c                |  6 ++--
 common/spl/spl_ram.c                |  3 +-
 common/spl/spl_semihosting.c        |  4 +--
 common/spl/spl_spi.c                |  4 +--
 common/spl/spl_ymodem.c             |  4 +--
 drivers/usb/gadget/f_sdp.c          |  8 ++----
 include/spl.h                       | 44 ++++++++++++++++++++---------
 test/image/spl_load.c               |  4 +--
 test/image/spl_load_os.c            |  6 +---
 17 files changed, 55 insertions(+), 78 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +3 -11
index bdaea439d7f..3982f4cca18 100644
@@ -108,18 +108,13 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
        if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) {
                struct spl_load_info load;
 
-               memset(&load, 0, sizeof(load));
-               spl_set_bl_len(&load, pagesize);
-               load.read = spl_romapi_read_seekable;
+               spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
                return spl_load_simple_fit(spl_image, &load, offset, header);
        } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) &&
                   valid_container_hdr((void *)header)) {
                struct spl_load_info load;
 
-               memset(&load, 0, sizeof(load));
-               spl_set_bl_len(&load, pagesize);
-               load.read = spl_romapi_read_seekable;
-
+               spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
                ret = spl_load_imx_container(spl_image, &load, offset);
        } else {
                /* TODO */
@@ -341,10 +336,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
                ss.end = p;
                ss.pagesize = pagesize;
 
-               memset(&load, 0, sizeof(load));
-               spl_set_bl_len(&load, 1);
-               load.read = spl_romapi_read_stream;
-               load.priv = &ss;
+               spl_load_init(&load, spl_romapi_read_stream, &ss, 1);
 
                return spl_load_simple_fit(spl_image, &load, (ulong)phdr, phdr);
        }
arch/arm/mach-sunxi/spl_spi_sunxi.c +1 -2
index d7abdc2e401..5f72e809952 100644
@@ -390,8 +390,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                struct spl_load_info load;
 
                debug("Found FIT image\n");
-               spl_set_bl_len(&load, 1);
-               load.read = spi_load_read;
+               spl_load_init(&load, spi_load_read, NULL, 1);
                ret = spl_load_simple_fit(spl_image, &load,
                                          load_offset, header);
        } else {
common/spl/spl_blk_fs.c +3 -6
index bc551c5c074..bbf90a9741e 100644
@@ -80,11 +80,8 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
                return ret;
        }
 
-       load.read = spl_fit_read;
-       if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-               spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-       else
-               spl_set_bl_len(&load, 1);
-       load.priv = &dev;
+       spl_load_init(&load, spl_fit_read, &dev,
+                     IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+                     ARCH_DMA_MINALIGN : 1);
        return spl_load(spl_image, bootdev, &load, filesize, 0);
 }
common/spl/spl_ext.c +1 -2
index 76f49a5a8a6..c5478820a9b 100644
@@ -51,8 +51,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
                goto end;
        }
 
-       spl_set_bl_len(&load, 1);
-       load.read = spl_fit_read;
+       spl_load_init(&load, spl_fit_read, NULL, 1);
        err = spl_load(spl_image, bootdev, &load, filelen, 0);
 
 end:
common/spl/spl_fat.c +4 -6
index bd8aab253a9..fce451b7664 100644
@@ -83,12 +83,10 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
                size = 0;
        }
 
-       load.read = spl_fit_read;
-       if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-               spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-       else
-               spl_set_bl_len(&load, 1);
-       load.priv = (void *)filename;
+       spl_load_init(&load, spl_fit_read, (void *)filename,
+                     IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+                     ARCH_DMA_MINALIGN : 1);
+
        err = spl_load(spl_image, bootdev, &load, size, 0);
 
 end:
common/spl/spl_mmc.c +1 -3
index 3cb4b698f7f..22714bc4d90 100644
@@ -46,9 +46,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
        struct blk_desc *bd = mmc_get_blk_desc(mmc);
        struct spl_load_info load;
 
-       load.priv = bd;
-       spl_set_bl_len(&load, bd->blksz);
-       load.read = h_spl_load_read;
+       spl_load_init(&load, h_spl_load_read, bd, bd->blksz);
        ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
        if (ret) {
                puts("mmc_load_image_raw_sector: mmc block read error\n");
common/spl/spl_nand.c +1 -3
index 5631fa6d563..22883f4e8b9 100644
@@ -71,9 +71,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
 {
        struct spl_load_info load;
 
-       load.priv = &offset;
-       spl_set_bl_len(&load, 1);
-       load.read = spl_nand_read;
+       spl_load_init(&load, spl_nand_read, &offset, 1);
        return spl_load(spl_image, bootdev, &load, 0, offset);
 }
 
common/spl/spl_net.c +1 -2
index be7278bb933..2be7b73ed35 100644
@@ -47,8 +47,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
                return rv;
        }
 
-       spl_set_bl_len(&load, 1);
-       load.read = spl_net_load_read;
+       spl_load_init(&load, spl_net_load_read, NULL, 1);
        return spl_load(spl_image, bootdev, &load, 0, 0);
 }
 #endif
common/spl/spl_nor.c +2 -4
index ed76b5e1293..1021d933999 100644
@@ -49,8 +49,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
                        int ret;
 
                        debug("Found FIT\n");
-                       spl_set_bl_len(&load, 1);
-                       load.read = spl_nor_load_read;
+                       spl_load_init(&load, spl_nor_load_read, NULL, 1);
 
                        ret = spl_load_simple_fit(spl_image, &load,
                                                  CONFIG_SYS_OS_BASE,
@@ -93,8 +92,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
         * Load real U-Boot from its location in NOR flash to its
         * defined location in SDRAM
         */
-       spl_set_bl_len(&load, 1);
-       load.read = spl_nor_load_read;
+       spl_load_init(&load, spl_nor_load_read, NULL, 1);
        return spl_load(spl_image, bootdev, &load, 0, spl_nor_get_uboot_base());
 }
 SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
common/spl/spl_ram.c +1 -2
index 5a23841f698..71b7a8374bb 100644
@@ -69,8 +69,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
                struct spl_load_info load;
 
                debug("Found FIT\n");
-               spl_set_bl_len(&load, 1);
-               load.read = spl_ram_load_read;
+               spl_load_init(&load, spl_ram_load_read, NULL, 1);
                ret = spl_load_simple_fit(spl_image, &load, 0, header);
        } else {
                ulong u_boot_pos = spl_get_image_pos();
common/spl/spl_semihosting.c +1 -3
index 2047248f39b..f36863fe48d 100644
@@ -43,9 +43,7 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
        }
        len = ret;
 
-       load.read = smh_fit_read;
-       spl_set_bl_len(&load, 1);
-       load.priv = &fd;
+       spl_load_init(&load, smh_fit_read, &fd, 1);
        ret = spl_load(spl_image, bootdev, &load, len, 0);
        if (ret)
                log_debug("could not read %s: %d\n", filename, ret);
common/spl/spl_spi.c +1 -3
index 8ab4803f7c4..691a431a926 100644
@@ -77,9 +77,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                return -ENODEV;
        }
 
-       load.priv = flash;
-       spl_set_bl_len(&load, 1);
-       load.read = spl_spi_fit_read;
+       spl_load_init(&load, spl_spi_fit_read, flash, 1);
 
 #if CONFIG_IS_ENABLED(OS_BOOT)
        if (spl_start_uboot()) {
common/spl/spl_ymodem.c +1 -3
index 4c7222af612..2be957134c1 100644
@@ -132,11 +132,9 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
                struct ymodem_fit_info info;
 
                debug("Found FIT\n");
-               load.priv = (void *)&info;
-               spl_set_bl_len(&load, 1);
+               spl_load_init(&load, ymodem_read_fit, (void *)&info, 1);
                info.buf = buf;
                info.image_read = BUF_SIZE;
-               load.read = ymodem_read_fit;
                ret = spl_load_simple_fit(spl_image, &load, 0, (void *)buf);
                size = info.image_read;
 
drivers/usb/gadget/f_sdp.c +2 -6
index 89496917a61..8a962c038fe 100644
@@ -843,9 +843,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
                                struct spl_load_info load;
 
                                debug("Found FIT\n");
-                               load.priv = header;
-                               spl_set_bl_len(&load, 1);
-                               load.read = sdp_load_read;
+                               spl_load_init(&load, sdp_load_read, header, 1);
                                spl_load_simple_fit(spl_image, &load, 0,
                                                    header);
 
@@ -856,9 +854,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
                            valid_container_hdr((void *)header)) {
                                struct spl_load_info load;
 
-                               load.priv = header;
-                               spl_set_bl_len(&load, 1);
-                               load.read = sdp_load_read;
+                               spl_load_init(&load, sdp_load_read, header, 1);
                                spl_load_imx_container(spl_image, &load, 0);
                                return SDP_EXIT;
                        }
include/spl.h +30 -14
index 2f6a3e64c10..12bf308e890 100644
@@ -282,28 +282,32 @@ static inline void *spl_image_fdt_addr(struct spl_image_info *info)
 #endif
 }
 
+struct spl_load_info;
+
+/**
+ * spl_load_reader() - Read from device
+ *
+ * @load: Information about the load state
+ * @offset: Offset to read from in bytes. This must be a multiple of
+ *          @load->bl_len.
+ * @count: Number of bytes to read. This must be a multiple of
+ *         @load->bl_len.
+ * @buf: Buffer to read into
+ * @return number of bytes read, 0 on error
+ */
+typedef ulong (*spl_load_reader)(struct spl_load_info *load, ulong sector,
+                                ulong count, void *buf);
+
 /**
  * Information required to load data from a device
  *
+ * @read: Function to call to read from the device
  * @priv: Private data for the device
  * @bl_len: Block length for reading in bytes
- * @read: Function to call to read from the device
  */
 struct spl_load_info {
+       spl_load_reader read;
        void *priv;
-       /**
-        * read() - Read from device
-        *
-        * @load: Information about the load state
-        * @offset: Offset to read from in bytes. This must be a multiple of
-        *          @load->bl_len.
-        * @count: Number of bytes to read. This must be a multiple of
-        *         @load->bl_len.
-        * @buf: Buffer to read into
-        * @return number of bytes read, 0 on error
-        */
-       ulong (*read)(struct spl_load_info *load, ulong sector, ulong count,
-                     void *buf);
 #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
        int bl_len;
 #endif
@@ -328,6 +332,18 @@ static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
 #endif
 }
 
+/**
+ * spl_load_init() - Set up a new spl_load_info structure
+ */
+static inline void spl_load_init(struct spl_load_info *load,
+                                spl_load_reader h_read, void *priv,
+                                uint bl_len)
+{
+       load->read = h_read;
+       load->priv = priv;
+       spl_set_bl_len(load, bl_len);
+}
+
 /*
  * We need to know the position of U-Boot in memory so we can jump to it. We
  * allow any U-Boot binary to be used (u-boot.bin, u-boot-nodtb.bin,
test/image/spl_load.c +1 -3
index 7cbad40ea0c..3b6206955d3 100644
@@ -343,9 +343,7 @@ static int spl_test_image(struct unit_test_state *uts, const char *test_name,
        } else {
                struct spl_load_info load;
 
-               spl_set_bl_len(&load, 1);
-               load.priv = img;
-               load.read = spl_test_read;
+               spl_load_init(&load, spl_test_read, img, 1);
                if (type == IMX8)
                        ut_assertok(spl_load_imx_container(&info_read, &load,
                                                           0));
test/image/spl_load_os.c +1 -6
index 7d5fb9b07e0..dc09ba191bf 100644
@@ -49,9 +49,7 @@ static int spl_test_load(struct unit_test_state *uts)
        int ret;
        int fd;
 
-       memset(&load, '\0', sizeof(load));
-       spl_set_bl_len(&load, 512);
-       load.read = read_fit_image;
+       spl_load_init(&load, read_fit_image, &text_ctx, 512);
 
        ret = sandbox_find_next_phase(fname, sizeof(fname), true);
        if (ret)
@@ -64,8 +62,6 @@ static int spl_test_load(struct unit_test_state *uts)
        ut_asserteq(512, os_read(fd, header, 512));
        text_ctx.fd = fd;
 
-       load.priv = &text_ctx;
-
        ut_assertok(spl_load_simple_fit(&image, &load, 0, header));
 
        return 0;
--
Quoted 2 lines

2.34.1

Look straight forward with nice clean up

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#30 lore raw

Re: [PATCH 13/14] spl: Create a function to init spl_load_info

In reply to Simon Glass
Quoted 4 lines · Simon Glass

Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited.

What is the code size impact of this?

IIRC the reason why I didn't do this is to avoid growing the code in cases where priv is unused.

Although in some places there are memsets which should be removed anyway.

Quoted 391 lines

---

  arch/arm/mach-imx/spl_imx_romapi.c  | 14 ++-------
  arch/arm/mach-sunxi/spl_spi_sunxi.c |  3 +-
  common/spl/spl_blk_fs.c             |  9 ++----
  common/spl/spl_ext.c                |  3 +-
  common/spl/spl_fat.c                | 10 +++----
  common/spl/spl_mmc.c                |  4 +--
  common/spl/spl_nand.c               |  4 +--
  common/spl/spl_net.c                |  3 +-
  common/spl/spl_nor.c                |  6 ++--
  common/spl/spl_ram.c                |  3 +-
  common/spl/spl_semihosting.c        |  4 +--
  common/spl/spl_spi.c                |  4 +--
  common/spl/spl_ymodem.c             |  4 +--
  drivers/usb/gadget/f_sdp.c          |  8 ++----
  include/spl.h                       | 44 ++++++++++++++++++++---------
  test/image/spl_load.c               |  4 +--
  test/image/spl_load_os.c            |  6 +---
  17 files changed, 55 insertions(+), 78 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +3 -11
index bdaea439d7f..3982f4cca18 100644
@@ -108,18 +108,13 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
  	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) {
  		struct spl_load_info load;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, pagesize);
-		load.read = spl_romapi_read_seekable;
+		spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
  		return spl_load_simple_fit(spl_image, &load, offset, header);
  	} else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) &&
  		   valid_container_hdr((void *)header)) {
  		struct spl_load_info load;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, pagesize);
-		load.read = spl_romapi_read_seekable;
-
+		spl_load_init(&load, spl_romapi_read_seekable, NULL, pagesize);
  		ret = spl_load_imx_container(spl_image, &load, offset);
  	} else {
  		/* TODO */
@@ -341,10 +336,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image,
  		ss.end = p;
  		ss.pagesize = pagesize;
 
-		memset(&load, 0, sizeof(load));
-		spl_set_bl_len(&load, 1);
-		load.read = spl_romapi_read_stream;
-		load.priv = &ss;
+		spl_load_init(&load, spl_romapi_read_stream, &ss, 1);
 
  		return spl_load_simple_fit(spl_image, &load, (ulong)phdr, phdr);
  	}
arch/arm/mach-sunxi/spl_spi_sunxi.c +1 -2
index d7abdc2e401..5f72e809952 100644
@@ -390,8 +390,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
  		struct spl_load_info load;
 
  		debug("Found FIT image\n");
-		spl_set_bl_len(&load, 1);
-		load.read = spi_load_read;
+		spl_load_init(&load, spi_load_read, NULL, 1);
  		ret = spl_load_simple_fit(spl_image, &load,
  					  load_offset, header);
  	} else {
common/spl/spl_blk_fs.c +3 -6
index bc551c5c074..bbf90a9741e 100644
@@ -80,11 +80,8 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
  		return ret;
  	}
 
-	load.read = spl_fit_read;
-	if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-		spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-	else
-		spl_set_bl_len(&load, 1);
-	load.priv = &dev;
+	spl_load_init(&load, spl_fit_read, &dev,
+		      IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+		      ARCH_DMA_MINALIGN : 1);
  	return spl_load(spl_image, bootdev, &load, filesize, 0);
  }
common/spl/spl_ext.c +1 -2
index 76f49a5a8a6..c5478820a9b 100644
@@ -51,8 +51,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
  		goto end;
  	}
 
-	spl_set_bl_len(&load, 1);
-	load.read = spl_fit_read;
+	spl_load_init(&load, spl_fit_read, NULL, 1);
  	err = spl_load(spl_image, bootdev, &load, filelen, 0);
 
  end:
common/spl/spl_fat.c +4 -6
index bd8aab253a9..fce451b7664 100644
@@ -83,12 +83,10 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
  		size = 0;
  	}
 
-	load.read = spl_fit_read;
-	if (IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN))
-		spl_set_bl_len(&load, ARCH_DMA_MINALIGN);
-	else
-		spl_set_bl_len(&load, 1);
-	load.priv = (void *)filename;
+	spl_load_init(&load, spl_fit_read, (void *)filename,
+		      IS_ENABLED(CONFIG_SPL_FS_FAT_DMA_ALIGN) ?
+		      ARCH_DMA_MINALIGN : 1);
+
  	err = spl_load(spl_image, bootdev, &load, size, 0);
 
  end:
common/spl/spl_mmc.c +1 -3
index 3cb4b698f7f..22714bc4d90 100644
@@ -46,9 +46,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
  	struct blk_desc *bd = mmc_get_blk_desc(mmc);
  	struct spl_load_info load;
 
-	load.priv = bd;
-	spl_set_bl_len(&load, bd->blksz);
-	load.read = h_spl_load_read;
+	spl_load_init(&load, h_spl_load_read, bd, bd->blksz);
  	ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
  	if (ret) {
  		puts("mmc_load_image_raw_sector: mmc block read error\n");
common/spl/spl_nand.c +1 -3
index 5631fa6d563..22883f4e8b9 100644
@@ -71,9 +71,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
  {
  	struct spl_load_info load;
 
-	load.priv = &offset;
-	spl_set_bl_len(&load, 1);
-	load.read = spl_nand_read;
+	spl_load_init(&load, spl_nand_read, &offset, 1);
  	return spl_load(spl_image, bootdev, &load, 0, offset);
  }
 
common/spl/spl_net.c +1 -2
index be7278bb933..2be7b73ed35 100644
@@ -47,8 +47,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
  		return rv;
  	}
 
-	spl_set_bl_len(&load, 1);
-	load.read = spl_net_load_read;
+	spl_load_init(&load, spl_net_load_read, NULL, 1);
  	return spl_load(spl_image, bootdev, &load, 0, 0);
  }
  #endif
common/spl/spl_nor.c +2 -4
index ed76b5e1293..1021d933999 100644
@@ -49,8 +49,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
  			int ret;
 
  			debug("Found FIT\n");
-			spl_set_bl_len(&load, 1);
-			load.read = spl_nor_load_read;
+			spl_load_init(&load, spl_nor_load_read, NULL, 1);
 
  			ret = spl_load_simple_fit(spl_image, &load,
  						  CONFIG_SYS_OS_BASE,
@@ -93,8 +92,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
  	 * Load real U-Boot from its location in NOR flash to its
  	 * defined location in SDRAM
  	 */
-	spl_set_bl_len(&load, 1);
-	load.read = spl_nor_load_read;
+	spl_load_init(&load, spl_nor_load_read, NULL, 1);
  	return spl_load(spl_image, bootdev, &load, 0, spl_nor_get_uboot_base());
  }
  SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
common/spl/spl_ram.c +1 -2
index 5a23841f698..71b7a8374bb 100644
@@ -69,8 +69,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
  		struct spl_load_info load;
 
  		debug("Found FIT\n");
-		spl_set_bl_len(&load, 1);
-		load.read = spl_ram_load_read;
+		spl_load_init(&load, spl_ram_load_read, NULL, 1);
  		ret = spl_load_simple_fit(spl_image, &load, 0, header);
  	} else {
  		ulong u_boot_pos = spl_get_image_pos();
common/spl/spl_semihosting.c +1 -3
index 2047248f39b..f36863fe48d 100644
@@ -43,9 +43,7 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
  	}
  	len = ret;
 
-	load.read = smh_fit_read;
-	spl_set_bl_len(&load, 1);
-	load.priv = &fd;
+	spl_load_init(&load, smh_fit_read, &fd, 1);
  	ret = spl_load(spl_image, bootdev, &load, len, 0);
  	if (ret)
  		log_debug("could not read %s: %d\n", filename, ret);
common/spl/spl_spi.c +1 -3
index 8ab4803f7c4..691a431a926 100644
@@ -77,9 +77,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
  		return -ENODEV;
  	}
 
-	load.priv = flash;
-	spl_set_bl_len(&load, 1);
-	load.read = spl_spi_fit_read;
+	spl_load_init(&load, spl_spi_fit_read, flash, 1);
 
  #if CONFIG_IS_ENABLED(OS_BOOT)
  	if (spl_start_uboot()) {
common/spl/spl_ymodem.c +1 -3
index 4c7222af612..2be957134c1 100644
@@ -132,11 +132,9 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
  		struct ymodem_fit_info info;
 
  		debug("Found FIT\n");
-		load.priv = (void *)&info;
-		spl_set_bl_len(&load, 1);
+		spl_load_init(&load, ymodem_read_fit, (void *)&info, 1);
  		info.buf = buf;
  		info.image_read = BUF_SIZE;
-		load.read = ymodem_read_fit;
  		ret = spl_load_simple_fit(spl_image, &load, 0, (void *)buf);
  		size = info.image_read;
 
drivers/usb/gadget/f_sdp.c +2 -6
index 89496917a61..8a962c038fe 100644
@@ -843,9 +843,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
  				struct spl_load_info load;
 
  				debug("Found FIT\n");
-				load.priv = header;
-				spl_set_bl_len(&load, 1);
-				load.read = sdp_load_read;
+				spl_load_init(&load, sdp_load_read, header, 1);
  				spl_load_simple_fit(spl_image, &load, 0,
  						    header);
 
@@ -856,9 +854,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
  			    valid_container_hdr((void *)header)) {
  				struct spl_load_info load;
 
-				load.priv = header;
-				spl_set_bl_len(&load, 1);
-				load.read = sdp_load_read;
+				spl_load_init(&load, sdp_load_read, header, 1);
  				spl_load_imx_container(spl_image, &load, 0);
  				return SDP_EXIT;
  			}
include/spl.h +30 -14
index 2f6a3e64c10..12bf308e890 100644
@@ -282,28 +282,32 @@ static inline void *spl_image_fdt_addr(struct spl_image_info *info)
  #endif
  }
 
+struct spl_load_info;
+
+/**
+ * spl_load_reader() - Read from device
+ *
+ * @load: Information about the load state
+ * @offset: Offset to read from in bytes. This must be a multiple of
+ *          @load->bl_len.
+ * @count: Number of bytes to read. This must be a multiple of
+ *         @load->bl_len.
+ * @buf: Buffer to read into
+ * @return number of bytes read, 0 on error
+ */
+typedef ulong (*spl_load_reader)(struct spl_load_info *load, ulong sector,
+				 ulong count, void *buf);
+
  /**
   * Information required to load data from a device
   *
+ * @read: Function to call to read from the device
   * @priv: Private data for the device
   * @bl_len: Block length for reading in bytes
- * @read: Function to call to read from the device
   */
  struct spl_load_info {
+	spl_load_reader read;
  	void *priv;
-	/**
-	 * read() - Read from device
-	 *
-	 * @load: Information about the load state
-	 * @offset: Offset to read from in bytes. This must be a multiple of
-	 *          @load->bl_len.
-	 * @count: Number of bytes to read. This must be a multiple of
-	 *         @load->bl_len.
-	 * @buf: Buffer to read into
-	 * @return number of bytes read, 0 on error
-	 */
-	ulong (*read)(struct spl_load_info *load, ulong sector, ulong count,
-		      void *buf);
  #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
  	int bl_len;
  #endif
@@ -328,6 +332,18 @@ static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
  #endif
  }
 
+/**
+ * spl_load_init() - Set up a new spl_load_info structure
+ */
+static inline void spl_load_init(struct spl_load_info *load,
+				 spl_load_reader h_read, void *priv,
+				 uint bl_len)
+{
+	load->read = h_read;
+	load->priv = priv;
+	spl_set_bl_len(load, bl_len);
+}
+
  /*
   * We need to know the position of U-Boot in memory so we can jump to it. We
   * allow any U-Boot binary to be used (u-boot.bin, u-boot-nodtb.bin,
test/image/spl_load.c +1 -3
index 7cbad40ea0c..3b6206955d3 100644
@@ -343,9 +343,7 @@ static int spl_test_image(struct unit_test_state *uts, const char *test_name,
  	} else {
  		struct spl_load_info load;
 
-		spl_set_bl_len(&load, 1);
-		load.priv = img;
-		load.read = spl_test_read;
+		spl_load_init(&load, spl_test_read, img, 1);
  		if (type == IMX8)
  			ut_assertok(spl_load_imx_container(&info_read, &load,
  							   0));
test/image/spl_load_os.c +1 -5
index 7d5fb9b07e0..dc09ba191bf 100644
@@ -49,9 +49,7 @@ static int spl_test_load(struct unit_test_state *uts)
  	int ret;
  	int fd;
 
-	memset(&load, '\0', sizeof(load));
-	spl_set_bl_len(&load, 512);
-	load.read = read_fit_image;
+	spl_load_init(&load, read_fit_image, &text_ctx, 512);
 
  	ret = sandbox_find_next_phase(fname, sizeof(fname), true);
  	if (ret)
@@ -64,8 +62,6 @@ static int spl_test_load(struct unit_test_state *uts)
  	ut_asserteq(512, os_read(fd, header, 512));
  	text_ctx.fd = fd;
 
-	load.priv = &text_ctx;
-
  	ut_assertok(spl_load_simple_fit(&image, &load, 0, header));
 
  	return 0;
#31 lore raw

Re: [PATCH 13/14] spl: Create a function to init spl_load_info

Hi Sean,

Quoted 8 lines · Sean Anderson
Quoted 4 lines · Simon Glass

Rather than having every caller set this up individually, create a common init function. This allows new fields to be added without the risk of them being left uninited.

What is the code size impact of this?

I don't see any, e.g. for socfpga_n5x_atf (which enabled SPL_FS_FAT)and firefly-rk3288

Quoted 6 lines

IIRC the reason why I didn't do this is to avoid growing the code in cases where priv is unused.

Although in some places there are memsets which should be removed anyway.

Yes, that might be helping.

Regards,
SImon

#32 lore raw

PATCH 14/14 blk: Correct comment for blk_get_devnum_by_uclass_idname()

In reply to Simon Glass

Update the comment to match the function. Fix the indentation while we are here.

---

 include/blk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/blk.h +2 -2
index 7c7cf7f2b10..1fc9a5b8471 100644
@@ -650,7 +650,7 @@ struct blk_driver *blk_driver_lookup_type(int uclass_id);
 struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum);
 
 /**
- * blk_get_devnum_by_uclass_id() - Get a block device by type name, and number
+ * blk_get_devnum_by_uclass_idname() - Get block device by type name and number
  *
  * This looks up the block device type based on @uclass_idname, then calls
  * blk_get_devnum_by_uclass_id().
@@ -660,7 +660,7 @@ struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnu
  * Return: point to block device descriptor, or NULL if not found
  */
 struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname,
-					    int devnum);
+						 int devnum);
 
 /**
  * blk_dselect_hwpart() - select a hardware partition
Signature · 1 line
2.34.1
Reviewed-by on v1 14/14
#33 lore raw

Re: [PATCH 14/14] blk: Correct comment for blk_get_devnum_by_uclass_idname()

Quoted 23 lines · Simon Glass

Update the comment to match the function. Fix the indentation while we are here.

---

  include/blk.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
include/blk.h +1 -1
index 7c7cf7f2b10..1fc9a5b8471 100644
@@ -650,7 +650,7 @@ struct blk_driver *blk_driver_lookup_type(int uclass_id);
  struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnum);
 
  /**
- * blk_get_devnum_by_uclass_id() - Get a block device by type name, and number
+ * blk_get_devnum_by_uclass_idname() - Get block device by type name and number
   *
   * This looks up the block device type based on @uclass_idname, then calls
   * blk_get_devnum_by_uclass_id().

include/blk.h struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnu · line 666

Quoted 8 lines
include/blk.h +1 -1
@@ -660,7 +660,7 @@ struct blk_desc *blk_get_devnum_by_uclass_id(enum uclass_id uclass_id, int devnu
   * Return: point to block device descriptor, or NULL if not found
   */
  struct blk_desc *blk_get_devnum_by_uclass_idname(const char *uclass_idname,
-					    int devnum);
+						 int devnum);
 
  /**
   * blk_dselect_hwpart() - select a hardware partition