Commit 8a8a226a authored by Carl-Daniel Hailfinger's avatar Carl-Daniel Hailfinger
Browse files

Retry correct range in write_page_write_jedec()


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.

Corresponding to flashrom svn r757.
Signed-off-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: default avatarLuke Dashjr <luke_coreboot@dashjr.org>
parent 11c9e687
......@@ -3060,7 +3060,7 @@ struct flashchip flashchips[] = {
.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,
......
......@@ -262,7 +262,7 @@ int erase_chip_jedec(struct flashchip *flash)
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 @@ retry:
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 @@ retry:
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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment