[U-Boot] [PATCH] sf: fix stmicro offset setup while erasing

Mike Frysinger vapier at gentoo.org
Thu Oct 15 01:28:03 CEST 2009


Reported-by: Peter Gombos <gombos at protecta.hu>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 drivers/mtd/spi/stmicro.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 9b910c1..ae0d047 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -281,7 +281,8 @@ int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
 
 	ret = 0;
 	for (actual = 0; actual < len; actual++) {
-		cmd[1] = (offset / sector_size) + actual;
+		cmd[1] = offset >> 16;
+		offset += sector_size;
 
 		ret = spi_flash_cmd(flash->spi, CMD_M25PXX_WREN, NULL, 0);
 		if (ret < 0) {
-- 
1.6.5



More information about the U-Boot mailing list