MLK-20171: mtd: flexspi: reset flexspi FLASHxCR2 registers during probe
authorHan Xu <han.xu@nxp.com>
Thu, 1 Nov 2018 20:01:27 +0000 (15:01 -0500)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Flexspi registers cannot be reset to default value, reset all FLASHxCR2
registers to 0 to avoid read data with invalid LUT commands.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
drivers/mtd/spi-nor/fsl-flexspi.c

index 8b1310f..3ec316e 100644 (file)
@@ -930,7 +930,6 @@ static int fsl_flexspi_init_rpm(struct fsl_flexspi *flex)
 static int fsl_flexspi_nor_setup(struct fsl_flexspi *flex)
 {
        void __iomem *base = flex->iobase;
-       u32 reg;
 
        /* Reset the module */
        writel(FLEXSPI_MCR0_SWRST_MASK, base + FLEXSPI_MCR0);
@@ -945,8 +944,11 @@ static int fsl_flexspi_nor_setup(struct fsl_flexspi *flex)
        writel(FLEXSPI_MCR0_AHB_TIMEOUT_MASK | FLEXSPI_MCR0_IP_TIMEOUT_MASK |
               FLEXSPI_MCR0_OCTCOMB_EN_MASK, base + FLEXSPI_MCR0);
 
-       /* Read the register value */
-       reg = readl(base + FLEXSPI_MCR0);
+       /* Reset the FLASHxCR2 */
+       writel(0, base + FLEXSPI_FLSHA1CR2);
+       writel(0, base + FLEXSPI_FLSHA2CR2);
+       writel(0, base + FLEXSPI_FLSHB1CR2);
+       writel(0, base + FLEXSPI_FLSHB2CR2);
 
        /* Init the LUT table. */
        fsl_flexspi_init_lut(flex);