mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Robin van der Gracht <robin@protonic.nl>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/6] firmware: rockchip: rename from rk3xxx-op-tee.bin to rk3xxx-bl32.bin
Date: Wed,  6 Nov 2024 19:57:19 +0100	[thread overview]
Message-ID: <20241106185724.2526-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241106185724.2526-1-a.fatoum@pengutronix.de>

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 <a.fatoum@pengutronix.de>
---
 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	other threads:[~2024-11-06 19:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 18:57 [PATCH 0/6] ARM: Rockchip: fix OP-TEE as BL32 installation Ahmad Fatoum
2024-11-06 18:57 ` Ahmad Fatoum [this message]
2024-11-06 22:13   ` [PATCH] fixup! firmware: rockchip: rename from rk3xxx-op-tee.bin to rk3xxx-bl32.bin Ahmad Fatoum
2024-11-06 18:57 ` [PATCH 2/6] ARM: lds: move stack top section to front of rodata Ahmad Fatoum
2024-11-06 18:57 ` [PATCH 3/6] ARM: Rockchip: fix clang warning about passing 32-bit register operand Ahmad Fatoum
2024-11-07  8:42   ` Marco Felsch
2024-11-07  8:48     ` Ahmad Fatoum
2024-11-06 18:57 ` [PATCH 4/6] ARM: Rockchip: save pointer to scratch memory in global variable Ahmad Fatoum
2024-11-06 18:57 ` [PATCH 5/6] ARM: Rockchip: implement tee.bin v1 header parsing Ahmad Fatoum
2024-11-06 18:57 ` [PATCH 6/6] ARM: Rockchip: use vendor blob OPTEE load addresses Ahmad Fatoum
2024-11-08 10:20 ` [PATCH 0/6] ARM: Rockchip: fix OP-TEE as BL32 installation Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241106185724.2526-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robin@protonic.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox