[PATCH v2 3/4] rockchip: rk3576: Add SPI Flash boot support
Quentin Schulz
quentin.schulz at cherry.de
Mon Aug 11 11:59:33 CEST 2025
Hi Jonas,
On 8/1/25 11:06 PM, Jonas Karlman wrote:
> The bootsource ids reported by BootROM of RK3576 for SPI NOR and USB
> differs slightly compared to prior SoCs:
>
> - Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
> - Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
> - Booting from sfc1 M0 has not been tested (no board using this config).
> - Booting from USB report a new bootsource id 0x81.
>
> Add a RK3576 specific read_brom_bootsource_id() function to help decode
> the new bootsource id values and the required boot_devices mapping of
> sfc0 and sfc1 to help support booting from SPI flash on RK3576.
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
> v2: No change
> ---
> arch/arm/dts/rk3576-u-boot.dtsi | 36 ++++++++++++++++++++++++++
> arch/arm/mach-rockchip/rk3576/rk3576.c | 23 ++++++++++++++++
> 2 files changed, 59 insertions(+)
>
> diff --git a/arch/arm/dts/rk3576-u-boot.dtsi b/arch/arm/dts/rk3576-u-boot.dtsi
> index fb5a107f47d9..c7ed09e03eec 100644
> --- a/arch/arm/dts/rk3576-u-boot.dtsi
> +++ b/arch/arm/dts/rk3576-u-boot.dtsi
> @@ -6,6 +6,11 @@
> #include "rockchip-u-boot.dtsi"
>
> / {
> + aliases {
> + spi5 = &sfc0;
> + spi6 = &sfc1;
> + };
> +
> chosen {
> u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
> };
> @@ -16,6 +21,17 @@
> };
> };
>
> +#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
> +&binman {
> + simple-bin-spi {
> + mkimage {
> + args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
> + offset = <0x8000>;
Is this a requirement of the SoC or just a default?
E.g. on my RK3399 I can flash at offset 0 u-boot-rockchip-spi.bin and
it'll happily boot. Is it still the same on RK3576 but you preferred to
have a similar offset than for eMMC/SD (and/or have space to store a
partition table before?)
> + };
> + };
> +};
> +#endif
Not a blocker for this patch but I think it would make sense to invert
the logic globally now so that we don't need to have to do this for
every new Rockchip SoC we'll support.
Have -T rksd in rockchip-u-boot.dtsi and all SoCs that have an SPI
controller and do not override this property would have -T rkspi set in
their SoC DTSI, e.g. rk3399-u-boot.dtsi would now get
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+&binman {
+ simple-bin-spi {
+ mkimage {
+ args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
+ };
+ };
+};
+#endif
Cheers,
Quentin
More information about the U-Boot
mailing list