[PATCH 13/15] rockchip: rk3328: Add support to build bootable SPI image

Dragan Simic dsimic at manjaro.org
Sat Feb 10 18:21:46 CET 2024


Hello Da Xue,

On 2024-02-09 02:57, Da Xue wrote:
> On Wed, Feb 7, 2024 at 10:53 PM Dragan Simic <dsimic at manjaro.org> 
> wrote:
>> On 2024-02-07 01:02, Jonas Karlman wrote:
>> > Similar to RK35xx the BootRom in RK3328 can read all data and look for
>> > idbloader at 0x8000, same as on SD and eMMC.
>> >
>> > Use the rksd format and modify the mkimage offset to generate a
>> > bootable
>> > u-boot-rockchip-spi.bin that can be written to 0x0 of SPI NOR flash.
>> >
>> > Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
>> 
>> Could you, please, clarify a bit why the "rkspi" format isn't used
>> instead of "rksd"?
> 
> "The SPI code has a bug that means that the 2 KiB blocks in which the
> bootloader is loaded have a stride of 4KiB, leaving the 2KiB inbetween
> as unused padding."
> 
> RK3399 has the 2K SPI bug and necessitated the rkspi format. RK3328
> came after RK3399 and resolved this bug so the SPI and MMC formats are
> now the same.
> 
> I verified on a ROC-RK3328-CC-V2.

Thank you very much too, for refreshing my memory.  I somehow forgot 
about
the bug that the RK3399 BROM suffers from.


>> > ---
>> >  arch/arm/dts/rk3328-u-boot.dtsi        | 11 +++++++++++
>> >  arch/arm/mach-rockchip/rk3328/rk3328.c |  1 +
>> >  2 files changed, 12 insertions(+)
>> >
>> > diff --git a/arch/arm/dts/rk3328-u-boot.dtsi
>> > b/arch/arm/dts/rk3328-u-boot.dtsi
>> > index b90d78878d77..2a5dca97dd4b 100644
>> > --- a/arch/arm/dts/rk3328-u-boot.dtsi
>> > +++ b/arch/arm/dts/rk3328-u-boot.dtsi
>> > @@ -120,3 +120,14 @@
>> >  &usb20_otg {
>> >       hnp-srp-disable;
>> >  };
>> > +
>> > +#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
>> > +&binman {
>> > +     simple-bin-spi {
>> > +             mkimage {
>> > +                     args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
>> > +                     offset = <0x8000>;
>> > +             };
>> > +     };
>> > +};
>> > +#endif
>> > diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c
>> > b/arch/arm/mach-rockchip/rk3328/rk3328.c
>> > index b591d38fe412..b82b209de9e2 100644
>> > --- a/arch/arm/mach-rockchip/rk3328/rk3328.c
>> > +++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
>> > @@ -36,6 +36,7 @@
>> >
>> >  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
>> >       [BROM_BOOTSOURCE_EMMC] = "/mmc at ff520000",
>> > +     [BROM_BOOTSOURCE_SPINOR] = "/spi at ff190000/flash at 0",
>> >       [BROM_BOOTSOURCE_SD] = "/mmc at ff500000",
>> >  };


More information about the U-Boot mailing list