diff mbox series

[1/5] imx: spl: return boot mode for asked MMC device in spl_mmc_boot_mode()

Message ID 20200423110753.51231-2-hws@denx.de
State New
Headers show
Series Fix spl_mmc_boot_mode() implementation for IMX | expand

Commit Message

Harald Seiler April 23, 2020, 11:07 a.m. UTC
From: Anatolij Gustschin <agust at denx.de>

Boards may extend or re-define the boot list in their board_boot_order()
function by modifying spl_boot_list. E.g. a board might boot SPL from a
slow SPI NOR flash and then load the U-Boot from an eMMC or SD-card.
Or it might use additional MMC boot device in spl_boot_list for cases
when the image in SPI NOR flash is not found, so it could fall back to
eMMC, SD-card or another boot device.

Getting the MMC boot mode in spl_mmc will fail when we are trying to
boot from an MMC device in the spl_boot_list and the original board
boot mode (as returned by spl_boot_device()) is not an MMC boot mode.
Fix it by checking the asked MMC boot device from the spl_mmc_boot_mode()
argument.

Signed-off-by: Anatolij Gustschin <agust at denx.de>
---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic May 2, 2020, 9:08 a.m. UTC | #1
> From: Anatolij Gustschin <agust at denx.de>
> Boards may extend or re-define the boot list in their board_boot_order()
> function by modifying spl_boot_list. E.g. a board might boot SPL from a
> slow SPI NOR flash and then load the U-Boot from an eMMC or SD-card.
> Or it might use additional MMC boot device in spl_boot_list for cases
> when the image in SPI NOR flash is not found, so it could fall back to
> eMMC, SD-card or another boot device.
> Getting the MMC boot mode in spl_mmc will fail when we are trying to
> boot from an MMC device in the spl_boot_list and the original board
> boot mode (as returned by spl_boot_device()) is not an MMC boot mode.
> Fix it by checking the asked MMC boot device from the spl_mmc_boot_mode()
> argument.
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 49bb3b928da1..e5835150a06d 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -229,7 +229,7 @@  u32 spl_mmc_boot_mode(const u32 boot_device)
 #ifdef CONFIG_SPL_FORCE_MMC_BOOT
 	switch (boot_device) {
 #else
-	switch (spl_boot_device()) {
+	switch (boot_device) {
 #endif
 	/* for MMC return either RAW or FAT mode */
 	case BOOT_DEVICE_MMC1: