diff mbox series

[RFC,3/3] mtd: nand: raw: atmel: Remove redundant PMECC probe

Message ID 20240311152306.2358845-4-ada@thorsis.com
State Under Review
Delegated to: Eugen Hristev
Headers show
Series mtd: nand: raw: atmel: Using dm driver for older sam9 SoCs | expand

Commit Message

Alexander Dahl March 11, 2024, 3:23 p.m. UTC
Always probing pmecc in the generic nand controller probe function and
bailing out if pmecc is missing, prevents the driver to be usable for
SoCs which do not have a pmecc hardware ecc engine like older sam9 SoCs,
for example at91sam9g20.  Tested on sam9x60 that the call, which the
comment was moved to, is sufficient to probe the pmecc.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 7 -------
 drivers/mtd/nand/raw/atmel/pmecc.c           | 1 +
 2 files changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 0e0441472b8..b36f3a3ccac 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2203,7 +2203,6 @@  static const struct udevice_id atmel_nand_controller_of_ids[] = {
 static int atmel_nand_controller_probe(struct udevice *dev)
 {
 	const struct atmel_nand_controller_caps *caps;
-	struct udevice *pmecc_dev;
 
 	caps = (struct atmel_nand_controller_caps *)dev_get_driver_data(dev);
 	if (!caps) {
@@ -2211,12 +2210,6 @@  static int atmel_nand_controller_probe(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	/* Probe pmecc driver */
-	if (uclass_get_device(UCLASS_MTD, 1, &pmecc_dev)) {
-		printf("%s: get device fail\n", __func__);
-		return -EINVAL;
-	}
-
 	return caps->ops->probe(dev, caps);
 }
 
diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c
index 51f6bd2e65b..e500a0fe3f8 100644
--- a/drivers/mtd/nand/raw/atmel/pmecc.c
+++ b/drivers/mtd/nand/raw/atmel/pmecc.c
@@ -913,6 +913,7 @@  struct atmel_pmecc *devm_atmel_pmecc_get(struct udevice *userdev)
 	ret = ofnode_parse_phandle_with_args(userdev->node_,
 					     "ecc-engine",
 					     NULL, 0, 0, &args);
+	/* Probe pmecc driver */
 	ret = uclass_get_device_by_ofnode(UCLASS_MTD, args.node, &pdev);
 	if (ret)
 		return NULL;