mtd: spi-nor: fsl-quadspi: reset the module in the probe
authorFrank Li <Frank.Li@freescale.com>
Tue, 4 Aug 2015 15:26:10 +0000 (10:26 -0500)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 6 Aug 2015 17:07:44 +0000 (10:07 -0700)
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@gmail.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/spi-nor/fsl-quadspi.c

index 676b3636107670e9658ee1aed2e7127ad69014fd..0144821a3692e1a3de5ab2a6a3113f42e76aca35 100644 (file)
@@ -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);