Skip to contentSkip to conversation

powerpc/mpc8xxx: Extend CWL table

PATCH New York Sun 2 participants 6 messages Aug 24, 2011 – Sep 2, 2011 PowerPC

lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH 1/3 powerpc/mpc8xxx: Extend CWL table

Extend CAS write Latency (CWL) table to comply with DDR3 spec

---
 arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +16 -2
index 391eb25..15cd375 100644
@@ -96,6 +96,10 @@ static inline int fsl_ddr_get_rtt(void)
  *       6 if 2.5ns > tCK >= 1.875ns
  *       7 if 1.875ns > tCK >= 1.5ns
  *       8 if 1.5ns > tCK >= 1.25ns
+ *       9 if 1.25ns > tCK >= 1.07ns
+ *       10 if 1.07ns > tCK >= 0.935ns
+ *       11 if 0.935ns > tCK >= 0.833ns
+ *       12 if 0.833ns > tCK >= 0.75ns
  */
 static inline unsigned int compute_cas_write_latency(void)
 {
@@ -110,8 +114,18 @@ static inline unsigned int compute_cas_write_latency(void)
 		cwl = 7;
 	else if (mclk_ps >= 1250)
 		cwl = 8;
-	else
-		cwl = 8;
+	else if (mclk_ps >= 1070)
+		cwl = 9;
+	else if (mclk_ps >= 935)
+		cwl = 10;
+	else if (mclk_ps >= 833)
+		cwl = 11;
+	else if (mclk_ps >= 750)
+		cwl = 12;
+	else {
+		cwl = 12;
+		printf("Warning: CWL is out of range\n");
+	}
 	return cwl;
 }
 
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH 2/3 powerpc/mpc8xxx: Move DDR RCW overriding to common code

DDR RCW varies at different speeds. It is common for all platform. Move it out from corenet_ds.

---
 arch/powerpc/cpu/mpc8xxx/ddr/options.c |   15 +++++++++++++++
 board/freescale/corenet_ds/ddr.c       |   14 --------------
 2 files changed, 15 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc8xxx/ddr/options.c +15 -0
index 7fc5494..7165635 100644
@@ -484,6 +484,7 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 	char buffer[HWCONFIG_BUFFER_SIZE];
 	char *buf = NULL;
 	const dynamic_odt_t *pdodt = odt_unknown;
+	ulong ddr_freq;
 
 	/*
 	 * Extract hwconfig from environment since we have not properly setup
@@ -928,6 +929,20 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 	if (pdimm[0].n_ranks == 4)
 		popts->quad_rank_present = 1;
 
+	ddr_freq = get_ddr_freq(0) / 1000000;
+	if (popts->registered_dimm_en) {
+		popts->rcw_override = 1;
+		popts->rcw_1 = 0x000a5a00;
+		if (ddr_freq <= 800)
+			popts->rcw_2 = 0x00000000;
+		else if (ddr_freq <= 1066)
+			popts->rcw_2 = 0x00100000;
+		else if (ddr_freq <= 1333)
+			popts->rcw_2 = 0x00200000;
+		else
+			popts->rcw_2 = 0x00300000;
+	}
+
 	fsl_ddr_board_options(popts, pdimm, ctrl_num);
 
 	return 0;
board/freescale/corenet_ds/ddr.c +0 -14
index a184592..e3b3855 100644
@@ -223,20 +223,6 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 
 	/* DHC_EN =1, ODT = 60 Ohm */
 	popts->ddr_cdr1 = DDR_CDR1_DHC_EN;
-
-	/* override SPD values. rcw_2 should vary at differnt speed */
-	if (pdimm[0].registered_dimm == 1) {
-		popts->rcw_override = 1;
-		popts->rcw_1 = 0x000a5a00;
-		if (ddr_freq <= 800)
-			popts->rcw_2 = 0x00000000;
-		else if (ddr_freq <= 1066)
-			popts->rcw_2 = 0x00100000;
-		else if (ddr_freq <= 1333)
-			popts->rcw_2 = 0x00200000;
-		else
-			popts->rcw_2 = 0x00300000;
-	}
 }
 
 phys_size_t initdram(int board_type)
Signature · 1 line
1.7.0.4
Applied
#2 lore raw

PATCH 2/3 powerpc/mpc8xxx: Move DDR RCW overriding to common code

Quoted 8 lines · York Sun

DDR RCW varies at different speeds. It is common for all platform. Move it out from corenet_ds.

---

arch/powerpc/cpu/mpc8xxx/ddr/options.c |   15 +++++++++++++++
board/freescale/corenet_ds/ddr.c       |   14 --------------
2 files changed, 15 insertions(+), 14 deletions(-)

applied to 85xx

- k

author
#3 lore raw

PATCH 3/3 powerpc/corenet_ds: Use separated speed tables for UDIMM and RDIMM

