Change chip_readb in loop to use verify_range in write_page_write_jedec (jedec.c).
Signed-off-by: Urja Rannikko urjaman@gmail.com
--- patch inlined: Index: jedec.c =================================================================== --- jedec.c (revision 595) +++ jedec.c (working copy) @@ -262,8 +262,8 @@ 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, chipaddr bios, + uint8_t *src, chipaddr dst, int page_size) { int i, tried = 0, start_index = 0, ok; chipaddr d = dst; @@ -288,15 +288,7 @@
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,dst,page_size,NULL);
if (!ok && tried++ < MAX_REFLASH_TRIES) { start_index = i; @@ -367,7 +359,7 @@ 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, + write_page_write_jedec(flash, bios, buf + i * page_size, bios + 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"); }
On 15.06.2009 20:54, Urja Rannikko wrote:
Change chip_readb in loop to use verify_range in write_page_write_jedec (jedec.c).
Signed-off-by: Urja Rannikko urjaman@gmail.com
Changed the reference variable types a bit. It should now work even for onboard flash. Can you check? Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-jedec_verify_range/jedec.c =================================================================== --- flashrom-jedec_verify_range/jedec.c (Revision 595) +++ flashrom-jedec_verify_range/jedec.c (Arbeitskopie) @@ -262,12 +262,14 @@ 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 @@
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 @@ 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");
On 15.06.2009 20:54, Urja Rannikko wrote:
Change chip_readb in loop to use verify_range in write_page_write_jedec (jedec.c).
Signed-off-by: Urja Rannikko urjaman@gmail.com
Changed the reference variable types a bit. It should now work even for onboard flash. Can you check? Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
I cant check with onboard flash (at the moment), sorry (if you meant that), but it looks ok and works with my external programmer, so: Acked-by: Urja Rannikko urjaman@gmail.com
On 17.06.2009 00:23, Urja Rannikko wrote:
On 15.06.2009 20:54, Urja Rannikko wrote:
Change chip_readb in loop to use verify_range in write_page_write_jedec (jedec.c).
Signed-off-by: Urja Rannikko urjaman@gmail.com
Changed the reference variable types a bit. It should now work even for onboard flash. Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
it looks ok and works with my external programmer, so: Acked-by: Urja Rannikko urjaman@gmail.com
Thanks, committed in r632.
Regards, Carl-Daniel