[U-Boot] Subject: [U-BOOT] [PATCH] In stmicro_erase() correctly calculate the high byte of the sector address.

In stmicro_erase() correctly calculate the high byte of the sector address.
Signed-off-by: Gary Jennejohn garyj@denx.de --- drivers/mtd/spi/stmicro.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index 9b910c1..b5808c5 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -281,7 +281,13 @@ 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; + /* + * Correctly calculate the high byte of the address. + * + * Note that the new code basically does what the + * Linux driver does. + */ + cmd[1] = ((offset + actual * sector_size) >> 16) & 0xff;
ret = spi_flash_cmd(flash->spi, CMD_M25PXX_WREN, NULL, 0); if (ret < 0) {

On Wednesday 11 November 2009 08:40:41 Gary Jennejohn wrote:
In stmicro_erase() correctly calculate the high byte of the sector address.
ive already posted a fix for it; sf: fix stmicro offset setup while erasing
see if that works for you -mike
participants (2)
-
Gary Jennejohn
-
Mike Frysinger