arm: socfpga: enable NAND boot support on Agilex platforms
Subsystems (5)
v2 cover arm: socfpga: enable NAND boot support on Agilex platforms
From: Dinesh Maniyam <[email protected]>
This series enables NAND boot support on SoCFPGA Agilex platforms.
It adds support for loading U-Boot from NAND in SPL using the full NAND/MTD framework, cleans up controller-specific SPL helpers, and enables the required NAND configuration for Agilex boards.
No functional change is intended for platforms that do not enable SPL NAND MTD framework support.
v1->v2:
--------
Patch 1: Add SPL_MAX_SIZE dependency
History:
--------
[v1]: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
Dinesh Maniyam (5):
mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
mtd: nand: add generic SPL NAND MTD loader
mtd: nand: wire SPL NAND MTD loader into SPL build
arm: socfpga: imply SPL_NAND_FRAMEWORK_CAPABLE for Agilex platforms
arm: socfpga: enable NAND support for Agilex
arch/arm/mach-socfpga/Kconfig | 2 + configs/socfpga_agilex_defconfig | 11 +++++ drivers/mtd/nand/raw/Kconfig | 30 ++++++++++++ drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/spl_nand_mtd.c | 76 +++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 drivers/mtd/nand/raw/spl_nand_mtd.c
Signature · 1 line
2.43.7
PATCH v2 1/5 mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
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.
--- drivers/mtd/nand/raw/Kconfig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/mtd/nand/raw/Kconfig +30 -0
@@ -809,6 +809,36 @@ 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 + depends on SPL_MAX_SIZE >= 0x40000 + help + Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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
Signature · 1 line
2.43.7
Re: [PATCH v2 1/5] mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
Quoted 50 lines · On Tue, Feb 03, 2026 at 03:47:17PM +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_CAPABLEKconfigoption 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/mtd/nand/raw/Kconfig +23
-0@@ -809,6 +809,36 @@ 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 + depends on SPL_MAX_SIZE >= 0x40000 + help + Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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
drivers/mtd/nand/raw/Kconfig config SYS_NAND_HW_ECC_OOBFIRST · line 844
Quoted 10 lines
drivers/mtd/nand/raw/Kconfig +7
-0+ 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
This still gets it backwards. Whatever depends on SPL_DM needs to add it. The max size is something that needs to be set for your platforms. The BSS requirement is not correct (there are platforms today without that set).
Signature · 1 line
Tom
Re: [PATCH v2 1/5] mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
Hi Tom,
Quoted 80 lines · Tom Rini
Quoted 50 lines · On Tue, Feb 03, 2026 at 03:47:17PM +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_CAPABLEKconfigoption 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/mtd/nand/raw/Kconfig +23
-0@@ -809,6 +809,36 @@ 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 + depends on SPL_MAX_SIZE >= 0x40000 + help + Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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 + helpdrivers/mtd/nand/raw/Kconfig config SYS_NAND_HW_ECC_OOBFIRST · line 844
Quoted 10 lines
drivers/mtd/nand/raw/Kconfig +7
-0+ 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_NANDThis still gets it backwards. Whatever depends on
SPL_DMneeds to add it. The max size is something that needs to be set for your platforms. The BSS requirement is not correct (there are platforms today without that set).Thanks for the input.
Understood — the capability-style symbol is not the right approach here. I’ll drop |SPL_NAND_FRAMEWORK_CAPABLE| and instead move the required dependencies directly onto |SPL_NAND_USE_NAND_FRAMEWORK|.
I’ll also remove the |SPL_MAX_SIZE| and BSS assumptions from the generic
Kconfigand ensure the appropriate limits and options are set in the affected platform configurations instead.I’ll rework the patch accordingly.
Dinesh
Re: [PATCH v2 1/5] mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
Hi
Quoted 13 lines · Dinesh
Hi Tom,
On 3/2/2026 10:57 pm, Tom Rini wrote:
On Tue, Feb 03, 2026 at 03:47:17PM +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.
Quoted 8 lines
Introduce a
SPL_NAND_FRAMEWORK_CAPABLEKconfigoption 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.
This what I have asked in the beginning, for now I don't like to have this change
in the framework unless we have more consumer. For the patch that you sent for make simple spl load, I will try to start to apply on one of my board
Michael
Quoted 65 lines
Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/Kconfig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/mtd/nand/raw/Kconfig +30
-0@@ -809,6 +809,36 @@ 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 + depends on SPL_MAX_SIZE >= 0x40000 + help + Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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_NANDThis still gets it backwards. Whatever depends on
SPL_DMneeds to add it. The max size is something that needs to be set for your platforms. The BSS requirement is not correct (there are platforms today without that set).Thanks for the input.
Understood — the capability-style symbol is not the right approach here. I’ll drop
SPL_NAND_FRAMEWORK_CAPABLEand instead move the required dependencies directly ontoSPL_NAND_USE_NAND_FRAMEWORK.I’ll also remove the
SPL_MAX_SIZEand BSS assumptions from the genericKconfigand ensure the appropriate limits and options are set in the affected platform configurations instead.I’ll rework the patch accordingly.
Dinesh
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v2 1/5] mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
Hi Michael,
Quoted 120 lines · Michael Nazzareno Trimarchi
[CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]
Hi
Quoted 12 lines · Dinesh
Hi Tom,
On 3/2/2026 10:57 pm, Tom Rini wrote:
On Tue, Feb 03, 2026 at 03:47:17PM +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.
Quoted 8 lines
Introduce a
SPL_NAND_FRAMEWORK_CAPABLEKconfigoption 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.
This what I have asked in the beginning, for now I don't like to have this change
in the framework unless we have more consumer. For the patch that you sent for make simple spl load, I will try to start to apply on one of my boardMichael
Just to clarify, when you mentioned “simple SPL load”, were you referring to the generic MTD-based SPL NAND loader I introduced?
If you meant the generic MTD-based loader, I’m preparing a newer RFC version that clarifies the scope and usage. It may be easier to test against that version, if you don’t mind waiting for it.
Dinesh
Quoted 58 lines
Signed-off-by Dinesh Maniyam<[email protected]>--- drivers/mtd/nand/raw/Kconfig | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/mtd/nand/raw/Kconfig +30
-0@@ -809,6 +809,36 @@ 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 + depends on SPL_MAX_SIZE >= 0x40000 + help + Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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_NANDThis still gets it backwards. Whatever depends on
SPL_DMneeds to add it. The max size is something that needs to be set for your platforms. The BSS requirement is not correct (there are platforms today without that set).Thanks for the input.
Understood — the capability-style symbol is not the right approach here. I’ll drop
SPL_NAND_FRAMEWORK_CAPABLEand instead move the required dependencies directly ontoSPL_NAND_USE_NAND_FRAMEWORK.Quoted 7 lines
I’ll also remove the
SPL_MAX_SIZEand BSS assumptions from the genericKconfigand ensure the appropriate limits and options are set in the affected platform configurations instead.I’ll rework the patch accordingly.
Dinesh
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
Re: [PATCH v2 1/5] mtd: nand: introduce SPL_NAND_FRAMEWORK_CAPABLE Kconfig option
In reply to Michael Nazzareno TrimarchiHi Dinesh,
Quoted 4 lines · Michael Nazzareno Trimarchi
This what I have asked in the beginning, for now I don't like to have this change
in the framework unless we have more consumer. For the patch that you sent for make simple spl load, I will try to start to apply on one of my board
I'm also interested in SPL NAND support. I have recently made an attempt to add SPI NAND SPL support:
https://lore.kernel.org/u-boot/[email protected]/
And then Jonas pointed out your series.
Do you think it can be extended to support SPI NAND?
Quoted 4 lines
Quoted 4 lines
+config
SPL_NAND_FRAMEWORK_CAPABLE
+ bool
+ depends onSPL_DM
+ depends onSPL_HAS_BSS_LINKER_SECTION
This is not defined on my platform.
Quoted 1 line
Quoted 1 line
+ depends on
SPL_MAX_SIZE>=0x40000
This is also not defined.
Quoted 16 lines
Quoted 16 lines
+ help
drivers/mtd/nand/raw/Kconfig +15
-0+ Indicates that the platform has sufficient SPL capabilities + (driver model, BSS support, and SRAM size) to support the + full NAND/MTD framework in SPL. + +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
Quoted 8 lines
Quoted 8 lines
+ 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.
When I try to build it, I get the following error:
drivers/mtd/nand/raw/nand.c:15:34: error: ‘CFG_SYS_NAND_BASE’ undeclared here (not in a function); did you mean ‘CFG_SYS_SDRAM_BASE’?
15 | #define CFG_SYS_NAND_BASE_LIST { CFG_SYS_NAND_BASE }
In my SPI NAND case, there is no NAND controller, so no CFG_SYS_NAND_BASE is defined.
PATCH v2 2/5 mtd: nand: add generic SPL NAND MTD loader
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Add a generic SPL NAND MTD loader providing nand_get_mtd() and nand_spl_load_image() helpers.
This allows SPL NAND MTD loading logic to be shared across NAND controllers instead of being embedded in individual drivers.
--- drivers/mtd/nand/raw/spl_nand_mtd.c | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 drivers/mtd/nand/raw/spl_nand_mtd.c
drivers/mtd/nand/raw/spl_nand_mtd.c new file +76 -0
@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright Altera Corporation (C) 2026. All rights reserved. +*/ + +#include <dm.h> +#include <hang.h> +#include <malloc.h> +#include <memalign.h> +#include <nand.h> + +struct mtd_info *nand_get_mtd (void ) +{ +struct mtd_info *mtd; + + mtd =get_nand_dev_by_index (nand_curr_device); +if (!mtd) +hang (); + +return mtd; +} + +int nand_spl_load_image (u32 offset,u32 len,void *dst) +{ +size_t count = len, actual =0 , page_align_overhead =0 ; +u32 page_align_offset =0 ; +u8 *page_buffer =NULL ; +int err =0 ; +struct mtd_info *mtd; + +if (!len || !dst) +return -EINVAL ; + + mtd =nand_get_mtd (); + +if (offset & (mtd->writesize -1 )) { + page_buffer =malloc_cache_aligned (mtd->writesize); +if (!page_buffer) { +debug ("Error: allocating buffer\n" ); +return -ENOMEM ; + } + + page_align_overhead = offset % mtd->writesize; + page_align_offset = offset - page_align_overhead; + count = mtd->writesize; + + err =nand_read_skip_bad (mtd, page_align_offset, &count, + &actual, mtd->size, page_buffer); +if (err) + goto out; + + count -= page_align_overhead; + count =min ((size_t )len, count); + +memcpy (dst, page_buffer + page_align_overhead, count); + + len -= count; +if (!len) + goto out; + + offset += count; + dst += count; + count = len; + } + + err =nand_read_skip_bad (mtd, offset, &count, + &actual, mtd->size, dst); + +out: +if (page_buffer) +free (page_buffer); + +return err; +} + +void nand_deselect (void ) {}
Signature · 1 line
2.43.7
Re: [PATCH v2 2/5] mtd: nand: add generic SPL NAND MTD loader
Quoted 5 lines · On Tue, Feb 03, 2026 at 03:47:18PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add a generic SPL NAND MTD loader providing
nand_get_mtd()andnand_spl_load_image()helpers.
Quoted 8 lines
This allows SPL NAND MTD loading logic to be shared across NAND controllers instead of being embedded in individual drivers.
Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/spl_nand_mtd.c | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 drivers/mtd/nand/raw/spl_nand_mtd.c
This is a good idea, and I'd like to see a follow-up RFC that switches at least one other platform over showing that this really is generic enough.
Signature · 1 line
Tom
Michael Nazzareno Trimarchi
Reviewed-byRe: [PATCH v2 2/5] mtd: nand: add generic SPL NAND MTD loader
Hi
Quoted 8 lines · Tom Rini
Quoted 5 lines · On Tue, Feb 03, 2026 at 03:47:18PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add a generic SPL NAND MTD loader providing
nand_get_mtd()andnand_spl_load_image()helpers.
Quoted 9 lines
Quoted 8 lines
This allows SPL NAND MTD loading logic to be shared across NAND controllers instead of being embedded in individual drivers.
Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/spl_nand_mtd.c | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 drivers/mtd/nand/raw/spl_nand_mtd.c
Quoted 6 lines
This is a good idea, and I'd like to see a follow-up RFC that switches at least one other platform over showing that this really is generic enough.
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v2 2/5] mtd: nand: add generic SPL NAND MTD loader
Hi Tom, Michael
Quoted 50 lines · Michael Nazzareno Trimarchi
[CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]
Hi
Quoted 7 lines · Tom Rini
Quoted 5 lines · On Tue, Feb 03, 2026 at 03:47:18PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Add a generic SPL NAND MTD loader providing
nand_get_mtd()andnand_spl_load_image()helpers.Quoted 8 lines
Quoted 8 lines
This allows SPL NAND MTD loading logic to be shared across NAND controllers instead of being embedded in individual drivers.
Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/spl_nand_mtd.c | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)create mode 100644
drivers/mtd/nand/raw/spl_nand_mtd.cReviewed-by Michael Trimarchi <[email protected]>Quoted 6 lines
This is a good idea, and I'd like to see a follow-up RFC that switches at least one other platform over showing that this really is generic enough.
--
TomThanks for the feedback.
I’ll send this as an RFC. I don’t currently have access to additional NAND platforms to validate the change myself, so testing and feedback from other maintainers would be greatly appreciated to help confirm that the solution is sufficiently generic.
Dinesh
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
PATCH v2 3/5 mtd: nand: wire SPL NAND MTD loader into SPL build
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Wire the generic SPL NAND MTD loader into the NAND SPL build when SPL_NAND_USE_NAND_FRAMEWORK is enabled.
--- drivers/mtd/nand/raw/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/Makefile +1 -0
@@ -12,6 +12,7 @@ endif obj-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o obj-$(CONFIG_SPL_NAND_CADENCE) += cadence_spl.o obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.o +obj-$(CONFIG_SPL_NAND_USE_NAND_FRAMEWORK) += spl_nand_mtd.o obj-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o obj-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o obj-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o
Signature · 1 line
2.43.7
Re: [PATCH v2 3/5] mtd: nand: wire SPL NAND MTD loader into SPL build
Quoted 15 lines · On Tue, Feb 03, 2026 at 03:47:19PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Wire the generic SPL NAND MTD loader into the NAND SPL build when
SPL_NAND_USE_NAND_FRAMEWORKis enabled.Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/Makefile | 1 + 1 file changed, 1 insertion(+)drivers/mtd/nand/raw/Makefile +0
-0
drivers/mtd/nand/raw/Makefile endif · line 18
Quoted 7 lines
drivers/mtd/nand/raw/Makefile +1
-0@@ -12,6 +12,7 @@ endif obj-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o obj-$(CONFIG_SPL_NAND_CADENCE) += cadence_spl.o obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.o +obj-$(CONFIG_SPL_NAND_USE_NAND_FRAMEWORK) += spl_nand_mtd.o obj-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o obj-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o obj-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o
This should be in the previous patch.
Signature · 1 line
Tom
Re: [PATCH v2 3/5] mtd: nand: wire SPL NAND MTD loader into SPL build
Hi Tom,
Quoted 28 lines · Tom Rini
Quoted 15 lines · On Tue, Feb 03, 2026 at 03:47:19PM +0800, [email protected] wrote:
From: Dinesh Maniyam <[email protected]>
Wire the generic SPL NAND MTD loader into the NAND SPL build when
SPL_NAND_USE_NAND_FRAMEWORKis enabled.Signed-off-by Dinesh Maniyam <[email protected]>--- drivers/mtd/nand/raw/Makefile | 1 + 1 file changed, 1 insertion(+)drivers/mtd/nand/raw/Makefile +0
-0drivers/mtd/nand/raw/Makefile endif · line 18
Quoted 7 lines
drivers/mtd/nand/raw/Makefile +1
-0@@ -12,6 +12,7 @@ endif obj-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o obj-$(CONFIG_SPL_NAND_CADENCE) += cadence_spl.o obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.o +obj-$(CONFIG_SPL_NAND_USE_NAND_FRAMEWORK) += spl_nand_mtd.o obj-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o obj-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o obj-$(CONFIG_SPL_NAND_ECC) += nand_ecc.oThis should be in the previous patch.
I will merge it to the previous patch.
Dinesh
PATCH v2 4/5 arm: socfpga: imply SPL_NAND_FRAMEWORK_CAPABLE for Agilex platforms
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Use imply instead of select for SPL_NAND_FRAMEWORK_CAPABLE on SoCFPGA Agilex and Agilex7M platforms.
SPL_NAND_FRAMEWORK_CAPABLE is a platform capability hint and should not be forced when its functional dependencies are not enabled. Using imply avoids Kconfig dependency warnings while allowing the feature to be enabled when appropriate.
--- arch/arm/mach-socfpga/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-socfpga/Kconfig +2 -0
@@ -59,6 +59,7 @@ config TARGET_SOCFPGA_AGILEX select NCORE_CACHE select SPL_CLK if SPL select TARGET_SOCFPGA_SOC64 + imply SPL_NAND_FRAMEWORK_CAPABLE config TARGET_SOCFPGA_AGILEX7M bool
@@ -71,6 +72,7 @@ config TARGET_SOCFPGA_AGILEX7M select NCORE_CACHE select SPL_CLK if SPL select TARGET_SOCFPGA_SOC64 + imply SPL_NAND_FRAMEWORK_CAPABLE config TARGET_SOCFPGA_AGILEX5 bool
Signature · 1 line
2.43.7
PATCH v2 5/5 arm: socfpga: enable NAND support for Agilex
In reply to [email protected]From: Dinesh Maniyam <[email protected]>
Enable NAND support for the SoCFPGA Agilex platform by enabling Denali NAND, SPL NAND support, and environment storage in NAND. This allows SPL and U-Boot to boot from NAND using the NAND/MTD infrastructure.
--- configs/socfpga_agilex_defconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)
configs/socfpga_agilex_defconfig +11 -0
@@ -7,6 +7,7 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000 CONFIG_SF_DEFAULT_MODE=0x2003 CONFIG_ENV_SIZE=0x2000 +CONFIG_ENV_OFFSET=0x00200000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="intel/socfpga_agilex_socdk" CONFIG_DM_RESET=y
@@ -25,6 +26,7 @@ CONFIG_SPL_FIT_SIGNATURE=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000 CONFIG_DISTRO_DEFAULTS=y +CONFIG_NAND_BOOT=y CONFIG_QSPI_BOOT=y CONFIG_BOOTDELAY=5 CONFIG_USE_BOOTARGS=y
@@ -39,7 +41,9 @@ CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x3fa00000 CONFIG_SPL_SYS_MALLOC_SIZE=0x500000 CONFIG_SPL_CACHE=y +CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_MTD=y +CONFIG_SPL_NAND_SUPPORT=y CONFIG_SPL_SPI_FLASH_MTD=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x04000000
@@ -60,6 +64,7 @@ CONFIG_CMD_UBI=y CONFIG_OF_UPSTREAM=y CONFIG_OF_LIST="" CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_IS_IN_UBI=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_ENV_UBI_PART="root"
@@ -74,6 +79,10 @@ CONFIG_MISC=y CONFIG_SYS_MMC_MAX_BLK_COUNT=256 CONFIG_MMC_DW=y CONFIG_DM_MTD=y +CONFIG_NAND_DENALI_DT=y +CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y +CONFIG_SYS_NAND_U_BOOT_OFFS=0x0 +CONFIG_SPL_NAND_USE_NAND_FRAMEWORK=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
@@ -94,3 +103,5 @@ CONFIG_WDT=y CONFIG_PANIC_HANG=y CONFIG_SPL_CRC32=y # CONFIG_TOOLS_MKEFICAPSULE is not set +CONFIG_MTDIDS_DEFAULT="nand0=ffb90000.nand.0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=ffb90000.nand.0:2m(u-boot),-(root)"
Signature · 1 line
2.43.7