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:
8
jedec.c
8
jedec.c
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user