mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: [PATCH] ARM: rockchip: make ATF installation optional
Date: Mon,  9 Jan 2023 19:00:24 +0100	[thread overview]
Message-ID: <20230109180024.2018960-1-ahmad@a3f.at> (raw)

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@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




             reply	other threads:[~2023-01-09 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 18:00 Ahmad Fatoum [this message]
2023-01-10 14:37 ` 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=20230109180024.2018960-1-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /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