[U-Boot] [PATCH 4/5] mtd: spi_flash: Clear SR error flags in case of failed write

Ahmed Samir Khalil engkhalil86 at gmail.com
Sun Oct 1 01:20:43 UTC 2017


If writing fail, error that is flagged into status
register-1 should be cleared. Otherwise, next
operation(s) may be done incorrectly/incomplete.

Signed-off-by: Ahmed S. Khalil <engkhalil86 at gmail.com>
---
 drivers/mtd/spi/spi_flash.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 6f54e10..b6b56fe 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -415,6 +415,9 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
 					buf + actual, chunk_len);
 		if (ret < 0) {
 			debug("SF: write failed\n");
+#ifdef CONFIG_SPI_FLASH_SPANSION
+			clear_sr(flash);
+#endif
 			break;
 		}
 
-- 
2.7.4



More information about the U-Boot mailing list