Skip to content

Commit 97d13bc

Browse files
richard-bootlinmiquelraynal
authored andcommitted
mtd: rawnand: sunxi: introduce ecc_err_mask in sunxi_nfc_caps
The H6/H616 error mask register is bigger than the A10/A23 one, so move its mask into sunxi_nfc_caps. No functional change Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 6208274 commit 97d13bc

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155

156156
/* define bit use in NFC_ECC_ST */
157157
#define NFC_ECC_ERR(x) BIT(x)
158-
#define NFC_ECC_ERR_MSK GENMASK(15, 0)
158+
#define NFC_ECC_ERR_MSK(nfc) (nfc->caps->ecc_err_mask)
159159

160160
/*
161161
* define bit use in NFC_REG_PAT_FOUND
@@ -246,6 +246,7 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
246246
* @random_en_mask: RANDOM_EN mask in NFC_ECC_CTL register
247247
* @random_dir_mask: RANDOM_DIRECTION mask in NFC_ECC_CTL register
248248
* @ecc_mode_mask: ECC_MODE mask in NFC_ECC_CTL register
249+
* @ecc_err_mask: NFC_ECC_ERR mask in NFC_ECC_ST register
249250
* @pat_found_mask: ECC_PAT_FOUND mask in NFC_REG_PAT_FOUND register
250251
* @dma_maxburst: DMA maxburst
251252
* @ecc_strengths: Available ECC strengths array
@@ -263,6 +264,7 @@ struct sunxi_nfc_caps {
263264
unsigned int random_en_mask;
264265
unsigned int random_dir_mask;
265266
unsigned int ecc_mode_mask;
267+
unsigned int ecc_err_mask;
266268
unsigned int pat_found_mask;
267269
unsigned int dma_maxburst;
268270
const u8 *ecc_strengths;
@@ -1040,7 +1042,7 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct nand_chip *nand, uint8_t *buf
10401042
sunxi_nfc_hw_ecc_update_stats(nand, &max_bitflips, ret);
10411043
}
10421044

1043-
if (status & NFC_ECC_ERR_MSK) {
1045+
if (status & NFC_ECC_ERR_MSK(nfc)) {
10441046
for (i = 0; i < nchunks; i++) {
10451047
int data_off = i * ecc->size;
10461048
int oob_off = i * (ecc->bytes + USER_DATA_SZ);
@@ -2245,6 +2247,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
22452247
.random_en_mask = BIT(9),
22462248
.random_dir_mask = BIT(10),
22472249
.ecc_mode_mask = GENMASK(15, 12),
2250+
.ecc_err_mask = GENMASK(15, 0),
22482251
.pat_found_mask = GENMASK(31, 16),
22492252
.dma_maxburst = 4,
22502253
.ecc_strengths = sunxi_ecc_strengths_a10,
@@ -2263,6 +2266,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
22632266
.random_en_mask = BIT(9),
22642267
.random_dir_mask = BIT(10),
22652268
.ecc_mode_mask = GENMASK(15, 12),
2269+
.ecc_err_mask = GENMASK(15, 0),
22662270
.pat_found_mask = GENMASK(31, 16),
22672271
.dma_maxburst = 8,
22682272
.ecc_strengths = sunxi_ecc_strengths_a10,

0 commit comments

Comments
 (0)