• Chuanhong Guo's avatar
    MIPS: ralink: mt7621: add memory detection support · 139c949f
    Chuanhong Guo authored
    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: default avatarChuanhong Guo <gch981213@gmail.com>
    [Minor commit message reword, make mt7621_memory_detect static]
    Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
    Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
    139c949f
mt7621.h 848 Bytes