Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

+4
+4
drivers/mtd/nand/sunxi_nand.c
··· 145 145 #define NFC_ECC_PIPELINE BIT(3) 146 146 #define NFC_ECC_EXCEPTION BIT(4) 147 147 #define NFC_ECC_BLOCK_SIZE_MSK BIT(5) 148 + #define NFC_ECC_BLOCK_512 BIT(5) 148 149 #define NFC_RANDOM_EN BIT(9) 149 150 #define NFC_RANDOM_DIRECTION BIT(10) 150 151 #define NFC_ECC_MODE_MSK GENMASK(15, 12) ··· 817 816 NFC_ECC_BLOCK_SIZE_MSK); 818 817 ecc_ctl |= NFC_ECC_EN | NFC_ECC_MODE(data->mode) | NFC_ECC_EXCEPTION | 819 818 NFC_ECC_PIPELINE; 819 + 820 + if (nand->ecc.size == 512) 821 + ecc_ctl |= NFC_ECC_BLOCK_512; 820 822 821 823 writel(ecc_ctl, nfc->regs + NFC_REG_ECC_CTL); 822 824 }