Hi Tom,

On 29/1/2026 11:24 pm, Tom Rini wrote:
On Thu, Jan 29, 2026 at 01:04:42PM +0800,[email protected] wrote:

From: Dinesh Maniyam<[email protected]>

The SPL NAND MTD framework requires working driver model support
and sufficient memory resources, which are not available on all
platforms.

Introduce a SPL_NAND_FRAMEWORK_CAPABLE Kconfig option to allow
platforms to explicitly advertise support for compiling the full
NAND/MTD framework into SPL.

This avoids accidental enablement of the SPL NAND framework on
platforms that cannot support it and provides a clear capability
boundary for platform maintainers.

Signed-off-by: Dinesh Maniyam<[email protected]>
---
  drivers/mtd/nand/raw/Kconfig | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index e0ff28cb21b..e41e5ef2e94 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -809,6 +809,31 @@ config SYS_NAND_HW_ECC_OOBFIRST
        bool "In SPL, read the OOB first and then the data from NAND"
        depends on SPL_NAND_SIMPLE
+config SPL_NAND_FRAMEWORK_CAPABLE
+       bool
+       depends on SPL_DM
+       depends on SPL_HAS_BSS_LINKER_SECTION
+
+config SPL_NAND_USE_NAND_FRAMEWORK
+       bool "Use NAND/MTD framework in SPL"
+       depends on SPL_NAND_SUPPORT && MTD
+       depends on SPL_NAND_FRAMEWORK_CAPABLE
+       depends on SPL_ENV_SUPPORT
+       depends on ENV_IS_IN_NAND
+       select SPL_SYS_NAND_SELF_INIT
+       select SPL_NAND_BASE
+       select SPL_NAND_DRIVERS
+       select SPL_NAND_IDENT
+       select SPL_NAND_INIT
+       select SPL_NAND_ECC
+       help
+               Enable loading U-Boot from NAND in SPL using the full
+               NAND/MTD framework instead of the minimal SPL NAND loaders.
+               This provides bad-block aware reads and flexible offset
+               handling via the common NAND/MTD infrastructure.
+               Platforms enabling this option must also provide working
+               driver model support and sufficient SPL memory resources.
+
  endif # if SPL
endif # if MTD_RAW_NAND
It sounds like dependencies are missing on existing symbols, and should
be added there, from the description. It also sounds like these
platforms have hard limits on SPL size, but aren't setting the
appropriate options to enforce that at link time. Or am I totally
misunderstanding?

Spot on!
The SPL memory requirement was only documented in the help text.
Add an explicit dependency on|SPL_MAX_SIZE| to ensure platforms enabling the
full NAND/MTD framework in SPL declare sufficient SRAM.

Reply via email to