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 2/4] ARM: at91: sama5d27-som1: clean up lowlevel.c
Date: Tue, 10 Mar 2020 09:03:24 +0100	[thread overview]
Message-ID: <20200310080326.21724-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200310080326.21724-1-a.fatoum@pengutronix.de>

In ARM, stack decrements before storing values, so decrementing a number
from the stack base is unnecessary. Existing instances of this were
removed in 6b3dc4abd8 ("ARM: Cleanup stack offset cargo cult"), but the
sama5d27-som1 board was added later than that. Fix the cargo cult here
as well and while at it, turn a macro that doesn't need to be one
into a static inline function.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  * New patch for issues raised by Sam against the giant board
    lowlevel.c
---
 arch/arm/boards/sama5d27-som1/lowlevel.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/sama5d27-som1/lowlevel.c b/arch/arm/boards/sama5d27-som1/lowlevel.c
index 7df5a4772d0b..6907dcf812b5 100644
--- a/arch/arm/boards/sama5d27-som1/lowlevel.c
+++ b/arch/arm/boards/sama5d27-som1/lowlevel.c
@@ -22,8 +22,10 @@
 /* PCK = 492MHz, MCK = 164MHz */
 #define MASTER_CLOCK	164000000
 
-#define sama5d2_pmc_enable_periph_clock(clk) \
-	at91_pmc_sam9x5_enable_periph_clock(IOMEM(SAMA5D2_BASE_PMC), clk)
+static inline void sama5d2_pmc_enable_periph_clock(int clk)
+{
+	at91_pmc_sam9x5_enable_periph_clock(IOMEM(SAMA5D2_BASE_PMC), clk);
+}
 
 static void ek_turn_led(unsigned color)
 {
@@ -69,7 +71,7 @@ ENTRY_FUNCTION(start_sama5d27_som1_ek, r0, r1, r2)
 
 	arm_cpu_lowlevel_init();
 
-	arm_setup_stack(SAMA5D2_SRAM_BASE + SAMA5D2_SRAM_SIZE - 16);
+	arm_setup_stack(SAMA5D2_SRAM_BASE + SAMA5D2_SRAM_SIZE);
 
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		ek_dbgu_init();
-- 
2.25.1


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

  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 ` Ahmad Fatoum [this message]
2020-03-10  8:03 ` [PATCH v2 3/4] ARM: at91: sama5d27-som1: branch to noinline function after stack setup Ahmad Fatoum
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-2-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