From patchwork Thu May 7 02:35:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wengbj X-Patchwork-Id: 469184 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 83B4E140281 for ; Thu, 7 May 2015 12:37:25 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id E9C0D284502; Thu, 7 May 2015 04:36:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 54C53284502 for ; Thu, 7 May 2015 04:35:20 +0200 (CEST) X-policyd-weight: using cached result; rate: -5.5 Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.138]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 7 May 2015 04:35:07 +0200 (CEST) Received: from fl.service?t-firefly.com (unknown [192.168.167.105]) by regular1.263xmail.com (Postfix) with SMTP id D402A4D05; Thu, 7 May 2015 10:36:11 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 1 Received: from mae.263xmail.com (unknown [121.41.50.71]) by smtp.263.net (Postfix) with ESMTP id D794A1F96F; Thu, 7 May 2015 10:36:07 +0800 (CST) Received: from fl.service?t-firefly.com (localhost [127.0.0.1]) by mae.263xmail.com (Postfix) with SMTP id 9FA843465C2; Thu, 7 May 2015 10:36:10 +0800 (CST) X-MAE-MAIL_UID: 00554acf9a08da6b@maes@583921a9ee8994b2 X-MAE-ID: 223.6.254.61 X-RL-NAME: fl.service@t-firefly.com X-LOGIN-NAME: fl.service@t-firefly.com X-SENDER-IP: 183.32.164.162 X-SENDER: fl.service@t-firefly.com From: wengbj To: blogic@openwrt.org Date: Thu, 7 May 2015 10:35:58 +0800 Message-Id: <1430966158-10775-1-git-send-email-fl.service@t-firefly.com> X-Mailer: git-send-email 1.7.9.5 Cc: fl.service@t-firefly.com, zxf@t-chip.com.cn, linux.c@foxmail.com, dxj@t-chip.com.cn, wbj@t-chip.com.cn, openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH] ralink: add mt7621 support automatic recognition memory size(32M-512M) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: wengbj --- ...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..802d682 --- /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)