[PATCH] ARM: rockchip: make ATF installation optional

Ahmad Fatoum ahmad at a3f.at
Mon Jan 9 10:00:24 PST 2023


On RK3399, ATF running as BL31 will disable normal world access to
some peripherals. To make it easier to develop PBL code that accesses
these peripherals prior to ATF installation, support running barebox
proper in EL3, so all of memory can be poked from the barebox shell.

This is strictly a development feature. Linux on ARM64 is not meant to
be booted without PSCI, which the secure monitor provides.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 arch/arm/mach-rockchip/Kconfig            | 13 +++++++++++--
 arch/arm/mach-rockchip/Makefile           |  2 +-
 arch/arm/mach-rockchip/include/mach/atf.h |  5 +++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 1f3ba706ee9f..4ac75ab9475c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -88,16 +88,25 @@ config MACH_RADXA_ROCK3
 
 comment "select board features:"
 
+config ARCH_ROCKCHIP_ATF
+	bool "Build rockchip ATF binaries into barebox"
+	depends on ARCH_ROCKCHIP_V8
+	default y
+	help
+	  When deselected, barebox proper will run in EL3. This can be
+	  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"
-	depends on ARCH_RK3399
+	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3399
 	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_RK3568
+	depends on ARCH_ROCKCHIP_ATF && ARCH_RK3568
 	help
 	  With this option enabled the RK3568 OP-TEE binary is compiled
 	  into barebox and started along with the BL31 trusted firmware.
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index a86ee71617c8..2529af7c7e97 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_ATF) += atf.o
 obj-$(CONFIG_ARCH_RK3188) += rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += rk3288.o
 obj-pbl-$(CONFIG_ARCH_RK3568) += rk3568.o
diff --git a/arch/arm/mach-rockchip/include/mach/atf.h b/arch/arm/mach-rockchip/include/mach/atf.h
index d1bae5a7714f..e5d55af3d74a 100644
--- a/arch/arm/mach-rockchip/include/mach/atf.h
+++ b/arch/arm/mach-rockchip/include/mach/atf.h
@@ -19,8 +19,13 @@
 #define RK3568_BAREBOX_LOAD_ADDRESS	(RK3568_DRAM_BOTTOM + 1024*1024)
 
 #ifndef __ASSEMBLY__
+#ifdef CONFIG_ARCH_ROCKCHIP_ATF
 void rk3399_atf_load_bl31(void *fdt);
 void rk3568_atf_load_bl31(void *fdt);
+#else
+static inline void rk3399_atf_load_bl31(void *fdt) { }
+static inline void rk3568_atf_load_bl31(void *fdt) { }
+#endif
 #endif
 
 #endif /* __MACH_ATF_H */
-- 
2.38.1




More information about the barebox mailing list