Hi Sean,
On Wed, Feb 25, 2026 at 4:45 PM Sean Anderson <[email protected]> wrote:
> Actually, I don't think this is correct. NAND devices have have multiple MTDs
> for each
> CS, and SPI-NOR devices are UCLASS_SPI_FLASH and not UCLASS_MTD. So I think
> it's better
> to do something like
>
> mtd_probe_devices();
> switch (bootdev->boot_device) {
> case BOOT_DEVICE_NAND:
> mtd = get_mtd_device_nm(CONFIG_SPL_MTD_NAND_NAME);
> break;
> case BOOT_DEVICE_SPI:
> mtd = get_mtd_device_nm(CONFIG_SPL_MTD_SPI_FLASH_NAME);
> break;
> default:
> mtd = ERR_PTR(-ENODEV);
> break;
> }
> if (IS_ERR(mtd)) {
> ret = PTR_ERR(mtd);
> goto out;
> }
...
> > Actually, if CONFIG_SPL_NAND_SUPPORT is enabled then the native nand loader
> > is compiled.
> > Maybe we should add a separate Kconfig for it (CONFIG_SPL_NAND_LOAD)
> > defaulting to
> > SPL_NAND_SUPPORT. Then users can disable the "native" load method if they
> > want to use MTD.
>
> I have a patch for this that I will try to send this week.
If you would like to prepare a patch for the generic SPL MTD loader,
I'll be glad to test it.
Thanks