[U-Boot] [PATCH v2] Fixing spi erase for S25FL128P_256K

Mike Frysinger vapier at gentoo.org
Tue Aug 10 22:55:34 CEST 2010


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


More information about the U-Boot mailing list