[MVEBU] SPI flash offset was depecrated?

Pali Rohár pali at kernel.org
Sun Jul 31 00:41:04 CEST 2022


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