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 03/34] ARM i.MX: Use SRAM stack in lowlevel code
Date: Fri,  1 Feb 2013 08:59:16 +0100	[thread overview]
Message-ID: <1359705587-9762-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1359705587-9762-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_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                   |    3 ++-
 arch/arm/boards/pcm037/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 +
 arch/arm/mach-imx/include/mach/imx31-regs.h            |    3 +++
 15 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
index 4e69aac..287b513 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;
 
 	b	imx27_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
index 8f4615a..c43f7fe 100644
--- a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
@@ -138,7 +138,7 @@ void __bare_init __naked reset(void)
 	writel(r, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
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 595c485..2e49e6e 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
 
 	b	imx25_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
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 5461b61..c63c953 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
 
 	b	imx35_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/guf-cupid/lowlevel.c b/arch/arm/boards/guf-cupid/lowlevel.c
index f2994eb..c141b54 100644
--- a/arch/arm/boards/guf-cupid/lowlevel.c
+++ b/arch/arm/boards/guf-cupid/lowlevel.c
@@ -314,7 +314,7 @@ void __bare_init __naked reset(void)
 	writel(r0, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/guf-neso/lowlevel.c b/arch/arm/boards/guf-neso/lowlevel.c
index 7a366d9..ca44607 100644
--- a/arch/arm/boards/guf-neso/lowlevel.c
+++ b/arch/arm/boards/guf-neso/lowlevel.c
@@ -88,7 +88,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx27_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx27_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/imx21ads/lowlevel_init.S b/arch/arm/boards/imx21ads/lowlevel_init.S
index f06c964..5be4995 100644
--- a/arch/arm/boards/imx21ads/lowlevel_init.S
+++ b/arch/arm/boards/imx21ads/lowlevel_init.S
@@ -118,7 +118,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
 
 	b	imx21_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/karo-tx25/lowlevel.c b/arch/arm/boards/karo-tx25/lowlevel.c
index b1afe18..9e96e39 100644
--- a/arch/arm/boards/karo-tx25/lowlevel.c
+++ b/arch/arm/boards/karo-tx25/lowlevel.c
@@ -21,6 +21,7 @@
 #include <mach/imx25-regs.h>
 #include <mach/esdctl.h>
 #include <io.h>
+#include <sizes.h>
 #include <mach/imx-nand.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
@@ -134,7 +135,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx25_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 8);
 
 	imx25_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm037/lowlevel.c b/arch/arm/boards/pcm037/lowlevel.c
index da01732..b531615 100644
--- a/arch/arm/boards/pcm037/lowlevel.c
+++ b/arch/arm/boards/pcm037/lowlevel.c
@@ -127,7 +127,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx31_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX31_IRAM_BASE_ADDR + MX31_IRAM_SIZE - 12);
 
 	imx31_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm038/lowlevel.c b/arch/arm/boards/pcm038/lowlevel.c
