diff mbox

[U-Boot,v3,05/15] imx6: isiotmx6ul: Update SPL board boot order for eMMC

Message ID 1486047373-31676-6-git-send-email-jagan@openedev.com
State Changes Requested
Delegated to: Stefano Babic
Headers show

Commit Message

Jagan Teki Feb. 2, 2017, 2:56 p.m. UTC
From: Jagan Teki <jagan@amarulasolutions.com>

SPL mmc device index is get based on the boot device, like
- BOOT_DEVICE_MMC1 for mmc device 0
- BOOT_DEVICE_MMC2 for mmc device 1

Currently BOOT_DEVICE_MMC1 is setting both SD/eSD and MMC/eMMC
boot devices in i.MX, So u-boot is loading from mmc device 0 even
"if the board booting from SD/eSD or MMC/eMMC"

So, this patch set BOOT_DEVICE_MMC2 for MMC/eMMC so for MMC/eMMC
the u-boot is loading from mmc device 1 and the board file need to
take care if the board have different mmc device order intialization.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 board/engicam/isiotmx6ul/isiotmx6ul.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Stefano Babic Feb. 19, 2017, 3:51 p.m. UTC | #1
On 02/02/2017 15:56, Jagan Teki wrote:
> From: Jagan Teki <jagan@amarulasolutions.com>
> 
> SPL mmc device index is get based on the boot device, like
> - BOOT_DEVICE_MMC1 for mmc device 0
> - BOOT_DEVICE_MMC2 for mmc device 1
> 
> Currently BOOT_DEVICE_MMC1 is setting both SD/eSD and MMC/eMMC
> boot devices in i.MX, So u-boot is loading from mmc device 0 even
> "if the board booting from SD/eSD or MMC/eMMC"
> 
> So, this patch set BOOT_DEVICE_MMC2 for MMC/eMMC so for MMC/eMMC
> the u-boot is loading from mmc device 1 and the board file need to
> take care if the board have different mmc device order intialization.
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Matteo Lisi <matteo.lisi@engicam.com>
> Cc: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  board/engicam/isiotmx6ul/isiotmx6ul.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c
> index 20c8aa7..07dd501 100644
> --- a/board/engicam/isiotmx6ul/isiotmx6ul.c
> +++ b/board/engicam/isiotmx6ul/isiotmx6ul.c
> @@ -205,6 +205,32 @@ int board_mmc_init(bd_t *bis)
>  
>  	return 0;
>  }
> +
> +#ifdef CONFIG_ENV_IS_IN_MMC
> +void board_boot_order(u32 *spl_boot_list)
> +{
> +	u32 bmode = imx6_src_get_boot_mode();
> +	u8 boot_dev = BOOT_DEVICE_MMC1;
> +
> +	switch ((bmode & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
> +	case IMX6_BMODE_SD:
> +	case IMX6_BMODE_ESD:
> +		/* SD/eSD - BOOT_DEVICE_MMC1 */
> +		break;
> +	case IMX6_BMODE_MMC:
> +	case IMX6_BMODE_EMMC:
> +		/* MMC/eMMC */
> +		boot_dev = BOOT_DEVICE_MMC2;
> +		break;
> +	default:
> +		/* Default - BOOT_DEVICE_MMC1 */
> +		printf("Wrong board boot order\n");
> +		break;
> +	}
> +
> +	spl_boot_list[0] = boot_dev;
> +}
> +#endif
>  #endif /* CONFIG_FSL_ESDHC */
>  
>  static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = {
> 
Reviewed by : Stefano Babic |sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c
index 20c8aa7..07dd501 100644
--- a/board/engicam/isiotmx6ul/isiotmx6ul.c
+++ b/board/engicam/isiotmx6ul/isiotmx6ul.c
@@ -205,6 +205,32 @@  int board_mmc_init(bd_t *bis)
 
 	return 0;
 }
+
+#ifdef CONFIG_ENV_IS_IN_MMC
+void board_boot_order(u32 *spl_boot_list)
+{
+	u32 bmode = imx6_src_get_boot_mode();
+	u8 boot_dev = BOOT_DEVICE_MMC1;
+
+	switch ((bmode & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
+	case IMX6_BMODE_SD:
+	case IMX6_BMODE_ESD:
+		/* SD/eSD - BOOT_DEVICE_MMC1 */
+		break;
+	case IMX6_BMODE_MMC:
+	case IMX6_BMODE_EMMC:
+		/* MMC/eMMC */
+		boot_dev = BOOT_DEVICE_MMC2;
+		break;
+	default:
+		/* Default - BOOT_DEVICE_MMC1 */
+		printf("Wrong board boot order\n");
+		break;
+	}
+
+	spl_boot_list[0] = boot_dev;
+}
+#endif
 #endif /* CONFIG_FSL_ESDHC */
 
 static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = {