mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
Refine handling of spi_write_enable() failures to fix chip erases on ichspi
Until the ICH SPI driver can handle preopcodes as standalone opcodes, we should handle such special opcode failure gracefully on ICH and compatible chipsets. This fixes chip erase on almost all ICH+VIA SPI masters. Thanks to Ali Nadalizadeh for helping track down this bug! Corresponding to flashrom svn r484. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
@ -68,6 +68,7 @@ int sb600_spi_write(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int rc = 0, i;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int result;
|
||||
|
||||
/* Erase first */
|
||||
printf("Erasing flash before programming... ");
|
||||
@ -77,7 +78,9 @@ int sb600_spi_write(struct flashchip *flash, uint8_t *buf)
|
||||
printf("Programming flash");
|
||||
for (i = 0; i < total_size; i++, buf++) {
|
||||
spi_disable_blockprotect();
|
||||
spi_write_enable();
|
||||
result = spi_write_enable();
|
||||
if (result)
|
||||
return result;
|
||||
spi_byte_program(i, *buf);
|
||||
/* wait program complete. */
|
||||
if (i % 0x8000 == 0)
|
||||
|
Reference in New Issue
Block a user