1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-08-31 08:12:06 +02:00

Fix unreliable detection of DRAM size on Orange Pi 3

In mctl_mem_matches() we need to flush/invalidate cache, so that
we can be sure, we're actually reading back data from DRAM, and
not values cached in data cache.

This fixes unreliable detection of DRAM size on Orange Pi 3.

Signed-off-by: Ondrej Jirman <megous@megous.com>
This commit is contained in:
Ondrej Jirman
2019-07-17 02:28:23 +02:00
parent cb9c7bcb92
commit c2675f18c0

View File

@@ -31,7 +31,9 @@ bool mctl_mem_matches(u32 offset)
/* Try to write different values to RAM at two addresses */
writel(0, CONFIG_SYS_SDRAM_BASE);
writel(0xaa55aa55, (ulong)CONFIG_SYS_SDRAM_BASE + offset);
dsb();
/* Make sure values are written and that we don't get a cached
* value back. */
flush_dcache_all();
/* Check if the same value is actually observed when reading back */
return readl(CONFIG_SYS_SDRAM_BASE) ==
readl((ulong)CONFIG_SYS_SDRAM_BASE + offset);