diff options
Diffstat (limited to 'mx29f002.c')
-rw-r--r-- | mx29f002.c | 37 |
1 files changed, 3 insertions, 34 deletions
@@ -43,6 +43,9 @@ int probe_29f002(struct flashchip *flash) return 0; } +/* FIXME: Use erase_chip_jedec? + * erase_29f002 uses shorter addresses, sends F0 (exit ID mode) and + * and has a bigger delay before polling the toggle bit */ int erase_29f002(struct flashchip *flash) { chipaddr bios = flash->virtual_memory; @@ -64,37 +67,3 @@ int erase_29f002(struct flashchip *flash) } return 0; } - -int write_29f002(struct flashchip *flash, uint8_t *buf) -{ - int i; - int total_size = flash->total_size * 1024; - chipaddr bios = flash->virtual_memory; - chipaddr dst = bios; - - chip_writeb(0xF0, bios); - programmer_delay(10); - if (erase_29f002(flash)) { - fprintf(stderr, "ERASE FAILED!\n"); - return -1; - } - 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); - chip_writeb(0xAA, bios + 0x5555); - chip_writeb(0x55, bios + 0x2AAA); - chip_writeb(0xA0, bios + 0x5555); - chip_writeb(*buf++, dst++); - - /* 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("\n"); - - return 0; -} |