mtd: nand: ifc: update bufnum mask for ver >= 2.0.0
authorJagdish Gediya <jagdish.gediya@nxp.com>
Thu, 23 Nov 2017 11:34:31 +0000 (17:04 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 08:17:55 +0000 (09:17 +0100)
[ Upstream commit bccb06c353af3764ca86d9da47652458e6c2eb41 ]

Bufnum mask is used to calculate page position in the internal SRAM.

As IFC version 2.0.0 has 16KB of internal SRAM as compared to older
versions which had 8KB. Hence bufnum mask needs to be updated.

Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/fsl_ifc_nand.c

index d1570f512f0bbad5c07c9903528c125e412c029a..f8f12ccc6471106e0899af648472784e387c8161 100644 (file)
@@ -907,6 +907,13 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
        if (ctrl->version == FSL_IFC_VERSION_1_1_0)
                fsl_ifc_sram_init(priv);
 
+       /*
+        * As IFC version 2.0.0 has 16KB of internal SRAM as compared to older
+        * versions which had 8KB. Hence bufnum mask needs to be updated.
+        */
+       if (ctrl->version >= FSL_IFC_VERSION_2_0_0)
+               priv->bufnum_mask = (priv->bufnum_mask * 2) + 1;
+
        return 0;
 }