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.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-generic_check_erased_range/jedec.c =================================================================== --- flashrom-generic_check_erased_range/jedec.c (revision 1216) +++ flashrom-generic_check_erased_range/jedec.c (working copy) @@ -261,10 +261,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; }
@@ -291,16 +288,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;
/* Issue the JEDEC Chip Erase command */ @@ -320,10 +313,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; }
Index: flashrom-generic_check_erased_range/sst49lfxxxc.c =================================================================== --- flashrom-generic_check_erased_range/sst49lfxxxc.c (revision 1216) +++ flashrom-generic_check_erased_range/sst49lfxxxc.c (working copy) @@ -69,9 +69,6 @@
status = wait_82802ab(flash);
- if (check_erased_range(flash, address, sector_size)) { - msg_cerr("ERASE FAILED!\n"); - return -1; - } + /* FIXME: Check the status register for errors. */ return 0; } Index: flashrom-generic_check_erased_range/sharplhf00l04.c =================================================================== --- flashrom-generic_check_erased_range/sharplhf00l04.c (revision 1216) +++ flashrom-generic_check_erased_range/sharplhf00l04.c (working copy) @@ -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; } Index: flashrom-generic_check_erased_range/82802ab.c =================================================================== --- flashrom-generic_check_erased_range/82802ab.c (revision 1216) +++ flashrom-generic_check_erased_range/82802ab.c (working copy) @@ -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; }
Index: flashrom-generic_check_erased_range/spi25.c =================================================================== --- flashrom-generic_check_erased_range/spi25.c (revision 1216) +++ flashrom-generic_check_erased_range/spi25.c (working copy) @@ -584,10 +584,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; }
@@ -623,10 +620,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; }
@@ -667,10 +661,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; }
@@ -716,10 +707,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; }
@@ -763,10 +751,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; }
@@ -808,10 +793,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; }
Index: flashrom-generic_check_erased_range/sst28sf040.c =================================================================== --- flashrom-generic_check_erased_range/sst28sf040.c (revision 1216) +++ flashrom-generic_check_erased_range/sst28sf040.c (working copy) @@ -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; }
Index: flashrom-generic_check_erased_range/stm50flw0x0x.c =================================================================== --- flashrom-generic_check_erased_range/stm50flw0x0x.c (revision 1216) +++ flashrom-generic_check_erased_range/stm50flw0x0x.c (working copy) @@ -107,11 +107,7 @@
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; }
@@ -139,5 +135,6 @@ } }
+ /* FIXME: Check the status register for errors. */ return 0; } Index: flashrom-generic_check_erased_range/flashrom.c =================================================================== --- flashrom-generic_check_erased_range/flashrom.c (revision 1216) +++ flashrom-generic_check_erased_range/flashrom.c (working copy) @@ -1290,6 +1290,10 @@ start + len - 1); if (do_something(flash, start, len)) return 1; + if (check_erased_range(flash, start, len)) { + msg_cerr("ERASE FAILED!\n"); + return -1; + } start += len; } } Index: flashrom-generic_check_erased_range/m29f400bt.c =================================================================== --- flashrom-generic_check_erased_range/m29f400bt.c (revision 1216) +++ flashrom-generic_check_erased_range/m29f400bt.c (working copy) @@ -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; }