1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

Move erase verification to generic code

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.

Corresponding to flashrom svn r1353.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Carl-Daniel Hailfinger
2011-06-26 17:04:16 +00:00
parent bfa021dd80
commit b4061f61cd
10 changed files with 21 additions and 72 deletions

30
spi25.c
View File

@ -481,10 +481,7 @@ int spi_chip_erase_60(struct flashchip *flash)
/* 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 @@ int spi_chip_erase_c7(struct flashchip *flash)
/* 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 @@ int spi_block_erase_52(struct flashchip *flash, unsigned int addr, unsigned int
*/
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 @@ int spi_block_erase_d8(struct flashchip *flash, unsigned int addr, unsigned int
*/
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 @@ int spi_block_erase_d7(struct flashchip *flash, unsigned int addr, unsigned int
*/
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 @@ int spi_block_erase_20(struct flashchip *flash, unsigned int addr, unsigned int
*/
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;
}