Title: [6908] branches/2009R1/drivers/mtd/devices/m25p80.c: Fix bug [#5288], need a write disable command to terminate AAI program according sst spi flash data sheet
- Revision
- 6908
- Author
- gyang
- Date
- 2009-07-02 00:38:34 -0500 (Thu, 02 Jul 2009)
Log Message
Fix bug [#5288], need a write disable command to terminate AAI program according sst spi flash data sheet
Modified Paths
Diff
Modified: branches/2009R1/drivers/mtd/devices/m25p80.c (6907 => 6908)
--- branches/2009R1/drivers/mtd/devices/m25p80.c 2009-07-02 05:38:15 UTC (rev 6907)
+++ branches/2009R1/drivers/mtd/devices/m25p80.c 2009-07-02 05:38:34 UTC (rev 6908)
@@ -521,6 +521,9 @@
/* write one byte. */
t[1].len = 1;
spi_sync(flash->spi, &m);
+ ret = wait_till_ready(flash);
+ if (ret)
+ goto time_out;
*retlen += m.actual_length - CMD_SIZE;
}
to += actual;
@@ -536,17 +539,22 @@
/* write two bytes. */
t[1].len = 2;
t[1].tx_buf = buf + actual;
+
+ spi_sync(flash->spi, &m);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
- spi_sync(flash->spi, &m);
-
*retlen += m.actual_length - cmd_sz;
cmd_sz = 1;
to += 2;
}
+ write_disable(flash);
+ ret = wait_till_ready(flash);
+ if (ret)
+ goto time_out;
if (actual != len) {
+ write_enable(flash);
flash->command[0] = OPCODE_BP;
flash->command[1] = to >> 16;
flash->command[2] = to >> 8;
@@ -554,17 +562,16 @@
t[0].len = CMD_SIZE;
t[1].len = 1;
t[1].tx_buf = buf + actual;
+
+ spi_sync(flash->spi, &m);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
- spi_sync(flash->spi, &m);
-
*retlen += m.actual_length - CMD_SIZE;
+ write_disable(flash);
}
- ret = wait_till_ready(flash);
time_out:
- write_disable(flash);
mutex_unlock(&flash->lock);
return ret;
}
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits