mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 3/4] ARM: at91: sama5d27-som1: branch to noinline function after stack setup
Date: Tue, 10 Mar 2020 09:03:25 +0100	[thread overview]
Message-ID: <20200310080326.21724-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200310080326.21724-1-a.fatoum@pengutronix.de>

We need to branch out as soon as possible after setting up the stack.
Do this and thereby avoid an access violation we now run into using
OSELAS.Toolchain-2019.09.1.

Fixes: 8bfb1852cf6a ("ARM: at91: add basic sama5d2-som1-ek1 support")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  * New patch. I observe a wrong value in the stack pointer when
    ek_turn_led is inlined.
---
 arch/arm/boards/sama5d27-som1/lowlevel.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/sama5d27-som1/lowlevel.c b/arch/arm/boards/sama5d27-som1/lowlevel.c
index 6907dcf812b5..62d35be9123d 100644
--- a/arch/arm/boards/sama5d27-som1/lowlevel.c
+++ b/arch/arm/boards/sama5d27-som1/lowlevel.c
@@ -65,14 +65,10 @@ static void ek_dbgu_init(void)
 
 extern char __dtb_z_at91_sama5d27_som1_ek_start[];
 
-ENTRY_FUNCTION(start_sama5d27_som1_ek, r0, r1, r2)
+static noinline void som1_entry(void)
 {
 	void *fdt;
 
-	arm_cpu_lowlevel_init();
-
-	arm_setup_stack(SAMA5D2_SRAM_BASE + SAMA5D2_SRAM_SIZE);
-
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		ek_dbgu_init();
 
@@ -81,3 +77,12 @@ ENTRY_FUNCTION(start_sama5d27_som1_ek, r0, r1, r2)
 	ek_turn_led(RGB_LED_GREEN);
 	barebox_arm_entry(SAMA5_DDRCS, SZ_128M, fdt);
 }
+
+ENTRY_FUNCTION(start_sama5d27_som1_ek, r0, r1, r2)
+{
+	arm_cpu_lowlevel_init();
+
+	arm_setup_stack(SAMA5D2_SRAM_BASE + SAMA5D2_SRAM_SIZE);
+
+	som1_entry();
+}
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-03-10  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  8:03 [PATCH v2 1/4] ARM: at91: add support for SAM9 SoC reset Ahmad Fatoum
2020-03-10  8:03 ` [PATCH v2 2/4] ARM: at91: sama5d27-som1: clean up lowlevel.c Ahmad Fatoum
2020-03-10  8:03 ` Ahmad Fatoum [this message]
2020-03-10  8:03 ` [PATCH v2 4/4] ARM: at91: add sama5d27-based Groboards Giant Board support Ahmad Fatoum
2020-03-11 15:07 ` [PATCH v2 1/4] ARM: at91: add support for SAM9 SoC reset 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=20200310080326.21724-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --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