diff mbox series

[meta-rockchip,1/2] rk356x: add support for upstream TF-A

Message ID 20240927-rk35-upstream-tf-a-v1-1-e3911342113f@cherry.de
State New
Headers show
Series rk35xx: add support for upstream TF-A | expand

Commit Message

Quentin Schulz Sept. 27, 2024, 12:59 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

Upstream TF-A > 2.11 (no release available yet) has initial support for
the RK3566 and RK3568. They both share the same code base.

This was not tested as I do not own RK356x boards.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 conf/machine/include/rk3566.inc                        |  3 +++
 conf/machine/include/rk3568.inc                        |  3 +++
 .../trusted-firmware-a/trusted-firmware-a_%.bbappend   | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+)
diff mbox series

Patch

diff --git a/conf/machine/include/rk3566.inc b/conf/machine/include/rk3566.inc
index 2522851..9454dba 100644
--- a/conf/machine/include/rk3566.inc
+++ b/conf/machine/include/rk3566.inc
@@ -20,4 +20,7 @@  PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
 UBOOT_SUFFIX ?= "itb"
 UBOOT_ENTRYPOINT ?= "0x06000000"
 
+TFA_PLATFORM = "rk3568"
+TFA_BUILD_TARGET = "bl31"
+
 ENABLE_STATELESS_VPU_GST ?= "1"
diff --git a/conf/machine/include/rk3568.inc b/conf/machine/include/rk3568.inc
index db188a3..a29546c 100644
--- a/conf/machine/include/rk3568.inc
+++ b/conf/machine/include/rk3568.inc
@@ -20,4 +20,7 @@  PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
 UBOOT_SUFFIX ?= "itb"
 UBOOT_ENTRYPOINT ?= "0x06000000"
 
+TFA_PLATFORM = "rk3568"
+TFA_BUILD_TARGET = "bl31"
+
 ENABLE_STATELESS_VPU_GST ?= "1"
diff --git a/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend b/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
index c9ad84c..7e155d7 100644
--- a/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
+++ b/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend
@@ -5,6 +5,8 @@  DEPENDS:append:rk3399 = " gcc-arm-none-eabi-native"
 COMPATIBLE_MACHINE:append:rk3399 = "|rk3399"
 COMPATIBLE_MACHINE:append:rk3328 = "|rk3328"
 COMPATIBLE_MACHINE:append:px30 = "|px30"
+COMPATIBLE_MACHINE:append:rk3566 = "|rk3566"
+COMPATIBLE_MACHINE:append:rk3568 = "|rk3568"
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
 SRC_URI += "\
@@ -31,4 +33,20 @@  fixup_baudrate:px30() {
 	sed -i "s/#define PX30_BAUDRATE\s\+.*/#define PX30_BAUDRATE ${RK_CONSOLE_BAUD}/" ${S}/plat/rockchip/px30/px30_def.h
 }
 
+# This is not a typo, rk3566 and rk3568 are supported by the same code base.
+fixup_baudrate:rk3566() {
+	sed -i "s/#define FPGA_BAUDRATE\s\+.*/#define FPGA_BAUDRATE ${RK_CONSOLE_BAUD}/" ${S}/plat/rockchip/rk3568/rk3568_def.h
+}
+
+fixup_baudrate:rk3568() {
+	sed -i "s/#define FPGA_BAUDRATE\s\+.*/#define FPGA_BAUDRATE ${RK_CONSOLE_BAUD}/" ${S}/plat/rockchip/rk3568/rk3568_def.h
+}
+
+# Only required for U-Boot configuration for which SPL_ATF_NO_PLATFORM_PARAM
+# symbol is enabled. This symbol is required for TF-A < 2.4-rc0, which is
+# unfortunately what Rockchip is using for their blob.
+# With upstream TF-A and SPL_ATF_NO_PLATFORM_PARAM disabled in U-Boot, TF-A will
+# get which console to use and at which baudrate from U-Boot directly.
+# If you use upstream U-Boot with SPL_ATF_NO_PLATFORM_PARAM disabled, you can
+# simply override this function to do nothing.
 do_patch[postfuncs] += "fixup_baudrate"