2010/8/10 Mike Frysinger <vap...@gentoo.org>: > 2010/8/10 Marc-André Hébert: >> 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. > > ugh, this is why the current sf framework annoys me. so much > duplication across drivers including bugs. > >> --- a/drivers/mtd/spi/spansion.c >> +++ b/drivers/mtd/spi/spansion.c >> @@ -274,8 +273,8 @@ int spansion_erase(struct spi_flash *flash, u32 >> offset, size_t len) >> } >> >> ret = 0; >> - for (actual = 0; actual < len; actual++) { >> - cmd[1] = (offset / sector_size) + actual; >> + for (actual = 0; actual < len; actual += sector_size) { >> + cmd[1] = (offset + actual) >> 16; > > how about the bug fix that went into stmicro: > - cmd[1] = (offset / sector_size) + actual; > + cmd[1] = offset >> 16; > + offset += sector_size; > -mike > Yeah I saw how stmicro did it, but I didn't do it that way simply because modifying the offset invalidates the debug statement afterwards:
debug("SF: SPANSION: Successfully erased %u bytes @ 0x%x\n", len, offset); Marc _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot