diff mbox

[U-Boot,05/10] Adding more registers and options

Message ID 1291863340-4354-5-git-send-email-yorksun@freescale.com
State Changes Requested
Delegated to: Kumar Gala
Headers show

Commit Message

York Sun Dec. 9, 2010, 2:55 a.m. UTC
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 registeres.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
 arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
 arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
 3 files changed, 21 insertions(+), 20 deletions(-)

Comments

Kumar Gala Dec. 14, 2010, 5:10 a.m. UTC | #1
On Dec 8, 2010, at 8:55 PM, York Sun 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 registeres.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> ---
> arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
> arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
> arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
> 3 files changed, 21 insertions(+), 20 deletions(-)

this probably breaks boards.  Did you do a build all on 85xx and 86xx?

- k
York Sun Dec. 14, 2010, 6:30 a.m. UTC | #2
On Mon, 2010-12-13 at 23:10 -0600, Kumar Gala wrote:
> On Dec 8, 2010, at 8:55 PM, York Sun 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 registeres.
> > 
> > Signed-off-by: York Sun <yorksun@freescale.com>
> > ---
> > arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
> > arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
> > arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
> > 3 files changed, 21 insertions(+), 20 deletions(-)
> 
> this probably breaks boards.  Did you do a build all on 85xx and 86xx?

No, I didn't try on other boards. The registers have default value of 0,
which shouldn't hurt.

York
Kumar Gala Dec. 14, 2010, 6:37 a.m. UTC | #3
On Dec 14, 2010, at 12:30 AM, York Sun wrote:

> On Mon, 2010-12-13 at 23:10 -0600, Kumar Gala wrote:
>> On Dec 8, 2010, at 8:55 PM, York Sun 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 registeres.
>>> 
>>> Signed-off-by: York Sun <yorksun@freescale.com>
>>> ---
>>> arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
>>> arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
>>> arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
>>> 3 files changed, 21 insertions(+), 20 deletions(-)
>> 
>> this probably breaks boards.  Did you do a build all on 85xx and 86xx?
> 
> No, I didn't try on other boards. The registers have default value of 0,
> which shouldn't hurt.
> 
> York
> 

Its not that, I think we fail to even compile.

For example:

[galak@right u-boot]$ git grep debug_ board/tqc/
board/tqc/tqm85xx/sdram.c:      ddr->debug_3 |= 0x00000400;
board/tqc/tqm85xx/sdram.c:      ddr->debug_3 &= ~0x00000400;
board/tqc/tqm85xx/sdram.c:      ddr->debug_2 |= 0x00000400;
board/tqc/tqm85xx/sdram.c:      while (ddr->debug_2 & 0x00000400)

- k
York Sun Dec. 14, 2010, 6:42 a.m. UTC | #4
On Tue, 2010-12-14 at 00:37 -0600, Kumar Gala wrote:
> On Dec 14, 2010, at 12:30 AM, York Sun wrote:
> 
> > On Mon, 2010-12-13 at 23:10 -0600, Kumar Gala wrote:
> >> On Dec 8, 2010, at 8:55 PM, York Sun 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 registeres.
> >>> 
> >>> Signed-off-by: York Sun <yorksun@freescale.com>
> >>> ---
> >>> arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
> >>> arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
> >>> arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
> >>> 3 files changed, 21 insertions(+), 20 deletions(-)
> >> 
> >> this probably breaks boards.  Did you do a build all on 85xx and 86xx?
> > 
> > No, I didn't try on other boards. The registers have default value of 0,
> > which shouldn't hurt.
> > 
> > York
> > 
> 
> Its not that, I think we fail to even compile.
> 
> For example:
> 
> [galak@right u-boot]$ git grep debug_ board/tqc/
> board/tqc/tqm85xx/sdram.c:      ddr->debug_3 |= 0x00000400;
> board/tqc/tqm85xx/sdram.c:      ddr->debug_3 &= ~0x00000400;
> board/tqc/tqm85xx/sdram.c:      ddr->debug_2 |= 0x00000400;
> board/tqc/tqm85xx/sdram.c:      while (ddr->debug_2 & 0x00000400)
> 

You are right. I didn't think there are other boards out of freescale
folder. Do you want to me revert back to debug_x or change all of them
to debug[x]?

York
Kumar Gala Dec. 14, 2010, 6:43 a.m. UTC | #5
On Dec 14, 2010, at 12:42 AM, York Sun wrote:

> On Tue, 2010-12-14 at 00:37 -0600, Kumar Gala wrote:
>> On Dec 14, 2010, at 12:30 AM, York Sun wrote:
>> 
>>> On Mon, 2010-12-13 at 23:10 -0600, Kumar Gala wrote:
>>>> On Dec 8, 2010, at 8:55 PM, York Sun 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 registeres.
>>>>> 
>>>>> Signed-off-by: York Sun <yorksun@freescale.com>
>>>>> ---
>>>>> arch/powerpc/cpu/mpc85xx/ddr-gen3.c      |   10 ++++++++--
>>>>> arch/powerpc/include/asm/fsl_ddr_sdram.h |   12 ++++++++++++
>>>>> arch/powerpc/include/asm/immap_85xx.h    |   19 +------------------
>>>>> 3 files changed, 21 insertions(+), 20 deletions(-)
>>>> 
>>>> this probably breaks boards.  Did you do a build all on 85xx and 86xx?
>>> 
>>> No, I didn't try on other boards. The registers have default value of 0,
>>> which shouldn't hurt.
>>> 
>>> York
>>> 
>> 
>> Its not that, I think we fail to even compile.
>> 
>> For example:
>> 
>> [galak@right u-boot]$ git grep debug_ board/tqc/
>> board/tqc/tqm85xx/sdram.c:      ddr->debug_3 |= 0x00000400;
>> board/tqc/tqm85xx/sdram.c:      ddr->debug_3 &= ~0x00000400;
>> board/tqc/tqm85xx/sdram.c:      ddr->debug_2 |= 0x00000400;
>> board/tqc/tqm85xx/sdram.c:      while (ddr->debug_2 & 0x00000400)
>> 
> 
> You are right. I didn't think there are other boards out of freescale
> folder. Do you want to me revert back to debug_x or change all of them
> to debug[x]?

Just change to debug[x] for the other places that are impacted.

- k
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/ddr-gen3.c b/arch/powerpc/cpu/mpc85xx/ddr-gen3.c
index 5805b3f..14a905d 100644
--- a/arch/powerpc/cpu/mpc85xx/ddr-gen3.c
+++ b/arch/powerpc/cpu/mpc85xx/ddr-gen3.c
@@ -80,6 +80,13 @@  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 < 18; i++)
+		out_be32(&ddr->debug[i], regs->debug[i]);
+
 #ifdef CONFIG_SYS_P4080_ERRATUM_DDR7
 	/*
 	 * Do not use automatic driver calibration, Instead of
@@ -104,8 +111,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
 
diff --git a/arch/powerpc/include/asm/fsl_ddr_sdram.h b/arch/powerpc/include/asm/fsl_ddr_sdram.h
index 17d4b31..6ec95b6 100644
--- a/arch/powerpc/include/asm/fsl_ddr_sdram.h
+++ b/arch/powerpc/include/asm/fsl_ddr_sdram.h
@@ -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[18];
 } 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);
diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h
index ee7338a..474082f 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -222,24 +222,7 @@  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;
+	u32	debug[18];		/* debug_1 to debug_18 */
 	u8	res12[184];
 } ccsr_ddr_t;