summaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files/arch/mips/ralink/common
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-08-31 18:53:26 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-08-31 18:53:26 +0000
commita43a8c98647194afa5528fd3afe26ea0b0781403 (patch)
tree644c8852e34e991c4362fc771ca255c08ae37312 /target/linux/ramips/files/arch/mips/ralink/common
parentab0a79714f445ae17d1ad601ff0628e75f31a430 (diff)
[ramips] share memory size detection code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17454 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/arch/mips/ralink/common')
-rw-r--r--target/linux/ramips/files/arch/mips/ralink/common/setup.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/target/linux/ramips/files/arch/mips/ralink/common/setup.c b/target/linux/ramips/files/arch/mips/ralink/common/setup.c
index 6440ccb01..86e951ca2 100644
--- a/target/linux/ramips/files/arch/mips/ralink/common/setup.c
+++ b/target/linux/ramips/files/arch/mips/ralink/common/setup.c
@@ -13,12 +13,30 @@
#include <linux/init.h>
#include <linux/io.h>
+#include <asm/bootinfo.h>
#include <asm/addrspace.h>
+
#include <asm/mach-ralink/common.h>
+#include <ralink_soc.h>
+
+static void __init detect_mem_size(void)
+{
+ unsigned long size;
+
+ for (size = RALINK_SOC_MEM_SIZE_MIN; size < RALINK_SOC_MEM_SIZE_MAX;
+ size <<= 1 ) {
+ if (!memcmp(detect_mem_size,
+ detect_mem_size + size, 1024))
+ break;
+ }
+
+ add_memory_region(RALINK_SOC_SDRAM_BASE, size, BOOT_MEM_RAM);
+}
void __init plat_mem_setup(void)
{
set_io_port_base(KSEG1);
+ detect_mem_size();
ramips_soc_setup();
}