All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] powerpc/mpc8xxx: Fix DDR code for empty first DIMM slot and enable DQS_en
@ 2011-08-09 20:50 York Sun
  2011-08-09 20:50 ` [U-Boot] [PATCH 2/7] powerpc/mpc8xxx: Add SPD EEPROM address for single controller 2 slots York Sun
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: York Sun @ 2011-08-09 20:50 UTC (permalink / raw)
  To: u-boot

Check second DIMM slot in case the first one is empty.
Honor DQS enable option for SDRAM mode register.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c |   19 ++++++++++---------
 arch/powerpc/include/asm/fsl_ddr_sdram.h |    4 ++++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c b/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c
index 3824aad..eb8d8e3 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c
@@ -146,7 +146,7 @@ static void set_csn_config(int dimm_number, int i, fsl_ddr_cfg_regs_t *ddr,
 		break;
 	case 2:
 		if ((dimm_number == 0 && dimm_params[0].n_ranks > 2) || \
-		   (dimm_number > 1 && dimm_params[dimm_number].n_ranks > 0))
+		   (dimm_number >= 1 && dimm_params[dimm_number].n_ranks > 0))
 			go_config = 1;
 		break;
 	case 3:
@@ -617,7 +617,7 @@ static void set_ddr_sdram_cfg_2(fsl_ddr_cfg_regs_t *ddr,
 	unsigned int sr_ie = 0;		/* Self-refresh interrupt enable */
 	unsigned int dll_rst_dis;	/* DLL reset disable */
 	unsigned int dqs_cfg;		/* DQS configuration */
-	unsigned int odt_cfg;		/* ODT configuration */
+	unsigned int odt_cfg = 0;	/* ODT configuration */
 	unsigned int num_pr;		/* Number of posted refreshes */
 	unsigned int obc_cfg;		/* On-The-Fly Burst Chop Cfg */
 	unsigned int ap_en;		/* Address Parity Enable */
@@ -625,15 +625,16 @@ static void set_ddr_sdram_cfg_2(fsl_ddr_cfg_regs_t *ddr,
 	unsigned int rcw_en = 0;	/* Register Control Word Enable */
 	unsigned int md_en = 0;		/* Mirrored DIMM Enable */
 	unsigned int qd_en = 0;		/* quad-rank DIMM Enable */
+	int i;
 
 	dll_rst_dis = 1;	/* Make this configurable */
 	dqs_cfg = popts->DQS_config;
-	if (popts->cs_local_opts[0].odt_rd_cfg
-	    || popts->cs_local_opts[0].odt_wr_cfg) {
-		/* FIXME */
-		odt_cfg = 2;
-	} else {
-		odt_cfg = 0;
+	for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
+		if (popts->cs_local_opts[i].odt_rd_cfg
+			|| popts->cs_local_opts[i].odt_wr_cfg) {
+			odt_cfg = SDRAM_CFG2_ODT_ONLY_READ;
+			break;
+		}
 	}
 
 	num_pr = 1;	/* Make this configurable */
@@ -1018,7 +1019,7 @@ static void set_ddr_sdram_mode(fsl_ddr_cfg_regs_t *ddr,
 #if defined(CONFIG_FSL_DDR2)
 	const unsigned int mclk_ps = get_memory_clk_period_ps();
 #endif
-
+	dqs_en = !popts->DQS_config;
 	rtt = fsl_ddr_get_rtt();
 
 	al = additive_latency;
diff --git a/arch/powerpc/include/asm/fsl_ddr_sdram.h b/arch/powerpc/include/asm/fsl_ddr_sdram.h
index bc063ea..5b6e8d9 100644
--- a/arch/powerpc/include/asm/fsl_ddr_sdram.h
+++ b/arch/powerpc/include/asm/fsl_ddr_sdram.h
@@ -92,6 +92,10 @@ typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 
 #define SDRAM_CFG2_D_INIT		0x00000010
 #define SDRAM_CFG2_ODT_CFG_MASK		0x00600000
+#define SDRAM_CFG2_ODT_NEVER		0
+#define SDRAM_CFG2_ODT_ONLY_WRITE	1
+#define SDRAM_CFG2_ODT_ONLY_READ	2
+#define SDRAM_CFG2_ODT_ALWAYS		3
 
 #define TIMING_CFG_2_CPO_MASK	0x0F800000
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-08-26 18:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 20:50 [U-Boot] [PATCH 1/7] powerpc/mpc8xxx: Fix DDR code for empty first DIMM slot and enable DQS_en York Sun
2011-08-09 20:50 ` [U-Boot] [PATCH 2/7] powerpc/mpc8xxx: Add SPD EEPROM address for single controller 2 slots York Sun
2011-08-09 20:50 ` [U-Boot] [PATCH 3/7] powerpc/mpc8xxx: Fix picos_to_mclk() and get_memory_clk_period_ps() York Sun
2011-08-09 20:50 ` [U-Boot] [PATCH 4/7] powerpc/mpc8xxx: Add DDR2 to unified DDR driver York Sun
2011-08-09 20:50 ` [U-Boot] [PATCH 5/7] powerpc/mpc83xx: Migrate from spd_sdram " York Sun
2011-08-24 22:36   ` Wolfgang Denk
2011-08-25 20:57     ` York Sun
2011-08-25 21:20       ` Wolfgang Denk
2011-08-25 21:25         ` York Sun
2011-08-25 21:30           ` Wolfgang Denk
2011-08-25 21:36             ` York Sun
2011-08-25 22:31               ` Wolfgang Denk
2011-08-26 17:00                 ` York Sun
2011-08-26 18:12                   ` Wolfgang Denk
2011-08-26 18:15                     ` York Sun
2011-08-09 20:50 ` [U-Boot] [PATCH 6/7] powerpc/mpc8349emds: " York Sun
2011-08-24 22:39   ` Wolfgang Denk
2011-08-09 20:50 ` [U-Boot] [PATCH 7/7] powerpc/8xxx: Add support for interactive DDR programming interface York Sun
2011-08-11  1:29   ` [U-Boot] [u-boot-release] " Tabi Timur-B04825
2011-08-24 22:33   ` [U-Boot] " Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.