[PATCH v1 5/5] optee: Support Rockchip OPTEE binaries

Alex Bee knaerzche at gmail.com
Sun Jul 16 10:10:34 CEST 2023


Currently the only ARM Rockchip SoC which is supported by upstream
optee-os is RK322x. For all other ARM SoCs a
vendor-provided OP-TEE binary has to be used to have a TEE available.
Those are using a calling convension different from upstream optee-os.

This introduces CONFIG_ROCKCHIP_OPTEE_BINARY which signals that any
of those vendor binaries is used and changes the calling convension
accordingly.

Signed-off-by: Alex Bee <knaerzche at gmail.com>
---
 arch/arm/mach-rockchip/Kconfig | 9 +++++++++
 common/spl/spl_optee.S         | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 9f12524aeb..41a9c4fe95 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -449,6 +449,15 @@ config ROCKCHIP_BOOT_MODE_REG
 	  The Soc will enter to different boot mode(defined in asm/arch-rockchip/boot_mode.h)
 	  according to the value from this register.
 
+config ROCKCHIP_OPTEE_BINARY
+	bool "Use a OP-TEE binary provided by Rockchip"
+	depends on SPL_FIT && SPL_OPTEE_IMAGE
+	default y if ROCKCHIP_RK3036 || ROCKCHIP_RK3128 || ROCKCHIP_RK3288
+	help
+	  This option enables the usage of vendor-provided OP-TEE binaries.
+
+	  Say Y if you are using OP-TEE binary provided by Rockchip.
+
 config ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON
 	bool "Disable device boot on power plug-in"
 	depends on PMIC_RK8XX
diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S
index a269904d38..ea41d8adb6 100644
--- a/common/spl/spl_optee.S
+++ b/common/spl/spl_optee.S
@@ -7,6 +7,10 @@
 #include <asm/assembler.h>
 
 ENTRY(spl_optee_entry)
+#ifdef CONFIG_ROCKCHIP_OPTEE_BINARY
+	ldr r1, =CONFIG_TEXT_BASE
+#else
 	ldr lr, =CONFIG_TEXT_BASE
+#endif
 	mov pc, r3
 ENDPROC(spl_optee_entry)
-- 
2.41.0



More information about the U-Boot mailing list