Skip to contentSkip to conversation

Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

PATCH Superseded Fabio Estevam 6 participants 12 messages Feb 15, 2018 – Feb 20, 2018

Subsystems (10)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

---
Changes since v1:
- Fix typo in commit log: "breaks the boot" instead of "breaks the build"

 arch/arm/cpu/arm1136/mx35/generic.c       | 21 +++++++++++++++++++++
 arch/arm/cpu/armv7/ls102xa/spl.c          | 17 +++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   | 17 +++++++++++++++++
 arch/arm/cpu/armv8/zynqmp/spl.c           | 14 ++++++++++++++
 arch/arm/mach-at91/spl.c                  | 15 +++++++++++++++
 arch/arm/mach-davinci/spl.c               |  5 +++++
 arch/arm/mach-imx/spl.c                   | 23 +++++++++++++++++++++++
 arch/arm/mach-mvebu/spl.c                 |  7 +++++++
 arch/arm/mach-rockchip/rk3188-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3288-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3368-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3399-board-spl.c |  5 +++++
 arch/arm/mach-socfpga/spl.c               | 11 +++++++++++
 arch/arm/mach-sunxi/board.c               |  6 ++++++
 arch/arm/mach-zynq/spl.c                  |  7 +++++++
 common/spl/spl_mmc.c                      | 11 -----------
 16 files changed, 163 insertions(+), 11 deletions(-)
arch/arm/cpu/arm1136/mx35/generic.c +21 -0
index 4dcfc72..5297d62 100644
@@ -524,3 +524,24 @@ u32 spl_boot_device(void)
 
 	return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_BUILD
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	case BOOT_DEVICE_NAND:
+		return 0;
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
arch/arm/cpu/armv7/ls102xa/spl.c +17 -0
index 1e4a164..1246eed 100644
@@ -14,3 +14,20 @@ u32 spl_boot_device(void)
 #endif
 	return BOOT_DEVICE_NAND;
 }
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
arch/arm/cpu/armv8/fsl-layerscape/spl.c +17 -0
index 3a74040..4093d15 100644
@@ -26,6 +26,23 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_BUILD
 
 void spl_board_init(void)
arch/arm/cpu/armv8/zynqmp/spl.c +14 -0
index 0bfa5c1..bc7313a 100644
@@ -115,6 +115,20 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+	case BOOT_DEVICE_RAM:
+		return 0;
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
arch/arm/mach-at91/spl.c +15 -0
index 91add92..7e7e24b 100644
@@ -87,3 +87,18 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 #endif
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+		break;
+#endif
+	case BOOT_DEVICE_NONE:
+	default:
+		hang();
+	}
+}
arch/arm/mach-davinci/spl.c +5 -0
index 4c74db9..564c200 100644
@@ -45,6 +45,11 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
arch/arm/mach-imx/spl.c +23 -0
index a9079fc..b2521b2 100644
@@ -132,6 +132,29 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 }
 #endif
 
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	/* for MMC return either RAW or FAT mode */
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+		return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+		return MMCSD_MODE_EMMCBOOT;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 /*
arch/arm/mach-mvebu/spl.c +7 -0
index a5086f1..d16a62d 100644
@@ -70,6 +70,13 @@ u32 spl_boot_device(void)
 	return get_boot_device();
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
 	int ret;
arch/arm/mach-rockchip/rk3188-board-spl.c +5 -0
index 74771d3..8e3b8ae 100644
@@ -72,6 +72,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 static int setup_arm_clock(void)
 {
 	struct udevice *dev;
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index f3ea624..f64a548 100644
@@ -78,6 +78,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
arch/arm/mach-rockchip/rk3368-board-spl.c +5 -0
index 8055ae5..72d2c97 100644
@@ -57,6 +57,11 @@ void board_init_f(ulong dummy)
 	}
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	return BOOT_DEVICE_MMC1;
arch/arm/mach-rockchip/rk3399-board-spl.c +5 -0
index d35990e..b96903e 100644
@@ -60,6 +60,11 @@ u32 spl_boot_device(void)
 	return boot_device;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #define TIMER_CHN10_BASE	0xff8680a0
 #define TIMER_END_COUNT_L	0x00
 #define TIMER_END_COUNT_H	0x04
arch/arm/mach-socfpga/spl.c +11 -0
index 9bf3b9a..71bae82 100644
@@ -66,6 +66,17 @@ u32 spl_boot_device(void)
 	}
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}
+#endif
+
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
arch/arm/mach-sunxi/board.c +6 -0
index 1753fae..0c60ee0 100644
@@ -260,6 +260,12 @@ u32 spl_boot_device(void)
 	return sunxi_get_boot_device();
 }
 
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 void board_init_f(ulong dummy)
 {
 	spl_init();
arch/arm/mach-zynq/spl.c +7 -0
index 0a303f4..b7e6d98 100644
@@ -69,6 +69,13 @@ u32 spl_boot_device(void)
 	return mode;
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_FS;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
common/spl/spl_mmc.c +0 -11
index 351f4ed..b57e0b0 100644
@@ -281,17 +281,6 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
-u32 __weak spl_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
-	return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-	return MMCSD_MODE_EMMCBOOT;
-#else
-	return MMCSD_MODE_RAW;
-#endif
-}
-
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
 {
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Hi Heiko,

Quoted 6 lines · Fabio Estevam

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

Quoted 7 lines

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

Can this the cause of the issue on the wandboard you told me yesterday ? Wasn't it due to CONFIG_SPL_EXT_SUPPORT ?

Just to collect and understand myself if issues are connected...

Best regards,
Stefano

Quoted 366 lines

---
Changes since v1:
- Fix typo in commit log: "breaks the boot" instead of "breaks the build"

 arch/arm/cpu/arm1136/mx35/generic.c       | 21 +++++++++++++++++++++
 arch/arm/cpu/armv7/ls102xa/spl.c          | 17 +++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   | 17 +++++++++++++++++
 arch/arm/cpu/armv8/zynqmp/spl.c           | 14 ++++++++++++++
 arch/arm/mach-at91/spl.c                  | 15 +++++++++++++++
 arch/arm/mach-davinci/spl.c               |  5 +++++
 arch/arm/mach-imx/spl.c                   | 23 +++++++++++++++++++++++
 arch/arm/mach-mvebu/spl.c                 |  7 +++++++
 arch/arm/mach-rockchip/rk3188-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3288-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3368-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3399-board-spl.c |  5 +++++
 arch/arm/mach-socfpga/spl.c               | 11 +++++++++++
 arch/arm/mach-sunxi/board.c               |  6 ++++++
 arch/arm/mach-zynq/spl.c                  |  7 +++++++
 common/spl/spl_mmc.c                      | 11 -----------
 16 files changed, 163 insertions(+), 11 deletions(-)
arch/arm/cpu/arm1136/mx35/generic.c +21 -0
index 4dcfc72..5297d62 100644
@@ -524,3 +524,24 @@ u32 spl_boot_device(void)
 
 	return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_BUILD
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	case BOOT_DEVICE_NAND:
+		return 0;
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
arch/arm/cpu/armv7/ls102xa/spl.c +17 -0
index 1e4a164..1246eed 100644
@@ -14,3 +14,20 @@ u32 spl_boot_device(void)
 #endif
 	return BOOT_DEVICE_NAND;
 }
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
arch/arm/cpu/armv8/fsl-layerscape/spl.c +17 -0
index 3a74040..4093d15 100644
@@ -26,6 +26,23 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_BUILD
 
 void spl_board_init(void)
arch/arm/cpu/armv8/zynqmp/spl.c +14 -0
index 0bfa5c1..bc7313a 100644
@@ -115,6 +115,20 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+	case BOOT_DEVICE_RAM:
+		return 0;
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
arch/arm/mach-at91/spl.c +15 -0
index 91add92..7e7e24b 100644
@@ -87,3 +87,18 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 #endif
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+		break;
+#endif
+	case BOOT_DEVICE_NONE:
+	default:
+		hang();
+	}
+}
arch/arm/mach-davinci/spl.c +5 -0
index 4c74db9..564c200 100644
@@ -45,6 +45,11 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
arch/arm/mach-imx/spl.c +23 -0
index a9079fc..b2521b2 100644
@@ -132,6 +132,29 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 }
 #endif
 
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	/* for MMC return either RAW or FAT mode */
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+		return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+		return MMCSD_MODE_EMMCBOOT;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 /*
arch/arm/mach-mvebu/spl.c +7 -0
index a5086f1..d16a62d 100644
@@ -70,6 +70,13 @@ u32 spl_boot_device(void)
 	return get_boot_device();
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
 	int ret;
arch/arm/mach-rockchip/rk3188-board-spl.c +5 -0
index 74771d3..8e3b8ae 100644
@@ -72,6 +72,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 static int setup_arm_clock(void)
 {
 	struct udevice *dev;
arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
index f3ea624..f64a548 100644
@@ -78,6 +78,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
arch/arm/mach-rockchip/rk3368-board-spl.c +5 -0
index 8055ae5..72d2c97 100644
@@ -57,6 +57,11 @@ void board_init_f(ulong dummy)
 	}
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	return BOOT_DEVICE_MMC1;
arch/arm/mach-rockchip/rk3399-board-spl.c +5 -0
index d35990e..b96903e 100644
@@ -60,6 +60,11 @@ u32 spl_boot_device(void)
 	return boot_device;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #define TIMER_CHN10_BASE	0xff8680a0
 #define TIMER_END_COUNT_L	0x00
 #define TIMER_END_COUNT_H	0x04
arch/arm/mach-socfpga/spl.c +11 -0
index 9bf3b9a..71bae82 100644
@@ -66,6 +66,17 @@ u32 spl_boot_device(void)
 	}
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}
+#endif
+
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
arch/arm/mach-sunxi/board.c +6 -0
index 1753fae..0c60ee0 100644
@@ -260,6 +260,12 @@ u32 spl_boot_device(void)
 	return sunxi_get_boot_device();
 }
 
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 void board_init_f(ulong dummy)
 {
 	spl_init();
arch/arm/mach-zynq/spl.c +7 -0
index 0a303f4..b7e6d98 100644
@@ -69,6 +69,13 @@ u32 spl_boot_device(void)
 	return mode;
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_FS;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
common/spl/spl_mmc.c +0 -11
index 351f4ed..b57e0b0 100644
@@ -281,17 +281,6 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
-u32 __weak spl_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
-	return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-	return MMCSD_MODE_EMMCBOOT;
-#else
-	return MMCSD_MODE_RAW;
-#endif
-}
-
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
 {
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Hi Stefano,

Quoted 14 lines

Hi Heiko,

Quoted 11 lines · Fabio Estevam

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards, such as cuboxi and wandboard:

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Quoted 5 lines
Quoted 2 lines

Revert it so that we can boot U-Boot again.

Can this the cause of the issue on the wandboard you told me yesterday ? Wasn't it due to CONFIG_SPL_EXT_SUPPORT ?

Yes, exactly - those boards have CONFIG_SPL_EXT_SUPPORT defined, but want to first use RAW booting (normally as default) and then boot from EXT.

This is somewhat priority inversion.

I've explained it in detail in the other reply to this issue and in
http://patchwork.ozlabs.org/patch/868854/

Quoted 359 lines

Just to collect and understand myself if issues are connected...

Best regards,
Stefano

Quoted 353 lines

---
Changes since v1:
- Fix typo in commit log: "breaks the boot" instead of "breaks the build"

 arch/arm/cpu/arm1136/mx35/generic.c       | 21

+++++++++++++++++++++ arch/arm/cpu/armv7/ls102xa/spl.c |
17 +++++++++++++++++ arch/arm/cpu/armv8/fsl-layerscape/spl.c | 17
+++++++++++++++++ arch/arm/cpu/armv8/zynqmp/spl.c | 14
++++++++++++++ arch/arm/mach-at91/spl.c | 15
+++++++++++++++ arch/arm/mach-davinci/spl.c | 5 +++++

 arch/arm/mach-imx/spl.c                   | 23
+++++++++++++++++++++++ arch/arm/mach-mvebu/spl.c
|  7 +++++++ arch/arm/mach-rockchip/rk3188-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3288-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3368-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3399-board-spl.c |  5 +++++
 arch/arm/mach-socfpga/spl.c               | 11 +++++++++++
 arch/arm/mach-sunxi/board.c               |  6 ++++++
 arch/arm/mach-zynq/spl.c                  |  7 +++++++
 common/spl/spl_mmc.c                      | 11 -----------
 16 files changed, 163 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm1136/mx35/generic.c index 4dcfc72..5297d62 100644

arch/arm/cpu/arm1136/mx35/generic.c +21 -0
@@ -524,3 +524,24 @@ u32 spl_boot_device(void)
 
 	return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_BUILD
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	case BOOT_DEVICE_NAND:
+		return 0;
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/ls102xa/spl.c index 1e4a164..1246eed 100644

arch/arm/cpu/armv7/ls102xa/spl.c +17 -0
@@ -14,3 +14,20 @@ u32 spl_boot_device(void)
 #endif
 	return BOOT_DEVICE_NAND;
 }
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/spl.c index 3a74040..4093d15 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c

arch/arm/cpu/armv8/fsl-layerscape/spl.c +17 -0
@@ -26,6 +26,23 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_BUILD
 
 void spl_board_init(void)
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/zynqmp/spl.c index 0bfa5c1..bc7313a 100644

arch/arm/cpu/armv8/zynqmp/spl.c +14 -0
@@ -115,6 +115,20 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+	case BOOT_DEVICE_RAM:
+		return 0;
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
arch/arm/mach-at91/spl.c +15 -0
index 91add92..7e7e24b 100644
@@ -87,3 +87,18 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 #endif
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+		break;
+#endif
+	case BOOT_DEVICE_NONE:
+	default:
+		hang();
+	}
+}
(quoted diff) +0 -0

b/arch/arm/mach-davinci/spl.c index 4c74db9..564c200 100644

arch/arm/mach-davinci/spl.c +5 -0
@@ -45,6 +45,11 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
arch/arm/mach-imx/spl.c +22 -0
index a9079fc..b2521b2 100644
@@ -132,6 +132,29 @@ int g_dnl_bind_fixup(struct
 usb_device_descriptor *dev, const char *name) }
 #endif
 
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW
 or FAT) */ +u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	/* for MMC return either RAW or FAT mode */
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+		return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+		return MMCSD_MODE_EMMCBOOT;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 /*
arch/arm/mach-mvebu/spl.c +7 -0
index a5086f1..d16a62d 100644
@@ -70,6 +70,13 @@ u32 spl_boot_device(void)
 	return get_boot_device();
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
 	int ret;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3188-board-spl.c index 74771d3..8e3b8ae 100644 --- a/arch/arm/mach-rockchip/rk3188-board-spl.c +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c

arch/arm/mach-rockchip/rk3188-board-spl.c +5 -0
@@ -72,6 +72,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 static int setup_arm_clock(void)
 {
 	struct udevice *dev;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3288-board-spl.c index f3ea624..f64a548 100644 --- a/arch/arm/mach-rockchip/rk3288-board-spl.c +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c

arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
@@ -78,6 +78,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3368-board-spl.c index 8055ae5..72d2c97 100644 --- a/arch/arm/mach-rockchip/rk3368-board-spl.c +++ b/arch/arm/mach-rockchip/rk3368-board-spl.c

arch/arm/mach-rockchip/rk3368-board-spl.c +5 -0
@@ -57,6 +57,11 @@ void board_init_f(ulong dummy)
 	}
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	return BOOT_DEVICE_MMC1;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3399-board-spl.c index d35990e..b96903e 100644 --- a/arch/arm/mach-rockchip/rk3399-board-spl.c +++ b/arch/arm/mach-rockchip/rk3399-board-spl.c

arch/arm/mach-rockchip/rk3399-board-spl.c +5 -0
@@ -60,6 +60,11 @@ u32 spl_boot_device(void)
 	return boot_device;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #define TIMER_CHN10_BASE	0xff8680a0
 #define TIMER_END_COUNT_L	0x00
 #define TIMER_END_COUNT_H	0x04
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/spl.c index 9bf3b9a..71bae82 100644

arch/arm/mach-socfpga/spl.c +11 -0
@@ -66,6 +66,17 @@ u32 spl_boot_device(void)
 	}
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) ||
 defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}
+#endif
+
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)

{

(quoted diff) +0 -0

b/arch/arm/mach-sunxi/board.c index 1753fae..0c60ee0 100644

arch/arm/mach-sunxi/board.c +6 -0
@@ -260,6 +260,12 @@ u32 spl_boot_device(void)
 	return sunxi_get_boot_device();
 }
 
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 void board_init_f(ulong dummy)
 {
 	spl_init();
arch/arm/mach-zynq/spl.c +7 -0
index 0a303f4..b7e6d98 100644
@@ -69,6 +69,13 @@ u32 spl_boot_device(void)
 	return mode;
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_FS;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
common/spl/spl_mmc.c +0 -0
index 351f4ed..b57e0b0 100644
@@ -281,17 +281,6 @@ static int spl_mmc_do_fs_boot(struct
 spl_image_info *spl_image, struct mmc *mmc) }
 #endif
 
Quoted 18 lines
Quoted 14 lines
common/spl/spl_mmc.c +0 -11
-u32 __weak spl_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FAT_SUPPORT) ||
 defined(CONFIG_SPL_EXT_SUPPORT)
-	return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-	return MMCSD_MODE_EMMCBOOT;
-#else
-	return MMCSD_MODE_RAW;
-#endif
-}
-
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
Quoted 2 lines

{

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/43b137a8/attachment.sig>

#3 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

In reply to Fabio Estevam

Hi Fabio,

Quoted 6 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

Quoted 6 lines

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

This is IMHO throwing the baby with the batch....

The problem is with legacy iMX6 boards, which use MMCSD_MODE_RAW to try booting, even when they use CONFIG_SPL_EXT_SUPPORT for the boot.

On those boards we do have following boot order:

if CONFIG_SPL_FAT_SUPPORT {
return MMCSD_MODE_FS
} else {
return MODE_RAW
}

And thn in the spl_load_image() they first try MODE_RAW and if failed, then MMCSD_MODE_EXT

So the (implicit) boot order is as follows:

1. SPL_FAT

2. RAW

3. If RAW fails, use EXT.

What I've think of:

1. Either implement the proper boot order (or just stick to the correct SPL_EXT_SUPPORT).

2. If you agree - I can prepare the code to put imx code there they were before this patch (to override the __weak function). In that way we would got the cleanup for other archs in.

Quoted 368 lines

---
Changes since v1:
- Fix typo in commit log: "breaks the boot" instead of "breaks the build"

 arch/arm/cpu/arm1136/mx35/generic.c       | 21 +++++++++++++++++++++
 arch/arm/cpu/armv7/ls102xa/spl.c          | 17 +++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   | 17 +++++++++++++++++
 arch/arm/cpu/armv8/zynqmp/spl.c           | 14 ++++++++++++++
 arch/arm/mach-at91/spl.c                  | 15 +++++++++++++++
 arch/arm/mach-davinci/spl.c               |  5 +++++
 arch/arm/mach-imx/spl.c                   | 23
+++++++++++++++++++++++ arch/arm/mach-mvebu/spl.c                 |
7 +++++++ arch/arm/mach-rockchip/rk3188-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3288-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3368-board-spl.c |  5 +++++
 arch/arm/mach-rockchip/rk3399-board-spl.c |  5 +++++
 arch/arm/mach-socfpga/spl.c               | 11 +++++++++++
 arch/arm/mach-sunxi/board.c               |  6 ++++++
 arch/arm/mach-zynq/spl.c                  |  7 +++++++
 common/spl/spl_mmc.c                      | 11 -----------
 16 files changed, 163 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm1136/mx35/generic.c index 4dcfc72..5297d62 100644

arch/arm/cpu/arm1136/mx35/generic.c +21 -0
@@ -524,3 +524,24 @@ u32 spl_boot_device(void)
 
 	return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_BUILD
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	case BOOT_DEVICE_NAND:
+		return 0;
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/ls102xa/spl.c index 1e4a164..1246eed 100644

arch/arm/cpu/armv7/ls102xa/spl.c +17 -0
@@ -14,3 +14,20 @@ u32 spl_boot_device(void)
 #endif
 	return BOOT_DEVICE_NAND;
 }
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/spl.c index 3a74040..4093d15 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c

arch/arm/cpu/armv8/fsl-layerscape/spl.c +17 -0
@@ -26,6 +26,23 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+#ifdef CONFIG_SPL_FAT_SUPPORT
+		return MMCSD_MODE_FS;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_BUILD
 
 void spl_board_init(void)
(quoted diff) +0 -0

b/arch/arm/cpu/armv8/zynqmp/spl.c index 0bfa5c1..bc7313a 100644

arch/arm/cpu/armv8/zynqmp/spl.c +14 -0
@@ -115,6 +115,20 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+	case BOOT_DEVICE_RAM:
+		return 0;
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
arch/arm/mach-at91/spl.c +15 -0
index 91add92..7e7e24b 100644
@@ -87,3 +87,18 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 #endif
+
+u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (boot_device) {
+#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+		return MMCSD_MODE_FS;
+		break;
+#endif
+	case BOOT_DEVICE_NONE:
+	default:
+		hang();
+	}
+}
arch/arm/mach-davinci/spl.c +5 -0
index 4c74db9..564c200 100644
@@ -45,6 +45,11 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
arch/arm/mach-imx/spl.c +22 -0
index a9079fc..b2521b2 100644
@@ -132,6 +132,29 @@ int g_dnl_bind_fixup(struct
 usb_device_descriptor *dev, const char *name) }
 #endif
 
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or
 FAT) */ +u32 spl_boot_mode(const u32 boot_device)
+{
+	switch (spl_boot_device()) {
+	/* for MMC return either RAW or FAT mode */
+	case BOOT_DEVICE_MMC1:
+	case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+		return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+		return MMCSD_MODE_EMMCBOOT;
+#else
+		return MMCSD_MODE_RAW;
+#endif
+		break;
+	default:
+		puts("spl: ERROR:  unsupported device\n");
+		hang();
+	}
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 /*
arch/arm/mach-mvebu/spl.c +7 -0
index a5086f1..d16a62d 100644
@@ -70,6 +70,13 @@ u32 spl_boot_device(void)
 	return get_boot_device();
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
 	int ret;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3188-board-spl.c index 74771d3..8e3b8ae 100644 --- a/arch/arm/mach-rockchip/rk3188-board-spl.c +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c

arch/arm/mach-rockchip/rk3188-board-spl.c +5 -0
@@ -72,6 +72,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 static int setup_arm_clock(void)
 {
 	struct udevice *dev;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3288-board-spl.c index f3ea624..f64a548 100644 --- a/arch/arm/mach-rockchip/rk3288-board-spl.c +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c

arch/arm/mach-rockchip/rk3288-board-spl.c +5 -0
@@ -78,6 +78,11 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3368-board-spl.c index 8055ae5..72d2c97 100644 --- a/arch/arm/mach-rockchip/rk3368-board-spl.c +++ b/arch/arm/mach-rockchip/rk3368-board-spl.c

arch/arm/mach-rockchip/rk3368-board-spl.c +5 -0
@@ -57,6 +57,11 @@ void board_init_f(ulong dummy)
 	}
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 u32 spl_boot_device(void)
 {
 	return BOOT_DEVICE_MMC1;
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3399-board-spl.c index d35990e..b96903e 100644 --- a/arch/arm/mach-rockchip/rk3399-board-spl.c +++ b/arch/arm/mach-rockchip/rk3399-board-spl.c

arch/arm/mach-rockchip/rk3399-board-spl.c +5 -0
@@ -60,6 +60,11 @@ u32 spl_boot_device(void)
 	return boot_device;
 }
 
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 #define TIMER_CHN10_BASE	0xff8680a0
 #define TIMER_END_COUNT_L	0x00
 #define TIMER_END_COUNT_H	0x04
arch/arm/mach-socfpga/spl.c +11 -0
index 9bf3b9a..71bae82 100644
@@ -66,6 +66,17 @@ u32 spl_boot_device(void)
 	}
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) ||
 defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}
+#endif
+
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)

{

arch/arm/mach-sunxi/board.c +6 -0
index 1753fae..0c60ee0 100644
@@ -260,6 +260,12 @@ u32 spl_boot_device(void)
 	return sunxi_get_boot_device();
 }
 
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_RAW;
+}
+
 void board_init_f(ulong dummy)
 {
 	spl_init();
arch/arm/mach-zynq/spl.c +7 -0
index 0a303f4..b7e6d98 100644
@@ -69,6 +69,13 @@ u32 spl_boot_device(void)
 	return mode;
 }
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_boot_mode(const u32 boot_device)
+{
+	return MMCSD_MODE_FS;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
common/spl/spl_mmc.c +0 -11
index 351f4ed..b57e0b0 100644
@@ -281,17 +281,6 @@ static int spl_mmc_do_fs_boot(struct
 spl_image_info *spl_image, struct mmc *mmc) }
 #endif
 
-u32 __weak spl_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FAT_SUPPORT) ||
 defined(CONFIG_SPL_EXT_SUPPORT)
-	return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-	return MMCSD_MODE_EMMCBOOT;
-#else
-	return MMCSD_MODE_RAW;
-#endif
-}
-
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
Quoted 1 line

{

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/85187a28/attachment.sig>

reviewer
#4 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Hi Lukasz,

Quoted 3 lines · Lukasz Majewski

2. If you agree - I can prepare the code to put imx code there they were before this patch (to override the __weak function). In that way we would got the cleanup for other archs in.

As we are in rc2 I prefer if we go with the imx partial revert.

Just sent a v3 as suggested.

Thanks

#5 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

In reply to Lukasz Majewski
Quoted 8 lines · Lukasz Majewski

Hi Fabio,

Quoted 6 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

Quoted 8 lines
Quoted 6 lines

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

This is IMHO throwing the baby with the batch....

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/17284e0a/attachment.sig>
#6 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Quoted 16 lines · Tom Rini
Quoted 15 lines · Lukasz Majewski

Hi Fabio,

Quoted 12 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

Quoted 7 lines
Quoted 1 line

This is IMHO throwing the baby with the batch....

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

Maybe we should go with the ordering option instead ? But that'd probably be something for 2018.05 .

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

In reply to Tom Rini

Hi Tom,

Quoted 16 lines · Lukasz Majewski
Quoted 15 lines

Hi Fabio,

Quoted 12 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards, such as cuboxi and wandboard:

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

Quoted 8 lines
Quoted 1 line

This is IMHO throwing the baby with the batch....

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

Just my 2 cents.

1. IMHO 2 months release cycle is too short, regarding the peace of development; we move Kconfig, perform DM conversion, and deal with legacy code

2. As we removed the obsolete / not maitained archs. We also need to scrutinize the "core" u-boot code (which is often 10+ years old).

As this patch showed - spotting some "implicit" errors - which cannot be found with travis CI build tests consumes some time.
What is even more strange - this code from the very beginnig was developmed on iMX6 board ....

We JUST need MORE time to stabilize thing......

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180215/d68db4a3/attachment.sig>

reviewer
#8 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Hi Lukasz,

Quoted 2 lines · Lukasz Majewski

As this patch showed - spotting some "implicit" errors - which cannot be found with travis CI build tests consumes some time.

Travis CI build test is great, but we also need boot tests to catch issues like this.

#9 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 20 lines · Lukasz Majewski

Hi Tom,

Quoted 18 lines · Lukasz Majewski
Quoted 16 lines

Hi Fabio,

Quoted 6 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards, such as cuboxi and wandboard:

Quoted 6 lines

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

This is IMHO throwing the baby with the batch....

Quoted 9 lines
Quoted 6 lines

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

Just my 2 cents.

I add my two cents, too.

Quoted 3 lines

1. IMHO 2 months release cycle is too short, regarding the peace of development; we move Kconfig, perform DM conversion, and deal with legacy code

+1

I have always the feeling to be late and, if shortening the release cycle has advantages, the side-effect is that each release must take care of some new improvement without breaking past because, yes, it is a release.

I understand that two months matches the Linux release cycle, but I agree with Lukasz that we need more time to stabilize a release, taking into account the goals we have (DM,...). And most of use are not working full time at the bootloader, that makes thing worst.

Even if distros release cycle is independent from U-Boot / Kernel, I do not know how many people take advantage of fast releasing. The most used embedded buildsystems (Buildroot / Linux) have a most relaxed release cycle and usually a Yocto release have just a U-Boot version.

Quoted 5 lines

2. As we removed the obsolete / not maitained archs. We also need to scrutinize the "core" u-boot code (which is often 10+ years old).

Quoted 8 lines

As this patch showed - spotting some "implicit" errors - which cannot be found with travis CI build tests consumes some time.
What is even more strange - this code from the very beginnig was developmed on iMX6 board ....

We JUST need MORE time to stabilize thing......

+1

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#10 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

Quoted 40 lines · Stefano Babic

Hi Lukasz,

Quoted 20 lines · Lukasz Majewski

Hi Tom,

Quoted 18 lines · Lukasz Majewski
Quoted 16 lines

Hi Fabio,

Quoted 6 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards, such as cuboxi and wandboard:

Quoted 6 lines

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

This is IMHO throwing the baby with the batch....

Quoted 9 lines
Quoted 6 lines

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

Just my 2 cents.

I add my two cents, too.

Quoted 3 lines

1. IMHO 2 months release cycle is too short, regarding the peace of development; we move Kconfig, perform DM conversion, and deal with legacy code

Quoted 8 lines

+1

I have always the feeling to be late and, if shortening the release cycle has advantages, the side-effect is that each release must take care of some new improvement without breaking past because, yes, it is a release.

I understand that two months matches the Linux release cycle

It does not, Linux has 70 days per cycle, 2.5 months. But is has significantly more contributors and maintainers.

, but I

Quoted 8 lines

agree with Lukasz that we need more time to stabilize a release, taking into account the goals we have (DM,...). And most of use are not working full time at the bootloader, that makes thing worst.

Even if distros release cycle is independent from U-Boot / Kernel, I do not know how many people take advantage of fast releasing. The most used embedded buildsystems (Buildroot / Linux) have a most relaxed release cycle and usually a Yocto

... project reference release ...

Quoted 1 line

release have just a U-Boot version.

Right.

Signature · 2 lines
Best regards,
Marek Vasut
reviewer
#11 lore raw

PATCH v2 1/1 Revert "spl: eMMC/SD: Provide one __weak spl_boot_mode() function"

In reply to Tom Rini

Hi Tom/Stefano,

Quoted 16 lines · Tom Rini
Quoted 15 lines · Lukasz Majewski

Hi Fabio,

Quoted 12 lines

This reverts commit d695d6627803dbb78a226e04b0436a01633a9936.

Commit d695d6627803 ("spl: eMMC/SD: Provide one __weak spl_boot_mode() function") breaks the boot on several i.MX6 boards,
such as cuboxi and wandboard:

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300) Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

Revert it so that we can boot U-Boot again.

Quoted 7 lines
Quoted 1 line

This is IMHO throwing the baby with the batch....

I kind of feel we need to revert this too, sorry. I'm also worried that we've broken some of the other platforms that also have funky if-else expected logic, and we'll be at the point soon where we have enough platforms that need to override the spl_boot_mode func with what they had before that it's not a huge win.

What is the resolution here? I also sent a partial revert on v3.

Please pick the one you prefer :-)