mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 03/36] ARM i.MX: Use SRAM stack in lowlevel code
Date: Sun,  3 Feb 2013 16:10:03 +0100	[thread overview]
Message-ID: <1359904236-11622-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1359904236-11622-1-git-send-email-plagnioj@jcrosoft.com>

From: Sascha Hauer <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-03 15:11 UTC|newest]

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

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=1359904236-11622-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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