aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@freescale.com>2015-08-04 11:26:16 -0400
committerBrian Norris <computersforpeace@gmail.com>2015-08-06 13:07:45 -0400
commit788a6cddda9ba83276e37567c17bb78406904074 (patch)
treed04c87ae32bc1912a25d6afb165e20ad2108c7c6 /drivers/mtd
parent8b8319c8b7d0385659c2df6376955cb6a1d918b6 (diff)
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@freescale.com> Acked-by: Han Xu <Han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 0144821a3692..d32b7e04ccca 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)
397 /* Erase a sector */ 397 /* Erase a sector */
398 lut_base = SEQID_SE * 4; 398 lut_base = SEQID_SE * 4;
399 399
400 if (q->nor_size <= SZ_16M) { 400 cmd = q->nor[0].erase_opcode;
401 cmd = SPINOR_OP_SE; 401 addrlen = q->nor_size <= SZ_16M ? ADDR24BIT : ADDR32BIT;
402 addrlen = ADDR24BIT;
403 } else {
404 /* use the 4-byte address */
405 cmd = SPINOR_OP_SE;
406 addrlen = ADDR32BIT;
407 }
408 402
409 writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), 403 writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen),
410 base + QUADSPI_LUT(lut_base)); 404 base + QUADSPI_LUT(lut_base));
@@ -473,6 +467,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
473 case SPINOR_OP_BRWR: 467 case SPINOR_OP_BRWR:
474 return SEQID_BRWR; 468 return SEQID_BRWR;
475 default: 469 default:
470 if (cmd == q->nor[0].erase_opcode)
471 return SEQID_SE;
476 dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd); 472 dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd);
477 break; 473 break;
478 } 474 }