Skip to contentSkip to conversation

ppc4xx: Add CONFIG_DDR_RFDC_FIXED to allow board specific RFDC values

PATCH New Stefan Roese 2 participants 3 messages Jul 19, 2010 – Jul 20, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc4xx: Add CONFIG_DDR_RFDC_FIXED to allow board specific RFDC values

Using this define, a board can define an opimized RFDC value and use the auto calibration code to "tune" the remaining DDR2 controller calibration register.

---
 arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +12 -0
index 0f69ef9..5e35c61 100644
@@ -767,6 +767,13 @@ static u32 DQS_calibration_methodB(struct ddrautocal *cal)
 
 	debug("\n\n");
 
+#if defined(CONFIG_DDR_RFDC_FIXED)
+	mtsdram(SDRAM_RFDC, CONFIG_DDR_RFDC_FIXED);
+	size = 512;
+	rffd_average = CONFIG_DDR_RFDC_FIXED & SDRAM_RFDC_RFFD_MASK;
+	mfsdram(SDRAM_RDCC, rdcc);	/* record this value */
+	cal->rdcc = rdcc;
+#else
 	in_window = 0;
 	rdcc = 0;
 
@@ -830,6 +837,7 @@ static u32 DQS_calibration_methodB(struct ddrautocal *cal)
 		rffd_average = SDRAM_RFDC_RFFD_MAX;
 
 	mtsdram(SDRAM_RFDC, rfdc_reg | SDRAM_RFDC_RFFD_ENCODE(rffd_average));
+#endif
 
 	rffd = rffd_average;
 	in_window = 0;
@@ -1211,10 +1219,14 @@ u32 DQS_autocalibration(void)
 		debug("*** best_result: read value SDRAM_RQDC 0x%08x\n",
 				rqdc_reg);
 
+#if defined(CONFIG_DDR_RFDC_FIXED)
+		mtsdram(SDRAM_RFDC, CONFIG_DDR_RFDC_FIXED);
+#else
 		mfsdram(SDRAM_RFDC, rfdc_reg);
 		rfdc_reg &= ~(SDRAM_RFDC_RFFD_MASK);
 		mtsdram(SDRAM_RFDC, rfdc_reg |
 				SDRAM_RFDC_RFFD_ENCODE(tcal.autocal.rffd));
+#endif
 
 		mfsdram(SDRAM_RFDC, rfdc_reg);
 		debug("*** best_result: read value SDRAM_RFDC 0x%08x\n",
Signature · 1 line
1.7.1.1
#1 lore raw

PATCH 1/1 ppc4xx: Add CONFIG_DDR_RFDC_FIXED to allow board specific RFDC values

Dear Stefan Roese,

Quoted 3 lines · In message <[email protected]> you wrote:

Using this define, a board can define an opimized RFDC value and use the auto calibration code to "tune" the remaining DDR2 controller calibration register.

...

Quoted 15 lines
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +7 -0
@@ -767,6 +767,13 @@ static u32 DQS_calibration_methodB(struct ddrautocal *cal)
 
 	debug("\n\n");
 
+#if defined(CONFIG_DDR_RFDC_FIXED)
+	mtsdram(SDRAM_RFDC, CONFIG_DDR_RFDC_FIXED);
+	size = 512;
+	rffd_average = CONFIG_DDR_RFDC_FIXED & SDRAM_RFDC_RFFD_MASK;
+	mfsdram(SDRAM_RDCC, rdcc);	/* record this value */
+	cal->rdcc = rdcc;
+#else
 	in_window = 0;
 	rdcc = 0;
 

arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c static u32 DQS_calibration_methodB(struct ddrautocal *cal) · line 840

Quoted 4 lines
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +1 -0
@@ -830,6 +837,7 @@ static u32 DQS_calibration_methodB(struct ddrautocal *cal)
 		rffd_average = SDRAM_RFDC_RFFD_MAX;
 
 	mtsdram(SDRAM_RFDC, rfdc_reg | SDRAM_RFDC_RFFD_ENCODE(rffd_average));
+#endif

In cases of such long blocks, where the ending #endif is many, many lines away, it is usually helpful to mark where the #endif belongs to:

	#endif /* CONFIG_DDR_RFDC_FIXED */

Please do this here, too.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm a programmer: I don't buy software, I write it.
                                                  -- Tom Christiansen
#2 lore raw

PATCH 1/1 ppc4xx: Add CONFIG_DDR_RFDC_FIXED to allow board specific RFDC values

Hi Wolfgang,

Quoted 23 lines · On Monday 19 July 2010 19:54:08 Wolfgang Denk wrote:
Quoted 23 lines
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +7 -0
@@ -767,6 +767,13 @@ static u32 DQS_calibration_methodB(struct ddrautocal
 *cal)
 
 	debug("\n\n");
 
+#if defined(CONFIG_DDR_RFDC_FIXED)
+	mtsdram(SDRAM_RFDC, CONFIG_DDR_RFDC_FIXED);
+	size = 512;
+	rffd_average = CONFIG_DDR_RFDC_FIXED & SDRAM_RFDC_RFFD_MASK;
+	mfsdram(SDRAM_RDCC, rdcc);	/* record this value */
+	cal->rdcc = rdcc;
+#else
 
 	in_window = 0;
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +0 -0
 	rdcc = 0;
@@ -830,6 +837,7 @@ static u32 DQS_calibration_methodB(struct ddrautocal
 *cal)
 
 		rffd_average = SDRAM_RFDC_RFFD_MAX;
 
 	mtsdram(SDRAM_RFDC, rfdc_reg | SDRAM_RFDC_RFFD_ENCODE(rffd_average));
 
Quoted 8 lines

Review static u32 DQS_calibration_methodB(struct ddrautocal · line 843

Quoted 1 line
(quoted diff) +1 -0
+#endif

In cases of such long blocks, where the ending #endif is many, many lines away, it is usually helpful to mark where the #endif belongs to:

	#endif /* CONFIG_DDR_RFDC_FIXED */

Please do this here, too.

Yes, good idea. Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de