sunxi: support asymmetric dual rank DRAM on A64/R40
authorIcenowy Zheng <icenowy@aosc.io>
Thu, 25 Feb 2021 16:13:24 +0000 (00:13 +0800)
committerAndre Przywara <andre.przywara@arm.com>
Fri, 16 Apr 2021 00:12:58 +0000 (01:12 +0100)
commite9dfd8e96031317a837e659ac2aa1a59278c2ce6
treeb6c7d8bc6bfdffd079467912609c25915e4f4a40
parent17d6eceab5c005ad6780ad22ae8e7b5c1c9ac0d7
sunxi: support asymmetric dual rank DRAM on A64/R40

Previously we have known that R40 has a configuration register for its
rank 1, which allows different configuration than rank 0. Reverse
engineering of newest libdram of A64 from Allwinner shows that A64 has
this register too. It's bit 0 (which enables dual rank in rank 0
configuration register) means a dedicated rank size setup is used for
rank 1.

Now, Pine64 scheduled to use a 3GiB LPDDR3 DRAM chip (which has 2GiB
rank 0 and 1GiB rank 1) on PinePhone, that makes asymmetric dual rank
DRAM support necessary.

Add this support. The code could support both A64 and R40, but because
dual rank detection is broken on R40 now, we cannot really use it on R40
currently.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h
arch/arm/mach-sunxi/dram_sunxi_dw.c