mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 26/28] ARM i.MX: Use SRAM stack in lowlevel code
Date: Wed, 17 Oct 2012 23:03:35 +0200	[thread overview]
Message-ID: <1350507817-7819-27-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1350507817-7819-1-git-send-email-s.hauer@pengutronix.de>

Several i.MX boards setup a temporary stack in their lowlevel code.
Instead of using STACK_BASE use a stack in internal SRAM to get rid
of the STACK_BASE compile time dependency.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/eukrea_cpuimx25/lowlevel.c             |    2 +-
 arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S        |    3 ++-
 arch/arm/boards/eukrea_cpuimx35/lowlevel.c             |    2 +-
 arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S |    3 ++-
 arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S |    3 ++-
 arch/arm/boards/guf-cupid/lowlevel.c                   |    2 +-
 arch/arm/boards/guf-neso/lowlevel.c                    |    2 +-
 arch/arm/boards/imx21ads/lowlevel_init.S               |    3 ++-
 arch/arm/boards/karo-tx25/lowlevel.c                   |    2 +-
 arch/arm/boards/pcm038/lowlevel.c                      |    2 +-
 arch/arm/boards/pcm043/lowlevel.c                      |    2 +-
 arch/arm/mach-imx/include/mach/imx21-regs.h            |    1 +
 arch/arm/mach-imx/include/mach/imx25-regs.h            |    3 +++
 arch/arm/mach-imx/include/mach/imx27-regs.h            |    1 +
 14 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
index d08e494..a2ecbbf 100644
--- a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
@@ -36,7 +36,7 @@ static void __bare_init __naked insdram(void)
 	uint32_t r;
 
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
index 08659e0..0b39562 100644
--- a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
+++ b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
@@ -124,7 +124,8 @@ reset:
 	sdram_init
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12	/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SDRAM */
+	ldr	sp, =MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 4;
 
 	ldr	r0, =MX27_NFC_BASE_ADDR		/* start of NFC SRAM                */
 	ldr	r2, =MX27_NFC_BASE_ADDR + 0x1000	/* end of NFC SRAM                  */
diff --git a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
index f95459a..5d56f9d 100644
--- a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
@@ -47,7 +47,7 @@ static void __bare_init __naked insdram(void)
 	writel(r, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
index 425cf99..3a307fd 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
@@ -98,7 +98,8 @@ reset:
 	str r3, [r0, #0x30]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12 /* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SRAM */
+	ldr	sp, =MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 4
 
 	ldr	r0, =MX25_NFC_BASE_ADDR		/* start of NFC SRAM                */
 	ldr	r2, =MX25_NFC_BASE_ADDR + 0x1000	/* end of NFC SRAM                  */
diff --git a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
index f36a44a..f69951c 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
@@ -155,7 +155,8 @@ reset:
 	str	r3, [r0, #0x30]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12		/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in internal SRAM */
+	ldr	sp, =MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 4
 
 	ldr	r0, =MX35_NFC_BASE_ADDR		/* start of NFC SRAM */
 	ldr	r2, =MX35_NFC_BASE_ADDR + 0x800	/* end of NFC SRAM */
diff --git a/arch/arm/boards/guf-cupid/lowlevel.c b/arch/arm/boards/guf-cupid/lowlevel.c
index e8ac9a3..d19fa3a 100644
--- a/arch/arm/boards/guf-cupid/lowlevel.c
+++ b/arch/arm/boards/guf-cupid/lowlevel.c
@@ -54,7 +54,7 @@ static void __bare_init __naked insdram(void)
 	writel(r, MX35_CCM_BASE_ADDR + CCM_PDR4);
 
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/guf-neso/lowlevel.c b/arch/arm/boards/guf-neso/lowlevel.c
index 55f0475..3e0d55d 100644
--- a/arch/arm/boards/guf-neso/lowlevel.c
+++ b/arch/arm/boards/guf-neso/lowlevel.c
@@ -34,7 +34,7 @@
 static void __bare_init __naked insdram(void)
 {
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/imx21ads/lowlevel_init.S b/arch/arm/boards/imx21ads/lowlevel_init.S
index a46dafe..e2b013e 100644
--- a/arch/arm/boards/imx21ads/lowlevel_init.S
+++ b/arch/arm/boards/imx21ads/lowlevel_init.S
@@ -119,7 +119,8 @@ reset:
 	str	r1, [r0]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12	/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SRAM */
+	ldr	sp, =MX21_IRAM_BASE_ADDR + MX21_IRAM_SIZE - 4
 
 	ldr	r0, =MX21_NFC_BASE_ADDR		/* start of NFC SRAM        */
 	ldr	r2, =MX21_NFC_BASE_ADDR + 0x800	/* end of NFC SRAM          */
diff --git a/arch/arm/boards/karo-tx25/lowlevel.c b/arch/arm/boards/karo-tx25/lowlevel.c
index 9223a82..e012f82 100644
--- a/arch/arm/boards/karo-tx25/lowlevel.c
+++ b/arch/arm/boards/karo-tx25/lowlevel.c
@@ -34,7 +34,7 @@ static void __bare_init __naked insdram(void)
 	uint32_t r;
 
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/pcm038/lowlevel.c b/arch/arm/boards/pcm038/lowlevel.c
index b2a47ac..c5d2190 100644
--- a/arch/arm/boards/pcm038/lowlevel.c
+++ b/arch/arm/boards/pcm038/lowlevel.c
@@ -35,7 +35,7 @@
 static void __bare_init __naked insdram(void)
 {
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/boards/pcm043/lowlevel.c b/arch/arm/boards/pcm043/lowlevel.c
index a99fe74..0ab6a5b 100644
--- a/arch/arm/boards/pcm043/lowlevel.c
+++ b/arch/arm/boards/pcm043/lowlevel.c
@@ -52,7 +52,7 @@ static void __bare_init __naked insdram(void)
 	writel(r, MX35_CCM_BASE_ADDR + CCM_PDR4);
 
 	/* setup a stack to be able to call imx_nand_load_image() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx_nand_load_image(_text, barebox_image_size);
 
diff --git a/arch/arm/mach-imx/include/mach/imx21-regs.h b/arch/arm/mach-imx/include/mach/imx21-regs.h
index 1c4b550..fbbb2eb 100644
--- a/arch/arm/mach-imx/include/mach/imx21-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx21-regs.h
@@ -70,6 +70,7 @@
 #define MX21_NFC_BASE_ADDR		(MX21_X_MEMC_BASE_ADDR + 0x3000)
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
+#define MX21_IRAM_SIZE			0x00001800
 
 /* AIPI (base MX21_AIPI_BASE_ADDR) */
 #define MX21_AIPI1_PSR0	0x00
diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h
index b8ae45a..9ab0fb3 100644
--- a/arch/arm/mach-imx/include/mach/imx25-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx25-regs.h
@@ -76,6 +76,9 @@
 #define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0400)
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
+#define MX25_IRAM_BASE_ADDR		0x78000000	/* internal ram */
+#define MX25_IRAM_SIZE			SZ_128K
+
 /*
  * Clock Controller Module (CCM)
  */
diff --git a/arch/arm/mach-imx/include/mach/imx27-regs.h b/arch/arm/mach-imx/include/mach/imx27-regs.h
index 90b4614..e523563 100644
--- a/arch/arm/mach-imx/include/mach/imx27-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx27-regs.h
@@ -100,6 +100,7 @@
 
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
+#define MX27_IRAM_SIZE			0x0000b400
 
 /* PCMCIA (base: MX27_PCMCIA_CTL_BASE_ADDR) */
 #define MX27_PCMCIA_PIPR	0x00
-- 
1.7.10.4


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

  parent reply	other threads:[~2012-10-17 21:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 21:03 [PATCH] ARM: Make memory known to " Sascha Hauer
2012-10-17 21:03 ` [PATCH 01/28] ARM: Make malloc available in all initcalls Sascha Hauer
2012-10-17 21:03 ` [PATCH 02/28] ARM at91sam926x: provide reset function for boards with lowlevel init Sascha Hauer
2012-10-18  7:26   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-19 15:30     ` Sascha Hauer
2012-10-17 21:03 ` [PATCH 03/28] ARM at91rm9200: " Sascha Hauer
2012-10-18  7:27   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17 21:03 ` [PATCH 04/28] ARM: Add new entry point for barebox Sascha Hauer
2012-10-17 21:03 ` [PATCH 05/28] ARM i.MX Add functions to get sdram base and size Sascha Hauer
2012-10-17 21:03 ` [PATCH 06/28] ARM i.MX boards: switch to barebox_arm_entry Sascha Hauer
2012-10-17 21:12   ` Alexander Shiyan
2012-11-01 19:21     ` Sascha Hauer
2012-10-17 21:03 ` [PATCH 07/28] ARM AT91 " Sascha Hauer
2012-10-17 21:03 ` [PATCH 08/28] ARM i.MXs " Sascha Hauer
2012-10-17 21:03 ` [PATCH 09/28] ARM OMAP " Sascha Hauer
2012-10-17 21:03 ` [PATCH 10/28] ARM Samsung " Sascha Hauer
2012-10-17 21:03 ` [PATCH 11/28] ARM PXA " Sascha Hauer
2012-10-17 21:03 ` [PATCH 12/28] ARM ep93xx " Sascha Hauer
2012-10-17 21:03 ` [PATCH 13/28] ARM tegra " Sascha Hauer
2012-10-17 21:03 ` [PATCH 14/28] ARM nomadik " Sascha Hauer
2012-10-17 21:03 ` [PATCH 15/28] ARM versatile " Sascha Hauer
2012-10-17 21:03 ` [PATCH 16/28] ARM netx " Sascha Hauer
2012-10-17 21:03 ` [PATCH 17/28] ARM: remove now unused *_LOWLEVEL_INIT Kconfig options Sascha Hauer
2012-10-17 21:03 ` [PATCH 18/28] ARM start: remove unused board_init_lowlevel* functions Sascha Hauer
2012-10-17 21:03 ` [PATCH 19/28] ARM pbl: setup stack at end of SDRAM Sascha Hauer
2012-10-17 21:03 ` [PATCH 20/28] ARM pbl: Call uncompressed binary with arguments Sascha Hauer
2012-10-18  7:29   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-19 15:32     ` Sascha Hauer
2012-10-19 16:15       ` Sascha Hauer
2012-10-17 21:03 ` [PATCH 21/28] ARM pbl: make MMU functional again Sascha Hauer
2012-10-17 21:03 ` [PATCH 22/28] ARM start: pick up memory/boarddata arguments from pbl Sascha Hauer
2012-10-17 21:03 ` [PATCH 23/28] ARM start: Add barebox_arm_boarddata function Sascha Hauer
2012-10-17 21:03 ` [PATCH 24/28] ARM: Determine base and size of malloc space from SDRAM Sascha Hauer
2012-10-17 21:03 ` [PATCH 25/28] ARM pbl: always copy piggydata Sascha Hauer
2012-10-18  7:23   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-19 15:34     ` Sascha Hauer
2012-10-19 17:27       ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17 21:03 ` Sascha Hauer [this message]
2012-10-17 21:03 ` [PATCH 27/28] generic memory layout: fix deps for [MALLOC|STACK]_BASE Sascha Hauer
2012-10-17 21:03 ` [PATCH 28/28] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT 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=1350507817-7819-27-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@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