diff mbox

[v3,3/9] mtd: spi-nor: fsl-quadspi: add fast-read mode support

Message ID 1471505884-33996-3-git-send-email-B56489@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yunhui Cui Aug. 18, 2016, 7:37 a.m. UTC
From: Yunhui Cui <yunhui.cui@nxp.com>

The qspi driver add generic fast-read mode for different
flash venders. There are some different board flash work on
different mode, such fast-read, quad-mode.

Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Han Xu Sept. 14, 2016, 7:45 p.m. UTC | #1
On Thu, Aug 18, 2016 at 2:37 AM, Yunhui Cui <B56489@freescale.com> wrote:
> From: Yunhui Cui <yunhui.cui@nxp.com>
>
> The qspi driver add generic fast-read mode for different
> flash venders. There are some different board flash work on
> different mode, such fast-read, quad-mode.
>
> Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
> ---
>  drivers/mtd/spi-nor/fsl-quadspi.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
> index 21c77e8..b0a74b8 100644
> --- a/drivers/mtd/spi-nor/fsl-quadspi.c
> +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
> @@ -389,11 +389,21 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q)
>         /* Read */
>         lut_base = SEQID_READ * 4;
>
> -       qspi_writel(q, LUT0(CMD, PAD1, read_op) | LUT1(ADDR, PAD1, addrlen),
> -                       base + QUADSPI_LUT(lut_base));
> -       qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
> -                   LUT1(FSL_READ, PAD4, rxfifo),
> -                       base + QUADSPI_LUT(lut_base + 1));
> +       if (nor->flash_read == SPI_NOR_FAST) {
> +               qspi_writel(q, LUT0(CMD, PAD1, read_op) |
> +                           LUT1(ADDR, PAD1, addrlen),
> +                               base + QUADSPI_LUT(lut_base));
> +               qspi_writel(q,  LUT0(DUMMY, PAD1, read_dm) |
> +                           LUT1(FSL_READ, PAD1, rxfifo),
> +                               base + QUADSPI_LUT(lut_base + 1));
> +       } else if (nor->flash_read == SPI_NOR_QUAD) {
> +               qspi_writel(q, LUT0(CMD, PAD1, read_op) |
> +                           LUT1(ADDR, PAD1, addrlen),
> +                               base + QUADSPI_LUT(lut_base));
> +               qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
> +                           LUT1(FSL_READ, PAD4, rxfifo),
> +                               base + QUADSPI_LUT(lut_base + 1));
> +       }
>
>         /* Write enable */
>         lut_base = SEQID_WREN * 4;
> @@ -468,6 +478,7 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
>  {
>         switch (cmd) {
>         case SPINOR_OP_READ_1_1_4:
> +       case SPINOR_OP_READ_FAST:
>                 return SEQID_READ;
>         case SPINOR_OP_WREN:
>                 return SEQID_WREN;
> --
> 2.1.0.27.g96db324
>
>
Acked-by: Han xu <han.xu@nxp.com>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox

Patch

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 21c77e8..b0a74b8 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -389,11 +389,21 @@  static void fsl_qspi_init_lut(struct fsl_qspi *q)
 	/* Read */
 	lut_base = SEQID_READ * 4;
 
-	qspi_writel(q, LUT0(CMD, PAD1, read_op) | LUT1(ADDR, PAD1, addrlen),
-			base + QUADSPI_LUT(lut_base));
-	qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
-		    LUT1(FSL_READ, PAD4, rxfifo),
-			base + QUADSPI_LUT(lut_base + 1));
+	if (nor->flash_read == SPI_NOR_FAST) {
+		qspi_writel(q, LUT0(CMD, PAD1, read_op) |
+			    LUT1(ADDR, PAD1, addrlen),
+				base + QUADSPI_LUT(lut_base));
+		qspi_writel(q,  LUT0(DUMMY, PAD1, read_dm) |
+			    LUT1(FSL_READ, PAD1, rxfifo),
+				base + QUADSPI_LUT(lut_base + 1));
+	} else if (nor->flash_read == SPI_NOR_QUAD) {
+		qspi_writel(q, LUT0(CMD, PAD1, read_op) |
+			    LUT1(ADDR, PAD1, addrlen),
+				base + QUADSPI_LUT(lut_base));
+		qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
+			    LUT1(FSL_READ, PAD4, rxfifo),
+				base + QUADSPI_LUT(lut_base + 1));
+	}
 
 	/* Write enable */
 	lut_base = SEQID_WREN * 4;
@@ -468,6 +478,7 @@  static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
 {
 	switch (cmd) {
 	case SPINOR_OP_READ_1_1_4:
+	case SPINOR_OP_READ_FAST:
 		return SEQID_READ;
 	case SPINOR_OP_WREN:
 		return SEQID_WREN;