From: Thomas Chou Date: Wed, 23 Dec 2015 13:47:02 +0000 (+0800) Subject: altera_qspi: allow ctrl-c to abort the erase ops X-Git-Tag: v2016.01-rc4~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8e8106dcd540e4c735da6a0b71919747c15ce93a;p=u-boot altera_qspi: allow ctrl-c to abort the erase ops Allow ctrl-c to abort the erase ops. Signed-off-by: Thomas Chou --- diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c index 0624ff4ea4..a9148a7fe4 100644 --- a/drivers/mtd/altera_qspi.c +++ b/drivers/mtd/altera_qspi.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -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 */