Author: hailfinger Date: Sun Jun 26 19:04:16 2011 New Revision: 1353 URL: http://flashrom.org/trac/flashrom/changeset/1353
Log: Erase functions are no longer called from chip drivers and thus their internal erase verification can be moved to generic code. This also makes it easier to skip the verify step if desired and to differentiate between failed command submission and failed erase verification.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at
Modified: trunk/82802ab.c trunk/flash.h trunk/flashrom.c trunk/jedec.c trunk/m29f400bt.c trunk/sharplhf00l04.c trunk/spi25.c trunk/sst28sf040.c trunk/sst49lfxxxc.c trunk/stm50flw0x0x.c
Modified: trunk/82802ab.c ============================================================================== --- trunk/82802ab.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/82802ab.c Sun Jun 26 19:04:16 2011 (r1353) @@ -136,11 +136,7 @@ status = wait_82802ab(flash); print_status_82802ab(status);
- if (check_erased_range(flash, page, pagesize)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } - + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/flash.h ============================================================================== --- trunk/flash.h Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/flash.h Sun Jun 26 19:04:16 2011 (r1353) @@ -210,7 +210,6 @@ int max(int a, int b); void tolower_string(char *str); char *extract_param(char **haystack, char *needle, char *delim); -int check_erased_range(struct flashchip *flash, int start, int len); int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start, int len, char *message); int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src);
Modified: trunk/flashrom.c ============================================================================== --- trunk/flashrom.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/flashrom.c Sun Jun 26 19:04:16 2011 (r1353) @@ -1400,6 +1400,10 @@ ret = erasefn(flash, start, len); if (ret) return ret; + if (check_erased_range(flash, start, len)) { + msg_cerr("ERASE FAILED!\n"); + return -1; + } /* Erase was successful. Adjust curcontents. */ memset(curcontents, 0xff, len); skip = 0;
Modified: trunk/jedec.c ============================================================================== --- trunk/jedec.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/jedec.c Sun Jun 26 19:04:16 2011 (r1353) @@ -264,10 +264,7 @@ /* wait for Toggle bit ready */ toggle_ready_jedec_slow(bios);
- if (check_erased_range(flash, page, pagesize)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -297,16 +294,12 @@ /* wait for Toggle bit ready */ toggle_ready_jedec_slow(bios);
- if (check_erased_range(flash, block, blocksize)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
static int erase_chip_jedec_common(struct flashchip *flash, unsigned int mask) { - int total_size = flash->total_size * 1024; chipaddr bios = flash->virtual_memory; int delay_us = 0; if(flash->probe_timing != TIMING_ZERO) @@ -329,10 +322,7 @@
toggle_ready_jedec_slow(bios);
- if (check_erased_range(flash, 0, total_size)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/m29f400bt.c ============================================================================== --- trunk/m29f400bt.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/m29f400bt.c Sun Jun 26 19:04:16 2011 (r1353) @@ -101,10 +101,7 @@ programmer_delay(10); toggle_ready_jedec(bios);
- if (check_erased_range(flash, 0, flash->total_size * 1024)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -124,10 +121,7 @@ programmer_delay(10); toggle_ready_jedec(bios);
- if (check_erased_range(flash, start, len)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/sharplhf00l04.c ============================================================================== --- trunk/sharplhf00l04.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/sharplhf00l04.c Sun Jun 26 19:04:16 2011 (r1353) @@ -50,9 +50,6 @@ status = wait_82802ab(flash); print_status_82802ab(status);
- if (check_erased_range(flash, blockaddr, blocklen)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/spi25.c ============================================================================== --- trunk/spi25.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/spi25.c Sun Jun 26 19:04:16 2011 (r1353) @@ -481,10 +481,7 @@ /* FIXME: We assume spi_read_status_register will never fail. */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(1000 * 1000); - if (check_erased_range(flash, 0, flash->total_size * 1024)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -520,10 +517,7 @@ /* FIXME: We assume spi_read_status_register will never fail. */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(1000 * 1000); - if (check_erased_range(flash, 0, flash->total_size * 1024)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -564,10 +558,7 @@ */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(100 * 1000); - if (check_erased_range(flash, addr, blocklen)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -613,10 +604,7 @@ */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(100 * 1000); - if (check_erased_range(flash, addr, blocklen)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -660,10 +648,7 @@ */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(100 * 1000); - if (check_erased_range(flash, addr, blocklen)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -705,10 +690,7 @@ */ while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) programmer_delay(10 * 1000); - if (check_erased_range(flash, addr, blocklen)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/sst28sf040.c ============================================================================== --- trunk/sst28sf040.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/sst28sf040.c Sun Jun 26 19:04:16 2011 (r1353) @@ -71,10 +71,7 @@ /* wait for Toggle bit ready */ toggle_ready_jedec(bios);
- if (check_erased_range(flash, address, sector_size)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
@@ -113,10 +110,7 @@ programmer_delay(10); toggle_ready_jedec(bios);
- if (check_erased_range(flash, 0, flash->total_size * 1024)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/sst49lfxxxc.c ============================================================================== --- trunk/sst49lfxxxc.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/sst49lfxxxc.c Sun Jun 26 19:04:16 2011 (r1353) @@ -70,9 +70,6 @@ status = wait_82802ab(flash); print_status_82802ab(status);
- if (check_erased_range(flash, address, sector_size)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; }
Modified: trunk/stm50flw0x0x.c ============================================================================== --- trunk/stm50flw0x0x.c Sun Jun 26 13:50:10 2011 (r1352) +++ trunk/stm50flw0x0x.c Sun Jun 26 19:04:16 2011 (r1353) @@ -107,10 +107,6 @@
wait_82802ab(flash);
- if (check_erased_range(flash, sector, sectorsize)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } - + /* FIXME: Check the status register for errors. */ return 0; }