altera_qspi: set fail_addr for erase ops
authorThomas Chou <thomas@wytron.com.tw>
Wed, 23 Dec 2015 13:06:12 +0000 (21:06 +0800)
committerThomas Chou <thomas@wytron.com.tw>
Mon, 28 Dec 2015 01:32:43 +0000 (09:32 +0800)
If the erase fails, fail_addr might indicate exactly which block
failed. If fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not
at the device level or was not specific to any particular block.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
drivers/mtd/altera_qspi.c

index 627a8ccee374be0d0e738e0b5760e0d15642a848..b0d4f2c810232d9f9b733c92ddb16e0f81085146 100644 (file)
@@ -145,6 +145,7 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr)
                        /* erase failed, sector might be protected */
                        debug("erase %08x fail %x\n", sect, stat);
                        writel(stat, &regs->isr); /* clear isr */
+                       instr->fail_addr = addr;
                        instr->state = MTD_ERASE_FAILED;
                        mtd_erase_callback(instr);
                        return -EIO;