Commit 3aa09076 authored by Boris Brezillon's avatar Boris Brezillon

mtd: nand: atmel: Fix DT backward compatibility in pmecc.c

PMECC caps extraction from old DT bindings is broken, thus leading to
erroneous EL registers offset, which in turn make HW ECC unusable on
sama5d2 when old bindings are in use.

Passing the NAND dev node instead of the NFC node to of_match_node()
solves the problem.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Fixes: f88fc122 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: <stable@vger.kernel.org>
Tested-by: default avatarRomain Izard <romain.izard.pro@gmail.com>
parent 5771a8c0
...@@ -945,6 +945,7 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev) ...@@ -945,6 +945,7 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev)
*/ */
struct platform_device *pdev = to_platform_device(userdev); struct platform_device *pdev = to_platform_device(userdev);
const struct atmel_pmecc_caps *caps; const struct atmel_pmecc_caps *caps;
const struct of_device_id *match;
/* No PMECC engine available. */ /* No PMECC engine available. */
if (!of_property_read_bool(userdev->of_node, if (!of_property_read_bool(userdev->of_node,
...@@ -953,21 +954,11 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev) ...@@ -953,21 +954,11 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev)
caps = &at91sam9g45_caps; caps = &at91sam9g45_caps;
/* /* Find the caps associated to the NAND dev node. */
* Try to find the NFC subnode and extract the associated caps match = of_match_node(atmel_pmecc_legacy_match,
* from there. userdev->of_node);
*/ if (match && match->data)
np = of_find_compatible_node(userdev->of_node, NULL, caps = match->data;
"atmel,sama5d3-nfc");
if (np) {
const struct of_device_id *match;
match = of_match_node(atmel_pmecc_legacy_match, np);
if (match && match->data)
caps = match->data;
of_node_put(np);
}
pmecc = atmel_pmecc_create(pdev, caps, 1, 2); pmecc = atmel_pmecc_create(pdev, caps, 1, 2);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment