mtd: spi-nor: fsl-quadspi: reset the module in the probe

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Sep 1 14:59:03 PDT 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8b8319c8b7d0385659c2df6376955cb6a1d918b6
Commit:     8b8319c8b7d0385659c2df6376955cb6a1d918b6
Parent:     5cc66cb7345d1bac71e94d7fd05dc86506f59dfe
Author:     Frank Li <Frank.Li at freescale.com>
AuthorDate: Tue Aug 4 10:26:10 2015 -0500
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Aug 6 10:07:44 2015 -0700

    mtd: spi-nor: fsl-quadspi: reset the module in the probe
    
    The uboot may run the QuadSpi controler with command:
        #sf probe
    
    So we should reset the module in the probe.
    This patch also clear the pending interrupts which arised by the uboot
    code.
    
    Signed-off-by: Huang Shijie <shijie8 at gmail.com>
    Signed-off-by: Frank Li <Frank.Li at freescale.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 676b363..0144821 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -716,6 +716,11 @@ static int fsl_qspi_nor_setup(struct fsl_qspi *q)
 	if (ret)
 		return ret;
 
+	/* Reset the module */
+	writel(QUADSPI_MCR_SWRSTSD_MASK | QUADSPI_MCR_SWRSTHD_MASK,
+		base + QUADSPI_MCR);
+	udelay(1);
+
 	/* Init the LUT table. */
 	fsl_qspi_init_lut(q);
 
@@ -733,6 +738,9 @@ static int fsl_qspi_nor_setup(struct fsl_qspi *q)
 	writel(QUADSPI_MCR_RESERVED_MASK | QUADSPI_MCR_END_CFG_MASK,
 			base + QUADSPI_MCR);
 
+	/* clear all interrupt status */
+	writel(0xffffffff, q->iobase + QUADSPI_FR);
+
 	/* enable the interrupt */
 	writel(QUADSPI_RSER_TFIE, q->iobase + QUADSPI_RSER);
 



More information about the linux-mtd-cvs mailing list