mediatek: add an upstreamed spi-nand driver
[openwrt/staging/mkresin.git] / target / linux / mediatek / patches-5.15 / 120-13-mtd-nand-mtk-ecc-also-parse-nand-ecc-engine-if-avail.patch
1 From 433b76fa0f3ca2865841abc21538dd8077ca3edd Mon Sep 17 00:00:00 2001
2 From: Chuanhong Guo <gch981213@gmail.com>
3 Date: Mon, 4 Apr 2022 00:05:38 +0800
4 Subject: [PATCH 13/15] mtd: nand: mtk-ecc: also parse nand-ecc-engine if
5 available
6
7 The recently added ECC engine support introduced a generic property
8 named nand-ecc-engine for ecc engine phandle. This patch adds support
9 for this new property.
10
11 Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
12 (cherry picked from commit a41f25feb6e47c1c4d8d3279ae990ccbd8dfab54)
13 ---
14 drivers/mtd/nand/ecc-mtk.c | 5 ++++-
15 1 file changed, 4 insertions(+), 1 deletion(-)
16
17 diff --git a/drivers/mtd/nand/ecc-mtk.c b/drivers/mtd/nand/ecc-mtk.c
18 index c64c3c45cdbc..79c7622af563 100644
19 --- a/drivers/mtd/nand/ecc-mtk.c
20 +++ b/drivers/mtd/nand/ecc-mtk.c
21 @@ -279,7 +279,10 @@ struct mtk_ecc *of_mtk_ecc_get(struct device_node *of_node)
22 struct mtk_ecc *ecc = NULL;
23 struct device_node *np;
24
25 - np = of_parse_phandle(of_node, "ecc-engine", 0);
26 + np = of_parse_phandle(of_node, "nand-ecc-engine", 0);
27 + /* for backward compatibility */
28 + if (!np)
29 + np = of_parse_phandle(of_node, "ecc-engine", 0);
30 if (np) {
31 ecc = mtk_ecc_get(np);
32 of_node_put(np);
33 --
34 2.35.1
35