summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorfaqiang.zhu <faqiang.zhu@nxp.com>2018-12-20 15:54:50 +0800
committerfaqiang.zhu <faqiang.zhu@nxp.com>2018-12-21 20:15:21 +0800
commit68261e4ca35d6b5eaa0c75a0579ec59d8c6f4503 (patch)
tree3491629ba8a7abb809809fc9fe1c2f24c84a7136 /drivers
parent5da847a4fad5d85aab497c78a6008cd94b750b35 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 8926a94e5c..8963c64b2c 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -762,8 +762,7 @@ static ulong bootloader_mmc_offset(void)
if (is_imx8m() || (is_imx8() && is_soc_rev(CHIP_REV_A)))
return 0x8400;
else if (is_imx8qm()) {
- int dev_no = mmc_get_env_dev();
- if (MEK_8QM_EMMC == dev_no)
+ if (MEK_8QM_EMMC == fastboot_devinfo.dev_id)
/* target device is eMMC boot0 partition, bootloader offset is 0x0 */
return 0x0;
else
@@ -908,6 +907,11 @@ static int get_fastboot_target_dev(char *mmc_dev, struct fastboot_ptentry *ptn)
sizeof(FASTBOOT_PARTITION_BOOTLOADER))) &&
(env_get("target_ubootdev"))) {
dev = simple_strtoul(env_get("target_ubootdev"), NULL, 10);
+
+ /* if target_ubootdev is set, it must be that users want to change
+ * fastboot device, then fastboot environment need to be updated */
+ fastboot_setup();
+
target_mmc = find_mmc_device(dev);
if ((target_mmc == NULL) || mmc_init(target_mmc)) {
printf("MMC card init failed!\n");
@@ -1247,7 +1251,10 @@ static int _fastboot_setup_dev(int *switched)
#if defined(CONFIG_FASTBOOT_STORAGE_MMC)
} else if (!strncmp(fastboot_env, "mmc", 3)) {
devinfo.type = DEV_MMC;
- devinfo.dev_id = mmc_get_env_dev();
+ if(env_get("target_ubootdev"))
+ devinfo.dev_id = simple_strtoul(env_get("target_ubootdev"), NULL, 10);
+ else
+ devinfo.dev_id = mmc_get_env_dev();
#endif
} else {
return 1;