diff mbox series

[U-Boot,v3,3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot

Message ID 20191010141130.29568-4-lukma@denx.de
State Accepted
Commit 58c76e63f17f87afdc45ec32a84c5e86fc2b6fdd
Delegated to: Stefano Babic
Headers show
Series dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper | expand

Commit Message

Lukasz Majewski Oct. 10, 2019, 2:11 p.m. UTC
The TPC70 can boot from SD card (debug/development) and eMMC (production).
The board_boot_order() function provides a run time check for the device
from which one wants to boot (it is selected by GPIO pins setup).

Moreover, a fallback to SD card is provided if the detection is not
possible or working properly.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

Changes in v3: None

 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Stefano Babic Oct. 14, 2019, 12:40 p.m. UTC | #1
> The TPC70 can boot from SD card (debug/development) and eMMC (production).
> The board_boot_order() function provides a run time check for the device
> from which one wants to boot (it is selected by GPIO pins setup).
> Moreover, a fallback to SD card is provided if the detection is not
> possible or working properly.
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
index e284d5ec57..e48a577f79 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
@@ -308,6 +308,26 @@  int board_mmc_init(bd_t *bd)
 	return fsl_esdhc_initialize(bd, &usdhc_cfg[0]);
 }
 
+void board_boot_order(u32 *spl_boot_list)
+{
+	u32 boot_device = spl_boot_device();
+	u32 reg = imx6_src_get_boot_mode();
+
+	reg = (reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT;
+
+	debug("%s: boot device: 0x%x (0x4 SD, 0x6 eMMC)\n", __func__, reg);
+	if (boot_device == BOOT_DEVICE_MMC1)
+		if (reg == IMX6_BMODE_MMC || reg == IMX6_BMODE_EMMC)
+			boot_device = BOOT_DEVICE_MMC2;
+
+	spl_boot_list[0] = boot_device;
+	/*
+	 * Below boot device is a 'fallback' - it shall always be possible to
+	 * boot from SD card
+	 */
+	spl_boot_list[1] = BOOT_DEVICE_MMC1;
+}
+
 void board_init_f(ulong dummy)
 {
 	/* setup AIPS and disable watchdog */