Skip to contentSkip to conversation

sunxi: makes an invisible option for H3-like DRAM controllers

PATCH New Icenowy Zheng 2 participants 6 messages Dec 28, 2016 – Jan 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: makes an invisible option for H3-like DRAM controllers

Allwinner SoCs after H3 (e.g. A64, H5, R40, V3s) uses a H3-like DesignWare DRAM controller, which do not have official free DRAM initialization code, but can use modified dram_sun8i_h3.c.

Add a invisible option for easier DRAM initialization code reuse.

---
 arch/arm/include/asm/arch-sunxi/dram.h | 2 +-
 arch/arm/mach-sunxi/Makefile           | 2 +-
 board/sunxi/Kconfig                    | 7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/dram.h +1 -1
index e0be744dba..c5456658a3 100644
@@ -24,7 +24,7 @@
 #include <asm/arch/dram_sun8i_a33.h>
 #elif defined(CONFIG_MACH_SUN8I_A83T)
 #include <asm/arch/dram_sun8i_a83t.h>
-#elif defined(CONFIG_MACH_SUN8I_H3)
+#elif defined(CONFIG_SUNXI_H3_DW_DRAM)
 #include <asm/arch/dram_sun8i_h3.h>
 #elif defined(CONFIG_MACH_SUN9I)
 #include <asm/arch/dram_sun9i.h>
arch/arm/mach-sunxi/Makefile +1 -1
index e73114ee64..dc737db4b9 100644
@@ -48,6 +48,6 @@ obj-$(CONFIG_MACH_SUN7I)	+= dram_sun4i.o
 obj-$(CONFIG_MACH_SUN8I_A23)	+= dram_sun8i_a23.o
 obj-$(CONFIG_MACH_SUN8I_A33)	+= dram_sun8i_a33.o
 obj-$(CONFIG_MACH_SUN8I_A83T)	+= dram_sun8i_a83t.o
-obj-$(CONFIG_MACH_SUN8I_H3)	+= dram_sun8i_h3.o
+obj-$(CONFIG_SUNXI_H3_DW_DRAM)	+= dram_sun8i_h3.o
 obj-$(CONFIG_MACH_SUN9I)	+= dram_sun9i.o
 endif
board/sunxi/Kconfig +7 -0
index e1d4ab148f..4ddd992684 100644
@@ -42,6 +42,12 @@ config SUNXI_GEN_SUN6I
 	separate ahb reset control registers, custom pmic bus, new style
 	watchdog, etc.
 
+config SUNXI_H3_DW_DRAM
+	bool
+	---help---
+	Select this for sunxi SoCs which uses a DRAM controller like the
+	DesignWare controller used in H3, mainly SoCs after H3, which do
+	not have official open-source DRAM initialization code.
 
 choice
 	prompt "Sunxi SoC Variant"
@@ -113,6 +119,7 @@ config MACH_SUN8I_H3
 	select ARCH_SUPPORT_PSCI
 	select SUNXI_GEN_SUN6I
 	select SUPPORT_SPL
+	select SUNXI_H3_DW_DRAM
 	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
 config MACH_SUN9I
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 sunxi: H3/A64: fix non-ODT setting

From: Andre Przywara <[email protected]>

According to Jens disabling the on-die-termination should set bit 5, not bit 1 in the respective register. Fix this.

---
 arch/arm/mach-sunxi/dram_sun8i_h3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/dram_sun8i_h3.c +1 -1
index b08b8e67cc..8e2527dee1 100644
@@ -347,7 +347,7 @@ static int mctl_channel_init(struct dram_para *para)
 		clrsetbits_le32(&mctl_ctl->datx[i].gcr, (0x3 << 4) |
 				(0x1 << 1) | (0x3 << 2) | (0x3 << 12) |
 				(0x3 << 14),
-				IS_ENABLED(CONFIG_DRAM_ODT_EN) ? 0x0 : 0x2);
+				IS_ENABLED(CONFIG_DRAM_ODT_EN) ? 0x0 : 0x20);
 
 	/* AC PDR should always ON */
 	setbits_le32(&mctl_ctl->aciocr, 0x1 << 1);
Signature · 1 line
2.11.0
#2 lore raw

PATCH 1/1 sunxi: H3/A64: fix non-ODT setting

Quoted 7 lines · Icenowy Zheng

From: Andre Przywara <[email protected]>

According to Jens disabling the on-die-termination should set bit 5, not bit 1 in the respective register. Fix this.

This has already been sent and merged (and it's missing your Signed-off-by).

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170105/2efd6853/attachment.sig>
#3 lore raw

PATCH 1/1 sunxi: makes an invisible option for H3-like DRAM controllers

In reply to Icenowy Zheng
Quoted 5 lines · Icenowy Zheng

Allwinner SoCs after H3 (e.g. A64, H5, R40, V3s) uses a H3-like DesignWare DRAM controller, which do not have official free DRAM initialization code, but can use modified dram_sun8i_h3.c.

Add a invisible option for easier DRAM initialization code reuse.

Since it's used on all the newer SoCs, do we need to keep the H3 name in the config option name?

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170105/729af849/attachment.sig>
#4 lore raw

PATCH 1/1 sunxi: makes an invisible option for H3-like DRAM controllers

06.01.2017, 06:16, "Maxime Ripard" <[email protected]>:

Quoted 9 lines · Icenowy Zheng
Quoted 5 lines

?Allwinner SoCs after H3 (e.g. A64, H5, R40, V3s) uses a H3-like ?DesignWare DRAM controller, which do not have official free DRAM ?initialization code, but can use modified dram_sun8i_h3.c.

?Add a invisible option for easier DRAM initialization code reuse.

Since it's used on all the newer SoCs, do we need to keep the H3 name in the config option name?

Good question...

Name it "SUNXI_DW_DRAM"?

(Although I think at least A33 uses the same series of DRAM controller)

Quoted 8 lines

Thanks,
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#5 lore raw

PATCH 1/1 sunxi: makes an invisible option for H3-like DRAM controllers

Quoted 8 lines · Icenowy Zheng

06.01.2017, 06:16, "Maxime Ripard" <[email protected]>:

Quoted 5 lines · Icenowy Zheng
Quoted 4 lines

?Allwinner SoCs after H3 (e.g. A64, H5, R40, V3s) uses a H3-like ?DesignWare DRAM controller, which do not have official free DRAM ?initialization code, but can use modified dram_sun8i_h3.c.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

?Add a invisible option for easier DRAM initialization code reuse.

Since it's used on all the newer SoCs, do we need to keep the H3 name in the config option name?

Good question...

Name it "SUNXI_DW_DRAM"?

Looks good.

Quoted 1 line

(Although I think at least A33 uses the same series of DRAM controller)

Does it? Why do we need a separate DRAM init code then?

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170109/f2c0e612/attachment.sig>