summaryrefslogtreecommitdiff
path: root/drivers/mtd/altera_qspi.c
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2015-12-23 21:47:02 +0800
committerThomas Chou <thomas@wytron.com.tw>2015-12-28 09:32:43 +0800
commit8e8106dcd540e4c735da6a0b71919747c15ce93a (patch)
tree9be8ea7ea08e0ff907f539f168a0ad707cbde147 /drivers/mtd/altera_qspi.c
parentd579d38f3f9df73057716168d0c52bac9a568760 (diff)
downloadu-boot-imx-8e8106dcd540e4c735da6a0b71919747c15ce93a.zip
u-boot-imx-8e8106dcd540e4c735da6a0b71919747c15ce93a.tar.gz
u-boot-imx-8e8106dcd540e4c735da6a0b71919747c15ce93a.tar.bz2
altera_qspi: allow ctrl-c to abort the erase ops
Allow ctrl-c to abort the erase ops. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'drivers/mtd/altera_qspi.c')
-rw-r--r--drivers/mtd/altera_qspi.c9
1 files changed, 9 insertions, 0 deletions
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 */