提交 8e8106dc 编写于 作者: T Thomas Chou

altera_qspi: allow ctrl-c to abort the erase ops

Allow ctrl-c to abort the erase ops.
Signed-off-by: NThomas Chou <thomas@wytron.com.tw>
上级 d579d38f
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <console.h>
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <fdt_support.h> #include <fdt_support.h>
...@@ -145,6 +146,14 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -145,6 +146,14 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr)
instr->state = MTD_ERASING; instr->state = MTD_ERASING;
addr &= ~(mtd->erasesize - 1); /* get lower aligned address */ addr &= ~(mtd->erasesize - 1); /* get lower aligned address */
while (addr < end) { 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; flash = pdata->base + addr;
last = pdata->base + addr + mtd->erasesize; last = pdata->base + addr + mtd->erasesize;
/* skip erase if sector is blank */ /* skip erase if sector is blank */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册