mtd: nand: sunxi: fix support for 512bytes ECC chunks

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Dec 16 11:59:02 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f59dab8d9e8f37f7042ba05bfbab748b1312e73e
Commit:     f59dab8d9e8f37f7042ba05bfbab748b1312e73e
Parent:     b156b7f2169bb4d963a2432ff03319fe7d64b823
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Thu Oct 20 10:12:42 2016 +0200
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Fri Oct 21 17:52:23 2016 +0200

    mtd: nand: sunxi: fix support for 512bytes ECC chunks
    
    The driver is incorrectly assuming that the ECC block size is always 1k
    which is not always true.
    
    Also take the other cases into account.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
---
 drivers/mtd/nand/sunxi_nand.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 8b8470c..e40482a 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -145,6 +145,7 @@
 #define NFC_ECC_PIPELINE	BIT(3)
 #define NFC_ECC_EXCEPTION	BIT(4)
 #define NFC_ECC_BLOCK_SIZE_MSK	BIT(5)
+#define NFC_ECC_BLOCK_512	BIT(5)
 #define NFC_RANDOM_EN		BIT(9)
 #define NFC_RANDOM_DIRECTION	BIT(10)
 #define NFC_ECC_MODE_MSK	GENMASK(15, 12)
@@ -817,6 +818,9 @@ static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd)
 	ecc_ctl |= NFC_ECC_EN | NFC_ECC_MODE(data->mode) | NFC_ECC_EXCEPTION |
 		   NFC_ECC_PIPELINE;
 
+	if (nand->ecc.size == 512)
+		ecc_ctl |= NFC_ECC_BLOCK_512;
+
 	writel(ecc_ctl, nfc->regs + NFC_REG_ECC_CTL);
 }
 



More information about the linux-mtd-cvs mailing list