Commit 0628282072253bc1ec63d82dd1a89a0f2dbfe6e6

Authored by Luo Ji
1 parent 9ef47adf18

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
... ... @@ -35,7 +35,7 @@
35 35 #ifdef CONFIG_FLASH_MCUFIRMWARE_SUPPORT
36 36 #define ANDROID_MCU_FRIMWARE_DEV_TYPE DEV_SF
37 37 #define ANDROID_MCU_FIRMWARE_START 0
38   -#define ANDROID_MCU_FIRMWARE_SIZE 0x4000000
  38 +#define ANDROID_MCU_FIRMWARE_SIZE 0x20000
39 39 #endif
40 40  
41 41 #endif