summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-26 09:53:34 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-12-10 14:35:34 +0100
commitee7f5d5d506e40b9707611eba6e40d76f8049b3b (patch)
treeb766030d5e37dac79be2dd44d37dd1bd09a2d634 /arch
parentb037240d1fcf1ab974946514f7ef5f24c34b9fa0 (diff)
downloadbarebox-ee7f5d5d506e40b9707611eba6e40d76f8049b3b.tar.gz
barebox-ee7f5d5d506e40b9707611eba6e40d76f8049b3b.tar.xz
ARM: OMAP: Safe boot info in fixed SRAM address
Storing the boot information in the image itself and passing a pointer around between images is cumbersome and doesn't fit well with multiimage support where the pointer we pass around is already occupied by the devicetree. Do the same as U-Boot does and store the boot information at the bottom of the SRAM public stack. To maintain the compatibility between new xloaders and older barebox binaries we still pass the boot information to the next stage via pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap/Makefile4
-rw-r--r--arch/arm/mach-omap/am33xx_generic.c3
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-generic.h3
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-silicon.h1
-rw-r--r--arch/arm/mach-omap/include/mach/generic.h2
-rw-r--r--arch/arm/mach-omap/include/mach/omap3-generic.h2
-rw-r--r--arch/arm/mach-omap/include/mach/omap3-silicon.h1
-rw-r--r--arch/arm/mach-omap/include/mach/omap4-generic.h2
-rw-r--r--arch/arm/mach-omap/include/mach/omap4-silicon.h3
-rw-r--r--arch/arm/mach-omap/omap3_generic.c3
-rw-r--r--arch/arm/mach-omap/omap4_generic.c3
-rw-r--r--arch/arm/mach-omap/omap_bootinfo.S25
-rw-r--r--arch/arm/mach-omap/omap_generic.c17
13 files changed, 28 insertions, 41 deletions
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 0d5428dedb..81a771eb3e 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,8 @@
# GNU General Public License for more details.
#
#
-obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o omap_bootinfo.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o omap_bootinfo.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
index 68dc9338f6..c22791883a 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -124,8 +124,9 @@ static int am33xx_bootsource(void)
{
enum bootsource src;
int instance = 0;
+ uint32_t *am33xx_bootinfo = (void *)AM33XX_SRAM_SCRATCH_SPACE;
- switch (omap_bootinfo[2] & 0xFF) {
+ switch (am33xx_bootinfo[2] & 0xFF) {
case 0x05:
src = BOOTSOURCE_NAND;
break;
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index e74a666f3f..8472d07302 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -11,6 +11,7 @@ u32 am33xx_get_cpu_rev(void);
static inline void am33xx_save_bootinfo(uint32_t *info)
{
unsigned long i = (unsigned long)info;
+ uint32_t *scratch = (void *)AM33XX_SRAM_SCRATCH_SPACE;
if (i & 0x3)
return;
@@ -19,7 +20,7 @@ static inline void am33xx_save_bootinfo(uint32_t *info)
if (i > AM33XX_SRAM0_START + AM33XX_SRAM0_SIZE)
return;
- omap_save_bootinfo(info);
+ memcpy(scratch, info, 3 * sizeof(uint32_t));
}
u32 am33xx_running_in_flash(void);
diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
index 30b605a695..16e665f2c4 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
@@ -120,6 +120,7 @@
/* OCMC */
#define AM33XX_SRAM0_START 0x402f0400
#define AM33XX_SRAM0_SIZE (SZ_128K - SZ_1K)
+#define AM33XX_SRAM_SCRATCH_SPACE 0x4030b800 /* start of public stack */
#define AM33XX_SRAM_GPMC_STACK_SIZE (0x40)
/* DDR offsets */
diff --git a/arch/arm/mach-omap/include/mach/generic.h b/arch/arm/mach-omap/include/mach/generic.h
index f4e18f3244..a2a48cc6af 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -73,8 +73,6 @@ static inline int omap_set_mmc_dev(const char *mmcdev)
}
#endif
-extern uint32_t omap_bootinfo[3];
-void omap_save_bootinfo(void *data);
void __noreturn omap_start_barebox(void *barebox);
void omap_set_bootmmc_devname(const char *devname);
diff --git a/arch/arm/mach-omap/include/mach/omap3-generic.h b/arch/arm/mach-omap/include/mach/omap3-generic.h
index 2210d879fe..5e29bac59b 100644
--- a/arch/arm/mach-omap/include/mach/omap3-generic.h
+++ b/arch/arm/mach-omap/include/mach/omap3-generic.h
@@ -16,7 +16,7 @@ static inline void omap3_save_bootinfo(uint32_t *info)
if (i > OMAP3_SRAM_BASE + SZ_64K)
return;
- omap_save_bootinfo(info);
+ memcpy((void *)OMAP3_SRAM_SCRATCH_SPACE, info, 3 * sizeof(uint32_t));
}
u32 omap3_running_in_flash(void);
diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 9138057a89..b4de045652 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -100,6 +100,7 @@
/** Interrupt Vector base address */
#define OMAP3_SRAM_BASE 0x40200000
+#define OMAP3_SRAM_SCRATCH_SPACE 0x4020f000 /* start of public stack */
#define OMAP3_SRAM_INTVECT 0x4020F800
#define OMAP3_SRAM_INTVECT_COPYSIZE 0x64
diff --git a/arch/arm/mach-omap/include/mach/omap4-generic.h b/arch/arm/mach-omap/include/mach/omap4-generic.h
index 85c92e1a5e..e246e360e5 100644
--- a/arch/arm/mach-omap/include/mach/omap4-generic.h
+++ b/arch/arm/mach-omap/include/mach/omap4-generic.h
@@ -15,7 +15,7 @@ static inline void omap4_save_bootinfo(uint32_t *info)
if (i > OMAP44XX_SRAM_BASE + SZ_64K)
return;
- omap_save_bootinfo(info);
+ memcpy((void *)OMAP44XX_SRAM_SCRATCH_SPACE, info, 3 * sizeof(uint32_t));
}
void __noreturn omap4_reset_cpu(unsigned long addr);
diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index 336415c16b..202da93d76 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -40,8 +40,7 @@
#define OMAP44XX_L4_PER_BASE 0x48000000
#define OMAP44XX_SRAM_BASE 0x40300000
-
-#define OMAP44XX_SRAM_BASE 0x40300000
+#define OMAP44XX_SRAM_SCRATCH_SPACE 0x4030c000 /* start of public stack */
/* EMIF and DMM registers */
#define OMAP44XX_EMIF1_BASE 0x4c000000
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index d36d63b6a6..dbb0b5f86c 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -469,8 +469,9 @@ void omap3_core_init(void)
static int omap3_bootsource(void)
{
enum bootsource src = BOOTSOURCE_UNKNOWN;
+ uint32_t *omap3_bootinfo = (void *)OMAP3_SRAM_SCRATCH_SPACE;
- switch (omap_bootinfo[1] & 0xFF) {
+ switch (omap3_bootinfo[1] & 0xFF) {
case 0x02:
src = BOOTSOURCE_NAND;
break;
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 5dde51ad15..0b683da181 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -505,8 +505,9 @@ static int omap_vector_init(void)
static int omap4_bootsource(void)
{
enum bootsource src;
+ uint32_t *omap4_bootinfo = (void *)OMAP44XX_SRAM_SCRATCH_SPACE;
- switch (omap_bootinfo[2] & 0xFF) {
+ switch (omap4_bootinfo[2] & 0xFF) {
case OMAP44XX_SAR_BOOT_NAND:
src = BOOTSOURCE_NAND;
break;
diff --git a/arch/arm/mach-omap/omap_bootinfo.S b/arch/arm/mach-omap/omap_bootinfo.S
deleted file mode 100644
index ffd0a3db3b..0000000000
--- a/arch/arm/mach-omap/omap_bootinfo.S
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <config.h>
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-.section ".text_bare_init","ax"
-.globl omap_bootinfo
-omap_bootinfo:
- .word 0x0
- .word 0x0
- .word 0x0
-
-.section ".text_bare_init","ax"
-ENTRY(omap_save_bootinfo)
- /*
- * save data from rom boot loader
- */
- adr r2, omap_bootinfo
- ldr r1, [r0, #0x00]
- str r1, [r2, #0x00]
- ldr r1, [r0, #0x04]
- str r1, [r2, #0x04]
- ldr r1, [r0, #0x08]
- str r1, [r2, #0x08]
- mov pc, lr
-ENDPROC(omap_save_bootinfo)
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 47fa9ba958..3d302f3efa 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -45,15 +45,24 @@ static void *omap_sram_start(void)
return NULL;
}
+static void *omap_scratch_space_start(void)
+{
+ if (cpu_is_am33xx())
+ return (void *)AM33XX_SRAM_SCRATCH_SPACE;
+ if (cpu_is_omap3())
+ return (void *)OMAP3_SRAM_SCRATCH_SPACE;
+ if (cpu_is_omap4())
+ return (void *)OMAP44XX_SRAM_SCRATCH_SPACE;
+ return NULL;
+}
+
void __noreturn omap_start_barebox(void *barebox)
{
int (*func)(void *) = barebox;
- uint32_t *arg;
void *sramadr = omap_sram_start();
+ void *scratch = omap_scratch_space_start();
- arg = (uint32_t *)&omap_bootinfo;
-
- memcpy(sramadr, &omap_bootinfo, sizeof(uint32_t) * 3);
+ memcpy(sramadr, scratch, sizeof(uint32_t) * 3);
shutdown_barebox();
func(sramadr);