[PATCH v5 2/6] rockchip: Use an external TPL binary on RK3568

Jonas Karlman jonas at kwiboo.se
Tue Feb 28 21:56:35 CET 2023


On 2023-02-28 10:19, Jagan Teki wrote:
> On Sun, 26 Feb 2023 at 00:31, Jonas Karlman <jonas at kwiboo.se> wrote:
>>
>> Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
>> back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
>> jumps to U-Boot SPL to continue the normal boot flow.
>>
>> However, there is no support to initialize DRAM on RK35xx SoCs using
>> U-Boot TPL and instead an external TPL binary must be used to generate a
>> bootable u-boot-rockchip.bin image.
>>
>> Add CONFIG_ROCKCHIP_EXTERNAL_TPL to indicate that an external TPL should
>> be used. Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
>> bootable u-boot-rockchip.bin image for RK3568.
>>
>> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>> Reviewed-by: Kever Yang <kever.yang at rock-chips.com>
>> Tested-by: Eugen Hristev <eugen.hristev at collabora.com>
>> ---
>> v5:
>> - No change
>>
>> v4:
>> - No change
>>
>> v3:
>> - Add help text to Kconfig option
>> - Add build step for rk3568 to documentation
>> - Collect r-b and t-b tags
>>
>> v2:
>> - Rename external-tpl-path to rockchip-tpl-path
>> - Rename EXTERNAL_TPL to ROCKCHIP_TPL
>> - Add CONFIG_ROCKCHIP_EXTERNAL_TPL option
>>
>>  Makefile                          |  1 +
>>  arch/arm/dts/rockchip-u-boot.dtsi | 10 ++++++++--
>>  arch/arm/mach-rockchip/Kconfig    |  8 ++++++++
>>  doc/board/rockchip/rockchip.rst   | 11 +++++++++++
>>  4 files changed, 28 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index bc1ee94fb74e..67701f20eb6d 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1336,6 +1336,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
>>                 -a opensbi-path=${OPENSBI} \
>>                 -a default-dt=$(default_dt) \
>>                 -a scp-path=$(SCP) \
>> +               -a rockchip-tpl-path=$(ROCKCHIP_TPL) \
>>                 -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
>>                 -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
>>                 -a spl-dtb=$(CONFIG_SPL_OF_REAL) \
>> diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
>> index 6c662a72d4f9..2878b80926c4 100644
>> --- a/arch/arm/dts/rockchip-u-boot.dtsi
>> +++ b/arch/arm/dts/rockchip-u-boot.dtsi
>> @@ -20,9 +20,12 @@
>>                 mkimage {
>>                         filename = "idbloader.img";
>>                         args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
>> -#ifdef CONFIG_TPL
>>                         multiple-data-files;
>>
>> +#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
>> +                       rockchip-tpl {
>> +                       };
>> +#elif defined(CONFIG_TPL)
>>                         u-boot-tpl {
>>                         };
>>  #endif
>> @@ -134,9 +137,12 @@
>>                 mkimage {
>>                         filename = "idbloader-spi.img";
>>                         args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
>> -#ifdef CONFIG_TPL
>>                         multiple-data-files;
>>
>> +#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
>> +                       rockchip-tpl {
>> +                       };
>> +#elif defined(CONFIG_TPL)
>>                         u-boot-tpl {
>>                         };
>>  #endif
>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
>> index b678ec41318e..0b191b364264 100644
>> --- a/arch/arm/mach-rockchip/Kconfig
>> +++ b/arch/arm/mach-rockchip/Kconfig
>> @@ -401,6 +401,14 @@ config TPL_ROCKCHIP_COMMON_BOARD
>>           common board is a basic TPL board init which can be shared for most
>>           of SoCs to avoid copy-paste for different SoCs.
>>
>> +config ROCKCHIP_EXTERNAL_TPL
>> +       bool "Use external TPL binary"
>> +       default y if ROCKCHIP_RK3568
> 
> Can you add RK3588 as well.

I will send a separate patch to enable this for RK3588.

Regards,
Jonas

> 
> With that,
> 
> Reviewed-by: Jagan Teki <jagan at edgeble.ai>



More information about the U-Boot mailing list