From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerlando Falauto Date: Fri, 28 Jun 2013 09:43:52 +0200 Subject: [U-Boot] [PATCH v2 1/2] cmd_sf: let "sf update" erase last sector as a whole In-Reply-To: <1372405433-30384-1-git-send-email-gerlando.falauto@keymile.com> References: <1372405433-30384-1-git-send-email-gerlando.falauto@keymile.com> Message-ID: <1372405433-30384-2-git-send-email-gerlando.falauto@keymile.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- common/cmd_sf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 19b0dc9..ab35a94 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"; -- 1.7.10.1