summaryrefslogtreecommitdiffstats
path: root/sst_fwhub.c
diff options
context:
space:
mode:
authorOllie Lho <ollie@sis.com.tw>2004-12-08 02:10:33 +0000
committerOllie Lho <ollie@sis.com.tw>2004-12-08 02:10:33 +0000
commit1b8b66000f6c8f18193cd93fff1e852faaa9715f (patch)
tree243aa40ddfcb6c075f1c4dc329e003b341033091 /sst_fwhub.c
parentd11f36180814c45b82142b168c95c6515278a926 (diff)
downloadflashrom-1b8b66000f6c8f18193cd93fff1e852faaa9715f.tar.gz
flashrom-1b8b66000f6c8f18193cd93fff1e852faaa9715f.tar.bz2
flashrom-1b8b66000f6c8f18193cd93fff1e852faaa9715f.zip
Add retry to write_byte_program_jedec(), 99% success rate
Corresponding to flashrom svn r29 and coreboot v2 svn r1814.
Diffstat (limited to 'sst_fwhub.c')
-rw-r--r--sst_fwhub.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/sst_fwhub.c b/sst_fwhub.c
index 71f5d3382..d9dd46709 100644
--- a/sst_fwhub.c
+++ b/sst_fwhub.c
@@ -79,10 +79,8 @@ int probe_sst_fwhub(struct flashchip *flash)
myusec_delay(10);
- // we need to mmap the write-protect space.
- printf("mapping control register at %x\n", 0 - 0x400000 -size);
bios = mmap(0, size, PROT_WRITE | PROT_READ, MAP_SHARED,
- flash->fd_mem, (off_t) (0 - 0x400000 - size));
+ flash->fd_mem, (off_t) (0xFFFFFFFF - 0x400000 - size + 1));
if (bios == MAP_FAILED) {
// it's this part but we can't map it ...
perror("Error MMAP /dev/mem");
@@ -101,23 +99,16 @@ unsigned char wait_sst_fwhub(volatile unsigned char *bios)
int erase_sst_fwhub_block(struct flashchip *flash, int offset)
{
- volatile unsigned char *bios = flash->virt_addr + offset;
- volatile unsigned char *wrprotect =
- flash->virt_addr_2 + offset + 2;
+ volatile unsigned char *wrprotect = flash->virt_addr_2 + offset + 2;
unsigned char status;
- // clear status register
- printf("Erase at %p\n", bios);
+ //printf("Erase at %p\n", bios);
// clear write protect
- printf("write protect is at %p\n", (wrprotect));
- printf("write protect is 0x%x\n", *(wrprotect));
*(wrprotect) = 0;
- printf("write protect is 0x%x\n", *(wrprotect));
erase_block_jedec(flash->virt_addr, offset);
status = wait_sst_fwhub(flash->virt_addr);
- //print_sst_fwhub_status(status);
- printf("DONE BLOCK 0x%x\n", offset);
+
return (0);
}
@@ -126,11 +117,8 @@ int erase_sst_fwhub(struct flashchip *flash)
int i;
unsigned int total_size = flash->total_size * 1024;
- printf("total_size is %d; flash->page_size is %d\n",
- total_size, flash->page_size);
for (i = 0; i < total_size; i += flash->page_size)
erase_sst_fwhub_block(flash, i);
- printf("DONE ERASE\n");
return (0);
}
@@ -145,7 +133,6 @@ void write_page_sst_fwhub(volatile char *bios, char *src,
src++;
dst++;
}
-
}
int write_sst_fwhub(struct flashchip *flash, unsigned char *buf)
@@ -165,10 +152,8 @@ int write_sst_fwhub(struct flashchip *flash, unsigned char *buf)
printf("%04d at address: 0x%08x", i, i * page_size);
write_page_sst_fwhub(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");
+ 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");
- protect_sst_fwhub(bios);
return (0);
}