Skip to content

Commit f59dab8

Browse files
author
Boris Brezillon
committed
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 <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
1 parent b156b7f commit f59dab8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/mtd/nand/sunxi_nand.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
#define NFC_ECC_PIPELINE BIT(3)
146146
#define NFC_ECC_EXCEPTION BIT(4)
147147
#define NFC_ECC_BLOCK_SIZE_MSK BIT(5)
148+
#define NFC_ECC_BLOCK_512 BIT(5)
148149
#define NFC_RANDOM_EN BIT(9)
149150
#define NFC_RANDOM_DIRECTION BIT(10)
150151
#define NFC_ECC_MODE_MSK GENMASK(15, 12)
@@ -817,6 +818,9 @@ static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd)
817818
ecc_ctl |= NFC_ECC_EN | NFC_ECC_MODE(data->mode) | NFC_ECC_EXCEPTION |
818819
NFC_ECC_PIPELINE;
819820

821+
if (nand->ecc.size == 512)
822+
ecc_ctl |= NFC_ECC_BLOCK_512;
823+
820824
writel(ecc_ctl, nfc->regs + NFC_REG_ECC_CTL);
821825
}
822826

0 commit comments

Comments
 (0)