[RFC PATCH 0/2] sunxi: D1/D1s/R528/T113-s DRAM init code
Andre Przywara
andre.przywara at arm.com
Tue Jan 3 02:17:53 CET 2023
Hi,
this is the extracted version of the Allwinner D1/D1s/R528/T113-s DRAM
"driver", to be included into mainline U-Boot at some point. With this
on top of my previous T113-s3 support series[1], I can boot my MangoPi MQ-R
without the help of awboot.
The DRAM init code is based on awboot's version, though has been heavily
reworked. To show what has been done, I pushed a history branch [2], which
takes a verbatim copy of awboot's mctl_hal.c, then converts this over the
course of about 80 patches into the version posted here. The series there
contains an awboot/U-Boot compat layer, so the file can be used in both
repositories. This compat layer is dropped here, but can be put back by
reverting the top patch of [2].
I was wondering if people could have a look at this version here, to give
early feedback. I will (re-)post this as part of a proper R528/T113-s
support series, but first need to sort out some minor issues and address
Samuel's comments on the previous version.
If you wonder, the (working!) Kconfig DRAM variables for the T113-s3 are:
CONFIG_DRAM_CLK=792
CONFIG_DRAM_ZQ=8092667
CONFIG_DRAM_SUNXI_ODT_EN=0
CONFIG_DRAM_SUNXI_TPR0=0x004a2195
CONFIG_DRAM_SUNXI_TPR11=0x340000
CONFIG_DRAM_SUNXI_TPR12=0x46
CONFIG_DRAM_SUNXI_TPR13=0x34000100
For the D1 with DDR3 chips (most boards?), it should be those values:
CONFIG_DRAM_CLK=792
CONFIG_DRAM_SUNXI_ODT_EN=1
CONFIG_DRAM_SUNXI_TPR0=0x004a2195
CONFIG_DRAM_SUNXI_TPR11=0x870000
CONFIG_DRAM_SUNXI_TPR12=0x24
CONFIG_DRAM_SUNXI_TPR13=0x34050100
According to the dump of some MangoPi MQ-1 firmware, the D1s should work with:
CONFIG_SUNXI_DRAM_DDR2=y
CONFIG_DRAM_CLK=528
CONFIG_DRAM_ZQ=8092665
CONFIG_DRAM_SUNXI_ODT_EN=0
CONFIG_DRAM_SUNXI_TPR0=0x00471992
CONFIG_DRAM_SUNXI_TPR11=0x30010
CONFIG_DRAM_SUNXI_TPR12=0x35
CONFIG_DRAM_SUNXI_TPR13=0x34000000
Many thanks!
Andre
[1] https://lore.kernel.org/u-boot/20221206004549.29015-1-andre.przywara@arm.com/
[2] https://github.com/apritzel/u-boot/commits/d1_dram_history
Andre Przywara (2):
Kconfig: sunxi: prepare for using drivers/ram/sunxi
sunxi: add R528/T113-s3/D1(s) DRAM initialisation code
drivers/Makefile | 1 +
drivers/ram/Kconfig | 3 +-
drivers/ram/Makefile | 2 +
drivers/ram/sunxi/Kconfig | 68 ++
drivers/ram/sunxi/Makefile | 4 +
drivers/ram/sunxi/dram_sun20i_d1.c | 1425 ++++++++++++++++++++++++++++
drivers/ram/sunxi/dram_sun20i_d1.h | 70 ++
7 files changed, 1572 insertions(+), 1 deletion(-)
create mode 100644 drivers/ram/sunxi/Kconfig
create mode 100644 drivers/ram/sunxi/Makefile
create mode 100644 drivers/ram/sunxi/dram_sun20i_d1.c
create mode 100644 drivers/ram/sunxi/dram_sun20i_d1.h
--
2.35.5
More information about the U-Boot
mailing list