mtd: spi-nor: fsl-quadspi: fix unsupported cmd when run flash_erase
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Sep 1 14:59:03 PDT 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=788a6cddda9ba83276e37567c17bb78406904074
Commit: 788a6cddda9ba83276e37567c17bb78406904074
Parent: 8b8319c8b7d0385659c2df6376955cb6a1d918b6
Author: Frank Li <Frank.Li at freescale.com>
AuthorDate: Tue Aug 4 10:26:16 2015 -0500
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Aug 6 10:07:45 2015 -0700
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: Frank Li <Frank.Li at freescale.com>
Acked-by: Han Xu <Han.xu at freescale.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/spi-nor/fsl-quadspi.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 0144821..d32b7e0 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -397,14 +397,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q)
/* Erase a sector */
lut_base = SEQID_SE * 4;
- if (q->nor_size <= SZ_16M) {
- cmd = SPINOR_OP_SE;
- addrlen = ADDR24BIT;
- } else {
- /* use the 4-byte address */
- cmd = SPINOR_OP_SE;
- addrlen = ADDR32BIT;
- }
+ cmd = q->nor[0].erase_opcode;
+ addrlen = q->nor_size <= SZ_16M ? ADDR24BIT : ADDR32BIT;
writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen),
base + QUADSPI_LUT(lut_base));
@@ -473,6 +467,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
case SPINOR_OP_BRWR:
return SEQID_BRWR;
default:
+ if (cmd == q->nor[0].erase_opcode)
+ return SEQID_SE;
dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd);
break;
}
More information about the linux-mtd-cvs
mailing list