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

Quentin Schulz quentin.schulz at theobroma-systems.com
Thu Feb 22 11:18:13 CET 2024


Hi Jonas,

On 2/17/24 01:22, Jonas Karlman wrote:
> Similar to RK35xx the BootRom in RK3328 can read all data and look for
> idbloader at 0x8000, same as it does for 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>
> ---
> v2:
> - No change
> ---
>   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 a030f1a5e51d..4d43fe2fb51a 100644
> --- a/arch/arm/dts/rk3328-u-boot.dtsi
> +++ b/arch/arm/dts/rk3328-u-boot.dtsi
> @@ -133,3 +133,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

Do we have a list of SoCs that need to use rkspi type for booting from 
SPI flashes? I would much rather have rksd the default in 
rockchip-u-boot.dtsi instead of having to add it for each and every SoC 
which is not impacted by this change (which I assume should be now all 
new SoCs?).

I could also imagine a Kconfig symbol just for that, one that would NOT 
appear in menuconfig because it makes no sense to make it selectable (I 
think this can be achieved without a prompt?), e.g. (not tested):
"""
config ROCKCHIP_SPI_IMAGE_TYPE
     string
     depends on ROCKCHIP_SPI_IMAGE
     default "rksd"
     default "rkspi" if ROCKCHIP_RK3399
     help
       The type passed to mkimage to generate a TPL+SPL image bootable 
from SPI flash on Rockchip SoCs.
"""

and then have
"""
args = "-n", CONFIG_SYS_SOC, "-T", CONFIG_ROCKCHIP_SPI_IMAGE_TYPE;
"""

in rockchip-u-boot.dtsi instead?

I've missed those changes for other SoCs but did you explain why the SPI 
image is expected to start at offset 0x8000? We don't have that in 
rockchip-u-boot.dtsi by default, so offset 0 I assume.

Cheers,
Quentin


More information about the U-Boot mailing list