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 <jo...@kwiboo.se>
---
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    |  4 ++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 54f894dab841..58f8c7a35335 100644
--- a/Makefile
+++ b/Makefile
@@ -1335,6 +1335,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..4a5415403446 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -377,6 +377,10 @@ config TPL_ROCKCHIP_BACK_TO_BROM
           SPL will return to the boot rom, which will then load the U-Boot
           binary to keep going on.
 
+config ROCKCHIP_EXTERNAL_TPL
+       bool "Use external TPL binary"
+       default y if ROCKCHIP_RK3568
+
 config ROCKCHIP_COMMON_BOARD
        bool "Rockchip common board file"
        help
-- 
2.39.1

Reply via email to