]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: rawnand: sunxi_spl: use NFC_ECC_MODE and NFC_RANDOM_SEED macros
authorRichard Genoud <richard.genoud@bootlin.com>
Fri, 23 Jan 2026 11:44:54 +0000 (12:44 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Tue, 3 Feb 2026 20:45:09 +0000 (21:45 +0100)
Use generic macros for ECC_MODE and RANDOM_SEED

As H6/H616 registers are different, use more generic macros than hard
coded values specific to A10-like SoC.

No functional changes.

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/raw/sunxi_nand_spl.c

index 9a6286b015d4ac67f8b3a63043d21a50e2a96e06..76458c2063eac6637dfdc55b4acb467be72152b9 100644 (file)
@@ -57,6 +57,7 @@ __maybe_unused static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
        .reg_spare_area = NFC_REG_A10_SPARE_AREA,
        .reg_pat_found = NFC_REG_ECC_ST,
        .pat_found_mask = GENMASK(31, 16),
+       .ecc_mode_mask = GENMASK(15, 12),
        .ecc_err_mask = GENMASK(15, 0),
        .random_en_mask = BIT(9),
 };
@@ -237,7 +238,9 @@ static int nand_read_page(const struct nfc_config *conf, u32 offs,
 
                /* Clear ECC status and restart ECC engine */
                writel(0, SUNXI_NFC_BASE + NFC_REG_ECC_ST);
-               writel((rand_seed << 16) | (conf->ecc_strength << 12) |
+
+               writel(NFC_RANDOM_SEED(rand_seed) |
+                      NFC_ECC_MODE(conf, conf->ecc_strength) |
                       (conf->randomize ? NFC_RANDOM_EN(conf) : 0) |
                       ecc512_bit |
                       NFC_ECC_EN | NFC_ECC_EXCEPTION,