sf: fix stmicro offset setup while erasing
authorMike Frysinger <vapier@gentoo.org>
Wed, 14 Oct 2009 23:28:03 +0000 (19:28 -0400)
committerWolfgang Denk <wd@denx.de>
Sun, 22 Nov 2009 22:56:36 +0000 (23:56 +0100)
Reported-by: Peter Gombos <gombos@protecta.hu>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
drivers/mtd/spi/stmicro.c

index 9b910c13fd8b16f13fb92543d07f2e8e859d684e..ae0d0471f21fecf9d1836d06210f5efbdb551032 100644 (file)
@@ -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) {