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 <engkhali...@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to