[PATCH 2/2] MIPS: ralink: mt7621: add memory detection support

Thomas Bogendoerfer tsbogend at alpha.franken.de
Mon Mar 29 10:26:07 BST 2021


On Fri, Mar 26, 2021 at 10:38:40PM -0700, Ilya Lipnitskiy wrote:
> From: Chuanhong Guo <gch981213 at gmail.com>
> 
> mt7621 has the following memory map:
> 0x0-0x1c000000: lower 448m memory
> 0x1c000000-0x2000000: peripheral registers
> 0x20000000-0x2400000: higher 64m memory
> 
> detect_memory_region in arch/mips/kernel/setup.c only adds the first
> memory region and isn't suitable for 512m memory detection because
> it may accidentally read the memory area for peripheral registers.
> 
> This commit adds memory detection capability for mt7621:
>   1. Add the highmem area when 512m is detected.
>   2. Guard memcmp from accessing peripheral registers:
>      This only happens when a user decided to change kernel load address
>      to 256m or higher address. Since this is a quite unusual case, we
>      just skip 512m testing and return 256m as memory size.
> 
> Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> [Minor commit message reword, make mt7621_memory_detect static]
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
> ---
>  arch/mips/include/asm/mach-ralink/mt7621.h |  7 +++---
>  arch/mips/ralink/common.h                  |  1 +
>  arch/mips/ralink/mt7621.c                  | 29 +++++++++++++++++++---
>  arch/mips/ralink/of.c                      |  2 ++
>  4 files changed, 32 insertions(+), 7 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]



More information about the Linux-mediatek mailing list