add retry to write_byte_program_jedec(), 99% success rate

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1814 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Li-Ta Lo
2004-12-08 02:10:33 +00:00
parent c48822ae91
commit 19b6945a40
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;
}