summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/raspberry-pi
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2013-10-19 14:21:26 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-10-22 15:28:59 +0200
commit607968f541d4619f6e4b5c518cb50a40bebae046 (patch)
treed06a375b56e4f7765668f79d7eb52b636894557f /arch/arm/boards/raspberry-pi
parentdb81ebba81409106c411aede9311485d174252cc (diff)
downloadbarebox-607968f541d4619f6e4b5c518cb50a40bebae046.tar.gz
barebox-607968f541d4619f6e4b5c518cb50a40bebae046.tar.xz
ARM: rpi: use the proper ARM memory size
Use the mailbox driver to query the size. This properly takes the firmware's VideoCore/ARM memory split into account. Linux can now be booted with more than 128 MiB. Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/raspberry-pi')
-rw-r--r--arch/arm/boards/raspberry-pi/rpi.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
index d3c6b117dd..06c43f3c79 100644
--- a/arch/arm/boards/raspberry-pi/rpi.c
+++ b/arch/arm/boards/raspberry-pi/rpi.c
@@ -26,12 +26,35 @@
#include <mach/core.h>
#include <mach/mbox.h>
+struct msg_get_arm_mem {
+ struct bcm2835_mbox_hdr hdr;
+ struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
+ u32 end_tag;
+};
+
struct msg_get_clock_rate {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_get_clock_rate get_clock_rate;
u32 end_tag;
};
+static int rpi_get_arm_mem(u32 *size)
+{
+ BCM2835_MBOX_STACK_ALIGN(struct msg_get_arm_mem, msg);
+ int ret;
+
+ BCM2835_MBOX_INIT_HDR(msg);
+ BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
+
+ ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
+ if (ret)
+ return ret;
+
+ *size = msg->get_arm_mem.body.resp.mem_size;
+
+ return 0;
+}
+
static int rpi_register_clkdev(u32 clock_id, const char *name)
{
BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg);
@@ -58,8 +81,16 @@ static int rpi_register_clkdev(u32 clock_id, const char *name)
static int rpi_mem_init(void)
{
- bcm2835_add_device_sdram(0);
- return 0;
+ u32 size = 0;
+ int ret;
+
+ ret = rpi_get_arm_mem(&size);
+ if (ret)
+ printf("could not query ARM memory size\n");
+
+ bcm2835_add_device_sdram(size);
+
+ return ret;
}
mem_initcall(rpi_mem_init);