diff options
author | Sean Nelson <audiohacked@gmail.com> | 2009-12-22 22:15:33 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-12-22 22:15:33 +0000 |
commit | 72a9a02b3864fb730ae9a8cff35266633842e324 (patch) | |
tree | 23d129299edf5dd7c00925c60fa66c3e3a23e5ae /am29f040b.c | |
parent | 63ce4bb0d26046d9de0769502740120f478d86ac (diff) | |
download | flashrom-72a9a02b3864fb730ae9a8cff35266633842e324.tar.gz flashrom-72a9a02b3864fb730ae9a8cff35266633842e324.tar.bz2 flashrom-72a9a02b3864fb730ae9a8cff35266633842e324.zip |
Convert the following chips to use struct eraseblock
Am29F010A/B
Am29F002(N)BB
Am29F002(N)BT
Am29F016D
Am29F040B
Am29F080B
Am29LV040B
Am29LV081B
A29040B
Pm29F002T
Pm29F002B
Change function signature of Am29 erase functions and JEDEC chip erase
to be usable with block_erasers.
Corresponding to flashrom svn r812.
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'am29f040b.c')
-rw-r--r-- | am29f040b.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/am29f040b.c b/am29f040b.c index 46a5ef4b..cfa6c49c 100644 --- a/am29f040b.c +++ b/am29f040b.c @@ -22,9 +22,8 @@ /* FIMXE: check that the 2 second delay is really needed. Use erase_sector_jedec if not? */ -static int erase_sector_29f040b(struct flashchip *flash, unsigned long address) +int erase_sector_29f040b(struct flashchip *flash, unsigned int address, unsigned int blocklen) { - int page_size = flash->page_size; chipaddr bios = flash->virtual_memory; chip_writeb(0xAA, bios + 0x555); @@ -39,13 +38,24 @@ static int erase_sector_29f040b(struct flashchip *flash, unsigned long address) /* wait for Toggle bit ready */ toggle_ready_jedec(bios + address); - if (check_erased_range(flash, address, page_size)) { + if (check_erased_range(flash, address, blocklen)) { fprintf(stderr, "ERASE FAILED!\n"); return -1; } return 0; } +/* erase chip with block_erase() prototype */ +int erase_chip_29f040b(struct flashchip *flash, unsigned int addr, unsigned int blocklen) +{ + if ((addr != 0) || (blocklen != flash->total_size * 1024)) { + fprintf(stderr, "%s called with incorrect arguments\n", + __func__); + return -1; + } + return erase_29f040b(flash); +} + /* FIXME: use write_sector_jedec? */ static int write_sector_29f040b(chipaddr bios, uint8_t *src, chipaddr dst, unsigned int page_size) @@ -127,7 +137,7 @@ int write_29f040b(struct flashchip *flash, uint8_t *buf) printf("Programming page "); for (i = 0; i < total_size / page_size; i++) { /* erase the page before programming */ - if (erase_sector_29f040b(flash, i * page_size)) { + if (erase_sector_29f040b(flash, i * page_size, page_size)) { fprintf(stderr, "ERASE FAILED!\n"); return -1; } |