Author: hailfinger Date: 2009-11-14 04:48:33 +0100 (Sat, 14 Nov 2009) New Revision: 757
Modified: trunk/flashchips.c trunk/jedec.c Log: 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.
Thanks to Luke Dashjr for testing.
Mark Winbond W29C040P as supported.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Luke Dashjr luke_coreboot@dashjr.org
Modified: trunk/flashchips.c =================================================================== --- trunk/flashchips.c 2009-11-06 18:09:42 UTC (rev 756) +++ trunk/flashchips.c 2009-11-14 03:48:33 UTC (rev 757) @@ -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,
Modified: trunk/jedec.c =================================================================== --- trunk/jedec.c 2009-11-06 18:09:42 UTC (rev 756) +++ trunk/jedec.c 2009-11-14 03:48:33 UTC (rev 757) @@ -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) {