@@ -2,6 +2,7 @@ menuconfig MTD_SPI_NAND
bool "SPI NAND device Support"
depends on DM_MTD && DM_SPI
select MTD_NAND_CORE
+ select SYS_NAND_SELF_INIT
select SPI_MEM
help
This is the framework for the SPI NAND device drivers.
@@ -28,6 +28,7 @@
#include <spi-mem.h>
#include <dm/device_compat.h>
#include <dm/devres.h>
+#include <dm/uclass.h>
#include <linux/bitops.h>
#include <linux/bug.h>
#include <linux/mtd/spinand.h>
@@ -1296,3 +1297,16 @@ U_BOOT_DRIVER(spinand) = {
.priv_auto = sizeof(struct spinand_device),
.probe = spinand_probe,
};
+
+void board_nand_init(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device_by_driver(UCLASS_SPI,
+ DM_DRIVER_GET(spinand),
+ &dev);
+ if (ret && ret != -ENODEV)
+ log_err("Failed to initialize SPI NAND driver. (error %d)\n",
+ ret);
+}
By analogy with RAW NAND drivers, select SYS_NAND_SELF_INIT option and implement board_nand_init() function. It will be called from nand_init(). Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> --- drivers/mtd/nand/spi/Kconfig | 1 + drivers/mtd/nand/spi/core.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)