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

Felix Fietkau nbd at openwrt.org
Fri May 8 08:03:45 EDT 2015


On 2015-05-07 04:25, wengbj wrote:
> From: daixj <fl.service at t-firefly.com>
> 
> Signed-off-by: daixj <fl.service at t-firefly.com>
> +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
That kind of code does not belong into the generic
arch/mips/kernel/setup.c
It should be passed in and set up via device tree information.

- Felix
_______________________________________________
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