summaryrefslogtreecommitdiff
path: root/jedec.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-14 03:48:33 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2009-11-14 03:48:33 +0000
commit965d9a4ea93e21e3fdf1792ae0521ea4efde9f12 (patch)
treeb3eb6f832a839bd9246c4773bd99f3b107381eb9 /jedec.c
parentffb22fad4ccd1cc4c0ba263819a52364649cbb85 (diff)
downloadflashrom-965d9a4ea93e21e3fdf1792ae0521ea4efde9f12.tar.gz
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> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@757 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/jedec.c b/jedec.c
index fb6e5ed..69a59b3 100644
--- a/jedec.c
+++ b/jedec.c
@@ -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) {