Skip to contentSkip to conversation

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

PATCH New Lukasz Majewski 4 participants 5 messages Jan 27, 2018 – Jan 30, 2018

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

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

The goal of this patch is to clean up the code related to choosing spl MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

To achieve the goal, all per mach/arch implementations eligible for unification has been replaced with one __weak implementation.

---
Comments regarding cleanup (to help maintainers assessment if those changes break anything):

Implementations necessary to stay as is:
----------------------------------------
- SW fix for broken ROM boot code
arch/arm/mach-uniphier/mmc-boot-mode.c

- Omap specific adjustments:
arch/arm/mach-omap2/boot-common.c

Below archs had a bit off-standard approach, but were eligible for using the __weak function:
--------------------
- at91 -> check if proper configs flags in the weak function are set:

        arch/arm/mach-at91/spl.c

- zyncmp -> the BOOT_DEVICE_RAM return of spl_boot_mode seems like an error (will hang in spl_mmc_load_image() anyway) arch/arm/cpu/armv8/zynqmp/spl.c

- fsl -> here we had a return of BOOT_DEVICE_NAND, but the spl_boot_mode is eMMC/SD card specific
(will hang in spl_mmc_load_image() anyway)

arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/cpu/armv7/ls102xa/spl.c
arch/arm/cpu/arm1136/mx35/generic.c

Test HW:

iMX6Q - display5 board

---
 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, 11 insertions(+), 163 deletions(-)
arch/arm/cpu/arm1136/mx35/generic.c +0 -21
index 5297d62d00..4dcfc72656 100644
@@ -524,24 +524,3 @@ 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 +0 -17
index 1246eed2ca..1e4a1641cb 100644
@@ -14,20 +14,3 @@ 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 +0 -17
index 4093d15e56..3a74040b97 100644
@@ -26,23 +26,6 @@ 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 +0 -14
index 41b0070a5e..970ac9b59b 100644
@@ -115,20 +115,6 @@ 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();
-	}
-}
-
 __weak void psu_init(void)
 {
 	 /*
arch/arm/mach-at91/spl.c +0 -15
index 7e7e24bbe6..91add921c6 100644
@@ -87,18 +87,3 @@ 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 +0 -5
index 564c2008e0..4c74db9ed0 100644
@@ -45,11 +45,6 @@ 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 +0 -23
index 6c16872f59..08a7e0071f 100644
@@ -130,29 +130,6 @@ 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 +0 -7
index d16a62d2dd..a5086f16fb 100644
@@ -70,13 +70,6 @@ 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 +0 -5
index 8e3b8ae3ba..74771d3a0b 100644
@@ -72,11 +72,6 @@ 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 +0 -5
index f64a54843f..f3ea624277 100644
@@ -78,11 +78,6 @@ 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 +0 -5
index 72d2c97d36..8055ae538f 100644
@@ -57,11 +57,6 @@ 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 +0 -5
index b96903e70f..d35990efd6 100644
@@ -60,11 +60,6 @@ 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 +0 -11
index 71bae827a1..9bf3b9a446 100644
@@ -66,17 +66,6 @@ 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 +0 -6
index 0c60ee04da..1753faec1d 100644
@@ -260,12 +260,6 @@ 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 +0 -7
index 1672fa05c2..32db076409 100644
@@ -69,13 +69,6 @@ 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 +11 -0
index b57e0b04e4..351f4edd41 100644
@@ -281,6 +281,17 @@ 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.11.0
#1 lore raw

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

Quoted 5 lines · Lukasz Majewski

The goal of this patch is to clean up the code related to choosing spl MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

It always was ;-)

Quoted 8 lines

To achieve the goal, all per mach/arch implementations eligible for unification has been replaced with one __weak implementation.

---
Comments regarding cleanup (to help maintainers assessment if those changes break anything):

You should run it through Travis at least, to detect if something stopped building.

Quoted 22 lines

Implementations necessary to stay as is:
----------------------------------------
- SW fix for broken ROM boot code
arch/arm/mach-uniphier/mmc-boot-mode.c

- Omap specific adjustments:
arch/arm/mach-omap2/boot-common.c

Below archs had a bit off-standard approach, but were eligible for using the __weak function:
--------------------
- at91 -> check if proper configs flags in the weak function are set:

        arch/arm/mach-at91/spl.c

- zyncmp -> the BOOT_DEVICE_RAM return of spl_boot_mode seems like an error (will hang in spl_mmc_load_image() anyway) arch/arm/cpu/armv8/zynqmp/spl.c

- fsl -> here we had a return of BOOT_DEVICE_NAND, but the spl_boot_mode is eMMC/SD card specific
(will hang in spl_mmc_load_image() anyway)

Quoted 7 lines

arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/cpu/armv7/ls102xa/spl.c
arch/arm/cpu/arm1136/mx35/generic.c

Test HW:

iMX6Q - display5 board

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

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

Hi Marek,

Quoted 9 lines · Lukasz Majewski
Quoted 6 lines

The goal of this patch is to clean up the code related to choosing spl MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

It always was ;-)

But some way forgotten :-)

Quoted 4 lines
Quoted 4 lines

To achieve the goal, all per mach/arch implementations eligible for unification has been replaced with one __weak implementation.

Quoted 8 lines
Quoted 5 lines

---
Comments regarding cleanup (to help maintainers assessment if those changes break anything):

You should run it through Travis at least, to detect if something stopped building.

https://travis-ci.org/lmajewski/u-boot-dfu

All "green".

Quoted 23 lines
Quoted 23 lines

Implementations necessary to stay as is:
----------------------------------------
- SW fix for broken ROM boot code
arch/arm/mach-uniphier/mmc-boot-mode.c

- Omap specific adjustments:
arch/arm/mach-omap2/boot-common.c

Below archs had a bit off-standard approach, but were eligible for using the __weak function:
--------------------
- at91 -> check if proper configs flags in the weak function are
set: arch/arm/mach-at91/spl.c

- zyncmp -> the BOOT_DEVICE_RAM return of spl_boot_mode seems like an error (will hang in spl_mmc_load_image() anyway) arch/arm/cpu/armv8/zynqmp/spl.c

- fsl -> here we had a return of BOOT_DEVICE_NAND, but the spl_boot_mode is eMMC/SD card specific
(will hang in spl_mmc_load_image() anyway)

Quoted 9 lines
Quoted 7 lines
        arch/arm/cpu/armv8/fsl-layerscape/spl.c
        arch/arm/cpu/armv7/ls102xa/spl.c
        arch/arm/cpu/arm1136/mx35/generic.c

Test HW:

iMX6Q - display5 board

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/20180127/4490b3b1/attachment.sig>

#3 lore raw

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

In reply to Lukasz Majewski
Quoted 23 lines · Lukasz Majewski

The goal of this patch is to clean up the code related to choosing spl MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

To achieve the goal, all per mach/arch implementations eligible for unification has been replaced with one __weak implementation.

---
Comments regarding cleanup (to help maintainers assessment if those changes break anything):

Implementations necessary to stay as is:
----------------------------------------
- SW fix for broken ROM boot code
arch/arm/mach-uniphier/mmc-boot-mode.c

- Omap specific adjustments:
arch/arm/mach-omap2/boot-common.c

Quoted 7 lines

Below archs had a bit off-standard approach, but were eligible for using the __weak function:
--------------------
- at91 -> check if proper configs flags in the weak function are set:

        arch/arm/mach-at91/spl.c

- zyncmp -> the BOOT_DEVICE_RAM return of spl_boot_mode seems like an error

zynqmp

Quoted 2 lines

(will hang in spl_mmc_load_image() anyway) arch/arm/cpu/armv8/zynqmp/spl.c

Changes look reasonable.

M

#4 lore raw

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

In reply to Lukasz Majewski
Quoted 396 lines · Lukasz Majewski

The goal of this patch is to clean up the code related to choosing spl MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

To achieve the goal, all per mach/arch implementations eligible for unification has been replaced with one __weak implementation.

---
Comments regarding cleanup (to help maintainers assessment if those changes break anything):

Implementations necessary to stay as is:
----------------------------------------
- SW fix for broken ROM boot code
arch/arm/mach-uniphier/mmc-boot-mode.c

- Omap specific adjustments:
arch/arm/mach-omap2/boot-common.c

Below archs had a bit off-standard approach, but were eligible for using the __weak function:
--------------------
- at91 -> check if proper configs flags in the weak function are set:

        arch/arm/mach-at91/spl.c

- zyncmp -> the BOOT_DEVICE_RAM return of spl_boot_mode seems like an error (will hang in spl_mmc_load_image() anyway) arch/arm/cpu/armv8/zynqmp/spl.c

- fsl -> here we had a return of BOOT_DEVICE_NAND, but the spl_boot_mode is eMMC/SD card specific
(will hang in spl_mmc_load_image() anyway)

arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/cpu/armv7/ls102xa/spl.c
arch/arm/cpu/arm1136/mx35/generic.c

Test HW:

iMX6Q - display5 board

---
 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, 11 insertions(+), 163 deletions(-)
arch/arm/cpu/arm1136/mx35/generic.c +0 -21
index 5297d62d00..4dcfc72656 100644
@@ -524,24 +524,3 @@ 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 +0 -17
index 1246eed2ca..1e4a1641cb 100644
@@ -14,20 +14,3 @@ 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 +0 -17
index 4093d15e56..3a74040b97 100644
@@ -26,23 +26,6 @@ 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 +0 -14
index 41b0070a5e..970ac9b59b 100644
@@ -115,20 +115,6 @@ 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();
-	}
-}
-
 __weak void psu_init(void)
 {
 	 /*
arch/arm/mach-at91/spl.c +0 -15
index 7e7e24bbe6..91add921c6 100644
@@ -87,18 +87,3 @@ 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 +0 -5
index 564c2008e0..4c74db9ed0 100644
@@ -45,11 +45,6 @@ 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 +0 -23
index 6c16872f59..08a7e0071f 100644
@@ -130,29 +130,6 @@ 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 +0 -7
index d16a62d2dd..a5086f16fb 100644
@@ -70,13 +70,6 @@ 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 +0 -5
index 8e3b8ae3ba..74771d3a0b 100644
@@ -72,11 +72,6 @@ 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 +0 -5
index f64a54843f..f3ea624277 100644
@@ -78,11 +78,6 @@ 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 +0 -5
index 72d2c97d36..8055ae538f 100644
@@ -57,11 +57,6 @@ 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 +0 -5
index b96903e70f..d35990efd6 100644
@@ -60,11 +60,6 @@ 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 +0 -11
index 71bae827a1..9bf3b9a446 100644
@@ -66,17 +66,6 @@ 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 +0 -6
index 0c60ee04da..1753faec1d 100644
@@ -260,12 +260,6 @@ 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 +0 -7
index 1672fa05c2..32db076409 100644
@@ -69,13 +69,6 @@ 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 +4 -0
index b57e0b04e4..351f4edd41 100644
@@ -281,6 +281,17 @@ 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;

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

Quoted 10 lines
common/spl/spl_mmc.c +7 -0
+#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)
 {

Best regards,
Stefano Babic

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
=====================================================================