In reply to York Sun

RDIMM has different timing parameters from UDIMM. Create new tables for RDIMMs. Single-, dual- and quad-rank RDIMMs have been verified with speeds from 800 to 1333MT/s. Speed table expands to include 1600MT/s for future use. Single- and quad-rank RDIMM entries are copied into UDIMM tables for future use.

---
 board/freescale/corenet_ds/ddr.c |  103 +++++++++++++++++++++++++++++++-------
 1 files changed, 84 insertions(+), 19 deletions(-)
board/freescale/corenet_ds/ddr.c +84 -19
index e3b3855..10ff4e7 100644
@@ -118,53 +118,111 @@ typedef struct {
 	u32 force_2T;
 } board_specific_parameters_t;
 
-/* ranges for parameters:
- *  wr_data_delay = 0-6
- *  clk adjust = 0-8
- *  cpo 2-0x1E (30)
- */
-
-
-/* XXX: these values need to be checked for all interleaving modes.  */
-/* XXX: No reliable dual-rank 800 MHz setting has been found.  It may
- *      seem reliable, but errors will appear when memory intensive
- *      program is run. */
-/* XXX: Single rank at 800 MHz is OK.  */
-const board_specific_parameters_t board_specific_parameters[][30] = {
+const board_specific_parameters_t board_specific_parameters_udimm[][30] = {
 	{
 	/*
 	 * memory controller 0
 	 *  lo|  hi|  num|  clk| wrlvl | cpo  |wrdata|2T
-	 * mhz| mhz|ranks|adjst| start | delay|
+	 * mhz| mhz|ranks|adjst| start |      |delay |
 	 */
 		{  0, 850,    4,    4,     6,   0xff,    2,  0},
 		{851, 950,    4,    5,     7,   0xff,    2,  0},
 		{951, 1050,   4,    5,     8,   0xff,    2,  0},
 		{1051, 1250,  4,    5,    10,   0xff,    2,  0},
 		{1251, 1350,  4,    5,    11,   0xff,    2,  0},
+		{1351, 1666,  4,    5,    12,   0xff,    2,  0},
 		{  0, 850,    2,    5,     6,   0xff,    2,  0},
 		{851, 950,    2,    5,     7,   0xff,    2,  0},
 		{951, 1050,   2,    5,     7,   0xff,    2,  0},
 		{1051, 1250,  2,    4,     6,   0xff,    2,  0},
 		{1251, 1350,  2,    5,     7,   0xff,    2,  0},
+		{1351, 1666,  2,    5,     8,   0xff,    2,  0},
+		{  0, 850,    1,    4,     5,   0xff,    2,  0},
+		{851, 950,    1,    4,     7,   0xff,    2,  0},
+		{951, 1050,   1,    4,     8,   0xff,    2,  0},
+		{1051, 1250,  1,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  1,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  1,    4,     8,   0xff,    2,  0},
 	},
 
 	{
 	/*
 	 * memory controller 1
 	 *  lo|  hi|  num|  clk| wrlvl | cpo  |wrdata|2T
-	 * mhz| mhz|ranks|adjst| start | delay|
+	 * mhz| mhz|ranks|adjst| start |      |delay |
 	 */
 		{  0, 850,    4,    4,     6,   0xff,    2,  0},
 		{851, 950,    4,    5,     7,   0xff,    2,  0},
 		{951, 1050,   4,    5,     8,   0xff,    2,  0},
 		{1051, 1250,  4,    5,    10,   0xff,    2,  0},
 		{1251, 1350,  4,    5,    11,   0xff,    2,  0},
+		{1351, 1666,  4,    5,    12,   0xff,    2,  0},
 		{  0, 850,    2,    5,     6,   0xff,    2,  0},
 		{851, 950,    2,    5,     7,   0xff,    2,  0},
 		{951, 1050,   2,    5,     7,   0xff,    2,  0},
 		{1051, 1250,  2,    4,     6,   0xff,    2,  0},
 		{1251, 1350,  2,    5,     7,   0xff,    2,  0},
+		{1351, 1666,  2,    5,     8,   0xff,    2,  0},
+		{  0, 850,    1,    4,     5,   0xff,    2,  0},
+		{851, 950,    1,    4,     7,   0xff,    2,  0},
+		{951, 1050,   1,    4,     8,   0xff,    2,  0},
+		{1051, 1250,  1,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  1,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  1,    4,     8,   0xff,    2,  0},
+	}
+};
+
+const board_specific_parameters_t board_specific_parameters_rdimm[][30] = {
+	{
+	/*
+	 * memory controller 0
+	 *  lo|  hi|  num|  clk| wrlvl | cpo  |wrdata|2T
+	 * mhz| mhz|ranks|adjst| start |      |delay |
+	 */
+		{  0, 850,    4,    4,     6,   0xff,    2,  0},
+		{851, 950,    4,    5,     7,   0xff,    2,  0},
+		{951, 1050,   4,    5,     8,   0xff,    2,  0},
+		{1051, 1250,  4,    5,    10,   0xff,    2,  0},
+		{1251, 1350,  4,    5,    11,   0xff,    2,  0},
+		{1351, 1666,  4,    5,    12,   0xff,    2,  0},
+		{  0, 850,    2,    4,     6,   0xff,    2,  0},
+		{851, 950,    2,    4,     7,   0xff,    2,  0},
+		{951, 1050,   2,    4,     7,   0xff,    2,  0},
+		{1051, 1250,  2,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  2,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  2,    4,     8,   0xff,    2,  0},
+		{  0, 850,    1,    4,     5,   0xff,    2,  0},
+		{851, 950,    1,    4,     7,   0xff,    2,  0},
+		{951, 1050,   1,    4,     8,   0xff,    2,  0},
+		{1051, 1250,  1,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  1,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  1,    4,     8,   0xff,    2,  0},
+	},
+
+	{
+	/*
+	 * memory controller 1
+	 *  lo|  hi|  num|  clk| wrlvl | cpo  |wrdata|2T
+	 * mhz| mhz|ranks|adjst| start |      |delay |
+	 */
+		{  0, 850,    4,    4,     6,   0xff,    2,  0},
+		{851, 950,    4,    5,     7,   0xff,    2,  0},
+		{951, 1050,   4,    5,     8,   0xff,    2,  0},
+		{1051, 1250,  4,    5,    10,   0xff,    2,  0},
+		{1251, 1350,  4,    5,    11,   0xff,    2,  0},
+		{1351, 1666,  4,    5,    12,   0xff,    2,  0},
+		{  0, 850,    2,    4,     6,   0xff,    2,  0},
+		{851, 950,    2,    4,     7,   0xff,    2,  0},
+		{951, 1050,   2,    4,     7,   0xff,    2,  0},
+		{1051, 1250,  2,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  2,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  2,    4,     8,   0xff,    2,  0},
+		{  0, 850,    1,    4,     5,   0xff,    2,  0},
+		{851, 950,    1,    4,     7,   0xff,    2,  0},
+		{951, 1050,   1,    4,     8,   0xff,    2,  0},
+		{1051, 1250,  1,    4,     8,   0xff,    2,  0},
+		{1251, 1350,  1,    4,     8,   0xff,    2,  0},
+		{1351, 1666,  1,    4,     8,   0xff,    2,  0},
 	}
 };
 
@@ -172,13 +230,20 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 				dimm_params_t *pdimm,
 				unsigned int ctrl_num)
 {
-	const board_specific_parameters_t *pbsp =
-				&(board_specific_parameters[ctrl_num][0]);
-	u32 num_params = sizeof(board_specific_parameters[ctrl_num]) /
-				sizeof(board_specific_parameters[0][0]);
+	const board_specific_parameters_t *pbsp;
+	u32 num_params;
 	u32 i;
 	ulong ddr_freq;
 
+	if (popts->registered_dimm_en) {
+		pbsp = &(board_specific_parameters_rdimm[ctrl_num][0]);
+		num_params = sizeof(board_specific_parameters_rdimm[ctrl_num]) /
+				sizeof(board_specific_parameters_rdimm[0][0]);
+	} else {
+		pbsp = &(board_specific_parameters_udimm[ctrl_num][0]);
+		num_params = sizeof(board_specific_parameters_udimm[ctrl_num]) /
+				sizeof(board_specific_parameters_udimm[0][0]);
+	}
 	/* Get clk_adjust, cpo, write_data_delay,2T, according to the board ddr
 	 * freqency and n_banks specified in board_specific_parameters table.
 	 */
Signature · 1 line
1.7.0.4
Applied
#4 lore raw

PATCH 3/3 powerpc/corenet_ds: Use separated speed tables for UDIMM and RDIMM

Quoted 10 lines · York Sun

RDIMM has different timing parameters from UDIMM. Create new tables for RDIMMs. Single-, dual- and quad-rank RDIMMs have been verified with speeds from 800 to 1333MT/s. Speed table expands to include 1600MT/s for future use. Single- and quad-rank RDIMM entries are copied into UDIMM tables for future use.

---
board/freescale/corenet_ds/ddr.c | 103 +++++++++++++++++++++++++++++++-------

1 files changed, 84 insertions(+), 19 deletions(-)

applied to 85xx

- k

Applied
#5 lore raw

PATCH 1/3 powerpc/mpc8xxx: Extend CWL table

In reply to York Sun
Quoted 6 lines · York Sun

Extend CAS write Latency (CWL) table to comply with DDR3 spec

---
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c | 18 ++++++++++++++++--

1 files changed, 16 insertions(+), 2 deletions(-)

applied to 85xx

- k