mail archive of the barebox mailing list
 help / color / mirror / Atom feed
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 2/2] arm: socfpga: agilex5: add helper for entry function
Date: Wed, 13 May 2026 14:22:23 +0200	[thread overview]
Message-ID: <20260513-socfpga-agilex5-entry-v1-2-090758694c88@pengutronix.de> (raw)
In-Reply-To: <20260513-socfpga-agilex5-entry-v1-0-090758694c88@pengutronix.de>

The entry function is useful for all Agilex 5 based boards and its easy
to get the stack location wrong.

Add a helper function that does the right thing for Agilex 5 and avoid
defining the stack location for every board.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/boards/arrow-axe5-eagle/lowlevel.c | 13 ++-----------
 include/mach/socfpga/barebox-arm.h          | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/arrow-axe5-eagle/lowlevel.c b/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
index b5a56a1a8c5f..de5a14b2d503 100644
--- a/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
+++ b/arch/arm/boards/arrow-axe5-eagle/lowlevel.c
@@ -5,23 +5,14 @@
 #include <asm/barebox-arm.h>
 #include <asm/system.h>
 #include <pbl.h>
+#include <mach/socfpga/barebox-arm.h>
 #include <mach/socfpga/debug_ll.h>
 #include <mach/socfpga/init.h>
 #include <mach/socfpga/generic.h>
-#include <mach/socfpga/soc64-handoff.h>
 #include <mach/socfpga/soc64-regs.h>
 
 extern char __dtb_z_socfpga_agilex5_axe5_eagle_start[];
 
-/*
- * The SDM firmware uses the last page in the OCRAM for handoff data. Put the
- * stack below the handoff data.
- *
- * Note: U-Boot puts the stack at 0x71000 (0x80000 - 0xf000) and reserves even
- * more space.
- */
-#define AXE5_STACKTOP SOC64_HANDOFF_BASE
-
 static noinline void axe5_eagle_continue(void)
 {
 	agilex5_clk_init();
@@ -52,7 +43,7 @@ static noinline void axe5_eagle_continue(void)
 	agilex5_barebox_entry(__dtb_z_socfpga_agilex5_axe5_eagle_start);
 }
 
-ENTRY_FUNCTION_WITHSTACK(start_socfpga_agilex5_axe5_eagle, AXE5_STACKTOP, r0, r1, r2)
+ENTRY_FUNCTION_AGILEX5(start_socfpga_agilex5_axe5_eagle)
 {
 	if (current_el() == 3)
 		socfpga_agilex5_cpu_lowlevel_init();
diff --git a/include/mach/socfpga/barebox-arm.h b/include/mach/socfpga/barebox-arm.h
new file mode 100644
index 000000000000..60c9ddabea23
--- /dev/null
+++ b/include/mach/socfpga/barebox-arm.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef SOCFPGA_BAREBOX_ARM_H_
+#define SOCFPGA_BAREBOX_ARM_H_
+
+#include <asm/barebox-arm.h>
+#include <mach/socfpga/soc64-handoff.h>
+
+/*
+ * The SDM firmware uses the last page in the OCRAM for handoff data. Put the
+ * stack below the handoff data.
+ *
+ * Note: U-Boot puts the stack at 0x71000 (0x80000 - 0xf000) and reserves even
+ * more space.
+ */
+#define AGILEX5_STACKTOP SOC64_HANDOFF_BASE
+
+#define ENTRY_FUNCTION_AGILEX5(name)					\
+	ENTRY_FUNCTION_WITHSTACK(name, AGILEX5_STACKTOP, r0, r1, r2)
+
+#endif

-- 
2.47.3




  parent reply	other threads:[~2026-05-13 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 12:22 [PATCH 0/2] arm: socfpga: agilex5: fix stack in " Michael Tretter
2026-05-13 12:22 ` [PATCH 1/2] arm: socfpga: axe5-eagle: fix stack location Michael Tretter
2026-05-13 12:22 ` Michael Tretter [this message]
2026-05-13 14:07 ` [PATCH 0/2] arm: socfpga: agilex5: fix stack in entry function 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=20260513-socfpga-agilex5-entry-v1-2-090758694c88@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