Skip to contentSkip to conversation

v2 patch for interactive DDR debugging

U-Boot Superseded York Sun 1 participant 3 messages Feb 18, 2011 PowerPC

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

York Sun

author
#0 lore raw

[Patch v2 1/2] Adding more SPD registers
[Patch v2 2/2] powerpc/8xxx: Adding interactive DDR debugging

This is v2 patch to add interactive DDR debugging after cleaning up according to feedback. Please review.

York

author
#1 lore raw

PATCH v2 1/2 Adding more SPD registers

Adding byte 32 and 33. Byte 33 is useful for displaying device type.

---
 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
author
#2 lore raw

PATCH v2 2/2 powerpc/8xxx: Adding interactive DDR debugging

In reply to York Sun

Use environment variable to activate the interactive DDR debugging. Syntax:
setenv ddr_interactive on

After reset, U-boot prompts before initializing DDR controllers FSL DDR>

The available commands are

print      print SPD and intermediate computed data
reset      reboot machine
recompute  reload SPD and options to default and recompute regs
edit       modify spd, parameter, or option
compute    recompute registers from current next_step to end
next_step  shows current next_step
help       this message
go         program the memory controller and continue with u-boot
---
 arch/powerpc/cpu/mpc8xxx/ddr/Makefile      |    1 +
 arch/powerpc/cpu/mpc8xxx/ddr/interactive.c | 1792 ++++++++++++++++++++++++++++
 arch/powerpc/cpu/mpc8xxx/ddr/main.c        |   10 +-
 doc/README.fsl-ddr                         |   19 +
 include/configs/corenet_ds.h               |    1 +
 5 files changed, 1820 insertions(+), 3 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc8xxx/ddr/interactive.c
arch/powerpc/cpu/mpc8xxx/ddr/Makefile +1 -0
index 4a5a785..a801cd6 100644
@@ -21,6 +21,7 @@ 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
 COBJS-$(CONFIG_FSL_DDR3)	+= ddr3_dimm_params.o
+COBJS-$(CONFIG_FSL_DDR_INTERACTIVE) += interactive.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
arch/powerpc/cpu/mpc8xxx/ddr/interactive.c new file +1792 -0

1,792 lines not on this page · raw message

arch/powerpc/cpu/mpc8xxx/ddr/main.c +7 -3
index bb96d66..9612c71 100644
@@ -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[],
@@ -407,7 +406,12 @@ 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, 0);
+#ifdef CONFIG_FSL_DDR_INTERACTIVE
+	if (getenv("ddr_interactive"))
+		total_memory = fsl_ddr_interactive(&info);
+	else
+#endif
+		total_memory = fsl_ddr_compute(&info, STEP_GET_SPD, 0);
 
 	/* Check for memory controller interleaving. */
 	memctl_interleaved = 0;
doc/README.fsl-ddr +19 -0
index a7ba193..db12477 100644
@@ -170,3 +170,22 @@ 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.
include/configs/corenet_ds.h +1 -0
index bff212e..0f83a53 100644
@@ -85,6 +85,7 @@
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
 #define CONFIG_MEM_INIT_VALUE		0xdeadbeef
 #endif
+#define CONFIG_FSL_DDR_INTERACTIVE
 
 #define CONFIG_ENABLE_36BIT_PHYS
 
Signature · 1 line
1.7.0.4