ram: sun20i_d1: Fix automatic bank detection

The check is expected to pass on D1s, where the DRAM die has only one
bank, as signified by bit 12 being unset in the stock dram_para1 value.
Changing the offset matches the algorithm from dram_sunxi_dw.c (which
uses 2 bank bits + 9 page bits), and works on D1, D1s, and T113-S3.

Link: https://github.com/smaeul/sun20i_d1_spl/issues/14
Link: https://github.com/YuzukiHD/TinyKasKit/commit/1bc76937dcf3
Reported-by: YuzukiTsuru <gloomyghost@gloomyghost.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2023-12-09 11:45:36 -06:00
parent 0ed210b265
commit 6b5d53a885

View File

@ -1100,7 +1100,7 @@ static int auto_scan_dram_size(const dram_para_t *para, dram_config_t *config)
udelay(1);
// Test if bit A23 is BA2 or mirror XXX A22?
chk = CFG_SYS_SDRAM_BASE + (1U << 22);
chk = CFG_SYS_SDRAM_BASE + (1U << 11);
ptr = CFG_SYS_SDRAM_BASE;
for (i = 0, j = 0; i < 64; i++) {
if (readl(chk) != get_payload(i & 1, ptr)) {