[OpenWrt-Devel] [PATCH 3/4] ralink: add mt7621 support automatic recognition memory size(32M-512M)

wengbj fl.service at t-firefly.com
Wed May 6 22:25:38 EDT 2015


From: daixj <fl.service at t-firefly.com>

Signed-off-by: daixj <fl.service at t-firefly.com>
---
 ...support-automatic-recognition-memory-size.patch |   50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 target/linux/ramips/patches-3.18/0113-add-mt7621-support-automatic-recognition-memory-size.patch

diff --git a/target/linux/ramips/patches-3.18/0113-add-mt7621-support-automatic-recognition-memory-size.patch b/target/linux/ramips/patches-3.18/0113-add-mt7621-support-automatic-recognition-memory-size.patch
new file mode 100644
index 0000000..f3906b8
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/0113-add-mt7621-support-automatic-recognition-memory-size.patch
@@ -0,0 +1,50 @@
+Index: linux-3.18.11/arch/mips/include/asm/mach-ralink/mt7621.h
+===================================================================
+--- linux-3.18.11.orig/arch/mips/include/asm/mach-ralink/mt7621.h	2015-05-06 17:46:36.606144740 +0800
++++ linux-3.18.11/arch/mips/include/asm/mach-ralink/mt7621.h	2015-05-06 17:50:16.362151259 +0800
+@@ -29,7 +29,7 @@
+ 
+ #define MT7621_DRAM_BASE                0x0
+ #define MT7621_DDR2_SIZE_MIN		32
+-#define MT7621_DDR2_SIZE_MAX		256
++#define MT7621_DDR2_SIZE_MAX		512
+ 
+ #define MT7621_CHIP_NAME0		0x3637544D
+ #define MT7621_CHIP_NAME1		0x20203132
+Index: linux-3.18.11/arch/mips/kernel/setup.c
+===================================================================
+--- linux-3.18.11.orig/arch/mips/kernel/setup.c	2015-04-04 10:46:37.000000000 +0800
++++ linux-3.18.11/arch/mips/kernel/setup.c	2015-05-07 09:30:27.138152614 +0800
+@@ -131,8 +131,12 @@
+ {
+ 	void *dm = &detect_magic;
+ 	phys_t size;
+-
+-	for (size = sz_min; size < sz_max; size <<= 1) {
++#if defined(CONFIG_SOC_MT7621)
++	phys_t low_mem_size   = 0x1c000000;
++	phys_t high_mem_start = 0x20000000;
++	phys_t high_mem_size  = 0;
++#endif
++	for (size = sz_min; size < sz_max; size <<= 1) {
+ 		if (!memcmp(dm, dm + size, sizeof(detect_magic)))
+ 			break;
+ 	}
+@@ -142,8 +146,15 @@
+ 		(unsigned long long) start,
+ 		((unsigned long long) sz_min) / SZ_1M,
+ 		((unsigned long long) sz_max) / SZ_1M);
+-
+-	add_memory_region(start, size, BOOT_MEM_RAM);
++#if defined(CONFIG_SOC_MT7621)
++       low_mem_size = (size > low_mem_size)?low_mem_size:size;
++       high_mem_size = size - low_mem_size;
++	add_memory_region(start,low_mem_size, BOOT_MEM_RAM);
++       if(high_mem_size > 0)
++		add_memory_region(high_mem_start,high_mem_size, BOOT_MEM_RAM);
++#else
++	add_memory_region(start, size, BOOT_MEM_RAM);
++#endif
+ }
+ 
+ static void __init print_memory_map(void)
-- 
1.7.9.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list