Skip to content

Commit ee61bba

Browse files
richard-bootlinmiquelraynal
authored andcommitted
mtd: rawnand: sunxi: introduce reg_pat_id in sunxi_nfc_caps
The H6/H616 pattern ID register is not at the same offset as the A10/A23 one, so move its offset into sunxi_nfc_caps. No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 1340fa8 commit ee61bba

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
#define NFC_REG_A10_USER_DATA 0x0050
5656
#define NFC_REG_USER_DATA(nfc, x) (nfc->caps->reg_user_data + ((x) * 4))
5757
#define NFC_REG_SPARE_AREA 0x00A0
58-
#define NFC_REG_PAT_ID 0x00A4
58+
#define NFC_REG_PAT_ID(nfc) (nfc->caps->reg_pat_id)
59+
#define NFC_REG_A10_PAT_ID 0x00A4
5960
#define NFC_REG_MDMA_ADDR 0x00C0
6061
#define NFC_REG_MDMA_CNT 0x00C4
6162
#define NFC_RAM0_BASE 0x0400
@@ -238,6 +239,7 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
238239
* @reg_io_data: I/O data register
239240
* @reg_ecc_err_cnt: ECC error counter register
240241
* @reg_user_data: User data register
242+
* @reg_pat_id: Pattern ID Register
241243
* @reg_pat_found: Data Pattern Status Register
242244
* @random_en_mask: RANDOM_EN mask in NFC_ECC_CTL register
243245
* @random_dir_mask: RANDOM_DIRECTION mask in NFC_ECC_CTL register
@@ -253,6 +255,7 @@ struct sunxi_nfc_caps {
253255
unsigned int reg_io_data;
254256
unsigned int reg_ecc_err_cnt;
255257
unsigned int reg_user_data;
258+
unsigned int reg_pat_id;
256259
unsigned int reg_pat_found;
257260
unsigned int random_en_mask;
258261
unsigned int random_dir_mask;
@@ -813,7 +816,7 @@ static int sunxi_nfc_hw_ecc_correct(struct nand_chip *nand, u8 *data, u8 *oob,
813816
if (pattern_found & BIT(step)) {
814817
u8 pattern;
815818

816-
if (unlikely(!(readl(nfc->regs + NFC_REG_PAT_ID) & 0x1))) {
819+
if (unlikely(!(readl(nfc->regs + NFC_REG_PAT_ID(nfc)) & 0x1))) {
817820
pattern = 0x0;
818821
} else {
819822
pattern = 0xff;
@@ -2233,6 +2236,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
22332236
.reg_io_data = NFC_REG_A10_IO_DATA,
22342237
.reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT,
22352238
.reg_user_data = NFC_REG_A10_USER_DATA,
2239+
.reg_pat_id = NFC_REG_A10_PAT_ID,
22362240
.reg_pat_found = NFC_REG_ECC_ST,
22372241
.random_en_mask = BIT(9),
22382242
.random_dir_mask = BIT(10),
@@ -2249,6 +2253,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
22492253
.reg_io_data = NFC_REG_A23_IO_DATA,
22502254
.reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT,
22512255
.reg_user_data = NFC_REG_A10_USER_DATA,
2256+
.reg_pat_id = NFC_REG_A10_PAT_ID,
22522257
.reg_pat_found = NFC_REG_ECC_ST,
22532258
.random_en_mask = BIT(9),
22542259
.random_dir_mask = BIT(10),

0 commit comments

Comments
 (0)