Skip to contentSkip to conversation

Freescale DDR rewrite

RFC New Kumar Gala 4 participants 14 messages Jun 9, 2008 – Jul 7, 2008

Subsystems (2)
lore
Share & tools
lore
author
#1 lore raw

RFC 1/8 Add proper SPD definitions for DDR1/2/3

Also added a few helper functions for DDR1 & DDR2 to print SPD info and verify the checksum.

---
 common/Makefile   |    1 +
 common/ddr_spd.c  |  504 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/ddr_spd.h |  249 ++++++++++++++++++++++++++
 3 files changed, 754 insertions(+), 0 deletions(-)
 create mode 100644 common/ddr_spd.c
 create mode 100644 include/ddr_spd.h
common/Makefile +1 -0
index b425795..503c3b5 100644
@@ -145,6 +145,7 @@ COBJS-y += cmd_mac.o
 COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
 COBJS-$(CONFIG_MP) += cmd_mp.o
 COBJS-$(CONFIG_CMD_SF) += cmd_sf.o
+COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(AOBJS:.o=.S) $(COBJS:.o=.c)
common/ddr_spd.c new file +504 -0

504 lines not on this page · raw message

include/ddr_spd.h new file +249 -0

249 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author
#2 lore raw

RFC 2/8 Rewrite the FSL mpc8xxx DDR controller setup code.

From: James Yang <[email protected]>

---
 cpu/mpc85xx/Makefile               |    9 +
 cpu/mpc86xx/Makefile               |    4 +
 cpu/mpc8xxx/Makefile               |   30 +
 cpu/mpc8xxx/common_timing_params.h |   54 +
 cpu/mpc8xxx/ddr2_dimm_params.h     |   99 ++
 cpu/mpc8xxx/fsl_ddr1.c             |  365 ++++++
 cpu/mpc8xxx/fsl_ddr2.c             |  384 ++++++
 cpu/mpc8xxx/fsl_ddr_sdram.c        | 2448 ++++++++++++++++++++++++++++++++++++
 cpu/mpc8xxx/fsl_ddr_sdram.h        |   87 ++
 cpu/mpc8xxx/fsl_memctrl.h          |   48 +
 cpu/mpc8xxx/memctl_options.h       |  100 ++
 11 files changed, 3628 insertions(+), 0 deletions(-)
 create mode 100644 cpu/mpc8xxx/Makefile
 create mode 100644 cpu/mpc8xxx/common_timing_params.h
 create mode 100644 cpu/mpc8xxx/ddr2_dimm_params.h
 create mode 100644 cpu/mpc8xxx/fsl_ddr1.c
 create mode 100644 cpu/mpc8xxx/fsl_ddr2.c
 create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.c
 create mode 100644 cpu/mpc8xxx/fsl_ddr_sdram.h
 create mode 100644 cpu/mpc8xxx/fsl_memctrl.h
 create mode 100644 cpu/mpc8xxx/memctl_options.h
cpu/mpc85xx/Makefile +9 -0
index adbc585..c180dbd 100644
@@ -33,6 +33,15 @@ SOBJS-$(CONFIG_MP) += release.o
 SOBJS	= $(SOBJS-y)
 COBJS-$(CONFIG_MP) += mp.o
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
+
+ifneq ($(CONFIG_FSL_DDR3),y)
+ifneq ($(CONFIG_FSL_DDR2),y)
+ifneq ($(CONFIG_FSL_DDR1),y)
+COBJS-y	+= spd_sdram.o
+endif
+endif
+endif
+
 COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o tlb.o \
 	  pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o \
 	  $(COBJS-y)
cpu/mpc86xx/Makefile +4 -0
index 537f62a..4227053 100644
@@ -40,6 +40,10 @@ COBJS-y	+= spd_sdram.o
 
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
 
+ifneq ($(CONFIG_FSL_DDR2),y)
+COBJS-y	+= spd_sdram.o
+endif
+
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 START	:= $(addprefix $(obj),$(START))
cpu/mpc8xxx/Makefile new file +30 -0
new file mode 100644
index 0000000..30f81ff
@@ -0,0 +1,30 @@
+#
+# Copyright 2008 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.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libmpc8xxx.a
+
+COBJS-$(CONFIG_FSL_DDR1)	+= fsl_ddr_sdram.o
+COBJS-$(CONFIG_FSL_DDR1)	+= fsl_ddr1.o
+
+COBJS-$(CONFIG_FSL_DDR2)	+= fsl_ddr_sdram.o
+COBJS-$(CONFIG_FSL_DDR2)	+= fsl_ddr2.o
+
+
+SRCS	:= $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
cpu/mpc8xxx/common_timing_params.h new file +54 -0

