The automatic retry in write_page_write_jedec didn't retry flashing the correct range, essentially rendering the functionality useless. This patch simplifies the code and fixes the bug.
Mark Winbond W29C040P as supported.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-write_page_write_jedec_retry/jedec.c =================================================================== --- flashrom-write_page_write_jedec_retry/jedec.c (Revision 756) +++ flashrom-write_page_write_jedec_retry/jedec.c (Arbeitskopie) @@ -262,7 +262,7 @@ int write_page_write_jedec(struct flashchip *flash, uint8_t *src, int start, int page_size) { - int i, tried = 0, start_index = 0, ok; + int i, tried = 0, ok; uint8_t *s = src; chipaddr bios = flash->virtual_memory; chipaddr dst = bios + start; @@ -275,7 +275,7 @@ chip_writeb(0xA0, bios + 0x5555);
/* transfer data from source to destination */ - for (i = start_index; i < page_size; i++) { + for (i = 0; i < page_size; i++) { /* If the data is 0xFF, don't program it */ if (*src != 0xFF) chip_writeb(*src, dst); @@ -290,7 +290,7 @@ ok = !verify_range(flash, src, start, page_size, NULL);
if (!ok && tried++ < MAX_REFLASH_TRIES) { - start_index = i; + fprintf(stderr, "retrying.\n"); goto retry; } if (!ok) { Index: flashrom-write_page_write_jedec_retry/flashchips.c =================================================================== --- flashrom-write_page_write_jedec_retry/flashchips.c (Revision 756) +++ flashrom-write_page_write_jedec_retry/flashchips.c (Arbeitskopie) @@ -3060,7 +3060,7 @@ .model_id = W_29C040P, .total_size = 512, .page_size = 256, - .tested = TEST_UNTESTED, + .tested = TEST_OK_PREW, .probe = probe_jedec, .probe_timing = 10, .erase = erase_chip_jedec,