[MVEBU] SPI flash offset was depecrated?

Pali Rohár pali at kernel.org
Tue Aug 2 11:27:25 CEST 2022


Hello! I have tested it without dm-pre-reloc on A385 Turris Omnia and
you are right. SPL cannot load proper U-Boot and throws error:

  Trying to boot from SPI
  Invalid bus 0 (err=-19)
  SPI probe failed.
  SPL: failed to boot from all boot devices

Stefan and Tom, it is possible to somehow "inject" dm-pre-reloc into spi
DTB SPL node during SPL compile time when CONFIG_SPL_SPI=y is enabled?

Because really CONFIG_SPL_SPI=y option does not work without
dm-pre-reloc.

On Saturday 30 July 2022 17:02:57 Tony Dinh wrote:
> Hi Pali,
> 
> Flashed to SPI and booted successfully! With CONFIG_SPL_SPI=y so SPL
> loads u-boot payload.
> 
> My observation: dm-preloc is also required using SPL SPI driver method:
> 
> &spi0 {
> u-boot,dm-pre-reloc;
> };
> 
> Perhaps it should be implied in Kconfig with a DM_xxx symbol if possible.
> 
> Thanks,
> Tony
> 
> On Sat, Jul 30, 2022 at 4:04 PM Tony Dinh <mibodhi at gmail.com> wrote:
> >
> > Hi Pali,
> >
> > "flash u-boot.bin or spl.bin separately"
> >
> > That's what we used to do many years ago! glad that we have a single
> > flashable image now, much more robust. Thanks for a clear and detailed
> > explanation!
> >
> > Tony
> >
> > On Sat, Jul 30, 2022 at 3:41 PM Pali Rohár <pali at kernel.org> wrote:
> > >
> > > On Saturday 30 July 2022 15:13:05 Tony Dinh wrote:
> > > > Hi Stefan and Pali,
> > > >
> > > > Sorry the question might be a bit trivial, but I could not find it in
> > > > the source tree. It's been a long time and I'm not up to date on this
> > > > subject. I recall a long time ago we needed to specify a SPI flash
> > > > offset for the u-boot image so SPL would know where to load it from.
> > >
> > > Hello! Now upstream U-Boot build process does not need to know offset
> > > where the proper U-Boot starts in SPI flash. SPL image determinate it at
> > > runtime (by looking into kwbimage header stored in SPI flash) and load
> > > proper U-Boot correctly.
> > >
> > > > I vaguely remember something about "return to BootROM and let the
> > > > BootROM load the u-boot image"? Is this applicable only when we kwboot
> > > > the u-boot-spl.kwb image, or also applicable to the u-boot payload on
> > > > SPI flash?
> > >
> > > Now upstream SPL can load proper U-Boot from SPI flash directly (if SPI
> > > flash driver is compiled into SPL) or it can "return to BootROM" and let
> > > BootROM to load proper U-Boot into RAM.
> > >
> > > This is configurable by defconfig options at compile time. We have
> > > tested that both options work fine. Using BootROM for loading U-Boot
> > > from SPI flash is slower than using dedicated SPL drivers (probably
> > > because BootROM read SPI at lower speed). But SPI flash drivers increase
> > > SPL binary (usage of BootROM does not). So you can choose which option
> > > you want -- either smaller SPL binary or faster U-Boot loading and
> > > booting. To disable SPI flash drivers in SPL, just disable option
> > > CONFIG_SPL_SPI.
> > >
> > > UART booting requires BootROM for loading proper U-Boot. But now
> > > upstream U-Boot generates universal u-boot-spl.kwb image which can be
> > > either flashed into SPI flash or booted via kwboot tool.
> > >
> > > You should _always_ flash u-boot-spl.kwb image into SPI flash memory. It
> > > is combined image of SPL and proper U-Boot with Marvell kwbimage header
> > > (required by BootROM). So never flash u-boot.bin or spl.bin separately.
> > >
> > > > I saw Stefan flashing instruction in board/Marvell/db-88f6820-gp/README
> > > >
> > > > Update from original Marvell U-Boot to mainline U-Boot:
> > > > -------------------------------------------------------
> > > > The resulting image including the SPL binary with the full DDR setup
> > > > is "u-boot-spl.kwb".
> > > > To update the SPI NOR flash, please use the following command:
> > > > => sf probe; tftpboot 2000000 db-88f6820-gp/u-boot-spl.kwb;\
> > > > sf update 2000000 0 60000
> > > > ...
> > > >
> > > > But building this board I got 642K u-boot-spl.kwb. So perhaps the
> > > > instructions above are out of date, or 60000  meant to be just an
> > > > example to be adjusted to the real image size?
> > >
> > > 60000 should be there just "example" and you should replace it by real
> > > image size.
> > >
> > > > Could you point me in the right direction,  ie. which Kconfig option
> > > > deals with this at the moment, or is it automatically set when we
> > > > build MVEBU -boot-spl.kwb?
> > > >
> > > > Thanks,
> > > > Tony
> > >
> > > Default Kconfig options for u-boot-spl.kwb should produce flashable
> > > SPI NOR image. It is option CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI.


More information about the U-Boot mailing list