54 lines not on this page · raw message

cpu/mpc8xxx/ddr2_dimm_params.h new file +99 -0

99 lines not on this page · raw message

cpu/mpc8xxx/fsl_ddr1.c new file +365 -0

365 lines not on this page · raw message

cpu/mpc8xxx/fsl_ddr2.c new file +384 -0

384 lines not on this page · raw message

cpu/mpc8xxx/fsl_ddr_sdram.c new file +2448 -0

2,043 lines not on this page · raw message

cpu/mpc8xxx/fsl_ddr_sdram.h new file +87 -0

87 lines not on this page · raw message

cpu/mpc8xxx/fsl_memctrl.h new file +48 -0

48 lines not on this page · raw message

cpu/mpc8xxx/memctl_options.h new file +100 -0

100 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.5.1

Part of the diff is not shown here. View the raw message.

author
#3 lore raw

RFC 3/8 FSL DDR: Add interactive DDR config support

From: James Yang <[email protected]>

Provide a mechanism to allow interactive configuration of DDR params. This is useful when trying to test various DDR settings to determine optimal configuration values for a given board.

---
 cpu/mpc8xxx/Makefile              |    1 +
 cpu/mpc8xxx/fsl_ddr_interactive.c | 1281 +++++++++++++++++++++++++++++++++++++
 cpu/mpc8xxx/fsl_ddr_sdram.c       |   10 +
 cpu/mpc8xxx/fsl_ddr_sdram.h       |    3 +
 4 files changed, 1295 insertions(+), 0 deletions(-)
 create mode 100644 cpu/mpc8xxx/fsl_ddr_interactive.c
cpu/mpc8xxx/Makefile +1 -0
index 30f81ff..0ceac5b 100644
@@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libmpc8xxx.a
 
+COBJS-$(CONFIG_FSL_DDR_INTERACTIVE)	+= fsl_ddr_interactive.o
 COBJS-$(CONFIG_FSL_DDR1)	+= fsl_ddr_sdram.o
 COBJS-$(CONFIG_FSL_DDR1)	+= fsl_ddr1.o
 
cpu/mpc8xxx/fsl_ddr_interactive.c new file +1281 -0

1,281 lines not on this page · raw message

cpu/mpc8xxx/fsl_ddr_sdram.c +10 -0
index 72af6ac..457cff3 100644
@@ -2370,6 +2370,16 @@ phys_size_t fsl_ddr_sdram(void)
 	 */
 	total_memory = fsl_ddr_sdram_compute(&info, STEP_GET_SPD);
 
+#ifdef CONFIG_FSL_DDR_INTERACTIVE
+	/*
+	 * The presence of the environment variable "ddrsetup"
+	 * causes the interactive DDR setup prompt to appear.
+	 */
+	if (getenv("ddrsetup")) {
+		total_memory = fsl_ddr_interactive(&info);
+	}
+#endif
+
 	/*
 	 * Check for memory controller interleaving.
 	 */
cpu/mpc8xxx/fsl_ddr_sdram.h +3 -0
index 0ac44a7..4034e9c 100644
@@ -54,6 +54,9 @@ typedef struct {
 
 
 extern phys_size_t
+fsl_ddr_interactive(fsl_ddr_sdram_info_t *pinfo);
+
+extern phys_size_t
 fsl_ddr_sdram_compute(fsl_ddr_sdram_info_t *pinfo,
 				  unsigned int start_step);
 
Signature · 1 line
1.5.5.1
author
#4 lore raw

RFC 4/8 FSL DDR: Provide a generic fsl_ddr_sdram_set_lawbar()

Make fsl_ddr_sdram_set_lawbar() a weak function to allow board code to override if desired.

---
 drivers/misc/fsl_law.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
drivers/misc/fsl_law.c +63 -0
index dca6a4d..f9bdf10 100644
@@ -72,6 +72,69 @@ void print_laws(void)
 	return;
 }
 
