[U-Boot] [PATCH 3/5] mtd: spi_flash: Clear SR if write/erase error is flagged

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


In case of write or erase error, flags are being
triggered into status register-1. The flags should be
cleared, otherwise they may lead to unstable behavior
for the following operation(s).

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 52dcb84..6f54e10 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -353,6 +353,9 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
 		ret = spi_flash_write_common(flash, cmd, sizeof(cmd), NULL, 0);
 		if (ret < 0) {
 			debug("SF: erase failed\n");
+#ifdef CONFIG_SPI_FLASH_SPANSION
+			clear_sr(flash);
+#endif
 			break;
 		}
 
-- 
2.7.4



More information about the U-Boot mailing list