From: Apurva Nandan <[email protected]>

Add Kconfig options to enable SPL loading of U-Boot from MTD devices:

- SPL_MTD_LOAD: Enable loading via MTD framework
- SYS_MTD_U_BOOT_OFFS: Configure U-Boot offset in MTD flash
  (default 0x80000 for K3, 0x0 otherwise)

This provides a unified boot path for all MTD devices.

Signed-off-by: Apurva Nandan <[email protected]>
Signed-off-by: Anurag Dutta <[email protected]>
---
 common/spl/Kconfig  | 22 ++++++++++++++++++++++
 common/spl/Makefile |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 996c9b8db4f..fb167933c60 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -973,6 +973,28 @@ config SPL_MTD
          devices. See SPL_NAND_SUPPORT and SPL_ONENAND_SUPPORT for how
          to enable specific MTD drivers.
 
+config SPL_MTD_LOAD
+       bool "Support loading from MTD framework"
+       depends on SPL_MTD
+       help
+         Enable support for loading next stage, U-Boot or otherwise, from
+         MTD Framework in U-Boot SPL.
+
+config SPL_MTD_NAND_LOAD
+       bool "Support loading from MTD framework for NAND flashes"
+       depends on SPL_MTD_LOAD
+       help
+         Enable support for loading next stage, U-Boot or otherwise, from
+         MTD Framework in U-Boot SPL for NAND flashes.
+
+config SYS_MTD_U_BOOT_OFFS
+       hex "address of u-boot payload in MTD flash"
+       default 0x80000 if ARCH_K3
+       default 0x0
+       depends on SPL_MTD_LOAD
+       help
+        Address within MTD Flash from where the u-boot payload is fetched.
+
 config SPL_MUSB_NEW
        bool "Support new Mentor Graphics USB"
        help
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 4c9482bd309..ae87523f45d 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -35,6 +35,8 @@ obj-$(CONFIG_$(PHASE_)NVME) += spl_nvme.o
 obj-$(CONFIG_$(PHASE_)SEMIHOSTING) += spl_semihosting.o
 obj-$(CONFIG_$(PHASE_)DFU) += spl_dfu.o
 obj-$(CONFIG_$(PHASE_)SPI_LOAD) += spl_spi.o
+obj-$(CONFIG_$(PHASE_)MTD_LOAD) += spl_mtd.o
+obj-$(CONFIG_$(PHASE_)MTD_NAND_LOAD) += spl_mtd_nand.o
 obj-$(CONFIG_$(PHASE_)RAM_SUPPORT) += spl_ram.o
 obj-$(CONFIG_$(PHASE_)USB_SDP_SUPPORT) += spl_sdp.o
 endif
-- 
2.34.1

Reply via email to