DRAM Controller

Several different families of DRAM controllers exist:

sun4i (Allwinner A10), sun5i (Allwinner A13) and sun7i (Allwinner A20) hardware
No accurate documentation for this particular DRAM controller exists in public access. But it is suspected that Allwinner uses one of the revisions of Synopsys DesignWare DDR2/3-Lite Memory Controller IP (MCTL) combined with DDR2/3-Lite PHY IP in A10/A13/A20. Also this DRAM controller apparently has siblings in Rockchip RK29XX, RK30XX and TI KeyStone2 hardware, which have some documentation and some bits of kernel and bootloader sources available in the Internet. Not to mention the original Allwinner boot0 bootloader sources and the suspend support code from the linux-sunxi kernel. This provides enough hints for finding out how the DRAM controller actually works by checking various bits of information via the trial and error method.

As a result, we have a reasonably usable reconstructed A10 DRAM Controller Register Guide.

A10 DRAM Controller Performance

A10 DRAM Controller Calibration

DRAM Calibration Results

See also: DRAM controller quirks

sun6i (Allwinner A31) hardware
The sun6i DRAM controller is very similar to the one found in public Rockchip RK30xx documentation.

A31 boot0/boot1 source: 

A31 u-boot support: A31 dram.c dram_sun6i.c

A31 DRAM Controller Register Guide

sun9i (Allwinner A80) and early sun8i (Allwinner A23) hardware
This DRAM controller generation is similar to the one found in Xilinx Zynq UltraScale+ SoCs, but with reduced features, maybe an older version. The PHY has more differences, some parts are still similar to RK30xx and TI KeyStone2.

Some initial register dumps from A23 reveal that there are significant differences between the A31 and A23 dram controllers. There are dram controller register defines in the a23 suspend code in this code (dram_init) the SPL parameters are read and stored into structure defined here without using the definition.

sun8i (Allwinner A33, A83T, H3) and sun50i (Allwinner A64, H5) hardware
The latest DRAM controller is similar to the previous sun9i generation, but with completely different register layout and some features removed. Controller and PHY registers got combined into a single block, with no particular or meaningful order.

There are some small differences between the various SoCs, especially in the PHYs, but overall it looks like they all use the same generation of DRAM controller. It seems like H5 doesn't have a BIST anymore, also some data training regsiters vanished.

sun50i (Allwinner H6) hardware
This generation of DRAM controller has DDR4 memory support, and still being mysterious now.

According to disassembly of auto_set_timing_para function of the libdram of H6, the PHY/controller seems to be similar to the one found in Xilinx Zynq UltraScale+ SoCs.