Commit 788a6cdd authored by Frank Li's avatar Frank Li Committed by Brian Norris

mtd: spi-nor: fsl-quadspi: fix unsupported cmd when run flash_erase

Erase function will use cmd 0x20 (SPINOR_OP_BE_4K) if kenrel enable option
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS.

This command is not in fsl-quadspi driver LUT. So driver continue report
fsl-quadspi 21e0000.qspi: Unsupported cmd 0x20.

This patch fix this issue.
Signed-off-by: default avatarFrank Li <Frank.Li@freescale.com>
Acked-by: default avatarHan Xu <Han.xu@freescale.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 8b8319c8
...@@ -397,14 +397,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) ...@@ -397,14 +397,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q)
/* Erase a sector */ /* Erase a sector */
lut_base = SEQID_SE * 4; lut_base = SEQID_SE * 4;
if (q->nor_size <= SZ_16M) { cmd = q->nor[0].erase_opcode;
cmd = SPINOR_OP_SE; addrlen = q->nor_size <= SZ_16M ? ADDR24BIT : ADDR32BIT;
addrlen = ADDR24BIT;
} else {
/* use the 4-byte address */
cmd = SPINOR_OP_SE;
addrlen = ADDR32BIT;
}
writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen),
base + QUADSPI_LUT(lut_base)); base + QUADSPI_LUT(lut_base));
...@@ -473,6 +467,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd) ...@@ -473,6 +467,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
case SPINOR_OP_BRWR: case SPINOR_OP_BRWR:
return SEQID_BRWR; return SEQID_BRWR;
default: default:
if (cmd == q->nor[0].erase_opcode)
return SEQID_SE;
dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd); dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment