summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-12-06 09:53:55 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-01-06 14:24:57 +0100
commiteb959e1bdfa60ee6586bc1aa263021856fcdf46e (patch)
tree2df9acaec42e66fdfa8b2b36e148449bd9a7539f /arch
parentfd096d92166e8c01feedba4688d3dbd816e4f2b0 (diff)
downloadbarebox-eb959e1bdfa60ee6586bc1aa263021856fcdf46e.tar.gz
barebox-eb959e1bdfa60ee6586bc1aa263021856fcdf46e.tar.xz
ARM: start kernel: find a valid address for the atags list automatically
If a board does not specify a place for the atags list default to SDRAM start + 0x100. The vast majority of boards uses this place anyway, so the call to armlinux_set_bootparams() can be removed for most boards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/lib/armlinux.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 75d751bb4d..d83c6a2e74 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -89,6 +89,24 @@ u64 armlinux_get_serial(void)
return armlinux_system_serial;
}
+void armlinux_set_bootparams(void *params)
+{
+ armlinux_bootparams = params;
+}
+
+static struct tag *armlinux_get_bootparams(void)
+{
+ struct memory_bank *mem;
+
+ if (armlinux_bootparams)
+ return armlinux_bootparams;
+
+ for_each_memory_bank(mem)
+ return (void *)mem->start + 0x100;
+
+ BUG();
+}
+
#ifdef CONFIG_ARM_BOARD_APPEND_ATAG
static struct tag *(*atag_appender)(struct tag *);
void armlinux_set_atag_appender(struct tag *(*func)(struct tag *))
@@ -99,7 +117,7 @@ void armlinux_set_atag_appender(struct tag *(*func)(struct tag *))
static void setup_start_tag(void)
{
- params = (struct tag *)armlinux_bootparams;
+ params = armlinux_get_bootparams();
params->hdr.tag = ATAG_CORE;
params->hdr.size = tag_size(tag_core);
@@ -235,11 +253,6 @@ static void setup_tags(unsigned long initrd_address,
}
-void armlinux_set_bootparams(void *params)
-{
- armlinux_bootparams = params;
-}
-
void start_linux(void *adr, int swap, unsigned long initrd_address,
unsigned long initrd_size, void *oftree)
{
@@ -252,7 +265,7 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
params = oftree;
} else {
setup_tags(initrd_address, initrd_size, swap);
- params = armlinux_bootparams;
+ params = armlinux_get_bootparams();
}
architecture = armlinux_get_architecture();