[U-Boot] [PATCH 5/5] altera_qspi: allow ctrl-c to abort the erase ops

Thomas Chou thomas at wytron.com.tw
Thu Dec 24 01:51:24 CET 2015


Allow ctrl-c to abort the erase ops.

Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
 drivers/mtd/altera_qspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c
index 0624ff4..a9148a7 100644
--- a/drivers/mtd/altera_qspi.c
+++ b/drivers/mtd/altera_qspi.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <console.h>
 #include <dm.h>
 #include <errno.h>
 #include <fdt_support.h>
@@ -145,6 +146,14 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr)
 	instr->state = MTD_ERASING;
 	addr &= ~(mtd->erasesize - 1); /* get lower aligned address */
 	while (addr < end) {
+		if (ctrlc()) {
+			if (flash_verbose)
+				putc('\n');
+			instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
+			instr->state = MTD_ERASE_FAILED;
+			mtd_erase_callback(instr);
+			return -EIO;
+		}
 		flash = pdata->base + addr;
 		last = pdata->base + addr + mtd->erasesize;
 		/* skip erase if sector is blank */
-- 
2.5.0



More information about the U-Boot mailing list