From: Gerlando Falauto Date: Wed, 3 Jul 2013 18:33:57 +0000 (+0200) Subject: cmd_sf: let "sf update" erase last sector as a whole X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=3488850629d2d27febe1839ea0b0f92e915c35fa;p=u-boot.git cmd_sf: let "sf update" erase last sector as a whole make "sf update" work with unaligned `len' parameter, by deleting the whole last sector before writing, so to allow for: sf update ${load_addr_r} 0 ${filesize} Signed-off-by: Gerlando Falauto Cc: Valentin Longchamp Cc: Holger Brunck Acked-by: Simon Glass Reviewed-by: Jagannadha Sutradharudu Teki --- diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 34844ac4a0..4af0f0af26 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -160,7 +160,8 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset, *skipped += len; return NULL; } - if (spi_flash_erase(flash, offset, len)) + /* Erase the entire sector */ + if (spi_flash_erase(flash, offset, flash->sector_size)) return "erase"; if (spi_flash_write(flash, offset, len, buf)) return "write";