sunxi: h616: dram: Rework size detection
authorJernej Skrabec <jernej.skrabec@gmail.com>
Sun, 9 Mar 2025 06:31:42 +0000 (07:31 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Thu, 27 Mar 2025 00:26:35 +0000 (00:26 +0000)
commit40c687aef01fd0ccdf24285f577db1bc0d64db16
treee273cc045a144e5f14a10494761123a622ac323a
parent17c1add327713cb7df80cf52cac0beaf9986542a
sunxi: h616: dram: Rework size detection

Since there is quite a few possible DRAM configurations in terms of bus
width, rank and rows and columns count, size detection algorithm must be
very careful not to test combination which would be bigger than H616 is
actually capable of handling.

Ideally, we should always detect memory aliasing, even for 4 GB memory
size, which is the maximum amount of memory that H616 is capable of
handling. For this reason, we have to configure minimum amount of
supported rows when testing for columns and vice versa. This way test
code will never step out of 4 GB boundary.

While at it, check for 17 rows maximum. This aligns code with BSP DRAM
driver. There is probably no such configuration which would make sense
with 4 GB memory.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/mach-sunxi/dram_sun50i_h616.c