Commit 58c76e63f17f87afdc45ec32a84c5e86fc2b6fdd

Authored by Lukasz Majewski
Committed by Stefano Babic
1 parent 309ce98fcb

imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot

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>

Showing 1 changed file with 20 additions and 0 deletions Side-by-side Diff

board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
... ... @@ -308,6 +308,26 @@
308 308 return fsl_esdhc_initialize(bd, &usdhc_cfg[0]);
309 309 }
310 310  
  311 +void board_boot_order(u32 *spl_boot_list)
  312 +{
  313 + u32 boot_device = spl_boot_device();
  314 + u32 reg = imx6_src_get_boot_mode();
  315 +
  316 + reg = (reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT;
  317 +
  318 + debug("%s: boot device: 0x%x (0x4 SD, 0x6 eMMC)\n", __func__, reg);
  319 + if (boot_device == BOOT_DEVICE_MMC1)
  320 + if (reg == IMX6_BMODE_MMC || reg == IMX6_BMODE_EMMC)
  321 + boot_device = BOOT_DEVICE_MMC2;
  322 +
  323 + spl_boot_list[0] = boot_device;
  324 + /*
  325 + * Below boot device is a 'fallback' - it shall always be possible to
  326 + * boot from SD card
  327 + */
  328 + spl_boot_list[1] = BOOT_DEVICE_MMC1;
  329 +}
  330 +
311 331 void board_init_f(ulong dummy)
312 332 {
313 333 /* setup AIPS and disable watchdog */