diff options
author | Ji Luo <ji.luo@nxp.com> | 2019-12-18 17:40:25 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2019-12-18 18:00:25 +0800 |
commit | 0e207921e9a0db4d1dff27fee8b9a22a43a8fcc9 (patch) | |
tree | 7e0cea0dc0e32e56b86ee97044767fa96e2ff0ce /drivers | |
parent | 1f40c25c7f54898d3b398fdf091c6aa6b24effe1 (diff) |
MA-15860 Get and switch the target dev in fastboot erase
Target mmc dev is not properly switched when the device enters
fastboot mode via uuu "-i" parameter, which causes "erase"
operation doesn't work.
Get and switch the target mmc dev every time before erase operations
happen.
Test: "fastboot erase boot_a" in uuu fastboot mode.
Change-Id: I4822d2b4ecfd2d874dfbe7474d6824b8fc3a7903
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index eb1a06d8cc..922ed4f088 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -1134,6 +1134,7 @@ static void process_flash_mmc(const char *cmdbuf) static void process_erase_mmc(const char *cmdbuf, char *response) { int mmc_no = 0; + char blk_dev[128]; lbaint_t blks, blks_start, blks_size, grp_size; struct mmc *mmc; struct blk_desc *dev_desc; @@ -1164,6 +1165,15 @@ static void process_erase_mmc(const char *cmdbuf, char *response) return; } + /* Get and switch target flash device. */ + if (get_fastboot_target_dev(blk_dev, ptn) != 0) { + printf("failed to get target dev!\n"); + return; + } else if (run_command(blk_dev, 0)) { + printf("Init of BLK device failed\n"); + return; + } + if (part_get_info(dev_desc, ptn->partition_index, &info)) { printf("Bad partition index:%d for partition:%s\n", |