[PATCH] mtd: fsl-quadspi: fix init AHB read in fsl_qspi_nor_setup()

Yogesh Gaur yogeshnarayan.gaur at nxp.com
Tue Jan 2 02:40:53 PST 2018


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 at nxp.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 943e9c4..c22e3eb 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -769,6 +769,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;
 }
 
@@ -794,9 +797,6 @@ static int fsl_qspi_nor_setup_last(struct fsl_qspi *q)
 	/* Init the LUT table again. */
 	fsl_qspi_init_lut(q);
 
-	/* Init for AHB read */
-	fsl_qspi_init_ahb_read(q);
-
 	return 0;
 }
 
-- 
1.9.1




More information about the linux-mtd mailing list