index 4515107..aecdbf3 100644
--- a/arch/arm/boards/pcm038/lowlevel.c
+++ b/arch/arm/boards/pcm038/lowlevel.c
@@ -95,7 +95,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call mx27_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx27_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm043/lowlevel.c b/arch/arm/boards/pcm043/lowlevel.c
index 639064f..a9832e2 100644
--- a/arch/arm/boards/pcm043/lowlevel.c
+++ b/arch/arm/boards/pcm043/lowlevel.c
@@ -190,7 +190,7 @@ void __bare_init __naked reset(void)
 	writel(r, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/mach-imx/include/mach/imx21-regs.h b/arch/arm/mach-imx/include/mach/imx21-regs.h
index 87bd99c..1fa463a 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 44bc1d3..c45befb 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
diff --git a/arch/arm/mach-imx/include/mach/imx31-regs.h b/arch/arm/mach-imx/include/mach/imx31-regs.h
index f641fe6..be3e4c1 100644
--- a/arch/arm/mach-imx/include/mach/imx31-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx31-regs.h
@@ -21,6 +21,9 @@
 
 #include <sizes.h>
 
+#define MX31_IRAM_BASE_ADDR		0x1fffc000
+#define MX31_IRAM_SIZE			0x00004000
+
 #define MX31_AIPS1_BASE_ADDR		0x43f00000
 #define MX31_AIPS1_SIZE			SZ_1M
 #define MX31_MAX_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x04000)
-- 
1.7.10.4


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

  parent reply	other threads:[~2013-02-01  8:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01  7:59 [PATCH v2] Add new ARM entry point for barebox Sascha Hauer
2013-02-01  7:59 ` [PATCH 01/34] ARM: Add new " Sascha Hauer
2013-02-01  7:59 ` [PATCH 02/34] ARM: add __noreturn to board_init_lowlevel_return Sascha Hauer
2013-02-01  7:59 ` Sascha Hauer [this message]
2013-02-01  7:59 ` [PATCH 04/34] ARM i.MX: Add i.MX specific entry point for barebox Sascha Hauer
2013-02-01  7:59 ` [PATCH 05/34] ARM i.MX: prepare external nand boot for SoC specific entry Sascha Hauer
2013-02-01  7:59 ` [PATCH 06/34] ARM i.MX boards: switch to barebox_arm_entry Sascha Hauer
2013-02-01  7:59 ` [PATCH 07/34] ARM MXS " Sascha Hauer
2013-02-01  7:59 ` [PATCH 08/34] ARM OMAP " Sascha Hauer
2013-02-01  7:59 ` [PATCH 09/34] ARM Samsung " Sascha Hauer
2013-02-01  7:59 ` [PATCH 10/34] ARM PXA " Sascha Hauer
2013-02-01  7:59 ` [PATCH 11/34] ARM ep93xx " Sascha Hauer
2013-02-01  7:59 ` [PATCH 12/34] ARM tegra " Sascha Hauer
2013-02-01  7:59 ` [PATCH 13/34] ARM nomadik " Sascha Hauer
2013-02-01  7:59 ` [PATCH 14/34] ARM versatile " Sascha Hauer
2013-02-01  7:59 ` [PATCH 15/34] ARM netx " Sascha Hauer
2013-02-01  7:59 ` [PATCH 16/34] ARM clep7212: " Sascha Hauer
2013-02-01  7:59 ` [PATCH 17/34] ARM raspberrypi: " Sascha Hauer
2013-02-01  7:59 ` [PATCH 18/34] ARM AT91: switch to barebox_arm_entry part1 Sascha Hauer
2013-02-01  8:11   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 10:13     ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-01  7:59 ` [PATCH 19/34] ARM AT91: switch at91rm9200 board to barebox_arm_entry Sascha Hauer
2013-02-01  7:59 ` [PATCH 20/34] ARM AT91: switch sama5d3 " Sascha Hauer
2013-02-01  7:59 ` [PATCH 21/34] ARM AT91: switch remaining boards " Sascha Hauer
2013-02-01  8:12   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-02 21:23   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-01  7:59 ` [PATCH 22/34] ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT Sascha Hauer
2013-02-01  7:59 ` [PATCH 23/34] ARM start-pbl: make board_init_lowlevel_return static Sascha Hauer
2013-02-01  7:59 ` [PATCH 24/34] ARM start-pbl: call uncompressed binary with arguments Sascha Hauer
2013-02-01  7:59 ` [PATCH 25/34] ARM start: pickup parameters from pbl Sascha Hauer
2013-02-01  7:59 ` [PATCH 26/34] ARM: Setup stack at end of SDRAM Sascha Hauer
2013-02-01  7:59 ` [PATCH 27/34] ARM pbl: Use dynamic parameters for early malloc space Sascha Hauer
2013-02-01  7:59 ` [PATCH 28/34] ARM mmu: pickup already enabled mmu Sascha Hauer
2013-02-01  7:59 ` [PATCH 29/34] ARM: Factor out early mmu code Sascha Hauer
2013-02-01  7:59 ` [PATCH 30/34] ARM: Enable mmu early Sascha Hauer
2013-02-01  7:59 ` [PATCH 31/34] ARM: Automatically determine malloc size Sascha Hauer
2013-02-01  7:59 ` [PATCH 32/34] generic memory layout: fix deps for [MALLOC|STACK]_BASE Sascha Hauer
2013-02-01  7:59 ` [PATCH 33/34] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT Sascha Hauer
2013-02-01  7:59 ` [PATCH 34/34] ARM pbl: inline decompress function Sascha Hauer
2013-02-01  8:15 ` [PATCH v2] Add new ARM entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2013-01-27 10:46 [PATCH] " Sascha Hauer
2013-01-27 10:46 ` [PATCH 03/34] ARM i.MX: Use SRAM stack in lowlevel 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=1359705587-9762-4-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