]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: ralink: mt7621: do memory detection on KSEG1
authorChuanhong Guo <gch981213@gmail.com>
Fri, 11 Feb 2022 00:13:44 +0000 (08:13 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Wed, 16 Feb 2022 19:46:50 +0000 (20:46 +0100)
commit65fc047069114f25dbd9364c69b19e6949494732
treeb13ea4b633c3387ec73c60b041863e5de99062c5
parent2704032d520af3894bb696a5829c4c87f9952d26
MIPS: ralink: mt7621: do memory detection on KSEG1

It's reported that current memory detection code occasionally detects
larger memory under some bootloaders.
Current memory detection code tests whether address space wraps around
on KSEG0, which is unreliable because it's cached.

Rewrite memory size detection to perform the same test on KSEG1 instead.
While at it, this patch also does the following two things:
1. use a fixed pattern instead of a random function pointer as the magic
   value.
2. add an additional memory write and a second comparison as part of the
   test to prevent possible smaller memory detection result due to
   leftover values in memory.

Fixes: c2696ff26db1 MIPS: ("ralink: mt7621: add memory detection support")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Tested-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/ralink/mt7621.c