summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorUrja Rannikko <urjaman@gmail.com>2009-06-25 13:57:31 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-06-25 13:57:31 +0000
commit0c854c0509ee41cff4e255d088f48484ca468eb1 (patch)
tree47478bc812481cc67f0c1d85a932a1f3fae47c1a /jedec.c
parentea07f6245cb622a073a363112a95fea51429a086 (diff)
downloadast2050-flashrom-0c854c0509ee41cff4e255d088f48484ca468eb1.zip
ast2050-flashrom-0c854c0509ee41cff4e255d088f48484ca468eb1.tar.gz
Change chip_readb in loop to use verify_range in write_page_write_jedec (jedec.c)
Tested by Urja Rannikko with external flasher. Tested by Uwe Hermann with onboard flash. Corresponding to flashrom svn r632. Signed-off-by: Urja Rannikko <urjaman@gmail.com> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Urja Rannikko <urjaman@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/jedec.c b/jedec.c
index 711a56d..5c71980 100644
--- a/jedec.c
+++ b/jedec.c
@@ -262,12 +262,14 @@ int erase_chip_jedec(struct flashchip *flash)
return 0;
}
-int write_page_write_jedec(chipaddr bios, uint8_t *src,
- chipaddr dst, int page_size)
+int write_page_write_jedec(struct flashchip *flash, uint8_t *src,
+ int start, int page_size)
{
int i, tried = 0, start_index = 0, ok;
- chipaddr d = dst;
uint8_t *s = src;
+ chipaddr bios = flash->virtual_memory;
+ chipaddr dst = bios + start;
+ chipaddr d = dst;
retry:
/* Issue JEDEC Data Unprotect comand */
@@ -288,15 +290,7 @@ retry:
dst = d;
src = s;
- ok = 1;
- for (i = 0; i < page_size; i++) {
- if (chip_readb(dst) != *src) {
- ok = 0;
- break;
- }
- dst++;
- src++;
- }
+ ok = !verify_range(flash, src, start, page_size, NULL);
if (!ok && tried++ < MAX_REFLASH_TRIES) {
start_index = i;
@@ -367,8 +361,8 @@ int write_jedec(struct flashchip *flash, uint8_t *buf)
printf("Programming page: ");
for (i = 0; i < total_size / page_size; i++) {
printf("%04d at address: 0x%08x", i, i * page_size);
- write_page_write_jedec(bios, buf + i * page_size,
- bios + i * page_size, page_size);
+ write_page_write_jedec(flash, buf + i * page_size,
+ i * page_size, page_size);
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
printf("\n");
OpenPOWER on IntegriCloud