Skip to contentSkip to conversation

spl: imx6: Let spl_boot_device return USDHC1 or USDHC2

RFC In review Adam Ford 2 participants 2 messages May 17, 2019 – May 20, 2019

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

RFC 1/1 spl: imx6: Let spl_boot_device return USDHC1 or USDHC2

Currently, when the spl_boot_device checks the boot device, it will only return MMC1 when it's either sd or eMMC regardless of whether or not it's MMC1 or MMC2. This is a problem when booting from MMC2 if MMC isn't being manually configured like in the DM_SPL case with SPL_OF_CONTROL.

This patch will check the register and return either MMC1 or MMC2.

arch/arm/mach-imx/spl.c +5 -3
index 9f1e0f6a72..1f230aca33 100644
@@ -24,6 +24,7 @@ u32 spl_boot_device(void)
 {
 	unsigned int bmode = readl(&src_base->sbmr2);
 	u32 reg = imx6_src_get_boot_mode();
+	u32 mmc_index = ((reg >> 11) & 0x03);
 
 	/*
 	 * Check for BMODE if serial downloader is enabled
@@ -84,11 +85,12 @@ u32 spl_boot_device(void)
 	/* SD/eSD: 8.5.3, Table 8-15  */
 	case IMX6_BMODE_SD:
 	case IMX6_BMODE_ESD:
-		return BOOT_DEVICE_MMC1;
-	/* MMC/eMMC: 8.5.3 */
 	case IMX6_BMODE_MMC:
 	case IMX6_BMODE_EMMC:
-		return BOOT_DEVICE_MMC1;
+		if (mmc_index == 1)
+			return BOOT_DEVICE_MMC2;
+		else
+			return BOOT_DEVICE_MMC1;
 	/* NAND Flash: 8.5.2, Table 8-10 */
 	case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
 		return BOOT_DEVICE_NAND;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines

Subject: [RFC] spl: imx6: Let spl_boot_device return USDHC1 or USDHC2

Currently, when the spl_boot_device checks the boot device, it will only return MMC1 when it's either sd or eMMC regardless of whether or not it's MMC1 or MMC2. This is a problem when booting from MMC2 if MMC isn't being manually configured like in the DM_SPL case with SPL_OF_CONTROL.

This patch will check the register and return either MMC1 or MMC2.

arch/arm/mach-imx/spl.c index renamed from arch/arm/mach-imx/spl.c +0 -0

9f1e0f6a72..1f230aca33 100644

arch/arm/mach-imx/spl.c +1 -0
@@ -24,6 +24,7 @@ u32 spl_boot_device(void)  {
 	unsigned int bmode = readl(&src_base->sbmr2);
 	u32 reg = imx6_src_get_boot_mode();
+	u32 mmc_index = ((reg >> 11) & 0x03);
 
 	/*
 	 * Check for BMODE if serial downloader is enabled @@ -84,11 +85,12
 @@ u32 spl_boot_device(void)
arch/arm/mach-imx/spl.c +0 -0
 	/* SD/eSD: 8.5.3, Table 8-15  */
 	case IMX6_BMODE_SD:

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 93

Quoted 10 lines
arch/arm/mach-imx/spl.c +4 -3
 	case IMX6_BMODE_ESD:
-		return BOOT_DEVICE_MMC1;
-	/* MMC/eMMC: 8.5.3 */
 	case IMX6_BMODE_MMC:
 	case IMX6_BMODE_EMMC:
-		return BOOT_DEVICE_MMC1;
+		if (mmc_index == 1)
+			return BOOT_DEVICE_MMC2;
+		else
+			return BOOT_DEVICE_MMC1;

Although it not fixes all the 4 sdhc ports for i.MX6Q, it is fine.

Quoted 5 lines
arch/arm/mach-imx/spl.c +0 -1
 	/* NAND Flash: 8.5.2, Table 8-10 */
 	case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
 		return BOOT_DEVICE_NAND;
--

2.17.1