Rebased against svn HEAD, no functional changes.
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
Index: flashrom-generic_check_erased_range/jedec.c =================================================================== --- flashrom-generic_check_erased_range/jedec.c (Revision 1224) +++ flashrom-generic_check_erased_range/jedec.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/sst49lfxxxc.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/sharplhf00l04.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/82802ab.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/spi25.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/sst28sf040.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/stm50flw0x0x.c (Arbeitskopie) @@ -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 1224) +++ flashrom-generic_check_erased_range/flashrom.c (Arbeitskopie) @@ -1395,6 +1395,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 oldcontents. */ memset(oldcontents, 0xff, len); skip = 0; Index: flashrom-generic_check_erased_range/m29f400bt.c =================================================================== --- flashrom-generic_check_erased_range/m29f400bt.c (Revision 1224) +++ flashrom-generic_check_erased_range/m29f400bt.c (Arbeitskopie) @@ -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; }