diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-09-22 00:55:00 -0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-10-19 13:47:06 -0400 |
commit | f4c92582137a645ffc42346d7176ddd1462c2be0 (patch) | |
tree | 789fd012dcfb7dc4064ac2a96c9aa562f3b838f1 /drivers/dfu | |
parent | d718ff70ee671df3a2af8d72ed6df5faae62b938 (diff) | |
download | u-boot-imx-f4c92582137a645ffc42346d7176ddd1462c2be0.zip u-boot-imx-f4c92582137a645ffc42346d7176ddd1462c2be0.tar.gz u-boot-imx-f4c92582137a645ffc42346d7176ddd1462c2be0.tar.bz2 |
dfu: dfu_sf: Use the erase sector size for erase operations
SPI NOR flashes need to erase the entire sector size and we cannot pass
any arbitrary length for the erase operation.
To illustrate the problem:
Copying data from PC to DFU device
Download [=========================] 100% 478208 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(10) = dfuERROR, status(14) = Something went wrong, but the
device does not know what it was
Done!
In this case, the binary has 478208 bytes and the M25P32 SPI NOR
has an erase sector of 64kB.
478208 = 7 entire sectors of 64kiB + 19456 bytes.
Erasing the first seven 64 kB sectors works fine, but when trying
to erase the remainding 19456 causes problem and the board hangs.
Fix the issue by always erasing with the erase sector size.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'drivers/dfu')
-rw-r--r-- | drivers/dfu/dfu_sf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c index c3d3c3b..448d95d 100644 --- a/drivers/dfu/dfu_sf.c +++ b/drivers/dfu/dfu_sf.c @@ -28,7 +28,8 @@ static int dfu_write_medium_sf(struct dfu_entity *dfu, { int ret; - ret = spi_flash_erase(dfu->data.sf.dev, offset, *len); + ret = spi_flash_erase(dfu->data.sf.dev, offset, + dfu->data.sf.dev->sector_size); if (ret) return ret; |