summaryrefslogtreecommitdiffstats
path: root/w49f002u.c
diff options
context:
space:
mode:
authorOllie Lho <ollie@sis.com.tw>2004-12-08 20:10:01 +0000
committerOllie Lho <ollie@sis.com.tw>2004-12-08 20:10:01 +0000
commitefa28589b1c2c402e62c8d5b1e32e5e45b164c2d (patch)
tree745e579906240cfce9f3f6bca9b1d5e63630289e /w49f002u.c
parent1b8b66000f6c8f18193cd93fff1e852faaa9715f (diff)
downloadflashrom-efa28589b1c2c402e62c8d5b1e32e5e45b164c2d.tar.gz
flashrom-efa28589b1c2c402e62c8d5b1e32e5e45b164c2d.tar.bz2
flashrom-efa28589b1c2c402e62c8d5b1e32e5e45b164c2d.zip
Add -E option for chip erase, remove duplicated code
Corresponding to flashrom svn r30 and coreboot v2 svn r1815.
Diffstat (limited to 'w49f002u.c')
-rw-r--r--w49f002u.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/w49f002u.c b/w49f002u.c
index c6200d0aa..5325076f4 100644
--- a/w49f002u.c
+++ b/w49f002u.c
@@ -35,27 +35,20 @@
int write_49f002(struct flashchip *flash, unsigned char *buf)
{
int i;
- int total_size = flash->total_size * 1024;
+ int total_size = flash->total_size * 1024, page_size =
+ flash->page_size;
volatile char *bios = flash->virt_addr;
- volatile char *dst = bios;
erase_chip_jedec(flash);
printf("Programming Page: ");
for (i = 0; i < total_size; i++) {
/* write to the sector */
- if ((i & 0xfff) == 0)
- printf("address: 0x%08lx", (unsigned long) i);
- *(bios + 0x5555) = 0xAA;
- *(bios + 0x2AAA) = 0x55;
- *(bios + 0x5555) = 0xA0;
- *dst++ = *buf++;
-
- /* wait for Toggle bit ready */
- toggle_ready_jedec(dst);
-
- if ((i & 0xfff) == 0)
- printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ printf("%04d at address: 0x%08x ", i, i * page_size);
+ write_sector_jedec(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\b");
+ fflush(stdout);
}
printf("\n");