summaryrefslogtreecommitdiffstats
path: root/sb600spi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-05-09 02:09:45 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-05-09 02:09:45 +0000
commit03adbe12691d512c0d9f28caa93cb35e468fd5d3 (patch)
tree9bd6460e4a69d0647706ab139184870b32244441 /sb600spi.c
parentc3129208648f241c0b6538235cd4e9854ae6539d (diff)
downloadflashrom-03adbe12691d512c0d9f28caa93cb35e468fd5d3.tar.gz
flashrom-03adbe12691d512c0d9f28caa93cb35e468fd5d3.tar.bz2
flashrom-03adbe12691d512c0d9f28caa93cb35e468fd5d3.zip
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>
Diffstat (limited to 'sb600spi.c')
-rw-r--r--sb600spi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sb600spi.c b/sb600spi.c
index 9a3e99deb..095fba1bb 100644
--- a/sb600spi.c
+++ b/sb600spi.c
@@ -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)