[PATCH v1 06/12] spi: use nand_register() instead of add_mtd_device()

Alexey Romanov avromanov at salutedevices.com
Thu Dec 28 16:39:09 CET 2023


Most functions that work with NAND device (for example fastboot),
use the get_nand_dev_by_index() function to work with NAND MTD.
In order to use this feature, SPI NAND must be registered via
nand_register().

Signed-off-by: Alexey Romanov <avromanov at salutedevices.com>
---
 drivers/mtd/nand/spi/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 27ad6fefdb..5210332712 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -23,6 +23,7 @@
 #else
 #include <common.h>
 #include <errno.h>
+#include <nand.h>
 #include <watchdog.h>
 #include <spi.h>
 #include <spi-mem.h>
@@ -1222,7 +1223,7 @@ static int spinand_probe(struct udevice *dev)
 #ifndef __UBOOT__
 	ret = mtd_device_register(mtd, NULL, 0);
 #else
-	ret = add_mtd_device(mtd);
+	ret = nand_register(0, mtd);
 #endif
 	if (ret)
 		goto err_spinand_cleanup;
-- 
2.30.1



More information about the U-Boot mailing list