[PATCH v1 1/2] mtd: nand: Allow full NAND framework in SPL

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Fri Jun 20 16:13:05 CEST 2025


Hi

On Fri, Jun 20, 2025 at 4:11 PM Tom Rini <trini at konsulko.com> wrote:
>
> On Fri, Jun 20, 2025 at 03:29:52AM -0700, alif.zakuan.yuslaimi at altera.com wrote:
>
> > From: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi at altera.com>
> >
> > Add configuration option to compile the entire NAND framework into
> > U-Boot SPL. This is required by some drivers, like the Denali NAND,
> > which use a lot of functionality from the NAND core.
> >
> > Signed-off-by: Marek Vasut <marex at denx.de>
> > Signed-off-by: Tien Fong Chee <tien.fong.chee at altera.com>
> > Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi at altera.com>
> > ---
> >  drivers/mtd/nand/raw/Kconfig  |  8 ++++++++
> >  drivers/mtd/nand/raw/Makefile | 28 ++++++++++++----------------
> >  2 files changed, 20 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> > index adb271dfb8f..28b48d53def 100644
> > --- a/drivers/mtd/nand/raw/Kconfig
> > +++ b/drivers/mtd/nand/raw/Kconfig
> > @@ -208,6 +208,7 @@ config NAND_CADENCE
> >  config NAND_DENALI
> >       bool
> >       select SYS_NAND_SELF_INIT
> > +     select SYS_NAND_ONFI_DETECTION if TARGET_SOCFPGA_SOC64
>
> If there's not a more generic SOCFPGA symbol to use here, this part is
> fine. But also unrelated as this isn't the SPL driver and this series is
> about SPL.
>
> >       imply CMD_NAND
> >
> >  config NAND_DENALI_DT
> > @@ -826,4 +827,11 @@ config SYS_NAND_HW_ECC_OOBFIRST
> >
> >  endif        # if SPL
> >
> > +config SPL_NAND_FRAMEWORK
> > +     bool "Compile the entire NAND framework into the SPL"
> > +     help
> > +       Some drivers require a lot of functionality from the NAND framework
> > +       core when used in SPL. This option allows compiling the full NAND
> > +       framework into the SPL instead of it's reduced version.
>
> There's some problems here. First, this needs to be inside of the "if
> SPL, not outside of it". Second, we already have SPL_NAND_DENALI as an
> option, so some explanation of what's being done here now is needed.
> Third, if we really really need SPL_NAND_SIMPLE and SPL_NAND_SUPPORT and
> SPL_NAND_FRAMEWORK it needs to be moved around so that first we have it
> as a choice, then we add more. But given all of the other options we
> have in common/spl/Kconfig right now for NAND, I'm unclear about what is
> missing today.

I have already rejected this patch for this specific option, because
you can always select and
this board or family are the only consumers. Why do we need it in the
first place?

Michael

>
> >  endif        # if MTD_RAW_NAND
> > diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
> > index 34cba77046a..08829406902 100644
> > --- a/drivers/mtd/nand/raw/Makefile
> > +++ b/drivers/mtd/nand/raw/Makefile
> > @@ -3,8 +3,18 @@
> >  # (C) Copyright 2006
> >  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> >
> > +nand-framework-objs := nand.o nand_bbt.o nand_ids.o nand_util.o \
> > +                    nand_ecc.o nand_base.o nand_timings.o nand_amd.o \
> > +                    nand_hynix.o nand_macronix.o nand_micron.o \
> > +                    nand_samsung.o nand_toshiba.o
> > +
> >  ifdef CONFIG_XPL_BUILD
> >
> > +ifdef CONFIG_SPL_NAND_FRAMEWORK
> > +obj-y += $(nand-framework-objs)
> > +NORMAL_DRIVERS=y
> > +endif
> > +
> >  ifdef CONFIG_SPL_NAND_DRIVERS
> >  NORMAL_DRIVERS=y
> >  endif
> > @@ -15,9 +25,7 @@ obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.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
> > -obj-$(CONFIG_SPL_NAND_BASE) += nand_base.o nand_amd.o nand_hynix.o \
> > -                             nand_macronix.o nand_micron.o \
> > -                             nand_samsung.o nand_toshiba.o
> > +obj-$(CONFIG_SPL_NAND_BASE) += nand_base.o
> >  obj-$(CONFIG_SPL_NAND_IDENT) += nand_ids.o nand_timings.o
> >  obj-$(CONFIG_$(PHASE_)NAND_INIT) += nand.o
> >  ifeq ($(CONFIG_SPL_ENV_SUPPORT),y)
> > @@ -28,19 +36,7 @@ else # not spl
> >
> >  NORMAL_DRIVERS=y
> >
> > -obj-y += nand.o
> > -obj-y += nand_bbt.o
> > -obj-y += nand_ids.o
> > -obj-y += nand_util.o
> > -obj-y += nand_ecc.o
> > -obj-y += nand_base.o
> > -obj-y += nand_amd.o
> > -obj-y += nand_hynix.o
> > -obj-y += nand_macronix.o
> > -obj-y += nand_micron.o
> > -obj-y += nand_samsung.o
> > -obj-y += nand_toshiba.o
> > -obj-y += nand_timings.o
> > +obj-y += $(nand-framework-objs)
> >
> >  endif # not spl
>
> Did you world build this change? At first it looks like we're dropping a
> lot of objects from other configs.
>
> --
> Tom



-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com


More information about the U-Boot mailing list