[PATCH v2 06/14] spi: use nand_register() instead of add_mtd_device()

Alexey Romanov avromanov at salutedevices.com
Tue Jan 9 18:32:18 CET 2024


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 07e521dbf5..2a3dbcfcb4 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>
@@ -1213,7 +1214,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