Skip to contentSkip to conversation

mips: mt7628: fix ddr_type for MT7688KN

PATCH New Weijie Gao 3 participants 4 messages Feb 23, 2021 – Apr 22, 2021

Subsystems (2)
lore
Share & tools
lore

Weijie Gao

author
#0 lore raw

PATCH 1/1 mips: mt7628: fix ddr_type for MT7688KN

The MT7688KN is a multi-chip package with 8MiB DDR1 KGD. So the DDR type from bootstrap register must be ignored, and always be assumed as DDR1.

This patch fixes an issue that mt7628_ddr_pad_ldo_config() may be passed with a wrong ddr_type in MT7688KN.

---
 arch/mips/mach-mtmips/mt7628/ddr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/mt7628/ddr.c +3 -3
index b091f2ecff..4e72459906 100644
@@ -140,6 +140,9 @@ void mt7628_ddr_init(void)
 	lspd = readl(sysc + SYSCTL_CLKCFG0_REG) &
 	       (CPU_PLL_FROM_BBP | CPU_PLL_FROM_XTAL);
 
+	if (pkg_type == PKG_ID_KN)
+		ddr_type = DRAM_DDR1;
+
 	mt7628_memc_reset(1);
 	__udelay(200);
 
@@ -152,9 +155,6 @@ void mt7628_ddr_init(void)
 	param.memsize = 0;
 	param.bus_width = 0;
 
-	if (pkg_type == PKG_ID_KN)
-		ddr_type = DRAM_DDR1;
-
 	if (ddr_type == DRAM_DDR1) {
 		if (lspd)
 			param.cfgs = ddr1_cfgs_160mhz;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 mips: mt7628: fix ddr_type for MT7688KN

Hi Weijie,

Quoted 27 lines · Weijie Gao

The MT7688KN is a multi-chip package with 8MiB DDR1 KGD. So the DDR type from bootstrap register must be ignored, and always be assumed as DDR1.

This patch fixes an issue that mt7628_ddr_pad_ldo_config() may be passed with a wrong ddr_type in MT7688KN.

---
  arch/mips/mach-mtmips/mt7628/ddr.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/mt7628/ddr.c +3 -0
index b091f2ecff..4e72459906 100644
@@ -140,6 +140,9 @@ void mt7628_ddr_init(void)
  	lspd = readl(sysc + SYSCTL_CLKCFG0_REG) &
  	       (CPU_PLL_FROM_BBP | CPU_PLL_FROM_XTAL);
 
+	if (pkg_type == PKG_ID_KN)
+		ddr_type = DRAM_DDR1;
+
  	mt7628_memc_reset(1);
  	__udelay(200);
 

arch/mips/mach-mtmips/mt7628/ddr.c void mt7628_ddr_init(void) · line 160

Quoted 9 lines
arch/mips/mach-mtmips/mt7628/ddr.c +0 -3
@@ -152,9 +155,6 @@ void mt7628_ddr_init(void)
  	param.memsize = 0;
  	param.bus_width = 0;
 
-	if (pkg_type == PKG_ID_KN)
-		ddr_type = DRAM_DDR1;
-
  	if (ddr_type == DRAM_DDR1) {
  		if (lspd)
  			param.cfgs = ddr1_cfgs_160mhz;

Just out of interest. How did you spot this issue?

Thanks,
Stefan

author
#2 lore raw

PATCH 1/1 mips: mt7628: fix ddr_type for MT7688KN

Quoted 42 lines · Stefan Roese

Hi Weijie,

Quoted 27 lines · Weijie Gao

The MT7688KN is a multi-chip package with 8MiB DDR1 KGD. So the DDR type from bootstrap register must be ignored, and always be assumed as DDR1.

This patch fixes an issue that mt7628_ddr_pad_ldo_config() may be passed with a wrong ddr_type in MT7688KN.

---
  arch/mips/mach-mtmips/mt7628/ddr.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/mt7628/ddr.c +3 -0
index b091f2ecff..4e72459906 100644
@@ -140,6 +140,9 @@ void mt7628_ddr_init(void)
  	lspd = readl(sysc + SYSCTL_CLKCFG0_REG) &
  	       (CPU_PLL_FROM_BBP | CPU_PLL_FROM_XTAL);
 
+	if (pkg_type == PKG_ID_KN)
+		ddr_type = DRAM_DDR1;
+
  	mt7628_memc_reset(1);
  	__udelay(200);
 

arch/mips/mach-mtmips/mt7628/ddr.c void mt7628_ddr_init(void) · line 160

Quoted 9 lines
arch/mips/mach-mtmips/mt7628/ddr.c +0 -3
@@ -152,9 +155,6 @@ void mt7628_ddr_init(void)
  	param.memsize = 0;
  	param.bus_width = 0;
 
-	if (pkg_type == PKG_ID_KN)
-		ddr_type = DRAM_DDR1;
-
  	if (ddr_type == DRAM_DDR1) {
  		if (lspd)
  			param.cfgs = ddr1_cfgs_160mhz;
Quoted 1 line

Just out of interest. How did you spot this issue?

I was told by another developer.

Quoted 3 lines

Thanks,
Stefan

#3 lore raw

PATCH 1/1 mips: mt7628: fix ddr_type for MT7688KN

In reply to Weijie Gao

Am Dienstag, den 23.02.2021, 15:12 +0800 schrieb Weijie Gao:

Quoted 5 lines

The MT7688KN is a multi-chip package with 8MiB DDR1 KGD. So the DDR type
from bootstrap register must be ignored, and always be assumed as DDR1.

Quoted 9 lines

This patch fixes an issue that mt7628_ddr_pad_ldo_config() may be passed
with a wrong ddr_type in MT7688KN.

---
 arch/mips/mach-mtmips/mt7628/ddr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

applied to u-boot-mips, thanks.

Signature · 1 line
- Daniel