summaryrefslogtreecommitdiffstats
path: root/82802ab.c
diff options
context:
space:
mode:
authorSean Nelson <audiohacked@gmail.com>2010-01-09 05:30:14 +0000
committerSean Nelson <audiohacked@gmail.com>2010-01-09 05:30:14 +0000
commitc8def6d30c451e2c1518d6a08f224f6087f2b249 (patch)
tree9373efbba7456aeba406150af7d7977fbddc095e /82802ab.c
parentae2085d4985c47b512fd3d23c8f8df9d80c4efc9 (diff)
downloadflashrom-c8def6d30c451e2c1518d6a08f224f6087f2b249.zip
flashrom-c8def6d30c451e2c1518d6a08f224f6087f2b249.tar.gz
Block eraser conversions and support for Eon EN25B series
Convert chips to block_erasers: ASD AE49F2008 AMIC A25L40P(T/U) AMIC A49LF040A EMST F49B002UA Eon EN25B05 Eon EN25B10 Eon EN25B20 Eon EN25B40 Eon EN25B80 Eon EN25B16 Eon EN25B32 Eon EN25B64 Eon EN25D16 Eon EN25F05 Eon EN25F10 Eon EN25F20 Eon EN25F40 Eon EN25F80 Eon EN25F16 Eon EN25F32 Intel 28F001BX-B Intel 28F001BX-T Intel 82802AB Intel 82802AC Macronix MX25L1635D Macronix MX25L3235D Macronix MX25L6405 Macronix MX25L12805 Macronix MX29F001B Macronix MX29F001T Macronix MX29LV040 Added new chips (according to datasheets): Eon EN25B05T Eon EN25B10T Eon EN25B20T Eon EN25B40T Eon EN25B80T Eon EN25B16T Eon EN25B32T Eon EN25B64T Added minor Device IDs for Eon EN25Bxx{T,B} chips. Corresponding to flashrom svn r843. Signed-off-by: Sean Nelson <audiohacked@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to '82802ab.c')
-rw-r--r--82802ab.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/82802ab.c b/82802ab.c
index 58d3467..dfe81e8 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -90,32 +90,32 @@ uint8_t wait_82802ab(chipaddr bios)
return status;
}
-int erase_82802ab_block(struct flashchip *flash, int offset)
+int erase_82802ab_block(struct flashchip *flash, unsigned int page, unsigned int pagesize)
{
- chipaddr bios = flash->virtual_memory + offset;
- chipaddr wrprotect = flash->virtual_registers + offset + 2;
+ chipaddr bios = flash->virtual_memory;
+ chipaddr wrprotect = flash->virtual_registers + page + 2;
uint8_t status;
// clear status register
- chip_writeb(0x50, bios);
+ chip_writeb(0x50, bios + page);
// clear write protect
chip_writeb(0, wrprotect);
// now start it
- chip_writeb(0x20, bios);
- chip_writeb(0xd0, bios);
+ chip_writeb(0x20, bios + page);
+ chip_writeb(0xd0, bios + page);
programmer_delay(10);
// now let's see what the register is
- status = wait_82802ab(flash->virtual_memory);
+ status = wait_82802ab(bios);
print_82802ab_status(status);
- if (check_erased_range(flash, offset, flash->page_size)) {
+ if (check_erased_range(flash, page, pagesize)) {
fprintf(stderr, "ERASE FAILED!\n");
return -1;
}
- printf("DONE BLOCK 0x%x\n", offset);
+ printf("DONE BLOCK 0x%x\n", page);
return 0;
}
@@ -128,7 +128,7 @@ int erase_82802ab(struct flashchip *flash)
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)
- if (erase_82802ab_block(flash, i)) {
+ if (erase_82802ab_block(flash, i, flash->page_size)) {
fprintf(stderr, "ERASE FAILED!\n");
return -1;
}
@@ -182,7 +182,7 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf)
}
/* erase block by block and write block by block; this is the most secure way */
- if (erase_82802ab_block(flash, i * page_size)) {
+ if (erase_82802ab_block(flash, i * page_size, page_size)) {
fprintf(stderr, "ERASE FAILED!\n");
return -1;
}
OpenPOWER on IntegriCloud