]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: rawnand: sunxi: introduce reg_pat_id in sunxi_nfc_caps
authorRichard Genoud <richard.genoud@bootlin.com>
Fri, 23 Jan 2026 11:44:48 +0000 (12:44 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Tue, 3 Feb 2026 20:44:53 +0000 (21:44 +0100)
Introduce NDFC Pattern ID Register in capability structure

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>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/raw/sunxi_nand.c
drivers/mtd/nand/raw/sunxi_nand.h

index c5efafa2414ca599881047f7bba1d895db58852f..c032cabb4dc9fcc0dc56a97c0c032e213dec2388 100644 (file)
@@ -731,7 +731,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
        if (pattern_found & NFC_ECC_PAT_FOUND(0)) {
                u8 pattern = 0xff;
 
-               if (unlikely(!(readl(nfc->regs + NFC_REG_PAT_ID) & 0x1)))
+               if (unlikely(!(readl(nfc->regs + NFC_REG_PAT_ID(nfc)) & 0x1)))
                        pattern = 0x0;
 
                memset(data, pattern, ecc->size);
@@ -1727,6 +1727,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
        .reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT,
        .reg_user_data = NFC_REG_A10_USER_DATA,
        .reg_pat_found = NFC_REG_ECC_ST,
+       .reg_pat_id = NFC_REG_A10_PAT_ID,
        .pat_found_mask = GENMASK(31, 16),
        .ecc_mode_mask = GENMASK(15, 12),
 };
index 3b155b0c8f3efc7cdd58fc36d658beba6d0fdd11..e18feb77c93c374ac1b3d16b207ae949b1c7d212 100644 (file)
@@ -50,7 +50,8 @@
 #define NFC_REG_A10_USER_DATA  0x0050
 #define NFC_REG_USER_DATA(nfc, x)      ((nfc)->caps->reg_user_data + ((x) * 4))
 #define NFC_REG_SPARE_AREA     0x00A0
-#define NFC_REG_PAT_ID         0x00A4
+#define NFC_REG_PAT_ID(nfc)    ((nfc)->caps->reg_pat_id)
+#define NFC_REG_A10_PAT_ID     0x00A4
 #define NFC_RAM0_BASE          0x0400
 #define NFC_RAM1_BASE          0x0800
 
  * @nstrengths:                Number of element of ECC strengths array
  * @reg_ecc_err_cnt:   ECC error counter register
  * @reg_user_data:     User data register
+ * @reg_pat_id:                Pattern ID Register
  * @reg_pat_found:     Data Pattern Status Register
  * @pat_found_mask:    ECC_PAT_FOUND mask in NFC_REG_PAT_FOUND register
  * @ecc_mode_mask:     ECC_MODE mask in NFC_ECC_CTL register
@@ -182,6 +184,7 @@ struct sunxi_nfc_caps {
        unsigned int nstrengths;
        unsigned int reg_ecc_err_cnt;
        unsigned int reg_user_data;
+       unsigned int reg_pat_id;
        unsigned int reg_pat_found;
        unsigned int pat_found_mask;
        unsigned int ecc_mode_mask;