diff mbox

[U-Boot,08/12] ARM: rpi_b: drop RAM size to 128M

Message ID 1341367375-11467-9-git-send-email-swarren@wwwdotorg.org
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren July 4, 2012, 2:02 a.m. UTC
The board really has 256M. However, the VC (VideoCore co-processor) shares
the RAM, and uses a configurable portion at the top. We tell U-Boot that a
smaller amount of RAM is present in order to avoid stomping on the area
the VC uses.

Extracted from work by Oleksandr Tymoshenko <gonzo@bluezbox.com>.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
 board/raspberrypi/rpi_b/rpi_b.c |    2 +-
 include/configs/rpi_b.h         |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Stephen Warren July 4, 2012, 2:27 a.m. UTC | #1
On 07/03/2012 08:09 PM, Naren (Narendra) Sankar wrote:
> This should not be hard-coded.
> 
> The current board has 256MB but still allows the VC to use different RAM configuration splits. So the u-boot/Linux partition can get more than 128MB.

While that's true, I believe there's currently no runtime API available
to retrieve the memory split information. When such an API is available,
we can remove the hard-coded limit and use the API instead.

Such an API has been requested; see:
https://github.com/raspberrypi/firmware/issues/47

> And it is possible to support up to 1GB of DRAM on this platform.

The hard-coding is in a location specific to the Raspberry-Pi model B.
So, it doesn't impose any restrictions on any other boards using the
same SoC. While the BCM2835 SoC may allow more memory, the RPi B
specifically only supports exactly 256MB.
diff mbox

Patch

diff --git a/board/raspberrypi/rpi_b/rpi_b.c b/board/raspberrypi/rpi_b/rpi_b.c
index 26df74b..688b0aa 100644
--- a/board/raspberrypi/rpi_b/rpi_b.c
+++ b/board/raspberrypi/rpi_b/rpi_b.c
@@ -21,7 +21,7 @@  DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-	gd->ram_size = SZ_256M;
+	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 
 	return 0;
 }
diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h
index b9595f9..9f74731 100644
--- a/include/configs/rpi_b.h
+++ b/include/configs/rpi_b.h
@@ -36,6 +36,13 @@ 
 #define CONFIG_NR_DRAM_BANKS		1
 #define CONFIG_SYS_TEXT_BASE		0x00008000
 #define CONFIG_SYS_SDRAM_BASE		0x00000000
+/*
+ * The board really has 256M. However, the VC (VideoCore co-processor) shares
+ * the RAM, and uses a configurable portion at the top. We tell U-Boot that a
+ * smaller amount of RAM is present in order to avoid stomping on the area
+ * the VC uses.
+ */
+#define CONFIG_SYS_SDRAM_SIZE		SZ_128M
 #define CONFIG_SYS_UBOOT_BASE		CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_INIT_RAM_SIZE	SZ_4K
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + \