mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 15:37:23 +00:00
sf: spansion: fixing erasing when sector size >64KiB
The spansion_erase currently only works when the sector size is 64KB. cmd[1] should contain the higher 8 bit of the 24 bit address of the sector to be erased. Currently it is holding the sector index to be erased which happens to be the same thing when the sector size is 64KB. Signed-off-by: Marc-Andre Hebert <marc-andre.hebert@humanware.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
74f9e0d8a0
commit
c3cb09207f
1 changed files with 3 additions and 4 deletions
|
@ -262,7 +262,6 @@ int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
len /= sector_size;
|
|
||||||
cmd[0] = CMD_S25FLXX_SE;
|
cmd[0] = CMD_S25FLXX_SE;
|
||||||
cmd[2] = 0x00;
|
cmd[2] = 0x00;
|
||||||
cmd[3] = 0x00;
|
cmd[3] = 0x00;
|
||||||
|
@ -274,8 +273,8 @@ int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
for (actual = 0; actual < len; actual++) {
|
for (actual = 0; actual < len; actual += sector_size) {
|
||||||
cmd[1] = (offset / sector_size) + actual;
|
cmd[1] = (offset + actual) >> 16;
|
||||||
|
|
||||||
ret = spi_flash_cmd(flash->spi, CMD_S25FLXX_WREN, NULL, 0);
|
ret = spi_flash_cmd(flash->spi, CMD_S25FLXX_WREN, NULL, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -298,7 +297,7 @@ int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("SF: SPANSION: Successfully erased %u bytes @ 0x%x\n",
|
debug("SF: SPANSION: Successfully erased %u bytes @ 0x%x\n",
|
||||||
len * sector_size, offset);
|
len, offset);
|
||||||
|
|
||||||
spi_release_bus(flash->spi);
|
spi_release_bus(flash->spi);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue