From 807e456f62c89d97ad9d69ba60cde9240734c394 Mon Sep 17 00:00:00 2001 From: Han Xu Date: Fri, 25 Apr 2014 13:40:19 +0800 Subject: [PATCH] MLK-11937: mtd: spi-nor: add DDR quad read support for Micron This patch adds the DDR(or DTR) quad read support for the Micron SPI NOR flash. Signed-off-by: Han Xu --- drivers/mtd/spi-nor/spi-nor.c | 5 +++++ include/linux/mtd/spi-nor.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 765f8a1cfe47..57c9c655832c 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1301,6 +1301,9 @@ static int set_ddr_quad_mode(struct spi_nor *nor, const struct flash_info *info) return status; } return status; + case CFI_MFR_ST: /* Micron, actually */ + /* DTR quad read works with the Extended SPI protocol. */ + return 0; default: return -EINVAL; } @@ -1498,6 +1501,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) case SPI_NOR_DDR_QUAD: if (JEDEC_MFR(info) == CFI_MFR_AMD) { /* Spansion */ nor->read_opcode = SPINOR_OP_READ_1_4_4_D; + } else if (JEDEC_MFR(info) == CFI_MFR_ST) { + nor->read_opcode = SPINOR_OP_READ_1_1_4_D; } else { dev_err(dev, "DDR Quad Read is not supported.\n"); return -EINVAL; diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 1d0b9fb9f628..7328180fbf26 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -46,7 +46,8 @@ #define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */ #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */ #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */ -#define SPINOR_OP_READ_1_4_4_D 0xeb /* Read data bytes (DDR Quad SPI) */ +#define SPINOR_OP_READ_1_1_4_D 0x6d /* Read data bytes (DDR Quad SPI) */ +#define SPINOR_OP_READ_1_4_4_D 0xed /* Read data bytes (DDR Quad SPI) */ #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */ #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */ #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */ -- 2.17.1