Skip to content

RFC sunxi: D1/D1s/R528/T113-s DRAM init code

Andre Przywara linux-sunxi u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Kconfig: sunxi: prepare for using drivers/ram/sunxidrivers/ram/Kconfig drivers/ram/sunxi/Kconfig+15 -10 replies
2/2sunxi: add R528/T113-s3/D1(s) DRAM initialisation codedrivers/Makefile drivers/ram/Makefile drivers/ram/sunxi/Kconfig +3 more+1557 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] sunxi: D1/D1s/R528/T113-s DRAM init code

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/[email protected]/
[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
Signature · 1 line
2.35.5