diff options
author | Ollie Lho <ollie@sis.com.tw> | 2004-12-08 02:10:33 +0000 |
---|---|---|
committer | Ollie Lho <ollie@sis.com.tw> | 2004-12-08 02:10:33 +0000 |
commit | 1b8b66000f6c8f18193cd93fff1e852faaa9715f (patch) | |
tree | 243aa40ddfcb6c075f1c4dc329e003b341033091 /jedec.c | |
parent | d11f36180814c45b82142b168c95c6515278a926 (diff) | |
download | ast2050-flashrom-1b8b66000f6c8f18193cd93fff1e852faaa9715f.zip ast2050-flashrom-1b8b66000f6c8f18193cd93fff1e852faaa9715f.tar.gz |
Add retry to write_byte_program_jedec(), 99% success rate
Corresponding to flashrom svn r29 and coreboot v2 svn r1814.
Diffstat (limited to 'jedec.c')
-rw-r--r-- | jedec.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -176,11 +176,14 @@ int write_page_write_jedec(volatile unsigned char *bios, unsigned char *src, int write_byte_program_jedec(volatile unsigned char *bios, unsigned char *src, volatile unsigned char *dst) { + int tried = 0; + /* If the data is 0xFF, don't program it */ if (*src == 0xFF) { return 0; } +retry: /* Issue JEDEC Byte Program command */ *(volatile unsigned char *) (bios + 0x5555) = 0xAA; *(volatile unsigned char *) (bios + 0x2AAA) = 0x55; @@ -188,9 +191,12 @@ int write_byte_program_jedec(volatile unsigned char *bios, unsigned char *src, /* transfer data from source to destination */ *dst = *src; - toggle_ready_jedec(bios); + if (*dst != *src && tried++ < 0x10) { + goto retry; + } + return 0; } |