Judging by the addresses used for locating OP-TEE, the OP-TEE support in
barebox could never have worked. This is also Sascha's recollection.

Follow-up patches will fix this, but lets set the stage by cleaning
up first and the future OP-TEE support for Rockchip:

  - Have a single single option for OP-TEE support instead of one per SoC
  - Rename the binaries to end in -bl32.bin, like they do on i.MX

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 Documentation/boards/rockchip.rst |  2 +-
 arch/arm/mach-rockchip/Kconfig    | 14 ++++----------
 arch/arm/mach-rockchip/atf.c      |  8 ++++----
 firmware/Makefile                 | 11 ++++++++---
 4 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/Documentation/boards/rockchip.rst 
b/Documentation/boards/rockchip.rst
index aa2febc8ebe8..2d2e0572dd8f 100644
--- a/Documentation/boards/rockchip.rst
+++ b/Documentation/boards/rockchip.rst
@@ -76,7 +76,7 @@ The build process needs three binary files which have to be 
copied from the
 .. code-block:: sh
 
   cp $RKBIN/bin/rk35/rk3568_bl31_v1.34.elf firmware/rk3568-bl31.bin
-  cp $RKBIN/bin/rk35/rk3568_bl32_v2.08.bin firmware/rk3568-op-tee.bin
+  cp $RKBIN/bin/rk35/rk3568_bl32_v2.08.bin firmware/rk3568-bl32.bin
   cp $RKBIN/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin 
arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
 
 With these barebox can be compiled as:
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ddaab7c28414..4069ad4ca138 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -135,18 +135,12 @@ config ARCH_ROCKCHIP_ATF
          useful for debugging early startup, but for all other cases,
          say y here.
 
-config ARCH_RK3399_OPTEE
-       bool "Build rk3399 OP-TEE binary into barebox"
+config ARCH_ROCKCHIP_OPTEE
+       bool "Build rockchip OP-TEE binary into barebox"
        depends on ARCH_ROCKCHIP_ATF && ARCH_RK3399
+       select PBL_OPTEE
        help
-         With this option enabled the RK3399 OP-TEE binary is compiled
-         into barebox and started along with the BL31 trusted firmware.
-
-config ARCH_RK3568_OPTEE
-       bool "Build rk3568 OP-TEE binary into barebox"
-       depends on ARCH_ROCKCHIP_ATF && ARCH_RK3568
-       help
-         With this option enabled the RK3568 OP-TEE binary is compiled
+         With this option enabled the OP-TEE binary is compiled
          into barebox and started along with the BL31 trusted firmware.
 
 endmenu
diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index eaba209ff32d..1e1861191c99 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -49,7 +49,7 @@ static unsigned long load_elf64_image_phdr(const void *elf)
                                                                                
\
        bl31 = load_elf64_image_phdr(bl31_elf);                                 
\
                                                                                
\
-       if (IS_ENABLED(CONFIG_ARCH_##SOC##_OPTEE)) {                            
\
+       if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP_OPTEE)) {                           
\
                optee_load_address = SOC##_OPTEE_LOAD_ADDRESS;                  
\
                                                                                
\
                get_builtin_firmware(tee_bin, &optee, &optee_size);             
\
@@ -68,12 +68,12 @@ static unsigned long load_elf64_image_phdr(const void *elf)
 
 void rk3399_atf_load_bl31(void *fdt)
 {
-       rockchip_atf_load_bl31(RK3399, rk3399_bl31_bin, rk3399_op_tee_bin, fdt);
+       rockchip_atf_load_bl31(RK3399, rk3399_bl31_bin, rk3399_bl32_bin, fdt);
 }
 
 void rk3568_atf_load_bl31(void *fdt)
 {
-       rockchip_atf_load_bl31(RK3568, rk3568_bl31_bin, rk3568_op_tee_bin, fdt);
+       rockchip_atf_load_bl31(RK3568, rk3568_bl31_bin, rk3568_bl32_bin, fdt);
 }
 
 void __noreturn rk3568_barebox_entry(void *fdt)
@@ -107,7 +107,7 @@ void __noreturn rk3568_barebox_entry(void *fdt)
 
 void rk3588_atf_load_bl31(void *fdt)
 {
-       rockchip_atf_load_bl31(RK3588, rk3588_bl31_bin, rk3588_op_tee_bin, fdt);
+       rockchip_atf_load_bl31(RK3588, rk3588_bl31_bin, rk3588_bl32_bin, fdt);
 }
 
 void __noreturn rk3588_barebox_entry(void *fdt)
diff --git a/firmware/Makefile b/firmware/Makefile
index fd63de1c559d..2f47e04bee41 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -24,11 +24,16 @@ fw-external-$(CONFIG_FIRMWARE_IMX93_OPTEE) += 
imx93-bl32.bin \
                                              mx93a0-ahab-container.img \
                                              mx93a1-ahab-container.img
 pbl-firmware-$(CONFIG_ARCH_RK3568) += rk3568-bl31.bin
-pbl-firmware-$(CONFIG_ARCH_RK3568_OPTEE) += rk3568-op-tee.bin
 pbl-firmware-$(CONFIG_ARCH_RK3588) += rk3588-bl31.bin
-pbl-firmware-$(CONFIG_ARCH_RK3588_OPTEE) += rk3588-op-tee.bin
 pbl-firmware-$(CONFIG_ARCH_RK3399) += rk3399-bl31.bin
-pbl-firmware-$(CONFIG_ARCH_RK3399_OPTEE) += rk3399-op-tee.bin
+ifeq ($(CONFIG_ARCH_ROCKCHIP_OPTEE),y)
+# We install BL31 & BL32 while already running in DRAM,
+# so fw-external is not needed
+pbl-firmware-$(CONFIG_ARCH_RK3568) += rk3568-bl32.bin
+pbl-firmware-$(CONFIG_ARCH_RK3588) += rk3588-bl32.bin
+pbl-firmware-$(CONFIG_ARCH_RK3399) += rk3399-bl32.bin
+endif
+
 firmware-$(CONFIG_DRIVER_NET_FSL_FMAN) += 
fsl_fman_ucode_ls1046_r1.0_106_4_18.bin
 
 fw-external-$(CONFIG_FIRMWARE_LS1028A_ATF) += ls1028a-bl31.bin
-- 
2.39.5


Reply via email to