openwrt/target/linux/ramips
Chuanhong Guo 7612ecb201 ramips: 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: 6d91ddf517 ("ramips: mt7621: add support for memory detection")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
(cherry picked from commit 2f024b7933)
[backport for OpenWrt 21.02 as it was reproducible with Kernel 5.4, see [1]]
[1]: https://forum.openwrt.org/t/113081
Tested-by: Dimitri Souza <dimitri.souza@gmail.com> [mt7621/archer-c6-v3]
Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
2022-02-22 20:48:46 +08:00
..
base-files/etc ramips: remove model name from LED labels 2020-10-02 14:51:57 +02:00
dts ramips: minew g1-c: Allow dynamic RAM sizes 2021-11-01 15:35:25 +01:00
files/drivers ramips: mt7530 swconfig: fix race condition in register access 2021-04-18 12:05:04 +02:00
image ramips: add support for minew g1-c 2021-09-21 14:08:51 +02:00
mt76x8 ramips: fix tl-mr3020-v3 switch topology to configure vlans via luci 2021-12-05 13:54:20 +01:00
mt7620 ramips: fix mac addresses of Youku YK1 2021-05-14 23:32:22 +02:00
mt7621 ramips: Add support for SERCOMM NA502 2021-06-10 17:09:35 +02:00
patches-5.4 ramips: mt7621: do memory detection on KSEG1 2022-02-22 20:48:46 +08:00
rt288x ramips: remove set_wifi_led function in 01_leds 2020-10-02 14:51:57 +02:00
rt305x ramips: add support for ZTE MF283+ 2021-06-02 21:29:16 +02:00
rt3883 ramips: remove generic profiles 2021-01-27 21:31:20 +01:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00
modules.mk ramips: rename mtk-hsdma to hsdma-mt7621 2021-03-15 10:32:53 -10:00