From: Apurva Nandan <[email protected]>

Only RAW NANDs are supported in the SPL, so create a new Kconfig
config for building SPI NAND subsystem in the SPL build using
SPL_NAND_SPI_SUPPORT Kconfig option.

Signed-off-by: Apurva Nandan <[email protected]>
Signed-off-by: Anurag Dutta <[email protected]>
---
 common/spl/Kconfig        | 8 ++++++++
 drivers/mtd/Makefile      | 1 +
 drivers/mtd/nand/Makefile | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index fb167933c60..1a28eb257dd 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1071,6 +1071,14 @@ config SPL_RELOC_LOADER
          to temporary memory, then copying it into place afterwards, then
          jumping to it.
 
+config SPL_NAND_SPI_SUPPORT
+       bool "Support loading from SPI NAND flash"
+       depends on SPL_MTD_LOAD
+       help
+         Enable support for SPI NAND flash devices in SPL boot flow.
+         When enabled, SPL can load U-Boot from SPI NAND using the MTD
+         subsystem.
+
 config SPL_UBI
        bool "Support UBI"
        help
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index ce05e206073..a1f9a1ddeda 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -35,6 +35,7 @@ ifneq ($(mtd-y),)
 obj-$(CONFIG_SPL_MTD) += mtd.o
 endif
 obj-$(CONFIG_$(PHASE_)NAND_SUPPORT) += nand/
+obj-$(CONFIG_$(PHASE_)NAND_SPI_SUPPORT) += nand/
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += onenand/
 obj-$(CONFIG_$(PHASE_)SPI_FLASH_SUPPORT) += spi/
 obj-$(CONFIG_SPL_UBI) += ubispl/
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index c8169cf7390..44cdf8ac1b2 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -1,10 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),)
 nandcore-objs := core.o bbt.o
+ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),)
 obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
 obj-$(CONFIG_MTD_RAW_NAND) += raw/
 obj-$(CONFIG_MTD_SPI_NAND) += spi/
 else
 obj-$(CONFIG_$(PHASE_)NAND_SUPPORT) += raw/
+obj-$(CONFIG_$(PHASE_)NAND_SPI_SUPPORT) += spi/ nandcore.o
 endif
-- 
2.34.1

Reply via email to