Commit 68261e4ca35d6b5eaa0c75a0579ec59d8c6f4503

Authored by faqiang.zhu
1 parent 5da847a4fa

MA-13303 fix the issue with 8qm boot from eMMC to flash SD

For mek_8qm, bootloader offset in SD card is 32kb, in eMMC
bootpartition, it's 0kb. This patch fix the issue that bootloader offset
used in uboot is always based on the device that the board boot from.

Now, if uboot environment variable "target_ubootdev" is set, bootloader
offset used in uboot is based on the device "target_ubootdev" specified.
So boot from eMMC to flash SD, the board can boot from SD and vice versa.

Change-Id: Ia2cd64ba6ece02b98ea3d2addbce00b1661077de
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>

Showing 1 changed file with 10 additions and 3 deletions Side-by-side Diff

drivers/usb/gadget/f_fastboot.c
... ... @@ -762,8 +762,7 @@
762 762 if (is_imx8m() || (is_imx8() && is_soc_rev(CHIP_REV_A)))
763 763 return 0x8400;
764 764 else if (is_imx8qm()) {
765   - int dev_no = mmc_get_env_dev();
766   - if (MEK_8QM_EMMC == dev_no)
  765 + if (MEK_8QM_EMMC == fastboot_devinfo.dev_id)
767 766 /* target device is eMMC boot0 partition, bootloader offset is 0x0 */
768 767 return 0x0;
769 768 else
... ... @@ -908,6 +907,11 @@
908 907 sizeof(FASTBOOT_PARTITION_BOOTLOADER))) &&
909 908 (env_get("target_ubootdev"))) {
910 909 dev = simple_strtoul(env_get("target_ubootdev"), NULL, 10);
  910 +
  911 + /* if target_ubootdev is set, it must be that users want to change
  912 + * fastboot device, then fastboot environment need to be updated */
  913 + fastboot_setup();
  914 +
911 915 target_mmc = find_mmc_device(dev);
912 916 if ((target_mmc == NULL) || mmc_init(target_mmc)) {
913 917 printf("MMC card init failed!\n");
... ... @@ -1247,7 +1251,10 @@
1247 1251 #if defined(CONFIG_FASTBOOT_STORAGE_MMC)
1248 1252 } else if (!strncmp(fastboot_env, "mmc", 3)) {
1249 1253 devinfo.type = DEV_MMC;
1250   - devinfo.dev_id = mmc_get_env_dev();
  1254 + if(env_get("target_ubootdev"))
  1255 + devinfo.dev_id = simple_strtoul(env_get("target_ubootdev"), NULL, 10);
  1256 + else
  1257 + devinfo.dev_id = mmc_get_env_dev();
1251 1258 #endif
1252 1259 } else {
1253 1260 return 1;