Skip to contentSkip to conversation

sunxi: H616: add LPDDR4 support

PATCH Superseded Mikhail Kalashnikov 1 participant 2 messages Jul 29, 2023

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover sunxi: H616: add LPDDR4 support

From: iuncuim <[email protected]>

At the moment, the driver only supports DDR3 and LPDDR3 memory. Add support for a new type DRAM.

iuncuim (1):
dram: h616: add LPDDR4 DRAM support

 .../include/asm/arch-sunxi/dram_sun50i_h616.h |   1 +
 arch/arm/mach-sunxi/Kconfig                   |  11 +
 arch/arm/mach-sunxi/dram_sun50i_h616.c        | 200 ++++++++++++++----
 arch/arm/mach-sunxi/dram_timings/Makefile     |   1 +
 .../dram_timings/h616_lpddr4_1200.c           |  96 +++++++++
 5 files changed, 270 insertions(+), 39 deletions(-)
 create mode 100644 arch/arm/mach-sunxi/dram_timings/h616_lpddr4_1200.c
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 sunxi: H616: add LPDDR4 DRAM support

From: iuncuim <[email protected]>

The H616 SoC family has support for several types of DRAM: DDR3, LPDDR3, DDR4 and LPDDR4.
At the moment, the driver only supports DDR3 and LPDDR3 memory. Let's extend the driver to support the LPDDR4 memory. This type of memory widely used in device with T507(-H) SoC. All "magic" values obtained from the boot0.
These changes have been successfully tested by me with MYiR MYB-YT507 (1GB ARTMEM ATL4B08323M62) and 9tripod X507BV4 (2GB FORESEE NCLDXC2MG512M32).

---
 .../include/asm/arch-sunxi/dram_sun50i_h616.h |   1 +
 arch/arm/mach-sunxi/Kconfig                   |  11 +
 arch/arm/mach-sunxi/dram_sun50i_h616.c        | 200 ++++++++++++++----
 arch/arm/mach-sunxi/dram_timings/Makefile     |   1 +
 .../dram_timings/h616_lpddr4_1200.c           |  96 +++++++++
 5 files changed, 270 insertions(+), 39 deletions(-)
 create mode 100644 arch/arm/mach-sunxi/dram_timings/h616_lpddr4_1200.c
arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h +1 -0
index 11774deded..ee25c324ff 100644
@@ -130,6 +130,7 @@ check_member(sunxi_mctl_ctl_reg, unk_0x4240, 0x4240);
 #define MSTR_DEVICETYPE_LPDDR2	BIT(2)
 #define MSTR_DEVICETYPE_LPDDR3	BIT(3)
 #define MSTR_DEVICETYPE_DDR4	BIT(4)
+#define MSTR_DEVICETYPE_LPDDR4	BIT(5)
 #define MSTR_DEVICETYPE_MASK	GENMASK(5, 0)
 #define MSTR_2TMODE		BIT(10)
 #define MSTR_BUSWIDTH_FULL	(0 << 12)
arch/arm/mach-sunxi/Kconfig +11 -0
index e20c3a3ee9..0e82edeeab 100644
@@ -441,6 +441,9 @@ config SUNXI_DRAM_DDR2
 config SUNXI_DRAM_LPDDR3
 	bool
 
+config SUNXI_DRAM_LPDDR4
+	bool
+
 choice
 	prompt "DRAM Type and Timing"
 	default SUNXI_DRAM_DDR3_1333 if !MACH_SUN8I_V3S
@@ -484,6 +487,14 @@ config SUNXI_DRAM_H616_LPDDR3
 	  This option is the LPDDR3 timing used by the stock boot0 by
 	  Allwinner.
 
+config SUNXI_DRAM_H616_LPDDR4
+	bool "LPDDR4 DRAM chips on the H616 DRAM controller"
+	select SUNXI_DRAM_LPDDR4
+	depends on DRAM_SUN50I_H616
+	help
+	  This option is the LPDDR4 timing used by the stock boot0 by
+	  Allwinner.
+
 config SUNXI_DRAM_H616_DDR3_1333
 	bool "DDR3-1333 boot0 timings on the H616 DRAM controller"
 	select SUNXI_DRAM_DDR3
arch/arm/mach-sunxi/dram_sun50i_h616.c +161 -39

347 lines not on this page · raw message

arch/arm/mach-sunxi/dram_timings/Makefile +1 -0
index 8bfd99448a..21afad4cd7 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_SUNXI_DRAM_H6_LPDDR3)	+= h6_lpddr3.o
 obj-$(CONFIG_SUNXI_DRAM_H6_DDR3_1333)	+= h6_ddr3_1333.o
 obj-$(CONFIG_SUNXI_DRAM_H616_DDR3_1333)	+= h616_ddr3_1333.o
 obj-$(CONFIG_SUNXI_DRAM_H616_LPDDR3)	+= h616_lpddr3.o
+obj-$(CONFIG_SUNXI_DRAM_H616_LPDDR4)	+= h616_lpddr4_1200.o
arch/arm/mach-sunxi/dram_timings/h616_lpddr4_1200.c new file +96 -0

97 lines not on this page · raw message

Signature · 1 line
2.41.0