Title: [6907] trunk/drivers/mtd/devices/m25p80.c: Fix bug [#5288], need a write disable command to terminate AAI program according sst spi flash data sheet
Revision
6907
Author
gyang
Date
2009-07-02 00:38:15 -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: trunk/drivers/mtd/devices/m25p80.c (6906 => 6907)


--- trunk/drivers/mtd/devices/m25p80.c	2009-07-02 05:35:33 UTC (rev 6906)
+++ trunk/drivers/mtd/devices/m25p80.c	2009-07-02 05:38:15 UTC (rev 6907)
@@ -517,6 +517,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;
@@ -533,18 +536,23 @@
 		/* 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;
 
 	/* Write out trailing byte if it exists. */
 	if (actual != len) {
+		write_enable(flash);
 		flash->command[0] = OPCODE_BP;
 		flash->command[1] = to >> 16;
 		flash->command[2] = to >> 8;
@@ -552,17 +560,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);
+time_out:
 	mutex_unlock(&flash->lock);
 	return ret;
 }
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to