1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

Add retry to write_byte_program_jedec(), 99% success rate

Corresponding to flashrom svn r29 and coreboot v2 svn r1814.
This commit is contained in:
Ollie Lho
2004-12-08 02:10:33 +00:00
parent d11f361808
commit 1b8b66000f
4 changed files with 12 additions and 74 deletions

View File

@ -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;
}