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

Configure Feed

Select the types of activity you want to include in your feed.

mtd: rawnand: sunxi: introduce ecc_mode_mask in sunxi_nfc_caps

The H6/H616 ECC_MODE field is not at the same offset, and has not the
same size.
So move the mask into sunxi_nfc_caps.

Also, introduce a non compile-time field_prep() because FIELD_PREP()
doesn't work with non compile-time constant.

No functional change.

Link: https://lore.kernel.org/all/cover.1761588465.git.geert+renesas@glider.be
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Richard Genoud and committed by
Miquel Raynal
d21b4338 8c1b28ab

+9 -4
+9 -4
drivers/mtd/nand/raw/sunxi_nand.c
··· 29 29 #include <linux/iopoll.h> 30 30 #include <linux/reset.h> 31 31 32 - /* non compile-time field get */ 32 + /* non compile-time field get/prep */ 33 33 #define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1)) 34 + #define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask)) 34 35 35 36 #define NFC_REG_CTL 0x0000 36 37 #define NFC_REG_ST 0x0004 ··· 146 145 #define NFC_ECC_BLOCK_512 BIT(5) 147 146 #define NFC_RANDOM_EN BIT(9) 148 147 #define NFC_RANDOM_DIRECTION BIT(10) 149 - #define NFC_ECC_MODE_MSK GENMASK(15, 12) 150 - #define NFC_ECC_MODE(x) ((x) << 12) 148 + #define NFC_ECC_MODE_MSK(nfc) (nfc->caps->ecc_mode_mask) 149 + #define NFC_ECC_MODE(nfc, x) field_prep(NFC_ECC_MODE_MSK(nfc), (x)) 151 150 #define NFC_RANDOM_SEED_MSK GENMASK(30, 16) 152 151 #define NFC_RANDOM_SEED(x) ((x) << 16) 153 152 ··· 239 238 * @reg_ecc_err_cnt: ECC error counter register 240 239 * @reg_user_data: User data register 241 240 * @reg_pat_found: Data Pattern Status Register 241 + * @ecc_mode_mask: ECC_MODE mask in NFC_ECC_CTL register 242 242 * @pat_found_mask: ECC_PAT_FOUND mask in NFC_REG_PAT_FOUND register 243 243 * @dma_maxburst: DMA maxburst 244 244 * @ecc_strengths: Available ECC strengths array ··· 252 250 unsigned int reg_ecc_err_cnt; 253 251 unsigned int reg_user_data; 254 252 unsigned int reg_pat_found; 253 + unsigned int ecc_mode_mask; 255 254 unsigned int pat_found_mask; 256 255 unsigned int dma_maxburst; 257 256 const u8 *ecc_strengths; ··· 1760 1757 ecc->read_oob_raw = nand_read_oob_std; 1761 1758 ecc->write_oob_raw = nand_write_oob_std; 1762 1759 1763 - sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(i) | NFC_ECC_EXCEPTION | 1760 + sunxi_nand->ecc.ecc_ctl = NFC_ECC_MODE(nfc, i) | NFC_ECC_EXCEPTION | 1764 1761 NFC_ECC_PIPELINE | NFC_ECC_EN; 1765 1762 1766 1763 if (ecc->size == 512) { ··· 2230 2227 .reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT, 2231 2228 .reg_user_data = NFC_REG_A10_USER_DATA, 2232 2229 .reg_pat_found = NFC_REG_ECC_ST, 2230 + .ecc_mode_mask = GENMASK(15, 12), 2233 2231 .pat_found_mask = GENMASK(31, 16), 2234 2232 .dma_maxburst = 4, 2235 2233 .ecc_strengths = sunxi_ecc_strengths_a10, ··· 2244 2240 .reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT, 2245 2241 .reg_user_data = NFC_REG_A10_USER_DATA, 2246 2242 .reg_pat_found = NFC_REG_ECC_ST, 2243 + .ecc_mode_mask = GENMASK(15, 12), 2247 2244 .pat_found_mask = GENMASK(31, 16), 2248 2245 .dma_maxburst = 8, 2249 2246 .ecc_strengths = sunxi_ecc_strengths_a10,