mtd: nand: atmel: Fix DT backward compatibility in pmecc.c
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sun Aug 6 18:59:02 PDT 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3aa0907675a38498d8f2d343e94207ad28a117cf
Commit: 3aa0907675a38498d8f2d343e94207ad28a117cf
Parent: 5771a8c08880cdca3bfb4a3fc6d309d6bba20877
Author: Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Mon Jul 17 20:20:08 2017 +0200
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Wed Jul 19 22:04:13 2017 +0200
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: Boris Brezillon <boris.brezillon at free-electrons.com>
Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: <stable at vger.kernel.org>
Tested-by: Romain Izard <romain.izard.pro at gmail.com>
---
drivers/mtd/nand/atmel/pmecc.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
index 55a8ee5..8c210a5 100644
--- a/drivers/mtd/nand/atmel/pmecc.c
+++ b/drivers/mtd/nand/atmel/pmecc.c
@@ -945,6 +945,7 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev)
*/
struct platform_device *pdev = to_platform_device(userdev);
const struct atmel_pmecc_caps *caps;
+ const struct of_device_id *match;
/* No PMECC engine available. */
if (!of_property_read_bool(userdev->of_node,
@@ -953,21 +954,11 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *userdev)
caps = &at91sam9g45_caps;
- /*
- * Try to find the NFC subnode and extract the associated caps
- * from there.
- */
- np = of_find_compatible_node(userdev->of_node, NULL,
- "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);
- }
+ /* Find the caps associated to the NAND dev node. */
+ match = of_match_node(atmel_pmecc_legacy_match,
+ userdev->of_node);
+ if (match && match->data)
+ caps = match->data;
pmecc = atmel_pmecc_create(pdev, caps, 1, 2);
}
More information about the linux-mtd-cvs
mailing list