From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 8/9] arm: socfpga: agilex5: add agilex5_barebox_entry
Date: Thu, 16 Apr 2026 11:48:12 +0200 [thread overview]
Message-ID: <20260416-socfpga-agilex5-sdram-v1-8-07556aa7219f@pengutronix.de> (raw)
In-Reply-To: <20260416-socfpga-agilex5-sdram-v1-0-07556aa7219f@pengutronix.de>
Extract the SoC-specific lowlevel entry code from the board-specific
lowlevel entry code to make it reusable with other boards.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/boards/arrow-axe5-eagle/lowlevel.c | 40 +----------------------------
arch/arm/mach-socfpga/atf.c | 40 ++++++++++++++++++++++++++++-
include/mach/socfpga/generic.h | 2 +-
3 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/arch/arm/boards/arrow-axe5-eagle/lowlevel.c b/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
index 4817b3ec2d86..fae542e11e89 100644
--- a/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
+++ b/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
@@ -8,11 +8,6 @@
#include <mach/socfpga/debug_ll.h>
#include <mach/socfpga/init.h>
#include <mach/socfpga/generic.h>
-#include <mach/socfpga/mailbox_s10.h>
-#include <mach/socfpga/soc64-firewall.h>
-#include <mach/socfpga/soc64-regs.h>
-#include <mach/socfpga/soc64-sdram.h>
-#include <mach/socfpga/soc64-system-manager.h>
extern char __dtb_z_socfpga_agilex5_axe5_eagle_start[];
@@ -20,10 +15,6 @@ extern char __dtb_z_socfpga_agilex5_axe5_eagle_start[];
static noinline void axe5_eagle_continue(void)
{
- void *fdt;
- phys_addr_t membase;
- phys_size_t memsize;
-
agilex5_clk_init();
socfpga_uart_setup_ll();
@@ -49,36 +40,7 @@ static noinline void axe5_eagle_continue(void)
mdelay(1000);
writel(0x410, 0x10c03300);
- if (current_el() == 3) {
- agilex5_initialize_security_policies();
- pr_debug("Security policies initialized\n");
-
- /*
- * need to set the bank select enable before the
- * agilex5_ddr_init_full() otherwise the serial doesn't show
- * anything.
- */
- if (!IS_ENABLED(CONFIG_DEBUG_LL))
- writel(LCR_BKSE, SOCFPGA_UART0_ADDRESS + LCR);
- agilex5_ddr_init_full();
-
- socfpga_mailbox_s10_init();
- socfpga_mailbox_s10_qspi_open();
-
- agilex5_load_and_start_image_via_tfa();
- }
-
- fdt = __dtb_z_socfpga_agilex5_axe5_eagle_start;
-
- membase = agilex5_mpfe_sdram_base();
- memsize = agilex5_mpfe_sdram_size();
-
- if (membase < SOCFPGA_AGILEX5_DDR_BASE || memsize == 0) {
- pr_err("Invalid firewall configuration\n");
- hang();
- }
-
- barebox_arm_entry(membase, memsize, fdt);
+ agilex5_barebox_entry(__dtb_z_socfpga_agilex5_axe5_eagle_start);
}
ENTRY_FUNCTION_WITHSTACK(start_socfpga_agilex5_axe5_eagle, AXE5_STACKTOP, r0, r1, r2)
diff --git a/arch/arm/mach-socfpga/atf.c b/arch/arm/mach-socfpga/atf.c
index 3ad19e33ac94..e3461d01174e 100644
--- a/arch/arm/mach-socfpga/atf.c
+++ b/arch/arm/mach-socfpga/atf.c
@@ -7,9 +7,12 @@
#include <asm/barebox-arm.h>
#include <mach/socfpga/atf.h>
#include <mach/socfpga/generic.h>
+#include <mach/socfpga/mailbox_s10.h>
#include <mach/socfpga/soc64-regs.h>
+#include <mach/socfpga/soc64-sdram.h>
+#include <mach/socfpga/soc64-system-manager.h>
-void __noreturn agilex5_load_and_start_image_via_tfa(void)
+static void __noreturn agilex5_load_and_start_image_via_tfa(void)
{
void *bl31 = (void *)AGILEX5_ATF_BL31_BASE_ADDR;
void *bl33 = (void *)AGILEX5_ATF_BL33_BASE_ADDR;
@@ -33,3 +36,38 @@ void __noreturn agilex5_load_and_start_image_via_tfa(void)
bl31_entry((uintptr_t)bl31, 0, (uintptr_t)bl33, 0);
__builtin_unreachable();
}
+
+void __noreturn agilex5_barebox_entry(void *fdt)
+{
+ phys_addr_t membase;
+ phys_size_t memsize;
+
+ if (current_el() == 3) {
+ agilex5_initialize_security_policies();
+ pr_debug("Security policies initialized\n");
+
+ /*
+ * need to set the bank select enable before the
+ * agilex5_ddr_init_full() otherwise the serial doesn't show
+ * anything.
+ */
+ if (!IS_ENABLED(CONFIG_DEBUG_LL))
+ writel(LCR_BKSE, SOCFPGA_UART0_ADDRESS + LCR);
+ agilex5_ddr_init_full();
+
+ socfpga_mailbox_s10_init();
+ socfpga_mailbox_s10_qspi_open();
+
+ agilex5_load_and_start_image_via_tfa();
+ }
+
+ membase = agilex5_mpfe_sdram_base();
+ memsize = agilex5_mpfe_sdram_size();
+
+ if (membase < SOCFPGA_AGILEX5_DDR_BASE || memsize == 0) {
+ pr_err("Invalid firewall configuration\n");
+ hang();
+ }
+
+ barebox_arm_entry(membase, memsize, fdt);
+}
diff --git a/include/mach/socfpga/generic.h b/include/mach/socfpga/generic.h
index 06768e9ec0a0..6c99a17e81f1 100644
--- a/include/mach/socfpga/generic.h
+++ b/include/mach/socfpga/generic.h
@@ -100,7 +100,7 @@ static inline void arria10_watchdog_disable(void) {}
#endif
int agilex5_clk_init(void);
-void __noreturn agilex5_load_and_start_image_via_tfa(void);
+void __noreturn agilex5_barebox_entry(void *fdt);
static inline void __udelay(unsigned us)
{
--
2.47.3
next prev parent reply other threads:[~2026-04-16 9:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 9:48 [PATCH 0/9] arm: socfpga: agilex5: rework low level code Michael Tretter
2026-04-16 9:48 ` [PATCH 1/9] arm: socfpga: agilex5: cleanup TF-A loading Michael Tretter
2026-04-16 9:48 ` [PATCH 2/9] arm: socfgpa: agilex5: remove unused memsize Michael Tretter
2026-04-16 9:48 ` [PATCH 3/9] arm: socfpga: agilex5: configure firewall with base and size Michael Tretter
2026-04-16 9:48 ` [PATCH 4/9] arm: socfpga: agilex5: fix read of memory limit Michael Tretter
2026-04-16 9:48 ` [PATCH 5/9] arm: socfpga: agilex5: fix SDRAM size calculation Michael Tretter
2026-04-16 9:48 ` [PATCH 6/9] arm: socfpga: agilex5: remove unused declarations Michael Tretter
2026-04-16 9:48 ` [PATCH 7/9] arm: socfpga: agilex5: read SDRAM limits from firewall Michael Tretter
2026-04-16 9:48 ` Michael Tretter [this message]
2026-04-16 9:48 ` [PATCH 9/9] arm: socfpga: agilex5: add explicit unreachable after TF-A load Michael Tretter
2026-04-17 8:25 ` [PATCH 0/9] arm: socfpga: agilex5: rework low level code 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=20260416-socfpga-agilex5-sdram-v1-8-07556aa7219f@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=s.trumtrar@pengutronix.de \
/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