Skip to contentSkip to conversation

mpc8xxx: Display RDIMM if detected

PATCH Superseded York Sun 4 participants 29 messages Dec 17, 2010 – Jan 10, 2011 PowerPC

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH v2 1/9 mpc8xxx: Display RDIMM if detected

Print a message when a RDIMM is detected.

---
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c        |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +7 -12
index 029e566..af0250d 100644
@@ -98,7 +98,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	unsigned int tDQSQ_max_ps = 0;
 	unsigned int tQHS_ps = 0;
 
-	unsigned int temp1, temp2, temp3;
+	unsigned int temp1, temp2;
 	unsigned int additive_latency = 0;
 #if !defined(CONFIG_FSL_DDR3)
 	const unsigned int mclk_ps = get_memory_clk_period_ps();
@@ -215,21 +215,16 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 	}
 
 	outpdimm->all_DIMMs_registered = 0;
+	outpdimm->all_DIMMs_unbuffered = 0;
 	if (temp1 && !temp2) {
 		outpdimm->all_DIMMs_registered = 1;
-	}
-
-	outpdimm->all_DIMMs_unbuffered = 0;
-	if (!temp1 && temp2) {
+		printf("Detected RDIMM(s)\n");
+	} else if (!temp1 && temp2) {
 		outpdimm->all_DIMMs_unbuffered = 1;
-	}
-
-	/* CHECKME: */
-	if (!outpdimm->all_DIMMs_registered
-	    && !outpdimm->all_DIMMs_unbuffered) {
+		printf("Detected UDIMM(s)\n");
+	} else
 		printf("ERROR:  Mix of registered buffered and unbuffered "
 				"DIMMs detected!\n");
-	}
 
 	temp1 = 0;
 	if (outpdimm->all_DIMMs_registered)
@@ -237,7 +232,7 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 			outpdimm->rcw[j] = dimm_params[0].rcw[j];
 			for (i = 1; i < number_of_dimms; i++)
 				if (dimm_params[i].rcw[j] != dimm_params[0].rcw[j]) {
-					temp3 = 1;
+					temp1 = 1;
 					break;
 				}
 		}
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

To temporarily fix buffer issue when running at flash, use bigger buffer to push down the stack deeper.

---
 common/hwconfig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/hwconfig.c +1 -1
index 3c9759f..1b33d95 100644
@@ -71,7 +71,7 @@ next:
 const char *cpu_hwconfig __attribute__((weak));
 const char *board_hwconfig __attribute__((weak));
 
-#define HWCONFIG_PRE_RELOC_BUF_SIZE	128
+#define HWCONFIG_PRE_RELOC_BUF_SIZE	256
 
 static const char *__hwconfig(const char *opt, size_t *arglen)
 {
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Dear York Sun,

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

To temporarily fix buffer issue when running at flash, use bigger buffer to push down the stack deeper.

Please explain 1) why this is needed and 2) what it has to do with running "at" (from?) flash?

hwconfig is intended for simple h/w configurations. In which case do you need more than 128 characters for such settings? And is this really needed / reasonable?

Best regards,

Wolfgang Denk

Signature · 4 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
"Stupidity, like virtue, is its own reward"     - William E. Davidsen
author
#3 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 6 lines · Wolfgang Denk

Dear York Sun,

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

To temporarily fix buffer issue when running at flash, use bigger buffer to push down the stack deeper.

Quoted 8 lines
Quoted 1 line

Please explain 1) why this is needed and 2) what it has to do with running "at" (from?) flash?

hwconfig is intended for simple h/w configurations. In which case do you need more than 128 characters for such settings? And is this really needed / reasonable?

First of all, I don't need more than 128 characters for hwconfig. I think the buggy code makes the buffer less usable.

If you look into the common/hwconfig.c, you will notice the _current_ code uses the stack as temporary memory to hold the variable. Even I don't agree with this way, I don't have a quick fix either. There may be two ways or more to fix it. One is to create wrapper functions to deal with pre-relocation and post-relocation functions. Another way is to allocate more space in gd. Which way do you think is better?

York

#4 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Dear York Sun,

Quoted 10 lines · In message <1294085287.24386.52.camel@oslab-l1> you wrote:
Quoted 7 lines

Please explain 1) why this is needed and 2) what it has to do with running "at" (from?) flash?

hwconfig is intended for simple h/w configurations. In which case do you need more than 128 characters for such settings? And is this really needed / reasonable?

First of all, I don't need more than 128 characters for hwconfig. I think the buggy code makes the buffer less usable.

Hm... I have no idea whish sort of "buggy code" you are referring to here, but in this case we shoul start and fix that buggy code, right?

Quoted 3 lines

If you look into the common/hwconfig.c, you will notice the _current_ code uses the stack as temporary memory to hold the variable. Even I don't agree with this way, I don't have a quick fix either. There may be

What's wrong with putting it on the stack? This prevents a permanent allocation, so the memory can easily be reused once that function returns.

Quoted 3 lines

two ways or more to fix it. One is to create wrapper functions to deal with pre-relocation and post-relocation functions. Another way is to allocate more space in gd. Which way do you think is better?

You fail to explain why we should change anything when you "don't need more than 128 characters for hwconfig" in the first place?

Best regards,

Wolfgang Denk

Signature · 6 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
A Vulcan can  no  sooner  be  disloyal  than  he  can  exist  without
breathing.
	-- Kirk, "The Menagerie", stardate 3012.4
author
#5 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 11 lines · Wolfgang Denk

Dear York Sun,

Quoted 8 lines · In message <1294085287.24386.52.camel@oslab-l1> you wrote:
Quoted 7 lines

Please explain 1) why this is needed and 2) what it has to do with running "at" (from?) flash?

hwconfig is intended for simple h/w configurations. In which case do you need more than 128 characters for such settings? And is this really needed / reasonable?

Quoted 5 lines
Quoted 2 lines

First of all, I don't need more than 128 characters for hwconfig. I think the buggy code makes the buffer less usable.

Hm... I have no idea whish sort of "buggy code" you are referring to here, but in this case we shoul start and fix that buggy code, right?

Making a buffer in a function's stack and make use of it out of the scope, that's the buggy code I am referring.

Quoted 8 lines
Quoted 4 lines

If you look into the common/hwconfig.c, you will notice the _current_ code uses the stack as temporary memory to hold the variable. Even I don't agree with this way, I don't have a quick fix either. There may be

What's wrong with putting it on the stack? This prevents a permanent allocation, so the memory can easily be reused once that function returns.

How can the content be guaranteed? The stack can be trashed when the function returns.

Quoted 7 lines
Quoted 4 lines

two ways or more to fix it. One is to create wrapper functions to deal with pre-relocation and post-relocation functions. Another way is to allocate more space in gd. Which way do you think is better?

You fail to explain why we should change anything when you "don't need more than 128 characters for hwconfig" in the first place?

I don't need more than 128 characters. However, the stack is trashed by other functions. I have to push the stack deeper to keep the content unchanged. I am not happy with it.

York

#6 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Dear York Sun,

Quoted 6 lines · In message <1294089991.24386.58.camel@oslab-l1> you wrote:
Quoted 3 lines

Hm... I have no idea whish sort of "buggy code" you are referring to here, but in this case we shoul start and fix that buggy code, right?

Making a buffer in a function's stack and make use of it out of the scope, that's the buggy code I am referring.

That is bad indeed, and needs to be fixed.

Quoted 6 lines
Quoted 2 lines

You fail to explain why we should change anything when you "don't need more than 128 characters for hwconfig" in the first place?

I don't need more than 128 characters. However, the stack is trashed by other functions. I have to push the stack deeper to keep the content unchanged. I am not happy with it.

Now I understand what you mean.

But we do not need a bigger buffer, or store another copy of the whole content of the "hwconfig" variable - we just need room to for the return value of hwconfig_parse(), which usually should be (much) smaller than the content of the "hwconfig" variable.

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
The price of curiosity is a terminal experience.
                         - Terry Pratchett, _The Dark Side of the Sun_
#7 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 11 lines · Wolfgang Denk

Dear York Sun,

Quoted 6 lines · In message <1294089991.24386.58.camel@oslab-l1> you wrote:
Quoted 3 lines

Hm... I have no idea whish sort of "buggy code" you are referring to here, but in this case we shoul start and fix that buggy code, right?

Making a buffer in a function's stack and make use of it out of the scope, that's the buggy code I am referring.

That is bad indeed, and needs to be fixed.

Where is that happening?

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

You fail to explain why we should change anything when you "don't need more than 128 characters for hwconfig" in the first place?

I don't need more than 128 characters. However, the stack is trashed by other functions. I have to push the stack deeper to keep the content unchanged. I am not happy with it.

Quoted 6 lines

Now I understand what you mean.

But we do not need a bigger buffer, or store another copy of the whole content of the "hwconfig" variable - we just need room to for the return value of hwconfig_parse(), which usually should be (much) smaller than the content of the "hwconfig" variable.

I agree with WD, I'm confused. Can you provide the hwconfig string you are using that has issues with 128 but works at 256.

- k

author
#8 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 25 lines · Kumar Gala
Quoted 11 lines · Wolfgang Denk

Dear York Sun,

Quoted 6 lines · In message <1294089991.24386.58.camel@oslab-l1> you wrote:
Quoted 3 lines

Hm... I have no idea whish sort of "buggy code" you are referring to here, but in this case we shoul start and fix that buggy code, right?

Making a buffer in a function's stack and make use of it out of the scope, that's the buggy code I am referring.

That is bad indeed, and needs to be fixed.

Where is that happening?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

You fail to explain why we should change anything when you "don't need more than 128 characters for hwconfig" in the first place?

I don't need more than 128 characters. However, the stack is trashed by other functions. I have to push the stack deeper to keep the content unchanged. I am not happy with it.

Now I understand what you mean.

Quoted 8 lines
Quoted 4 lines

But we do not need a bigger buffer, or store another copy of the whole content of the "hwconfig" variable - we just need room to for the return value of hwconfig_parse(), which usually should be (much) smaller than the content of the "hwconfig" variable.

I agree with WD, I'm confused. Can you provide the hwconfig string you are using that has issues with 128 but works at 256.

- k

fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false

With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it.

York

#9 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Dear York Sun,

Quoted 7 lines · In message <1294418957.8466.8.camel@oslab-l1> you wrote:

fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false

With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it.

This is yet another problem, then.

Best regards,

Wolfgang Denk

Signature · 4 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
"Wish not to seem, but to be, the best."                  - Aeschylus
#10 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 4 lines · Wolfgang Denk

Dear York Sun,

Quoted 1 line · In message <1294418957.8466.8.camel@oslab-l1> you wrote:
Quoted 8 lines
Quoted 6 lines

fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false

With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it.

This is yet another problem, then.

So I figured the problem out and need to rework the hwconfig API to fix it.

We need some new versions of the APIs that take a buffer for use early before boot.

- k

#11 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 14 lines · Kumar Gala
Quoted 11 lines · Wolfgang Denk

Dear York Sun,

Quoted 7 lines · In message <1294418957.8466.8.camel@oslab-l1> you wrote:

fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false

With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it.

Quoted 5 lines
Quoted 1 line

This is yet another problem, then.

So I figured the problem out and need to rework the hwconfig API to fix it.

We need some new versions of the APIs that take a buffer for use early before boot.

I've posted:

http://patchwork.ozlabs.org/patch/78045/
http://patchwork.ozlabs.org/patch/78046/

Which should resolve the hwconfig issue and not require the patch to bump the size up.

- k

author
#12 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

Quoted 20 lines · Kumar Gala
Quoted 18 lines · Kumar Gala
Quoted 4 lines · Wolfgang Denk

Dear York Sun,

Quoted 1 line · In message <1294418957.8466.8.camel@oslab-l1> you wrote:
Quoted 8 lines
Quoted 6 lines

fsl_ddr:ctlr_intlv=cacheline,bank_intlv=cs0_cs1_cs2_cs3,ecc=off,addr_hash=false

With the buffer size 128, the sub function gets "ctlr_intlv=cacheline,bank_intlv=cs0_". It is not because the buffer is not enough, but the stack has been trashed. I have debug log if you need it.

This is yet another problem, then.

So I figured the problem out and need to rework the hwconfig API to fix it.

Quoted 8 lines
Quoted 1 line

We need some new versions of the APIs that take a buffer for use early before boot.

I've posted:

http://patchwork.ozlabs.org/patch/78045/
http://patchwork.ozlabs.org/patch/78046/

Which should resolve the hwconfig issue and not require the patch to bump the size up.

I have confirmed your patches. I will drop this patch and resubmit the rest.

York

#13 lore raw

PATCH v2 2/9 make the hwconfig buffer deeper

In reply to Kumar Gala

Dear Kumar Gala,

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

Making a buffer in a function's stack and make use of it out of the scope, that's the buggy code I am referring.

That is bad indeed, and needs to be fixed.

Where is that happening?

__hwconfig() calls hwconfig_parse() an passes a local stack buffer (buf) as argument; hwconfig_parse() returns a pointer into this buffer; then __hwconfig() returns the return value from hwconfig_parse() - but here the local stack buffer gots out of scope.

Best regards,

Wolfgang Denk

Signature · 4 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
Make it right before you make it faster.
author
#14 lore raw

PATCH v2 3/9 mpc8xxx: Enable ECC on/off control in hwconfig

In reply to York Sun

Add fsl_ddr:ecc=on in hwconfig. If ECC is enabled in board configuration file, ECC can be turned on/off by this switch. If this switch is omitted, it is ON by default.

Syntax is
hwconfig=fsl_ddr:ecc=on

---
 arch/powerpc/cpu/mpc8xxx/ddr/options.c |    9 ++++++---
 doc/README.fsl-ddr                     |    7 +++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
arch/powerpc/cpu/mpc8xxx/ddr/options.c +6 -3
index 774c0e4..38260f5 100644
@@ -81,10 +81,13 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 	/* Operational Mode Paramters */
 
 	/* Pick ECC modes */
-#ifdef CONFIG_DDR_ECC
-	popts->ECC_mode = 1;		  /* 0 = disabled, 1 = enabled */
-#else
 	popts->ECC_mode = 0;		  /* 0 = disabled, 1 = enabled */
+#ifdef CONFIG_DDR_ECC
+	if (hwconfig_sub("fsl_ddr", "ecc")) {
+		if (hwconfig_subarg_cmp("fsl_ddr", "ecc", "on"))
+			popts->ECC_mode = 1;
+	} else
+		popts->ECC_mode = 1;
 #endif
 	popts->ECC_init_using_memctl = 1; /* 0 = use DMA, 1 = use memctl */
 
doc/README.fsl-ddr +7 -0
index 1657ef6..9e3c539 100644
@@ -78,6 +78,13 @@ If the DDR controller supports address hashing, it can be enabled by hwconfig.
 Syntax is:
 hwconfig=fsl_ddr:addr_hash=true
 
+Memory controller ECC on/off
+============================
+If ECC is enabled in board configuratoin file, i.e. #define CONFIG_DDR_ECC,
+ECC can be turned on/off by hwconfig.
+
+Syntax is
+hwconfig=fsl_ddr:ecc=off
 
 Memory testing options for mpc85xx
 ==================================
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH v2 3/9 mpc8xxx: Enable ECC on/off control in hwconfig

Quoted 10 lines · York Sun
arch/powerpc/cpu/mpc8xxx/ddr/options.c +0 -2
index 774c0e4..38260f5 100644
@@ -81,10 +81,13 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
 	/* Operational Mode Paramters */
 
 	/* Pick ECC modes */
-#ifdef CONFIG_DDR_ECC
-	popts->ECC_mode = 1;		  /* 0 = disabled, 1 = enabled */

arch/powerpc/cpu/mpc8xxx/ddr/options.c unsigned int populate_memctl_options(int all_DIMMs_registered, · line 92

Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/options.c +6 -1
-#else
 	popts->ECC_mode = 0;		  /* 0 = disabled, 1 = enabled */
+#ifdef CONFIG_DDR_ECC
+	if (hwconfig_sub("fsl_ddr", "ecc")) {
+		if (hwconfig_subarg_cmp("fsl_ddr", "ecc", "on"))
+			popts->ECC_mode = 1;
+	} else
+		popts->ECC_mode = 1;
 #endif
 	popts->ECC_init_using_memctl = 1; /* 0 = use DMA, 1 = use memctl */

You'll need to update to use hwconfig_sub_f() & hwconfig_subarg_cmp_f()

- k

author
#16 lore raw

PATCH v2 4/9 corenet_ds: Enable ECC for corenet_ds

In reply to York Sun

ECC can be turned on/off by hwconfig without recompiling. So enable it by default.

---
 include/configs/corenet_ds.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/corenet_ds.h +1 -1
index 454a30a..49f0a26 100644
@@ -76,7 +76,7 @@
 #define CONFIG_BACKSIDE_L2_CACHE
 #define CONFIG_SYS_INIT_L2CSR0		L2CSR0_L2E
 #define CONFIG_BTB			/* toggle branch predition */
-/*#define	CONFIG_DDR_ECC*/
+#define	CONFIG_DDR_ECC
 #ifdef CONFIG_DDR_ECC
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
Signature · 1 line
1.7.0.4
author
#17 lore raw

PATCH v2 5/9 mpc85xx: Adding more registers and options

In reply to York Sun

Add writing to cdr1, cdr2, err_disable, err_int_en and debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registers.

---
 arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
 arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
 arch/powerpc/include/asm/immap_85xx.h    |   21 ++-------------------
 board/tqc/tqm85xx/sdram.c                |    8 ++++----
 4 files changed, 26 insertions(+), 25 deletions(-)
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +8 -2
index e46dcb7..23c87af 100644
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/fsl_ddr_sdram.h>
+#include <asm/processor.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
@@ -79,6 +80,12 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 	out_be32(&ddr->ddr_sr_cntr, regs->ddr_sr_cntr);
 	out_be32(&ddr->ddr_sdram_rcw_1, regs->ddr_sdram_rcw_1);
 	out_be32(&ddr->ddr_sdram_rcw_2, regs->ddr_sdram_rcw_2);
+	out_be32(&ddr->ddr_cdr1, regs->ddr_cdr1);
+	out_be32(&ddr->ddr_cdr2, regs->ddr_cdr2);
+	out_be32(&ddr->err_disable, regs->err_disable);
+	out_be32(&ddr->err_int_en, regs->err_int_en);
+	for (i = 0; i < 32; i++)
+		out_be32(&ddr->debug[i], regs->debug[i]);
 
 	/* Set, but do not enable the memory */
 	temp_sdram_cfg = regs->ddr_sdram_cfg;
@@ -93,8 +100,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 	if ((((in_be32(&ddr->sdram_cfg) >> 24) & 0x7) == SDRAM_TYPE_DDR2)
 	    && in_be32(&ddr->sdram_cfg) & 0x80000) {
 		/* set DEBUG_1[31] */
-		u32 temp = in_be32(&ddr->debug_1);
-		out_be32(&ddr->debug_1, temp | 1);
+		setbits_be32(&ddr->debug[0], 1);
 	}
 #endif
 
arch/powerpc/include/asm/fsl_ddr_sdram.h +12 -0
index 17d4b31..769549f 100644
@@ -120,6 +120,11 @@ typedef struct fsl_ddr_cfg_regs_s {
 	unsigned int ddr_sdram_rcw_1;
 	unsigned int ddr_sdram_rcw_2;
 	unsigned int ddr_eor;
+	unsigned int ddr_cdr1;
+	unsigned int ddr_cdr2;
+	unsigned int err_disable;
+	unsigned int err_int_en;
+	unsigned int debug[32];
 } fsl_ddr_cfg_regs_t;
 
 typedef struct memctl_options_partial_s {
@@ -175,6 +180,7 @@ typedef struct memctl_options_s {
 	/* mirrior DIMMs for DDR3 */
 	unsigned int mirrored_dimm;
 	unsigned int quad_rank_present;
+	unsigned int ap_en;	/* address parity enable for RDIMM */
 
 	/* Global Timing Parameters */
 	unsigned int cas_latency_override;
@@ -210,6 +216,12 @@ typedef struct memctl_options_s {
 	unsigned int zq_en;
 	/* Write leveling */
 	unsigned int wrlvl_en;
+	/* RCW override for RDIMM */
+	unsigned int rcw_override;
+	unsigned int rcw_1;
+	unsigned int rcw_2;
+	/* control register 1 */
+	unsigned int ddr_cdr1;
 } memctl_options_t;
 
 extern phys_size_t fsl_ddr_sdram(void);
arch/powerpc/include/asm/immap_85xx.h +2 -19
index 30c64eb..0069d50 100644
@@ -222,25 +222,8 @@ typedef struct ccsr_ddr {
 	u32	capture_ext_address;	/* Error Extended Addr Capture */
 	u32	err_sbe;		/* Single-Bit ECC Error Management */
 	u8	res11[164];
-	u32	debug_1;
-	u32	debug_2;
-	u32	debug_3;
-	u32	debug_4;
-	u32	debug_5;
-	u32	debug_6;
-	u32	debug_7;
-	u32	debug_8;
-	u32	debug_9;
-	u32	debug_10;
-	u32	debug_11;
-	u32	debug_12;
-	u32	debug_13;
-	u32	debug_14;
-	u32	debug_15;
-	u32	debug_16;
-	u32	debug_17;
-	u32	debug_18;
-	u8	res12[184];
+	u32	debug[32];		/* debug_1 to debug_32 */
+	u8	res12[128];
 } ccsr_ddr_t;
 
 #define DDR_EOR_RD_BDW_OPT_DIS	0x80000000 /* Read BDW Opt. disable */
board/tqc/tqm85xx/sdram.c +4 -4
index 503c5e5..d2af127 100644
@@ -220,7 +220,7 @@ long int sdram_setup (int casl)
 	 * 4. Before DDR_SDRAM_CFG[MEM_EN] set, write D3[21] to disable data
 	 *    training
 	 */
-	ddr->debug_3 |= 0x00000400;
+	ddr->debug[2] |= 0x00000400;
 
 	/*
 	 * 5. Wait 200 micro-seconds
@@ -262,18 +262,18 @@ long int sdram_setup (int casl)
 	/*
 	 * 8. Clear D3[21] to re-enable data training
 	 */
-	ddr->debug_3 &= ~0x00000400;
+	ddr->debug[2] &= ~0x00000400;
 
 	/*
 	 * 9. Set D2(21) to force data training to run
 	 */
-	ddr->debug_2 |= 0x00000400;
+	ddr->debug[1] |= 0x00000400;
 
 	/*
 	 * 10. Poll on D2[21] until it is cleared by hardware
 	 */
 	asm ("sync;isync;msync");
-	while (ddr->debug_2 & 0x00000400)
+	while (ddr->debug[1] & 0x00000400)
 		asm ("eieio");
 
 	/*
Signature · 1 line
1.7.0.4
#18 lore raw

PATCH v2 5/9 mpc85xx: Adding more registers and options

Dear York Sun,

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

Add writing to cdr1, cdr2, err_disable, err_int_en and debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registers.

Can you please explain what this patch is good for?

"Adding more registers and options" is not really helpful to understand what you are trying to acchived here, and neither is the rest of the commit massage.

Best regards,

Wolfgang Denk

Signature · 4 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
How come everyone's going so slow if it's called rush hour?
author
#19 lore raw

PATCH v2 6/9 mpc85xx: Enable unique mode registers and dynamic ODT for DDR3

In reply to York Sun

Added fsl_ddr_get_version() function to for DDR3 to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. If true, always use unique mode registers. Dynamic ODT is enabled if needed. The table is documented in doc/README.fsl-ddr. This function may also need to be extend for future other platforms if such a feature exists.

Enable address parity and RCW by default for RDIMMs.

Change default output driver impedance from 34 ohm to 40ohm. Make it 34ohm for quad-rank RDIMMs.

Use a formula to calculate rodt_on for timing_cfg_5.

---
 arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |    6 +
 arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c |  320 ++++++++++++++++++++++++++----
 arch/powerpc/cpu/mpc8xxx/ddr/options.c   |  308 ++++++++++++++++++++++++++++-
 arch/powerpc/include/asm/fsl_ddr_sdram.h |   18 ++
 doc/README.fsl-ddr                       |   67 ++++++-
 5 files changed, 670 insertions(+), 49 deletions(-)
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +6 -0
index 23c87af..5f1848f 100644
@@ -66,6 +66,12 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 	out_be32(&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2);
 	out_be32(&ddr->sdram_mode, regs->ddr_sdram_mode);
 	out_be32(&ddr->sdram_mode_2, regs->ddr_sdram_mode_2);
+	out_be32(&ddr->sdram_mode_3, regs->ddr_sdram_mode_3);
+	out_be32(&ddr->sdram_mode_4, regs->ddr_sdram_mode_4);
+	out_be32(&ddr->sdram_mode_5, regs->ddr_sdram_mode_5);
+	out_be32(&ddr->sdram_mode_6, regs->ddr_sdram_mode_6);
+	out_be32(&ddr->sdram_mode_7, regs->ddr_sdram_mode_7);
+	out_be32(&ddr->sdram_mode_8, regs->ddr_sdram_mode_8);
 	out_be32(&ddr->sdram_md_cntl, regs->ddr_sdram_md_cntl);
 	out_be32(&ddr->sdram_interval, regs->ddr_sdram_interval);
 	out_be32(&ddr->sdram_data_init, regs->ddr_data_init);
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +278 -42

499 lines not on this page · raw message

arch/powerpc/cpu/mpc8xxx/ddr/options.c +302 -6

331 lines not on this page · raw message

arch/powerpc/include/asm/fsl_ddr_sdram.h +18 -0
index 769549f..e8b9c04 100644
@@ -24,6 +24,7 @@
 #define DDR_OTF		6	/* on-the-fly BC4 and BL8 */
 #define DDR_BL8		8	/* burst length 8 */
 
+#define DDR3_RTT_OFF		0
 #define DDR3_RTT_60_OHM		1 /* RTT_Nom = RZQ/4 */
 #define DDR3_RTT_120_OHM	2 /* RTT_Nom = RZQ/2 */
 #define DDR3_RTT_40_OHM		3 /* RTT_Nom = RZQ/6 */
@@ -50,6 +51,15 @@ typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 #endif
 #endif	/* #if defined(CONFIG_FSL_DDR1) */
 
+#define FSL_DDR_ODT_NEVER		0x0
+#define FSL_DDR_ODT_CS			0x1
+#define FSL_DDR_ODT_ALL_OTHER_CS	0x2
+#define FSL_DDR_ODT_OTHER_DIMM		0x3
+#define FSL_DDR_ODT_ALL			0x4
+#define FSL_DDR_ODT_SAME_DIMM		0x5
+#define FSL_DDR_ODT_CS_AND_OTHER_DIMM	0x6
+#define FSL_DDR_ODT_OTHER_CS_ONSAMEDIMM	0x7
+
 /* define bank(chip select) interleaving mode */
 #define FSL_DDR_CS0_CS1			0x40
 #define FSL_DDR_CS2_CS3			0x20
@@ -106,6 +116,12 @@ typedef struct fsl_ddr_cfg_regs_s {
 	unsigned int ddr_sdram_cfg_2;
 	unsigned int ddr_sdram_mode;
 	unsigned int ddr_sdram_mode_2;
+	unsigned int ddr_sdram_mode_3;
+	unsigned int ddr_sdram_mode_4;
+	unsigned int ddr_sdram_mode_5;
+	unsigned int ddr_sdram_mode_6;
+	unsigned int ddr_sdram_mode_7;
+	unsigned int ddr_sdram_mode_8;
 	unsigned int ddr_sdram_md_cntl;
 	unsigned int ddr_sdram_interval;
 	unsigned int ddr_data_init;
@@ -156,6 +172,8 @@ typedef struct memctl_options_s {
 		unsigned int auto_precharge;
 		unsigned int odt_rd_cfg;
 		unsigned int odt_wr_cfg;
+		unsigned int odt_rtt_norm;
+		unsigned int odt_rtt_wr;
 	} cs_local_opts[CONFIG_CHIP_SELECTS_PER_CTRL];
 
 	/* Special configurations for chip select */
doc/README.fsl-ddr +66 -1

70 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#20 lore raw

PATCH v2 6/9 mpc85xx: Enable unique mode registers and dynamic ODT for DDR3

Dear York Sun,

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

Added fsl_ddr_get_version() function to for DDR3 to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. If true, always use unique mode registers. Dynamic ODT is enabled if needed. The table is documented in doc/README.fsl-ddr. This function may also need to be extend for future other platforms if such a feature exists.

Enable address parity and RCW by default for RDIMMs.

Change default output driver impedance from 34 ohm to 40ohm. Make it 34ohm for quad-rank RDIMMs.

...

Quoted 28 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +28 -0
+static void set_ddr_sdram_mode_3(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode;		/* Extended SDRAM mode */
+	u16 sdmode;		/* SDRAM mode */
+	u32 rtt;
+
+	sdmode = ddr->ddr_sdram_mode & 0xFFFF;
+	esdmode = (ddr->ddr_sdram_mode >> 16) & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt = popts->rtt_override_value;
+	else
+		rtt = popts->cs_local_opts[1].odt_rtt_norm;
+
+	esdmode &= 0xFDBB;	/* clear bit 9,6,2 */
+	esdmode |= (0
+		| ((rtt & 0x4) << 7)   /* rtt field is split */
+		| ((rtt & 0x2) << 5)   /* rtt field is split */
+		| ((rtt & 0x1) << 2)  /* rtt field is split */
+		);
+
+	ddr->ddr_sdram_mode_3 = (0
+			       | ((esdmode & 0xFFFF) << 16)
+			       | ((sdmode & 0xFFFF) << 0)
+			       );
+	debug("FSLDDR: ddr_sdram_mode_3 = 0x%08x\n", ddr->ddr_sdram_mode_3);
+}

...

Quoted 18 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +18 -0
+static void set_ddr_sdram_mode_5(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode;		/* Extended SDRAM mode */
+	u16 sdmode;		/* SDRAM mode */
+	u32 rtt;
+
+	sdmode = ddr->ddr_sdram_mode & 0xFFFF;
+	esdmode = (ddr->ddr_sdram_mode >> 16) & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt = popts->rtt_override_value;
+	else
+		rtt = popts->cs_local_opts[2].odt_rtt_norm;
+
+	esdmode &= 0xFDBB;	/* clear bit 9,6,2 */
+	esdmode |= (0
+		| ((rtt & 0x4) << 7)   /* rtt field is split */

arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c static void set_ddr_sdram_mode_2(fsl_ddr_cfg_regs_t *ddr, · line 795

Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +10 -0
+		| ((rtt & 0x2) << 5)   /* rtt field is split */
+		| ((rtt & 0x1) << 2)  /* rtt field is split */
+		);
+
+	ddr->ddr_sdram_mode_5 = (0
+			       | ((esdmode & 0xFFFF) << 16)
+			       | ((sdmode & 0xFFFF) << 0)
+			       );
+	debug("FSLDDR: ddr_sdram_mode_5 = 0x%08x\n", ddr->ddr_sdram_mode_5);
+}

Seems the only difference between these functions is the index into the array?

Quoted 23 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +23 -0
+static void set_ddr_sdram_mode_4(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode2 = 0;	/* Extended SDRAM mode 2 */
+	u16 esdmode3 = 0;	/* Extended SDRAM mode 3 */
+	u32 rtt_wr = 0;		/* Dynamic ODT off */
+
+	esdmode2 = (ddr->ddr_sdram_mode_2 >> 16) & 0xFFFF;
+	esdmode3 = ddr->ddr_sdram_mode_2 & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt_wr = popts->rtt_wr_override_value;
+	else
+		rtt_wr = popts->cs_local_opts[1].odt_rtt_wr;
+
+	esdmode2 &= 0xF9FF;	/* clear bit 10, 9 */
+	esdmode2 |= (rtt_wr & 0x3) << 9;
+	ddr->ddr_sdram_mode_4 = (0
+				 | ((esdmode2 & 0xFFFF) << 16)
+				 | ((esdmode3 & 0xFFFF) << 0)
+				 );
+	debug("FSLDDR: ddr_sdram_mode_4 = 0x%08x\n", ddr->ddr_sdram_mode_4);
+}

...

Quoted 13 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +13 -0
+static void set_ddr_sdram_mode_6(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode2 = 0;	/* Extended SDRAM mode 2 */
+	u16 esdmode3 = 0;	/* Extended SDRAM mode 3 */
+	u32 rtt_wr = 0;		/* Dynamic ODT off */
+
+	esdmode2 = (ddr->ddr_sdram_mode_2 >> 16) & 0xFFFF;
+	esdmode3 = ddr->ddr_sdram_mode_2 & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt_wr = popts->rtt_wr_override_value;
+	else

arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c static void set_ddr_sdram_mode_2(fsl_ddr_cfg_regs_t *ddr, · line 819

Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +10 -0
+		rtt_wr = popts->cs_local_opts[2].odt_rtt_wr;
+
+	esdmode2 &= 0xF9FF;	/* clear bit 10, 9 */
+	esdmode2 |= (rtt_wr & 0x3) << 9;
+	ddr->ddr_sdram_mode_6 = (0
+				 | ((esdmode2 & 0xFFFF) << 16)
+				 | ((esdmode3 & 0xFFFF) << 0)
+				 );
+	debug("FSLDDR: ddr_sdram_mode_6 = 0x%08x\n", ddr->ddr_sdram_mode_6);
+}

Same here.

Quoted 42 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +42 -0
+static void set_ddr_sdram_mode_7(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode;		/* Extended SDRAM mode */
+	u16 sdmode;		/* SDRAM mode */
+	u32 rtt;
+
+	sdmode = ddr->ddr_sdram_mode & 0xFFFF;
+	esdmode = (ddr->ddr_sdram_mode >> 16) & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt = popts->rtt_override_value;
+	else
+		rtt = popts->cs_local_opts[3].odt_rtt_norm;
+
+	esdmode &= 0xFDBB;	/* clear bit 9,6,2 */
+	esdmode |= (0
+		| ((rtt & 0x4) << 7)   /* rtt field is split */
+		| ((rtt & 0x2) << 5)   /* rtt field is split */
+		| ((rtt & 0x1) << 2)  /* rtt field is split */
+		);
+
+	ddr->ddr_sdram_mode_7 = (0
+			       | ((esdmode & 0xFFFF) << 16)
+			       | ((sdmode & 0xFFFF) << 0)
+			       );
+	debug("FSLDDR: ddr_sdram_mode_7 = 0x%08x\n", ddr->ddr_sdram_mode_7);
+}
+
+static void set_ddr_sdram_mode_8(fsl_ddr_cfg_regs_t *ddr,
+				const memctl_options_t *popts)
+{
+	u16 esdmode2 = 0;	/* Extended SDRAM mode 2 */
+	u16 esdmode3 = 0;	/* Extended SDRAM mode 3 */
+	u32 rtt_wr = 0;	/* Rtt_WR - dynamic ODT off */
+
+	esdmode2 = (ddr->ddr_sdram_mode_2 >> 16) & 0xFFFF;
+	esdmode3 = ddr->ddr_sdram_mode_2 & 0xFFFF;
+
+	if (popts->rtt_override)
+		rtt_wr = popts->rtt_wr_override_value;
+	else

arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c static void set_ddr_sdram_mode_2(fsl_ddr_cfg_regs_t *ddr, · line 872

Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +10 -0
+		rtt_wr = popts->cs_local_opts[3].odt_rtt_wr;
+
+	esdmode2 &= 0xF9FF;	/* clear bit 10, 9 */
+	esdmode2 |= (rtt_wr & 0x3) << 9;
+	ddr->ddr_sdram_mode_8 = (0
+				 | ((esdmode2 & 0xFFFF) << 16)
+				 | ((esdmode3 & 0xFFFF) << 0)
+				 );
+	debug("FSLDDR: ddr_sdram_mode_8 = 0x%08x\n", ddr->ddr_sdram_mode_8);
+}

And two more copies...

Please do not duplicate code.

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
There are very few personal problems that cannot be solved through  a
suitable application of high explosives.
author
#21 lore raw

PATCH v2 7/9 Adding more SPD registers

In reply to York Sun

Adding byte 32 and 33

---
 include/ddr_spd.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/ddr_spd.h +3 -1
index 710e528..d632a1e 100644
@@ -219,7 +219,9 @@ typedef struct ddr3_spd_eeprom_s {
 					     Delay Time*/
 	unsigned char opt_features;    /* 30 SDRAM Optional Features */
 	unsigned char therm_ref_opt;   /* 31 SDRAM Thermal and Refresh Opts */
-	unsigned char res_32_59[28];   /* 32-59 Reserved, General Section */
+	unsigned char therm_sensor;    /* 32 Module Thermal Sensor */
+	unsigned char device_type;     /* 33 SDRAM device type */
+	unsigned char res_34_59[26];   /* 34-59 Reserved, General Section */
 
 	/* Module-Specific Section: Bytes 60-116 */
 	union {
Signature · 1 line
1.7.0.4
#22 lore raw

PATCH v2 7/9 Adding more SPD registers

Dear York Sun,

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

Adding byte 32 and 33

---
 include/ddr_spd.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Where are these new definitions used?

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
A year spent in artificial intelligence is enough to make one believe
in God.
author
#23 lore raw

PATCH v2 8/9 mpc85xx: Implement workaround for erratum DDR-A003

In reply to York Sun

Erratum DDR-A003 requires workaround to correctly set RCW10 for registered DIMM. Also adding polling after enabling DDR controller to ensure completion.

---
 arch/powerpc/cpu/mpc85xx/cmd_errata.c    |    4 ++
 arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   81 +++++++++++++++++++++++++++++-
 arch/powerpc/include/asm/fsl_ddr_sdram.h |   19 +++++++
 include/configs/P4080DS.h                |    1 +
 4 files changed, 104 insertions(+), 1 deletions(-)
arch/powerpc/cpu/mpc85xx/cmd_errata.c +4 -0
index d73f3d7..9edaa0b 100644
@@ -47,6 +47,10 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
 	puts("Work-around for Erratum CPU22 enabled\n");
 #endif
+#ifdef CONFIG_SYS_FSL_NMG_DDR_A003
+	puts("Work-around for Erratum DDR-A003 enabled\n");
+#endif
+
 	return 0;
 }
 
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +80 -1

94 lines not on this page · raw message

arch/powerpc/include/asm/fsl_ddr_sdram.h +19 -0
index e8b9c04..7d6048a 100644
@@ -101,6 +101,25 @@ typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 #define WR_DATA_DELAY_SHIFT	10
 #endif
 
+/* DDR_MD_CNTL */
+#define MD_CNTL_MD_EN		0x80000000
+#define MD_CNTL_CS_SEL_CS0	0x00000000
+#define MD_CNTL_CS_SEL_CS1	0x10000000
+#define MD_CNTL_CS_SEL_CS2	0x20000000
+#define MD_CNTL_CS_SEL_CS3	0x30000000
+#define MD_CNTL_CS_SEL_CS0_CS1	0x40000000
+#define MD_CNTL_CS_SEL_CS2_CS3	0x50000000
+#define MD_CNTL_MD_SEL_MR	0x00000000
+#define MD_CNTL_MD_SEL_EMR	0x01000000
+#define MD_CNTL_MD_SEL_EMR2	0x02000000
+#define MD_CNTL_MD_SEL_EMR3	0x03000000
+#define MD_CNTL_SET_REF		0x00800000
+#define MD_CNTL_SET_PRE		0x00400000
+#define MD_CNTL_CKE_CNTL_LOW	0x00100000
+#define MD_CNTL_CKE_CNTL_HIGH	0x00200000
+#define MD_CNTL_WRCW		0x00080000
+#define MD_CNTL_MD_VALUE(x)	(x & 0x0000FFFF)
+
 /* Record of register values computed */
 typedef struct fsl_ddr_cfg_regs_s {
 	struct {
include/configs/P4080DS.h +1 -0
index 21b48e9..f1e8a17 100644
@@ -37,5 +37,6 @@
 
 #define CONFIG_SYS_P4080_ERRATUM_CPU22
 #define CONFIG_SYS_P4080_ERRATUM_SERDES8
+#define CONFIG_SYS_FSL_NMG_DDR_A003
 
 #include "corenet_ds.h"
Signature · 1 line
1.7.0.4
#24 lore raw

PATCH v2 8/9 mpc85xx: Implement workaround for erratum DDR-A003

Quoted 16 lines · York Sun

Erratum DDR-A003 requires workaround to correctly set RCW10 for registered DIMM. Also adding polling after enabling DDR controller to ensure completion.

---

arch/powerpc/cpu/mpc85xx/cmd_errata.c    |    4 ++
arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   81 +++++++++++++++++++++++++++++-
arch/powerpc/include/asm/fsl_ddr_sdram.h |   19 +++++++
include/configs/P4080DS.h                |    1 +
4 files changed, 104 insertions(+), 1 deletions(-)
arch/powerpc/cpu/mpc85xx/cmd_errata.c +0 -0
index d73f3d7..9edaa0b 100644

arch/powerpc/cpu/mpc85xx/cmd_errata.c static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 50

Quoted 4 lines
arch/powerpc/cpu/mpc85xx/cmd_errata.c +1 -0
@@ -47,6 +47,10 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
 	puts("Work-around for Erratum CPU22 enabled\n");
 #endif
+#ifdef CONFIG_SYS_FSL_NMG_DDR_A003

change this to CONFIG_SYS_FSL_ERRATUM_DDR_A003

arch/powerpc/cpu/mpc85xx/cmd_errata.c static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 55

Quoted 5 lines
arch/powerpc/cpu/mpc85xx/cmd_errata.c +3 -0
+	puts("Work-around for Erratum DDR-A003 enabled\n");
+#endif
+
 	return 0;
 }

- k

author
#25 lore raw

PATCH v2 9/9 corenet_ds: Extend board specific parameters

In reply to York Sun

Extend board specific parameters to include cpo, write leveling override Extend write leveling sample to 0xf
Adding rcw overrid for quad-rank RDIMMs

---
 arch/powerpc/include/asm/fsl_ddr_sdram.h |    3 +
 board/freescale/corenet_ds/ddr.c         |  155 +++++++++++++++---------------
 2 files changed, 81 insertions(+), 77 deletions(-)
arch/powerpc/include/asm/fsl_ddr_sdram.h +3 -0
index 7d6048a..0cfe95a 100644
@@ -120,6 +120,9 @@ typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 #define MD_CNTL_WRCW		0x00080000
 #define MD_CNTL_MD_VALUE(x)	(x & 0x0000FFFF)
 
+/* DDR_CDR1 */
+#define DDR_CDR1_DHC_EN	0x80000000
+
 /* Record of register values computed */
 typedef struct fsl_ddr_cfg_regs_s {
 	struct {
board/freescale/corenet_ds/ddr.c +78 -77

206 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#26 lore raw

PATCH v2 9/9 corenet_ds: Extend board specific parameters

Dear York Sun,

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

Extend board specific parameters to include cpo, write leveling override Extend write leveling sample to 0xf
Adding rcw overrid for quad-rank RDIMMs

...

board/freescale/corenet_ds/ddr.c typedef struct { · line 171

Quoted 4 lines
board/freescale/corenet_ds/ddr.c +4 -0
+	/*	memory controller 0
+	 *	 lo|  hi|  num|  clk| wrlvl | cpo  |wrdata|2T
+	 *	mhz| mhz|ranks|adjst| start | delay|
+	 */

Incorrect multi-line comment style. Please fix globally.

board/freescale/corenet_ds/ddr.c void fsl_ddr_board_options(memctl_options_t *popts, · line 246

Quoted 5 lines
board/freescale/corenet_ds/ddr.c +5 -0
+		    pdimm[0].n_ranks == pbsp->n_ranks) {
+			popts->cpo_override = pbsp->cpo;
+			popts->write_data_delay = pbsp->write_data_delay;
+			popts->clk_adjust = pbsp->clk_adjust;
+			popts->wrlvl_start = pbsp->wrlvl_start;

Indentation by TAB only. Please fix globally.

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
If you're not part of the solution, then you're part of the  precipi-
tate.
#27 lore raw

PATCH v2 1/9 mpc8xxx: Display RDIMM if detected

In reply to York Sun

Dear York Sun,

Quoted 1 line · In message <[email protected]> you wrote:

Print a message when a RDIMM is detected.

...

arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params, · line 232

Quoted 4 lines
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +1 -1
+	} else
 		printf("ERROR:  Mix of registered buffered and unbuffered "
 				"DIMMs detected!\n");
-	}

Mutli-line statement needs braces.

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
Too many people are ready to carry the stool when the piano needs  to
be moved.
#28 lore raw

PATCH v2 1/9 mpc8xxx: Display RDIMM if detected

Hello.

Quoted 8 lines · Wolfgang Denk
Quoted 1 line

Print a message when a RDIMM is detected.

...

arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params, · line 232

Quoted 4 lines
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +1 -1
+	} else
  		printf("ERROR:  Mix of registered buffered and unbuffered "
  				"DIMMs detected!\n");
-	}

Mutli-line statement needs braces.

Well, not only that. CodingStyle requires that if some parts of the *if*
statement used {}, then all parts need to use {}.

Quoted 3 lines

Best regards,

Wolfgang Denk

WBR, Sergei