+#if defined(CONFIG_FSL_DDR1) || \
+    defined(CONFIG_FSL_DDR2) || \
+    defined(CONFIG_FSL_DDR3)
+#include <../cpu/mpc8xxx/fsl_ddr_sdram.h>
+
+void
+__fsl_ddr_sdram_set_lawbar(const common_timing_params_t *memctl_common_params,
+			   unsigned int memctl_interleaved,
+			   unsigned int ctrl_num)
+{
+	unsigned long law_base_address;
+	unsigned long memsize_MB;
+	unsigned int law_size;
+
+	/*
+	 * If no DIMMs on this controller, do not proceed any further.
+	 */
+	if (!memctl_common_params->ndimms_present) {
+		return;
+	}
+
+	law_base_address = memctl_common_params->base_address;
+
+	/*
+	 * Compute LAWBARn[SIZE] value for 2**(SIZE + 1) bytes.
+	 * If interleaving is used, the memory size must represent
+	 * the combined total of both controllers.
+	 * The first supported LAW size is 16M, at LAWAR_SIZE_16M == 23.
+	 * Fnord.
+	 */
+	memsize_MB = memctl_common_params->total_mem / 0x100000;
+	law_size = 19 + __ilog2(memsize_MB << memctl_interleaved);
+
+	if (ctrl_num == 0) {
+		/*
+		 * Set up LAWBAR1 for DDR controller 1 space.
+		 */
+		unsigned int lawbar1_target_id = memctl_interleaved
+			? LAW_TRGT_IF_DDR_INTRLV : LAW_TRGT_IF_DDR_1;
+
+		set_law(1, law_base_address, law_size, lawbar1_target_id);
+		debug("ctl0 law_base_address = 0x%08X, law_size = 0x%x\n",
+		      law_base_address, law_size);
+
+	} else if (ctrl_num == 1) {
+		/*
+		 * Set up LAWBAR2 for DDR controller 2 space.
+		 */
+		set_law(2, law_base_address, law_size, LAW_TRGT_IF_DDR_2);
+		debug("ctl1 law_base_address = 0x%08X, law_size = 0x%x\n",
+		      law_base_address, law_size);
+
+	} else {
+		printf("unexpected controller number %u in fsl_ddr_sdram_set_lawbar()\n", ctrl_num);
+	}
+}
+
+__attribute__((weak, alias("__fsl_ddr_sdram_set_lawbar"))) void
+fsl_ddr_sdram_set_lawbar(const common_timing_params_t *memctl_common_params,
+			 unsigned int memctl_interleaved,
+			 unsigned int ctrl_num);
+#endif
+
 void init_laws(void)
 {
 	int i;
Signature · 1 line
1.5.5.1
author
#5 lore raw

RFC 5/8 FSL DDR: Add e500 TLB helper for DDR code

Provide a helper function that board code can call to map TLBs when setting up DDR.

---
 cpu/mpc85xx/tlb.c     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/mmu.h |    1 +
 2 files changed, 64 insertions(+), 0 deletions(-)
cpu/mpc85xx/tlb.c +63 -0
index 3d15d50..63f34e6 100644
@@ -90,3 +90,66 @@ void init_tlbs(void)
 
 	return ;
 }
+
+unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg)
+{
+	unsigned int tlb_size;
+	unsigned int ram_tlb_index;
+	unsigned int ram_tlb_address;
+
+	/*
+	 * Determine size of each TLB1 entry.
+	 */
+	switch (memsize_in_meg) {
+	case 16:
+	case 32:
+		tlb_size = BOOKE_PAGESZ_16M;
+		break;
+	case 64:
+	case 128:
+		tlb_size = BOOKE_PAGESZ_64M;
+		break;
+	case 256:
+	case 512:
+		tlb_size = BOOKE_PAGESZ_256M;
+		break;
+	case 1024:
+	case 2048:
+		if (PVR_VER(get_pvr()) > PVR_VER(PVR_85xx))
+			tlb_size = BOOKE_PAGESZ_1G;
+		else
+			tlb_size = BOOKE_PAGESZ_256M;
+		break;
+	default:
+		puts("DDR: only 16M,32M,64M,128M,256M,512M,1G and 2G are supported.\n");
+
+		/*
+		 * The memory was not able to be mapped.
+		 * Default to a small size.
+		 */
+		tlb_size = BOOKE_PAGESZ_64M;
+		memsize_in_meg = 64;
+		break;
+	}
+
+	/*
+	 * Configure DDR TLB1 entries.
+	 * Starting at TLB1 8, use no more than 8 TLB1 entries.
+	 */
+	ram_tlb_index = 8;
+	ram_tlb_address = (unsigned int)CFG_DDR_SDRAM_BASE;
+	while (ram_tlb_address < (memsize_in_meg * 1024 * 1024)
+	      && ram_tlb_index < 16) {
+		set_tlb(1, ram_tlb_address, ram_tlb_address,
+			MAS3_SX|MAS3_SW|MAS3_SR, 0,
+			0, ram_tlb_index, tlb_size, 1);
+
+		ram_tlb_address += (0x1000 << ((tlb_size - 1) * 2));
+		ram_tlb_index++;
+	}
+
+	/*
+	 * Confirm that the requested amount of memory was mapped.
+	 */
+	return memsize_in_meg;
+}
include/asm-ppc/mmu.h +1 -0
index 050a7b6..8975e6c 100644
@@ -431,6 +431,7 @@ extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
 extern void disable_tlb(u8 esel);
 extern void invalidate_tlb(u8 tlb);
 extern void init_tlbs(void);
+extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 
 #define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \
 	{ .tlb = _tlb, .epn = _epn, .rpn = _rpn, .perms = _perms, \
Signature · 1 line
1.5.5.1
author
#6 lore raw

RFC 6/8 Modify mpc8641HPCN to use the new DDR setup code.

From: Jon Loeliger <[email protected]>

---
 Makefile                                  |    3 +
 board/freescale/mpc8641hpcn/Makefile      |    8 +-
 board/freescale/mpc8641hpcn/ddr.c         |  288 +++++++++++++++++++++++++++++
 board/freescale/mpc8641hpcn/mpc8641hpcn.c |    5 +-
 cpu/mpc86xx/Makefile                      |    1 -
 include/configs/MPC8641HPCN.h             |  127 ++++++++------
 6 files changed, 371 insertions(+), 61 deletions(-)
 create mode 100644 board/freescale/mpc8641hpcn/ddr.c
Makefile +3 -0
index cc988e1..39fc369 100644
@@ -236,6 +236,9 @@ endif
 ifeq ($(CPU),mpc85xx)
 LIBS += drivers/qe/qe.a
 endif
+ifeq ($(CPU),mpc86xx)
+LIBS += cpu/mpc8xxx/libmpc8xxx.a
+endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
 LIBS += drivers/usb/libusb.a
board/freescale/mpc8641hpcn/Makefile +5 -3
index 115df05..bbc64d1 100644
@@ -25,10 +25,12 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o law.o
+COBJS-y	+= $(BOARD).o
+COBJS-y	+= law.o
+COBJS-y	+= ddr.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
 $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8641hpcn/ddr.c new file +288 -0

288 lines not on this page · raw message

board/freescale/mpc8641hpcn/mpc8641hpcn.c +2 -3
index bb1f927..755c967 100644
@@ -25,18 +25,17 @@
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
 #include <asm/immap_fsl_pci.h>
-#include <spd_sdram.h>
 #include <asm/io.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 
 #include "../common/pixis.h"
+#include "../cpu/mpc8xxx/fsl_ddr_sdram.h"
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
 
-void sdram_init(void);
 long int fixed_sdram(void);
 
 
@@ -59,7 +58,7 @@ initdram(int board_type)
 	long dram_size = 0;
 
 #if defined(CONFIG_SPD_EEPROM)
-	dram_size = spd_sdram();
+	dram_size = fsl_ddr_sdram();
 #else
 	dram_size = fixed_sdram();
 #endif
cpu/mpc86xx/Makefile +0 -1
index 4227053..454c728 100644
@@ -36,7 +36,6 @@ COBJS-y	+= cpu.o
 COBJS-y	+= cpu_init.o
 COBJS-y	+= speed.o
 COBJS-y	+= interrupts.o
-COBJS-y	+= spd_sdram.o
 
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
 
include/configs/MPC8641HPCN.h +72 -53

144 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author
#7 lore raw

RFC 7/8 Modify MPC8610HPCD to use the new DDR setup code.

From: Jon Loeliger <[email protected]>

---
 board/freescale/mpc8610hpcd/Makefile      |   10 +-
 board/freescale/mpc8610hpcd/ddr.c         |  279 +++++++++++++++++++++++++++++
 board/freescale/mpc8610hpcd/mpc8610hpcd.c |    3 +-
 include/configs/MPC8610HPCD.h             |   54 ++++--
 4 files changed, 324 insertions(+), 22 deletions(-)
 create mode 100644 board/freescale/mpc8610hpcd/ddr.c
board/freescale/mpc8610hpcd/Makefile +5 -5
index e17a9cb..9236364 100644
@@ -23,14 +23,14 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o law.o
+COBJS-y	+= $(BOARD).o
+COBJS-y	+= ddr.o
+COBJS-y	+= law.o
 
 COBJS-${CONFIG_FSL_DIU_FB}	+= mpc8610hpcd_diu.o
 
-COBJS	+= ${COBJS-y}
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
 $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8610hpcd/ddr.c new file +279 -0

279 lines not on this page · raw message

board/freescale/mpc8610hpcd/mpc8610hpcd.c +2 -1
index 3a855b5..f8d8707 100644
@@ -33,6 +33,7 @@
 #include <spd_sdram.h>
 
 #include "../common/pixis.h"
+#include "../cpu/mpc8xxx/fsl_ddr_sdram.h"
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
@@ -119,7 +120,7 @@ initdram(int board_type)
 	long dram_size = 0;
 
 #if defined(CONFIG_SPD_EEPROM)
-	dram_size = spd_sdram();
+	dram_size = fsl_ddr_sdram();
 #else
 	dram_size = fixed_sdram();
 #endif
include/configs/MPC8610HPCD.h +38 -16

95 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author
#8 lore raw

RFC 8/8 Modify MPC8544 DS to use the new DDR setup code.

---
 Makefile                              |    1 +
 board/freescale/mpc8544ds/Makefile    |    9 +-
 board/freescale/mpc8544ds/ddr.c       |  268 +++++++++++++++++++++++++++++++++
 board/freescale/mpc8544ds/mpc8544ds.c |   21 ++-
 cpu/mpc85xx/Makefile                  |    2 +-
 include/configs/MPC8544DS.h           |   59 ++++++--
 6 files changed, 339 insertions(+), 21 deletions(-)
 create mode 100644 board/freescale/mpc8544ds/ddr.c
Makefile +1 -0
index 39fc369..d0499ba 100644
@@ -235,6 +235,7 @@ LIBS += drivers/qe/qe.a
 endif
 ifeq ($(CPU),mpc85xx)
 LIBS += drivers/qe/qe.a
+LIBS += cpu/mpc8xxx/libmpc8xxx.a
 endif
 ifeq ($(CPU),mpc86xx)
 LIBS += cpu/mpc8xxx/libmpc8xxx.a
board/freescale/mpc8544ds/Makefile +6 -3
index 53368b2..3e82bbf 100644
@@ -26,10 +26,13 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o law.o tlb.o
+COBJS-y	+= $(BOARD).o
+COBJS-y	+= ddr.o
+COBJS-y	+= law.o
+COBJS-y	+= tlb.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
 $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
board/freescale/mpc8544ds/ddr.c new file +268 -0

268 lines not on this page · raw message

board/freescale/mpc8544ds/mpc8544ds.c +15 -6
index dd10af8..d3b2f94 100644
@@ -24,22 +24,21 @@
 #include <command.h>
 #include <pci.h>
 #include <asm/processor.h>
+#include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/immap_fsl_pci.h>
 #include <asm/io.h>
-#include <spd_sdram.h>
 #include <miiphy.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 
 #include "../common/pixis.h"
+#include "../cpu/mpc8xxx/fsl_ddr_sdram.h"
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
 
-void sdram_init(void);
-
 int board_early_init_f (void)
 {
 	return 0;
@@ -71,7 +70,13 @@ initdram(int board_type)
 
 	puts("Initializing\n");
 
-	dram_size = spd_sdram();
+	dram_size = fsl_ddr_sdram();
+	printf("dram_size = %u\n", dram_size);
+
+	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
+	printf("dram_size = %u after setup_ddr_tlbs\n", dram_size);
+
+	dram_size *= 0x100000;
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/*
@@ -96,10 +101,14 @@ testdram(void)
 	       CFG_MEMTEST_END);
 
 	printf("DRAM test phase 1:\n");
-	for (p = pstart; p < pend; p++)
+	for (p = pstart; p < pend; p++) {
+		if ((((unsigned int) p) & 0xffff) == 0) {
+			printf ("%p\n", p);
+		}
 		*p = 0xaaaaaaaa;
+	}
 
-	for (p = pstart; p < pend; p++) {
+	 for (p = pstart; p < pend; p++) {
 		if (*p != 0xaaaaaaaa) {
 			printf ("DRAM test fails at: %08x\n", (uint) p);
 			return 1;
cpu/mpc85xx/Makefile +1 -1
index c180dbd..d51a6dd 100644
@@ -43,7 +43,7 @@ endif
 endif
 
 COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o tlb.o \
-	  pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o \
+	  pci.o serial_scc.o commproc.o ether_fcc.o qe_io.o \
 	  $(COBJS-y)
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
include/configs/MPC8544DS.h +48 -11

83 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#9 lore raw

RFC 1/8 Add proper SPD definitions for DDR1/2/3

In reply to Kumar Gala
Quoted 33 lines · Kumar Gala

Also added a few helper functions for DDR1 & DDR2 to print SPD info and verify the checksum.

---
 common/Makefile   |    1 +
 common/ddr_spd.c  |  504 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/ddr_spd.h |  249 ++++++++++++++++++++++++++
 3 files changed, 754 insertions(+), 0 deletions(-)
 create mode 100644 common/ddr_spd.c
 create mode 100644 include/ddr_spd.h
common/Makefile +1 -0
index b425795..503c3b5 100644
@@ -145,6 +145,7 @@ COBJS-y += cmd_mac.o
 COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
 COBJS-$(CONFIG_MP) += cmd_mp.o
 COBJS-$(CONFIG_CMD_SF) += cmd_sf.o
+COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(AOBJS:.o=.S) $(COBJS:.o=.c)
common/ddr_spd.c new file +3 -0
new file mode 100644
index 0000000..bfabb93
@@ -0,0 +1,504 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *

common/ddr_spd.c line 13

Quoted 10 lines
common/ddr_spd.c new file +10 -0
+ * 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.
+ */
+
+#include <common.h>
+#include <ddr_spd.h>
+
+void
+ddr1_spd_dump(const ddr1_spd_eeprom_t *spd)

[major snippage]

Hi Kumar,

There is a "do_sdram" command in common/cmd_i2c.c that I believe is doing the same thing, but probably a lot less (I suspect the command is showing its age).

#if defined(CONFIG_CMD_SDRAM)
U_BOOT_CMD(
isdram, 2, 1, do_sdram,
"isdram - print SDRAM configuration information\n",
"chip\n - print SDRAM configuration information\n"
" (valid chip values 50..57)\n"
);
#endif

Are you aware of that command? Is your SPD dump going to supersede it?

Best regards,
gvb

#10 lore raw

RFC 1/8 Add proper SPD definitions for DDR1/2/3

Quoted 1 line · Jerry Van Baren

Is your SPD dump going to supersede it?

In spades.

jdl

#11 lore raw

cover Freescale DDR rewrite

In reply to Kumar Gala

Dear Kumar,

Quoted 3 lines · in message <[email protected]> you…

This is a series of patches that are a work-in-progress towards a new DDR initialization for the Freescale 8{3,5,6}xxx devices that have a common DDR controller.

Just to avoid misunderstandings: I understand these patches as RFC only (as the subject says), i. e. this is not an attempt yet to get this included in the upcoming release. Please confirm.

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
miracle:  an  extremely  outstanding  or  unusual  event,  thing,  or
accomplishment.                                - Webster's Dictionary
#12 lore raw

cover Freescale DDR rewrite

Quoted 10 lines · Wolfgang Denk

Dear Kumar,

Quoted 3 lines · in message <[email protected]> you…

This is a series of patches that are a work-in-progress towards a new DDR initialization for the Freescale 8{3,5,6}xxx devices that have a common DDR controller.

Just to avoid misunderstandings: I understand these patches as RFC only (as the subject says), i. e. this is not an attempt yet to get this included in the upcoming release. Please confirm.

That is correct. In the meantime, there has been some further development on this code base as well.

jdl

author
#13 lore raw

cover Freescale DDR rewrite

Quoted 10 lines · Jon Loeliger
Quoted 9 lines · Wolfgang Denk

Dear Kumar,

in message <[email protected]

Quoted 5 lines

you wrote:
This is a series of patches that are a work-in-progress towards a new
DDR initialization for the Freescale 8{3,5,6}xxx devices that have a common DDR controller.

Quoted 7 lines
Quoted 3 lines

Just to avoid misunderstandings: I understand these patches as RFC only (as the subject says), i. e. this is not an attempt yet to get this included in the upcoming release. Please confirm.

That is correct. In the meantime, there has been some further development on this code base as well.

Agreed, the hope is to get something in shape for the 1.3.5 window.

- k