[v10,2/2] mtd: fsl-quadspi: fix init AHB read in fsl_qspi_nor_setup()

Message ID 1523349348-20778-3-git-send-email-yogeshnarayan.gaur@nxp.com
State Changes Requested
Headers show
Series
  • mtd: fsl-quadspi: add support to create dynamic LUT entry
Related show

Commit Message

Yogesh Narayan Gaur April 10, 2018, 8:35 a.m.
Move AHB read initialize in fsl_qspi_nor_setup().

In file spi-nor.c, func spi_nor_scan() calls nor->read() thru
spi_nor_read_sfdp() API.

Presently, fsl_qspi_init_ahb_read() called from fsl_qspi_nor_setup_last().
Func fsl_qspi_probe() calls spi_nor_scan() first and then calls
fsl_qspi_nor_setup_last().

When nor->read() being called from inside spi_nor_read_sfdp(), QSPI cntlr
AHB mode initialization is not yet done results in data read error.

Initialize AHB read inside fsl_qspi_nor_setup().

Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
---
Changes for v10:
- None
Changes for v9:
- None
Changes for v8:
- None
Changes for v7:
- None
Changes for v6:
- None
Changes for v5:
- None
Changes for v4:
- None
Changes for v3:
- None
Changes for v2:
- None

 drivers/mtd/spi-nor/fsl-quadspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Marek Vasut April 10, 2018, 9:25 a.m. | #1
On 04/10/2018 10:35 AM, Yogesh Gaur wrote:
> Move AHB read initialize in fsl_qspi_nor_setup().
> 
> In file spi-nor.c, func spi_nor_scan() calls nor->read() thru
> spi_nor_read_sfdp() API.
> 
> Presently, fsl_qspi_init_ahb_read() called from fsl_qspi_nor_setup_last().
> Func fsl_qspi_probe() calls spi_nor_scan() first and then calls
> fsl_qspi_nor_setup_last().
> 
> When nor->read() being called from inside spi_nor_read_sfdp(), QSPI cntlr
> AHB mode initialization is not yet done results in data read error.
> 
> Initialize AHB read inside fsl_qspi_nor_setup().

Please run the commit message through aspell or somesuch, hint : func,
thru, cntlr .

Patch

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 667cab2..401a783 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -796,6 +796,9 @@  static int fsl_qspi_nor_setup(struct fsl_qspi *q)
 	/* enable the interrupt */
 	qspi_writel(q, QUADSPI_RSER_TFIE, q->iobase + QUADSPI_RSER);
 
+	/* Init for AHB read */
+	fsl_qspi_init_ahb_read(q);
+
 	return 0;
 }
 
@@ -818,9 +821,6 @@  static int fsl_qspi_nor_setup_last(struct fsl_qspi *q)
 	if (ret)
 		return ret;
 
-	/* Init for AHB read */
-	fsl_qspi_init_ahb_read(q);
-
 	/* Prepare LUT for AHB read - required for read from devmem interface */
 	fsl_qspi_prep_ahb_read(q);