Commit 0628282072253bc1ec63d82dd1a89a0f2dbfe6e6
1 parent
9ef47adf18
Exists in
smarc-imx_v2017.03_o8.1.0_1.3.0_8m
and in
1 other branch
MA-11705 [Android] Correct the parameters for 'sf' command
Pass the parameters of 'sf' command in bytes instead of in block size. Change-Id: I7fa5bad97a0b61b35c7ba46770d3b56df3f6a41e Signed-off-by: Luo Ji <ji.luo@nxp.com>
Showing 2 changed files with 9 additions and 5 deletions Side-by-side Diff
drivers/usb/gadget/f_fastboot.c
... | ... | @@ -570,15 +570,19 @@ |
570 | 570 | return ret; |
571 | 571 | } |
572 | 572 | |
573 | +static int get_block_size(void); | |
573 | 574 | #ifdef CONFIG_FLASH_MCUFIRMWARE_SUPPORT |
574 | 575 | static void process_flash_sf(const char *cmdbuf) |
575 | 576 | { |
577 | + int blksz = 0; | |
578 | + blksz = get_block_size(); | |
579 | + | |
576 | 580 | if (download_bytes) { |
577 | 581 | struct fastboot_ptentry *ptn; |
578 | 582 | ptn = fastboot_flash_find_ptn(cmdbuf); |
579 | 583 | if (ptn == 0) { |
580 | 584 | fastboot_fail("partition does not exist"); |
581 | - } else if ((download_bytes > ptn->length)) { | |
585 | + } else if ((download_bytes > ptn->length * blksz)) { | |
582 | 586 | fastboot_fail("image too large for partition"); |
583 | 587 | /* TODO : Improve check for yaffs write */ |
584 | 588 | } else { |
... | ... | @@ -593,8 +597,8 @@ |
593 | 597 | return; |
594 | 598 | } |
595 | 599 | /* Erase */ |
596 | - sprintf(sf_command, "sf erase 0x%x 0x%x",ptn->start, /*start*/ | |
597 | - ptn->length /*size*/); | |
600 | + sprintf(sf_command, "sf erase 0x%x 0x%x", ptn->start * blksz, /*start*/ | |
601 | + ptn->length * blksz /*size*/); | |
598 | 602 | ret = run_command(sf_command, 0); |
599 | 603 | if (ret) { |
600 | 604 | fastboot_fail("Erasing sf failed"); |
... | ... | @@ -603,7 +607,7 @@ |
603 | 607 | /* Write image */ |
604 | 608 | sprintf(sf_command, "sf write 0x%x 0x%x 0x%x", |
605 | 609 | (unsigned int)(ulong)interface.transfer_buffer, /* source */ |
606 | - ptn->start, /* start */ | |
610 | + ptn->start * blksz, /* start */ | |
607 | 611 | download_bytes /*size*/); |
608 | 612 | printf("sf write '%s'\n", ptn->name); |
609 | 613 | ret = run_command(sf_command, 0); |
include/configs/mx7ulp_evk_android.h