lantiq: kernel: xway-nand: Move ECC engine setting to new DT binding
[openwrt/staging/stintel.git] / target / linux / lantiq / patches-5.4 / 0019-MTD-nand-support-new-dt-bindings.patch
1 The nand-ecc-mode DT binding is depracated but the new bindings are
2 not supported by kernel 5.4. Based on a fix in the kernel to not
3 overwrite the DT ECC settings, the DT needs to be updated and moves
4 to the new DT binding.
5 Since the DT is shared between kernel 5.4 and 5.10, this patch is
6 an interim solution to allow to use the new DT bindings in kernel 5.4.
7 It should be removed when moving away from kernel 5.4.
8 --- a/drivers/mtd/nand/raw/nand_base.c
9 +++ b/drivers/mtd/nand/raw/nand_base.c
10 @@ -4851,10 +4851,17 @@ static int of_get_nand_ecc_mode(struct d
11 {
12 const char *pm;
13 int err, i;
14 + struct device_node *eng_np;
15
16 err = of_property_read_string(np, "nand-ecc-mode", &pm);
17 - if (err < 0)
18 + if (err < 0) {
19 + if (of_property_read_bool(np, "nand-use-soft-ecc-engine"))
20 + return NAND_ECC_SOFT;
21 + eng_np = of_parse_phandle(np, "nand-ecc-engine", 0);
22 + if (eng_np && (eng_np == np))
23 + return NAND_ECC_ON_DIE;
24 return err;
25 + }
26
27 for (i = 0; i < ARRAY_SIZE(nand_ecc_modes); i++)
28 if (!strcasecmp(pm, nand_ecc_modes[i]))