Display RDIMM if detected
PATCH 1/10 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
@@ -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
PATCH 2/10 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
@@ -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 256static const char *__hwconfig (const char *opt,size_t *arglen) {
Signature · 1 line
1.7.0.4
PATCH 2/10 make the hwconfig buffer deeper
Dear York Sun,
Quoted 2 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.
What does this mean? "temporarily fix" ? Do you have another, permanent fix in the works
Quoted 10 lines
Signed-off-by York Sun <[email protected]>--- common/hwconfig.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)common/hwconfig.c +0
-0
common/hwconfig.c next: · line 74
Quoted 5 lines
common/hwconfig.c +1
-1@@ -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
Is this really, really necessary? Memory is a scarce resource pre relocation.
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 If it happens once, it's a bug. If it happens twice, it's a feature. If it happens more than twice, it's a design philosophy.
PATCH 2/10 make the hwconfig buffer deeper
Wolfgang,
Quoted 8 lines · Wolfgang Denk
Dear York Sun,
Quoted 2 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.
What does this mean? "temporarily fix" ? Do you have another, permanent fix in the works
I am not happy with this "fix" either. Kumar changed the code to use deeper buffer as a workaround. This is the only way I can make it work following him.
Quoted 14 lines
Quoted 14 lines
Signed-off-by York Sun <[email protected]>--- common/hwconfig.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)common/hwconfig.c +0
-0@@ -71,7 +71,7 @@ next: const char *cpu_hwconfig __attribute__((weak)); const char *board_hwconfig __attribute__((weak));
Quoted 5 lines
common/hwconfig.c next: · line 74
Quoted 2 lines
common/hwconfig.c +1
-1-#define HWCONFIG_PRE_RELOC_BUF_SIZE 128 +#define HWCONFIG_PRE_RELOC_BUF_SIZE 256Is this really, really necessary? Memory is a scarce resource pre relocation.
Let me work with Kumar on this.
York
PATCH 2/10 make the hwconfig buffer deeper
Quoted 30 lines · York Sun
Wolfgang,
Quoted 8 lines · Wolfgang Denk
Dear York Sun,
Quoted 2 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.
What does this mean? "temporarily fix" ? Do you have another, permanent fix in the works
I am not happy with this "fix" either. Kumar changed the code to use deeper buffer as a workaround. This is the only way I can make it work following him.
Quoted 14 lines
Quoted 14 lines
Signed-off-by York Sun <[email protected]>---
common/hwconfig.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)common/hwconfig.c +0
-0@@ -71,7 +71,7 @@ next: const char *cpu_hwconfig __attribute__((weak)); const char *board_hwconfig __attribute__((weak));
Quoted 7 lines
Quoted 5 lines
common/hwconfig.c next: · line 74
Quoted 2 lines
common/hwconfig.c +1
-1-#define HWCONFIG_PRE_RELOC_BUF_SIZE 128 +#define HWCONFIG_PRE_RELOC_BUF_SIZE 256Is this really, really necessary? Memory is a scarce resource pre relocation.
Let me work with Kumar on this.
Got any ideas? I'm not a fan but not sure what else we can do.
- k
PATCH 3/10 Enable ECC on/off control in hwconfig
In reply to York SunAdd 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
@@ -82,10 +82,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
@@ -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
PATCH 4/10 Enable ECC for corenet_ds
In reply to York SunECC 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
@@ -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
PATCH 5/10 Adding more registers and options
In reply to York SunAdd 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.
--- 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(-)
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +8 -2
@@ -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
arch/powerpc/include/asm/fsl_ddr_sdram.h +12 -0
@@ -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 );
arch/powerpc/include/asm/immap_85xx.h +1 -18
@@ -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;
Signature · 1 line
1.7.0.4
PATCH 5/10 Adding more registers and options
Quoted 10 lines · York Sun
Add writing to cdr1, cdr2,
err_disable,err_int_enand debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registeres.Signed-off-by York Sun <[email protected]>---
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
PATCH 5/10 Adding more registers and options
Quoted 6 lines · Kumar Gala
Quoted 4 lines · York Sun
Add writing to cdr1, cdr2,
err_disable,err_int_enand debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registeres.
Quoted 8 lines
Quoted 6 lines
Signed-off-by York Sun <[email protected]>---
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
PATCH 5/10 Adding more registers and options
Quoted 14 lines · York Sun
Quoted 13 lines · Kumar Gala
Quoted 10 lines · York Sun
Add writing to cdr1, cdr2,
err_disable,err_int_enand debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registeres.Signed-off-by York Sun <[email protected]>---
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(-)
Quoted 7 lines
Quoted 1 line
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 at 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
PATCH 5/10 Adding more registers and options
Quoted 26 lines · Kumar Gala
Quoted 14 lines · York Sun
Quoted 13 lines · Kumar Gala
Quoted 10 lines · York Sun
Add writing to cdr1, cdr2,
err_disable,err_int_enand debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registeres.Signed-off-by York Sun <[email protected]>---
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(-)Quoted 7 lines
Quoted 1 line
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.
Quoted 8 lines
For example:
[galak at 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
PATCH 5/10 Adding more registers and options
Quoted 36 lines · York Sun
Quoted 26 lines · Kumar Gala
Quoted 14 lines · York Sun
Quoted 13 lines · Kumar Gala
Quoted 10 lines · York Sun
Add writing to cdr1, cdr2,
err_disable,err_int_enand debug registers Add options to override rcw, address parity to RDIMMs.
Use array for debug registeres.Signed-off-by York Sun <[email protected]>---
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(-)Quoted 7 lines
Quoted 1 line
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.
Quoted 8 lines
For example:
[galak at 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)
Quoted 3 lines
You are right. I didn't think there are other boards out of freescale folder. Do you want to me revert back to
debug_xor change all of them to debug[x]?
Just change to debug[x] for the other places that are impacted.
- k
PATCH 6/10 Enable unique mode registers and dynamic ODT for DDR3
In reply to York SunAdded fsl_ddr_get_version() function to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. This function may be needed for future other platforms if such a feature exists. If true, always use unique mode registers. Dynamic ODT is enabled if needed. The table is documented in doc/README.fsl-ddr.
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 | 18 ++ arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c | 305 +++++++++++++++++++++++++---- arch/powerpc/cpu/mpc8xxx/ddr/options.c | 308 +++++++++++++++++++++++++++++- arch/powerpc/include/asm/fsl_ddr_sdram.h | 18 ++ board/freescale/corenet_ds/ddr.c | 125 ++++++------- doc/README.fsl-ddr | 67 +++++++- 6 files changed, 723 insertions(+), 118 deletions(-)
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +18 -0
@@ -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);
@@ -133,3 +139,15 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,udelay (10000 );/* throttle polling rate */ } } + +u32 fsl_ddr_get_version (void ) +{ +ccsr_ddr_t *ddr; +u32 ver_major_minor_errata; + + ddr = (void *)CONFIG_SYS_MPC85xx_DDR_ADDR; + ver_major_minor_errata = (in_be32 (&ddr->ip_rev1) &0xFFFF ) <<8 ; + ver_major_minor_errata |= (in_be32 (&ddr->ip_rev2) &0xFF00 ) >>8 ; + +return ver_major_minor_errata; +}
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +263 -42
484 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
@@ -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 */
board/freescale/corenet_ds/ddr.c +56 -69
174 lines not on this page · raw message
doc/README.fsl-ddr +66 -1
70 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 6/10 Enable unique mode registers and dynamic ODT for DDR3
Quoted 13 lines · York Sun
Added
fsl_ddr_get_version()function to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. This function may be needed for future other platforms if such a feature exists. If true, always use unique mode registers. Dynamic ODT is enabled if needed. The table is documented in doc/README.fsl-ddr.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_onfortiming_cfg_5.
Quoted 7 lines
Signed-off-by York Sun <[email protected]>---
arch/powerpc/cpu/mpc85xx/ddr-gen3.c | 18 ++ arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c | 305 +++++++++++++++++++++++++---- arch/powerpc/cpu/mpc8xxx/ddr/options.c | 308 +++++++++++++++++++++++++++++- arch/powerpc/include/asm/fsl_ddr_sdram.h | 18 ++ board/freescale/corenet_ds/ddr.c | 125 ++++++-------
do we really need to mix corenet_ds/ddr.c in this patch?
Quoted 2 lines
doc/README.fsl-ddr | 67 +++++++-
6 files changed, 723 insertions(+), 118 deletions(-)
What about other DDR3 boards like P2020DS? Are they impacted by this patch?
- k
PATCH 6/10 Enable unique mode registers and dynamic ODT for DDR3
Quoted 23 lines · Kumar Gala
Quoted 13 lines · York Sun
Added
fsl_ddr_get_version()function to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. This function may be needed for future other platforms if such a feature exists. If true, always use unique mode registers. Dynamic ODT is enabled if needed. The table is documented in doc/README.fsl-ddr.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_onfortiming_cfg_5.Quoted 7 lines
Signed-off-by York Sun <[email protected]>---
arch/powerpc/cpu/mpc85xx/ddr-gen3.c | 18 ++ arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c | 305 +++++++++++++++++++++++++---- arch/powerpc/cpu/mpc8xxx/ddr/options.c | 308 +++++++++++++++++++++++++++++- arch/powerpc/include/asm/fsl_ddr_sdram.h | 18 ++ board/freescale/corenet_ds/ddr.c | 125 ++++++-------
Quoted 6 lines
do we really need to mix
corenet_ds/ddr.cin this patch?Quoted 2 lines
doc/README.fsl-ddr | 67 +++++++-
6 files changed, 723 insertions(+), 118 deletions(-)What about other DDR3 boards like P2020DS? Are they impacted by this patch?
No. The unique mode registers are only used if DDRC supports it.
York
PATCH 6/10 Enable unique mode registers and dynamic ODT for DDR3
In reply to York SunDear York Sun,
Quoted 3 lines · In message <[email protected]> you wrote:
Added
fsl_ddr_get_version()function to poll DDRC IP version (major, minor, errata) to determine if unique mode registers are available. This function may be needed for future other platforms if such a feature exists. If true, always
Then please resubmit when any platform gets added that actually uses this. Until then it would be just dead 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
Anything that is worth doing at all is worth doing well.
-- Philip Earl of ChesterfieldPATCH 7/10 Adding more SPD registers
In reply to York SunAdding byte 32 and 33
--- include/ddr_spd.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
include/ddr_spd.h +3 -1
@@ -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;/* 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
PATCH 7/10 Adding more SPD registers
Dear York Sun,
Quoted 12 lines · In message <[email protected]> you wrote:
Adding byte 32 and 33
Signed-off-by York Sun <[email protected]>--- include/ddr_spd.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)include/ddr_spd.h +0
-0
include/ddr_spd.h typedef struct ddr3_spd_eeprom_s { · line 223
Quoted 6 lines
include/ddr_spd.h +2
-1@@ -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;/* SDRAM device type */
for consistency: make the comment "33 SDRAM device type".
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 We do not colonize. We conquer. We rule. There is no other way for us. -- Rojan, "By Any Other Name", stardate 4657.5
PATCH 8/10 Implement workaround for erratum DDRA003
In reply to York SunErratum DDRA003 requires workaround to correctly set RCW10 for registered DIMM. Also adding polling after enabling DDR controller to ensure completion.
--- arch/powerpc/cpu/mpc85xx/ddr-gen3.c | 53 ++++++++++++++++++++++++++++++++++- include/configs/P4080DS.h | 1 + 2 files changed, 53 insertions(+), 1 deletions(-)
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +52 -1
@@ -108,6 +108,55 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs, temp_sdram_cfg = regs->ddr_sdram_cfg; temp_sdram_cfg &= ~(SDRAM_CFG_MEM_EN );out_be32 (&ddr->sdram_cfg, temp_sdram_cfg); +#ifdef CONFIG_SYS_P4080_ERRATUM_DDRA003 +if (regs->ddr_sdram_rcw_2 &0x00f00000 ) { +out_be32 (&ddr->timing_cfg_2, regs->timing_cfg_2 &0xf07fffff ); +out_be32 (&ddr->debug[2 ],0x00000400 ); +out_be32 (&ddr->ddr_zq_cntl, regs->ddr_zq_cntl &0x7fffffff ); +out_be32 (&ddr->ddr_wrlvl_cntl, regs->ddr_wrlvl_cntl &0x7fffffff ); +out_be32 (&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2 &0xffffffeb ); +out_be32 (&ddr->mtcr,0 ); +out_be32 (&ddr->debug[12 ],0x00000015 ); +out_be32 (&ddr->debug[21 ],0x24000000 ); +out_be32 (&ddr->sdram_interval, regs->ddr_sdram_interval &0xffff ); +out_be32 (&ddr->sdram_cfg, temp_sdram_cfg |SDRAM_CFG_BI |SDRAM_CFG_MEM_EN ); + + asmvolatile ("sync;isync" ); +while (!(in_be32 (&ddr->debug[1 ]) &0x2 )); + +switch (regs->ddr_sdram_rcw_2 &0x00f00000 ) { +case 0x00000000 : +out_be32 (&ddr->sdram_md_cntl,0xc4080002 ); +break ; +case 0x00100000 : +out_be32 (&ddr->sdram_md_cntl,0xc408000a ); +break ; +case 0x00200000 : +out_be32 (&ddr->sdram_md_cntl,0xc4080012 ); +break ; +case 0x00300000 : +out_be32 (&ddr->sdram_md_cntl,0xc408001a ); +break ; +default : +out_be32 (&ddr->sdram_md_cntl,0xc4080002 ); +printf ("Unsupported RC10\n" ); +break ; + } + +while (in_be32 (&ddr->sdram_md_cntl) &0x80000000 ); +udelay (6 ); +out_be32 (&ddr->sdram_cfg, temp_sdram_cfg); +out_be32 (&ddr->timing_cfg_2, regs->timing_cfg_2); +out_be32 (&ddr->debug[2 ],0x0 ); +out_be32 (&ddr->ddr_zq_cntl, regs->ddr_zq_cntl); +out_be32 (&ddr->ddr_wrlvl_cntl, regs->ddr_wrlvl_cntl); +out_be32 (&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2); +out_be32 (&ddr->debug[12 ],0x0 ); +out_be32 (&ddr->debug[21 ],0x0 ); +out_be32 (&ddr->sdram_interval, regs->ddr_sdram_interval); + + } +#endif /* * For 8572 DDR1 erratum - DDR controller may enter illegal state * when operatiing in 32-bit bus mode with 4-beat bursts,
@@ -131,8 +180,10 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs, asmvolatile ("sync;isync" );/* Let the controller go */ - temp_sdram_cfg =in_be32 (&ddr->sdram_cfg); + temp_sdram_cfg =in_be32 (&ddr->sdram_cfg) & ~SDRAM_CFG_BI ;out_be32 (&ddr->sdram_cfg, temp_sdram_cfg |SDRAM_CFG_MEM_EN ); + asmvolatile ("sync;isync" ); +while (!(in_be32 (&ddr->debug[1 ]) &0x2 ));/* Poll DDR_SDRAM_CFG_2[D_INIT] bit until auto-data init is done. */ while (in_be32 (&ddr->sdram_cfg_2) &0x10 ) {
include/configs/P4080DS.h +1 -0
@@ -45,6 +45,7 @@#define CONFIG_SYS_P4080_ERRATUM_CPC9 #define CONFIG_SYS_P4080_ERRATUM_DDR1 #define CONFIG_SYS_P4080_ERRATUM_DDR7 +#define CONFIG_SYS_P4080_ERRATUM_DDRA003 #define CONFIG_SYS_P4080_ERRATUM_ESDHC1 #define CONFIG_SYS_P4080_ERRATUM_ESDHC9 #define CONFIG_SYS_P4080_ERRATUM_ESDHC11
Signature · 1 line
1.7.0.4
PATCH 8/10 Implement workaround for erratum DDRA003
Quoted 14 lines · York Sun
Erratum DDRA003 requires workaround to correctly set RCW10 for registered DIMM. Also adding polling after enabling DDR controller to ensure completion.
Signed-off-by York Sun <[email protected]>---
arch/powerpc/cpu/mpc85xx/ddr-gen3.c| 53 ++++++++++++++++++++++++++++++++++-include/configs/P4080DS.h| 1 +2 files changed, 53 insertions(+), 1 deletions(-)arch/powerpc/cpu/mpc85xx/ddr-gen3.c +0
-0
arch/powerpc/cpu/mpc85xx/ddr-gen3.c void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs, · line 111
Quoted 4 lines
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +1
-0@@ -108,6 +108,55 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs, temp_sdram_cfg = regs->ddr_sdram_cfg; temp_sdram_cfg &= ~(SDRAM_CFG_MEM_EN );out_be32 (&ddr->sdram_cfg, temp_sdram_cfg); +#ifdef CONFIG_SYS_P4080_ERRATUM_DDRA003
Name this:
#ifdef CONFIG_SYS_FSL_NMG_DDR_A003
Quoted 77 lines
arch/powerpc/cpu/mpc85xx/ddr-gen3.c +51
-1+if (regs->ddr_sdram_rcw_2 &0x00f00000 ) { +out_be32 (&ddr->timing_cfg_2, regs->timing_cfg_2 &0xf07fffff ); +out_be32 (&ddr->debug[2 ],0x00000400 ); +out_be32 (&ddr->ddr_zq_cntl, regs->ddr_zq_cntl &0x7fffffff ); +out_be32 (&ddr->ddr_wrlvl_cntl, regs->ddr_wrlvl_cntl &0x7fffffff ); +out_be32 (&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2 &0xffffffeb ); +out_be32 (&ddr->mtcr,0 ); +out_be32 (&ddr->debug[12 ],0x00000015 ); +out_be32 (&ddr->debug[21 ],0x24000000 ); +out_be32 (&ddr->sdram_interval, regs->ddr_sdram_interval &0xffff ); +out_be32 (&ddr->sdram_cfg, temp_sdram_cfg |SDRAM_CFG_BI |SDRAM_CFG_MEM_EN ); + + asmvolatile ("sync;isync" ); +while (!(in_be32 (&ddr->debug[1 ]) &0x2 )); + +switch (regs->ddr_sdram_rcw_2 &0x00f00000 ) { +case 0x00000000 : +out_be32 (&ddr->sdram_md_cntl,0xc4080002 ); +break ; +case 0x00100000 : +out_be32 (&ddr->sdram_md_cntl,0xc408000a ); +break ; +case 0x00200000 : +out_be32 (&ddr->sdram_md_cntl,0xc4080012 ); +break ; +case 0x00300000 : +out_be32 (&ddr->sdram_md_cntl,0xc408001a ); +break ; +default : +out_be32 (&ddr->sdram_md_cntl,0xc4080002 ); +printf ("Unsupported RC10\n" ); +break ; + } + +while (in_be32 (&ddr->sdram_md_cntl) &0x80000000 ); +udelay (6 ); +out_be32 (&ddr->sdram_cfg, temp_sdram_cfg); +out_be32 (&ddr->timing_cfg_2, regs->timing_cfg_2); +out_be32 (&ddr->debug[2 ],0x0 ); +out_be32 (&ddr->ddr_zq_cntl, regs->ddr_zq_cntl); +out_be32 (&ddr->ddr_wrlvl_cntl, regs->ddr_wrlvl_cntl); +out_be32 (&ddr->sdram_cfg_2, regs->ddr_sdram_cfg_2); +out_be32 (&ddr->debug[12 ],0x0 ); +out_be32 (&ddr->debug[21 ],0x0 ); +out_be32 (&ddr->sdram_interval, regs->ddr_sdram_interval); + + } +#endif /* * For 8572 DDR1 erratum - DDR controller may enter illegal state * when operatiing in 32-bit bus mode with 4-beat bursts, @@ -131,8 +180,10 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs, asmvolatile ("sync;isync" );/* Let the controller go */ - temp_sdram_cfg =in_be32 (&ddr->sdram_cfg); + temp_sdram_cfg =in_be32 (&ddr->sdram_cfg) & ~SDRAM_CFG_BI ;out_be32 (&ddr->sdram_cfg, temp_sdram_cfg |SDRAM_CFG_MEM_EN ); + asmvolatile ("sync;isync" ); +while (!(in_be32 (&ddr->debug[1 ]) &0x2 ));/* Poll DDR_SDRAM_CFG_2[D_INIT] bit until auto-data init is done. */ while (in_be32 (&ddr->sdram_cfg_2) &0x10 ) {include/configs/P4080DS.h +1
-0@@ -45,6 +45,7 @@#define CONFIG_SYS_P4080_ERRATUM_CPC9 #define CONFIG_SYS_P4080_ERRATUM_DDR1 #define CONFIG_SYS_P4080_ERRATUM_DDR7 +#define CONFIG_SYS_P4080_ERRATUM_DDRA003 #define CONFIG_SYS_P4080_ERRATUM_ESDHC1 #define CONFIG_SYS_P4080_ERRATUM_ESDHC9 #define CONFIG_SYS_P4080_ERRATUM_ESDHC11 Signature · 1 line
1.7.0.4
You need to update arch/powerpc/cpu/mpc85xx/cmd_errata.c
- k
PATCH 9/10 Adding interactive ddr
In reply to York SunUse environment variable to active the interactive debugging.
--- arch/powerpc/cpu/mpc8xxx/ddr/Makefile | 6 +- arch/powerpc/cpu/mpc8xxx/ddr/interactive.c | 1882 ++++++++++++++++++++++++++++ arch/powerpc/cpu/mpc8xxx/ddr/main.c | 8 +- doc/README.fsl-ddr | 20 + 4 files changed, 1910 insertions(+), 6 deletions(-) create mode 100644 arch/powerpc/cpu/mpc8xxx/ddr/interactive.c
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +3 -3
@@ -11,15 +11,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)libddr.a COBJS-$(CONFIG_FSL_DDR1) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR1) += ddr1_dimm_params.o COBJS-$(CONFIG_FSL_DDR2) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR2) += ddr2_dimm_params.o COBJS-$(CONFIG_FSL_DDR3) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR3) += ddr3_dimm_params.o SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +1882 -0
1,882 lines not on this page · raw message
arch/powerpc/cpu/mpc8xxx/ddr/main.c +5 -3
@@ -21,6 +21,7 @@ extern void fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, unsigned int memctl_interleaved, unsigned int ctrl_num); +extern phys_size_t fsl_ddr_interactive (fsl_ddr_info_t *pinfo);/* processor specific function */ extern void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
@@ -75,7 +76,6 @@ extern void fsl_ddr_get_spd(generic_spd_eeprom_t *ctrl_dimms_spd,* | interleaving */ -#ifdef DEBUG const char *step_string_tbl[] = {"STEP_GET_SPD" ,"STEP_COMPUTE_DIMM_PARMS" ,
@@ -96,7 +96,6 @@ const char * step_to_string(unsigned int step) {return step_string_tbl[s]; } -#endif int step_assign_addresses(fsl_ddr_info_t *pinfo, unsigned int dbw_cap_adj[],
@@ -405,7 +404,10 @@ phys_size_t fsl_ddr_sdram(void)memset (&info,0 ,sizeof (fsl_ddr_info_t));/* Compute it once normally. */ - total_memory =fsl_ddr_compute (&info,STEP_GET_SPD ); +if (getenv ("ddr_interactive" )) + total_memory =fsl_ddr_interactive (&info); +else + total_memory =fsl_ddr_compute (&info,STEP_GET_SPD );/* Check for memory controller interleaving. */ memctl_interleaved =0 ;
doc/README.fsl-ddr +20 -0
@@ -170,3 +170,23 @@ Single slot system Reference http://www.xrosstalkmag.com/mag_issues/xrosstalk_oct08_final.pdf http://download.micron.com/pdf/technotes/ddr3/tn4108_ddr3_design_guide.pdf + + +Interactive DDR debugging +=========================== + +For DDR parameter tuning up and debugging, the interactive DDR debugging can +be activated by saving an environment variable "ddr_interactive". The value +doesn't matter. Once activated, U-boot prompts "FSL DDR>" before enabling DDR +controller. The available commands can be seen by typing "help". + +The example flow of using interactive debugging is +type command "compute" to calculate the parameters from the default +type command "print" with arguments to show SPD, options, registers +type command "edit" with arguments to change any if desired +type command "go" to continue calculation and enable DDR controller + +Note, check "next_step" to show the flow. For example, after editing registers, +DDR controller will be enabled with current setting without further +calculation. +
Signature · 1 line
1.7.0.4
PATCH 9/10 Adding interactive ddr
Quoted 10 lines · York Sun
Use environment variable to active the interactive debugging.
Signed-off-by York Sun <[email protected]>---
arch/powerpc/cpu/mpc8xxx/ddr/Makefile | 6 +- arch/powerpc/cpu/mpc8xxx/ddr/interactive.c | 1882 ++++++++++++++++++++++++++++ arch/powerpc/cpu/mpc8xxx/ddr/main.c | 8 +- doc/README.fsl-ddr | 20 + 4 files changed, 1910 insertions(+), 6 deletions(-)create mode 100644
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c
Can you make this the last patch.
- k
PATCH 9/10 Adding interactive ddr
In reply to York SunDear York Sun,
Quoted 1 line · In message <[email protected]> you wrote:
Use environment variable to active the interactive debugging.
...
s/active/activate/
Quoted 11 lines
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +1
-1@@ -11,15 +11,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)libddr.a COBJS-$(CONFIG_FSL_DDR1) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR1) += ddr1_dimm_params.o
arch/powerpc/cpu/mpc8xxx/ddr/Makefile include $(TOPDIR)/config.mk · line 23
Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +2
-2COBJS-$(CONFIG_FSL_DDR2) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR2) += ddr2_dimm_params.o COBJS-$(CONFIG_FSL_DDR3) += main.o util.o ctrl_regs.o options.o \ - lc_common_dimm_params.o + lc_common_dimm_params.o interactive.o COBJS-$(CONFIG_FSL_DDR3) += ddr3_dimm_params.o
Building interactive.o should depend on CONFIG_FSL_DDR_INTERACTIVE being set.
Quoted 7 lines
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +0
-0SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +0
-0
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 7
Quoted 7 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +7
-0@@ -0,0 +1,1882 @@ +/* +* Copyright 2010 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* Version 2 as published by the Free Software Foundation. +*/
NAK. V2 or later is mandatory.
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 91
Quoted 12 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +12
-0+static void fsl_ddr_generic_edit (void *pdata, +void *pend, +unsigned int element_size, +unsigned int element_num, +unsigned int value) +{ +char *pcdata = (char *)pdata;/* BIG ENDIAN ONLY */ + + pcdata += element_num * element_size; +if ((pcdata + element_size) > (char *) pend) { +debug ("trying to write past end of data\n" ); +return ;
Should that not be an error message that is always enabled?
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 106
Quoted 3 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +3
-0+default : +debug ("unexpected element size %u\n" , element_size); +break ;
Ditto?
Quoted 7 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +7
-0+static const options_strings_t options[] = { + {"cs0_odt_rd_cfg", offsetof(memctl_options_t, cs_local_opts[0].odt_rd_cfg)}, + {"cs0_odt_wr_cfg", offsetof(memctl_options_t, cs_local_opts[0].odt_wr_cfg)}, + {"cs0_odt_rtt_norm", offsetof(memctl_options_t, cs_local_opts[0].odt_rtt_norm)}, + {"cs0_odt_rtt_wr", offsetof(memctl_options_t, cs_local_opts[0].odt_rtt_wr)}, + {"cs1_odt_rd_cfg", offsetof(memctl_options_t, cs_local_opts[1].odt_rd_cfg)}, + {"cs1_odt_wr_cfg", offsetof(memctl_options_t, cs_local_opts[1].odt_wr_cfg)},
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 426
Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +10
-0+ {"cs1_odt_rtt_norm", offsetof(memctl_options_t, cs_local_opts[1].odt_rtt_norm)}, + {"cs1_odt_rtt_wr", offsetof(memctl_options_t, cs_local_opts[1].odt_rtt_wr)}, + {"cs2_odt_rd_cfg", offsetof(memctl_options_t, cs_local_opts[2].odt_rd_cfg)}, + {"cs2_odt_wr_cfg", offsetof(memctl_options_t, cs_local_opts[2].odt_wr_cfg)}, + {"cs2_odt_rtt_norm", offsetof(memctl_options_t, cs_local_opts[2].odt_rtt_norm)}, + {"cs2_odt_rtt_wr", offsetof(memctl_options_t, cs_local_opts[2].odt_rtt_wr)}, + {"cs3_odt_rd_cfg", offsetof(memctl_options_t, cs_local_opts[3].odt_rd_cfg)}, + {"cs3_odt_wr_cfg", offsetof(memctl_options_t, cs_local_opts[3].odt_wr_cfg)}, + {"cs3_odt_rtt_norm", offsetof(memctl_options_t, cs_local_opts[3].odt_rtt_norm)}, + {"cs3_odt_rtt_wr", offsetof(memctl_options_t, cs_local_opts[3].odt_rtt_wr)},
Lines too long.
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 469
Quoted 3 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +3
-0+if (handle_uint_option_table (options, nopts, (u32 ) p, + optname_str, value_str)) +return ;
Please use braces for multiline statements.
Quoted 74 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +74
-0+printf ("couldn't find option string %s\n" , optname_str); +} + +static void print_fsl_memctl_config_regs (const fsl_ddr_cfg_regs_t *ddr) +{ +unsigned int i; + +for (i =0 ; i <CONFIG_CHIP_SELECTS_PER_CTRL ; i++) { +printf ("cs%u_bnds = %08X\n" , i, ddr->cs[i].bnds); +printf ("cs%u_config = %08X\n" , i, ddr->cs[i].config); +printf ("cs%u_config_2 = %08X\n" , i, ddr->cs[i].config_2); + } + +printf ("timing_cfg_3 = %08X\n" , ddr->timing_cfg_3); +printf ("timing_cfg_0 = %08X\n" , ddr->timing_cfg_0); +printf ("timing_cfg_1 = %08X\n" , ddr->timing_cfg_1); +printf ("timing_cfg_2 = %08X\n" , ddr->timing_cfg_2); +printf ("ddr_sdram_cfg = %08X\n" , ddr->ddr_sdram_cfg); +printf ("ddr_sdram_cfg_2 = %08X\n" , ddr->ddr_sdram_cfg_2); +printf ("ddr_sdram_mode = %08X\n" , ddr->ddr_sdram_mode); +printf ("ddr_sdram_mode_2 = %08X\n" , ddr->ddr_sdram_mode_2); +printf ("ddr_sdram_mode_3 = %08X\n" , ddr->ddr_sdram_mode_3); +printf ("ddr_sdram_mode_4 = %08X\n" , ddr->ddr_sdram_mode_4); +printf ("ddr_sdram_mode_5 = %08X\n" , ddr->ddr_sdram_mode_5); +printf ("ddr_sdram_mode_6 = %08X\n" , ddr->ddr_sdram_mode_6); +printf ("ddr_sdram_mode_7 = %08X\n" , ddr->ddr_sdram_mode_7); +printf ("ddr_sdram_mode_8 = %08X\n" , ddr->ddr_sdram_mode_8); +printf ("ddr_sdram_interval = %08X\n" , ddr->ddr_sdram_interval); +printf ("ddr_data_init = %08X\n" , ddr->ddr_data_init); +printf ("ddr_sdram_clk_cntl = %08X\n" , ddr->ddr_sdram_clk_cntl); +printf ("ddr_init_addr = %08X\n" , ddr->ddr_init_addr); +printf ("ddr_init_ext_addr = %08X\n" , ddr->ddr_init_ext_addr); +printf ("timing_cfg_4 = %08X\n" , ddr->timing_cfg_4); +printf ("timing_cfg_5 = %08X\n" , ddr->timing_cfg_5); +printf ("ddr_zq_cntl = %08X\n" , ddr->ddr_zq_cntl); +printf ("ddr_wrlvl_cntl = %08X\n" , ddr->ddr_wrlvl_cntl); +printf ("ddr_sr_cntr = %08X\n" , ddr->ddr_sr_cntr); +printf ("ddr_sdram_rcw_1 = %08X\n" , ddr->ddr_sdram_rcw_1); +printf ("ddr_sdram_rcw_2 = %08X\n" , ddr->ddr_sdram_rcw_2); +printf ("ddr_cdr1 = %08X\n" , ddr->ddr_cdr1); +printf ("ddr_cdr2 = %08X\n" , ddr->ddr_cdr2); +printf ("err_disable = %08X\n" , ddr->err_disable); +printf ("err_int_en = %08X\n" , ddr->err_int_en); +for (i =0 ; i <18 ; i++) +printf ("debug_%02d = %08X\n" , i+1 , ddr->debug[i]); +} + +static void fsl_ddr_regs_edit (fsl_ddr_info_t *pinfo, +unsigned int ctrl_num, +const char *regname, +unsigned int value) +{ +unsigned int i; +fsl_ddr_cfg_regs_t *ddr; +char buf[20 ]; + +debug ("fsl_ddr_regs_edit: ctrl_num = %u, " +"regname = %s, value = 0x%08X\n" , + ctrl_num, regname, value); +if (ctrl_num >CONFIG_NUM_DDR_CONTROLLERS ) +return ; + +/* FIXME: Change this into struct like the other editing functions */ + ddr = &(pinfo->fsl_ddr_config_reg[ctrl_num]); + +for (i =0 ; i <CONFIG_CHIP_SELECTS_PER_CTRL ; i++) { +sprintf (buf,"cs%u_bnds" , i); +if (strcmp (buf, regname) ==0 ) { + ddr->cs[i].bnds = value; +return ; + } + +sprintf (buf,"cs%u_config" , i); +if (strcmp (buf, regname) ==0 ) {
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 554
Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +10
-0+ ddr->cs[i].config = value; +return ; + } + +sprintf (buf,"cs%u_config_2" , i); +if (strcmp (buf, regname) ==0 ) { + ddr->cs[i].config_2 = value; +return ; + } + }
Use format string / pointer table and a loop.
Quoted 139 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +139
-0+if (strcmp ("timing_cfg_3" , regname) ==0 ) { + ddr->timing_cfg_3 = value; +return ; + } + +if (strcmp ("timing_cfg_0" , regname) ==0 ) { + ddr->timing_cfg_0 = value; +return ; + } + +if (strcmp ("timing_cfg_1" , regname) ==0 ) { + ddr->timing_cfg_1 = value; +return ; + } + +if (strcmp ("timing_cfg_2" , regname) ==0 ) { + ddr->timing_cfg_2 = value; +return ; + } + +if (strcmp ("ddr_sdram_cfg" , regname) ==0 ) { + ddr->ddr_sdram_cfg = value; +return ; + } + +if (strcmp ("ddr_sdram_cfg_2" , regname) ==0 ) { + ddr->ddr_sdram_cfg_2 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode" , regname) ==0 ) { + ddr->ddr_sdram_mode = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_2" , regname) ==0 ) { + ddr->ddr_sdram_mode_2 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_3" , regname) ==0 ) { + ddr->ddr_sdram_mode_3 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_4" , regname) ==0 ) { + ddr->ddr_sdram_mode_4 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_5" , regname) ==0 ) { + ddr->ddr_sdram_mode_5 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_6" , regname) ==0 ) { + ddr->ddr_sdram_mode_6 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_7" , regname) ==0 ) { + ddr->ddr_sdram_mode_7 = value; +return ; + } + +if (strcmp ("ddr_sdram_mode_8" , regname) ==0 ) { + ddr->ddr_sdram_mode_8 = value; +return ; + } + +if (strcmp ("ddr_sdram_interval" , regname) ==0 ) { + ddr->ddr_sdram_interval = value; +return ; + } + +if (strcmp ("ddr_data_init" , regname) ==0 ) { + ddr->ddr_data_init = value; +return ; + } + +if (strcmp ("ddr_sdram_clk_cntl" , regname) ==0 ) { + ddr->ddr_sdram_clk_cntl = value; +return ; + } + +if (strcmp ("ddr_init_addr" , regname) ==0 ) { + ddr->ddr_init_addr = value; +return ; + } + +if (strcmp ("ddr_init_ext_addr" , regname) ==0 ) { + ddr->ddr_init_ext_addr = value; +return ; + } + +if (strcmp ("timing_cfg_4" , regname) ==0 ) { + ddr->timing_cfg_4 = value; +return ; + } + +if (strcmp ("timing_cfg_5" , regname) ==0 ) { + ddr->timing_cfg_5 = value; +return ; + } + +if (strcmp ("ddr_zq_cntl" , regname) ==0 ) { + ddr->ddr_zq_cntl = value; +return ; + } + +if (strcmp ("ddr_wrlvl_cntl" , regname) ==0 ) { + ddr->ddr_wrlvl_cntl = value; +return ; + } + +if (strcmp ("ddr_sr_cntr" , regname) ==0 ) { + ddr->ddr_sr_cntr = value; +return ; + } + +if (strcmp ("ddr_sdram_rcw_1" , regname) ==0 ) { + ddr->ddr_sdram_rcw_1 = value; +return ; + } + +if (strcmp ("ddr_sdram_rcw_2" , regname) ==0 ) { + ddr->ddr_sdram_rcw_2 = value; +return ; + } + +if (strcmp ("ddr_cdr1" , regname) ==0 ) { + ddr->ddr_cdr1 = value; +return ; + } + +if (strcmp ("ddr_cdr2" , regname) ==0 ) { + ddr->ddr_cdr2 = value; +return ; + }
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 704
Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +10
-0+ +if (strcmp ("err_disable" , regname) ==0 ) { + ddr->err_disable = value; +return ; + } + +if (strcmp ("err_int_en" , regname) ==0 ) { + ddr->err_int_en = value; +return ; + }
Use string / pointer table and a loop.
...
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 1257
Quoted 3 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +3
-0+#define PRINT_NXS (x, y, z) printf("%-3d : %02x %s\n", x, y, z); +#define PRINT_NNXXS (n0, n1, x0, x1, s) printf("%-3d-%3d: %02x %02x %s\n", n0, n1, x0, x1, s); +#define PRINT_SNNlots (x, y, z, arr) do {printf(x); printf("%-3d-%3d: ", y, z); for (i = y; i <= z; i++) printf("%02x", arr[i - y]); } while (0)
Lines way too long; please fix globally.
...
Quoted 14 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +14
-0+if (strcmp (argv[i],"dimmparms" ) ==0 ) { + step_mask |=STEP_COMPUTE_DIMM_PARMS ; +continue ; + } + +if (strcmp (argv[i],"commonparms" ) ==0 ) { + step_mask |=STEP_COMPUTE_COMMON_PARMS ; +continue ; + } + +if (strcmp (argv[i],"opts" ) ==0 ) { + step_mask |=STEP_GATHER_OPTS ; +continue ; + }
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 1611
Quoted 10 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +10
-0+ +if (strcmp (argv[i],"addresses" ) ==0 ) { + step_mask |=STEP_ASSIGN_ADDRESSES ; +continue ; + } + +if (strcmp (argv[i],"regs" ) ==0 ) { + step_mask |=STEP_COMPUTE_REGS ; +continue ; + }
Here again the code could be made much smaller and easier to read by using a data (table) driven approach and a loop through the table. Please consider using this technique globally.
Best regards,
Wolfgang Denk
Signature · 7 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 But it's real. And if it's real it can be affected ... we may not be able to break it, but, I'll bet you credits to Navy Beans we can put a dent in it. -- deSalle, "Catspaw", stardate 3018.2
PATCH 9/10 Adding interactive ddr
Quoted 25 lines · Wolfgang Denk
Dear York Sun,
Quoted 1 line · In message <[email protected]> you wrote:
Use environment variable to active the interactive debugging.
...
s/active/activate/
Quoted 17 lines
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +0
-0@@ -11,15 +11,15 @@ include $(TOPDIR)/config.mkLIB = $(obj)libddr.a
COBJS-$(CONFIG_FSL_DDR1) += main.o util.o ctrl_regs.o options.o \
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +1
-1- lc_common_dimm_params.o + lc_common_dimm_params.o interactive.oCOBJS-$(CONFIG_FSL_DDR1) += ddr1_dimm_params.o
COBJS-$(CONFIG_FSL_DDR2) += main.o util.o ctrl_regs.o options.o \
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +1
-1- lc_common_dimm_params.o + lc_common_dimm_params.o interactive.oCOBJS-$(CONFIG_FSL_DDR2) += ddr2_dimm_params.o
Quoted 7 lines
Quoted 4 lines
COBJS-$(CONFIG_FSL_DDR3) += main.o util.o ctrl_regs.o options.o \
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +1
-1- lc_common_dimm_params.o + lc_common_dimm_params.o interactive.oCOBJS-$(CONFIG_FSL_DDR3) += ddr3_dimm_params.o
Building interactive.o should depend on
CONFIG_FSL_DDR_INTERACTIVEbeing set.
Agreed
Quoted 17 lines
Quoted 8 lines
SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +0
-0arch/powerpc/cpu/mpc8xxx/ddr/interactive.c line 7
Quoted 7 lines
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +7
-0@@ -0,0 +1,1882 @@ +/* +* Copyright 2010 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* Version 2 as published by the Free Software Foundation. +*/ NAK. V2 or later is mandatory.
Yes, we will fix.
- k
PATCH 10/10 Extend board specific parameters
In reply to York SunExtend board specific parameters to include write leveling start override Extend write leveling sample to 0xf
Adding rcw overrid for quad-rank RDIMMs
--- board/freescale/corenet_ds/ddr.c | 120 +++++++++++++++++++++----------------- 1 files changed, 66 insertions(+), 54 deletions(-)
board/freescale/corenet_ds/ddr.c +66 -54
@@ -145,6 +145,7 @@ typedef struct {u32 datarate_mhz_high;u32 n_ranks;u32 clk_adjust; +u32 wrlvl_start;u32 cpo;u32 write_data_delay;u32 force_2T;
@@ -164,57 +165,57 @@ typedef struct {/* XXX: Single rank at 800 MHz is OK. */ const board_specific_parameters_t board_specific_parameters[][30 ] = { { -/* memory controller 0 */ -/* lo| hi| num| clk| cpo|wrdata|2T */ -/* mhz| mhz|ranks|adjst| | delay| */ - {0 ,333 ,4 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,4 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,4 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,4 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,4 ,5 ,0xff ,2 ,0 }, - {851 ,1050 ,4 ,5 ,0xff ,2 ,0 }, - {1051 ,1250 ,4 ,5 ,0xff ,2 ,0 }, - {1251 ,1350 ,4 ,5 ,0xff ,2 ,0 }, - {0 ,333 ,2 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,2 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,2 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,2 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,2 ,5 ,0xff ,2 ,0 }, - {851 ,1050 ,2 ,5 ,0xff ,2 ,0 }, - {1051 ,1250 ,2 ,5 ,0xff ,2 ,0 }, - {1251 ,1350 ,2 ,5 ,0xff ,2 ,0 }, - {0 ,333 ,1 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,1 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,1 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,1 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,1 ,5 ,0xff ,2 ,0 } +/* memory controller 0 */ +/* lo| hi| num| clk| wrlvl | cpo |wrdata|2T */ +/* mhz| mhz|ranks|adjst| start | delay| */ + {0 ,333 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {851 ,1050 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {1051 ,1250 ,4 ,5 ,8 ,0xff ,2 ,0 }, + {1251 ,1350 ,4 ,5 ,9 ,0xff ,2 ,0 }, + {0 ,333 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {851 ,1050 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {1051 ,1250 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {1251 ,1350 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {0 ,333 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,1 ,5 ,7 ,0xff ,2 ,0 } }, { -/* memory controller 1 */ -/* lo| hi| num| clk| cpo|wrdata|2T */ -/* mhz| mhz|ranks|adjst| | delay| */ - {0 ,333 ,4 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,4 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,4 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,4 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,4 ,5 ,0xff ,2 ,0 }, - {851 ,1050 ,4 ,5 ,0xff ,2 ,0 }, - {1051 ,1250 ,4 ,5 ,0xff ,2 ,0 }, - {1251 ,1350 ,4 ,5 ,0xff ,2 ,0 }, - {0 ,333 ,2 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,2 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,2 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,2 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,2 ,5 ,0xff ,2 ,0 }, - {851 ,1050 ,2 ,5 ,0xff ,2 ,0 }, - {1051 ,1250 ,2 ,5 ,0xff ,2 ,0 }, - {1251 ,1350 ,2 ,5 ,0xff ,2 ,0 }, - {0 ,333 ,1 ,5 ,0xff ,2 ,0 }, - {334 ,400 ,1 ,5 ,0xff ,2 ,0 }, - {401 ,549 ,1 ,5 ,0xff ,2 ,0 }, - {550 ,680 ,1 ,5 ,0xff ,2 ,0 }, - {681 ,850 ,1 ,5 ,0xff ,2 ,0 } +/* memory controller 1 */ +/* lo| hi| num| clk| wrlvl | cpo |wrdata|2T */ +/* mhz| mhz|ranks|adjst| start | delay| */ + {0 ,333 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {851 ,1050 ,4 ,5 ,7 ,0xff ,2 ,0 }, + {1051 ,1250 ,4 ,5 ,8 ,0xff ,2 ,0 }, + {1251 ,1350 ,4 ,5 ,9 ,0xff ,2 ,0 }, + {0 ,333 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {851 ,1050 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {1051 ,1250 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {1251 ,1350 ,2 ,5 ,7 ,0xff ,2 ,0 }, + {0 ,333 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {334 ,400 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {401 ,549 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {550 ,680 ,1 ,5 ,7 ,0xff ,2 ,0 }, + {681 ,850 ,1 ,5 ,7 ,0xff ,2 ,0 } } };
@@ -236,12 +237,12 @@ void fsl_ddr_board_options(memctl_options_t *popts,for (i =0 ; i < num_params; i++) {if (ddr_freq >= pbsp->datarate_mhz_low && ddr_freq <= pbsp->datarate_mhz_high && - pdimm->n_ranks == pbsp->n_ranks) { + 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; popts->twoT_en = pbsp->force_2T; - popts->wrlvl_start = pbsp->clk_adjust +2 ; } pbsp++; }
@@ -255,7 +256,8 @@ void fsl_ddr_board_options(memctl_options_t *popts,* Write leveling override */ popts->wrlvl_override =1 ; - popts->wrlvl_sample =0xa ; + popts->wrlvl_sample =0xf ; +/* * Rtt and Rtt_WR override */
@@ -267,9 +269,19 @@ void fsl_ddr_board_options(memctl_options_t *popts,/* DHC_EN =1, ODT = 60 Ohm */ popts->ddr_cdr1 =0x80080000 ; - popts->rcw_override =1 ; - popts->rcw_1 =0x000a5000 ; - popts->rcw_2 =0x00100000 ; +/* override SPD values. rcw_2 should vary at differnt speed */ +if (pdimm[0 ].n_ranks ==4 ) { + 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
PATCH 10/10 Extend board specific parameters
Dear York Sun,
Quoted 5 lines · In message <[email protected]> you wrote:
Extend board specific parameters to include write leveling start override Extend write leveling sample to
0xf
Adding rcw overrid for quad-rank RDIMMsSigned-off-by York Sun <[email protected]>
...
board/freescale/corenet_ds/ddr.c typedef struct { · line 170
Quoted 3 lines
board/freescale/corenet_ds/ddr.c +3
-0+/* memory controller 0 */ +/* lo| hi| num| clk| wrlvl | cpo |wrdata|2T */ +/* mhz| mhz|ranks|adjst| start | delay| */
Incorrect multiline comment style. Please fix globally.
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 PLEASE NOTE: Some Quantum Physics Theories Suggest That When the Con- sumer Is Not Directly Observing This Product, It May Cease to Exist or Will Exist Only in a Vague and Undetermined State.
PATCH 1/10 Display RDIMM if detected
In reply to York SunDear York Sun,
Quoted 1 line · In message <[email protected]> you wrote:
Print a message when a RDIMM is detected.
Please put an indication of affected boards / processors / architectures in the Subject: ; like "mpc8xxx: ..."
(applies to all patches).
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 Certainly there are things in life that money can't buy, but it's very funny - Did you ever try buying them without money? - Ogden Nash