Skip to contentSkip to conversation

Add DDR3 memory support for SMDK5250

PATCH New Hatim Ali 1 participant 6 messages Feb 23, 2012

lore
Share & tools
lore

Hatim Ali

author
#0 lore raw

v3 cover Add DDR3 memory support for SMDK5250

SMDK5250 boards are available with different DDR memory variants like LPDDR2, LPDDR3 and DDR3. This patch series adds support for DDR3 memory @ 667Mhz for SMDK5250 board.

Changes in v2:
* Replaced some hex values with macro definitions for readability in dmc_init_ddr3.c file.
* Moved the clock initialization code from dmc_init_ddr3.c to clock_init.c
* Made a separate patch for selecting DDR3 memory by default.

Changes in v1:
In this patchset:
* Renamed dmc_init.c file to dmc_init_lpddr2.c
* Moved functions common to LPDDR2 and DDR3 memory setup from dmc_init_lpddr2.c to dmc_common.c
* Replaced register hex values with macro values for clarity.

Hatim Ali (5):
SMDK5250: LPDDR2: Renaming the dmc_init.c file to dmc_init_lpddr2.c
SMDK5250: LPDDR2: Renaming the PHY_RESET_VAL macro and fixing a minor
typo.
SMDK5250: Creating a common file to be used by all variants of DDR
SMDK5250: DDR3: Add memory initialization code for DDR3.
SMDK5250: Selecting DDR3 memory by default.

 board/samsung/smdk5250/Makefile                    |    9 +-
 board/samsung/smdk5250/clock_init.c                |   15 +
 board/samsung/smdk5250/dmc_common.c                |  133 +++++++++
 board/samsung/smdk5250/dmc_init_ddr3.c             |  297 ++++++++++++++++++++
 .../smdk5250/{dmc_init.c => dmc_init_lpddr2.c}     |  166 +-----------
 board/samsung/smdk5250/setup.h                     |  227 +++++++++++++--
 include/configs/smdk5250.h                         |    6 +
 7 files changed, 662 insertions(+), 191 deletions(-)
 create mode 100644 board/samsung/smdk5250/dmc_common.c
 create mode 100644 board/samsung/smdk5250/dmc_init_ddr3.c
 rename board/samsung/smdk5250/{dmc_init.c => dmc_init_lpddr2.c} (66%)
Signature · 1 line
1.7.2.3
author
#1 lore raw

PATCH v3 1/5 SMDK5250: LPDDR2: Renaming the dmc_init.c file to dmc_init_lpddr2.c

SMDK5250 board support different type of memory chips like DDR3, LPDDR2 and LPDDR3. Since the memory setup sequence for different types of chips are different, therefore, we will have different dmc_init_xxx.c files. Hence, renaming the dmc_init.c file (which is specific to LPDDR2) to dmc_init_lpddr2.c

board/samsung/smdk5250/Makefile +1 -1
index 226db1f..b18002a 100644
@@ -27,7 +27,7 @@ LIB	= $(obj)lib$(BOARD).o
 SOBJS	:= lowlevel_init.o
 
 COBJS	:= clock_init.o
-COBJS	+= dmc_init.o
+COBJS	+= dmc_init_lpddr2.o
 COBJS	+= tzpc_init.o
 
 ifndef CONFIG_SPL_BUILD
board/samsung/smdk5250/dmc_init_lpddr2.c renamed from board/samsung/smdk5250/dmc_init.c +0 -0
similarity index 100%
rename from board/samsung/smdk5250/dmc_init.c
rename to board/samsung/smdk5250/dmc_init_lpddr2.c
Signature · 1 line
1.7.2.3
author
#2 lore raw

PATCH v3 2/5 SMDK5250: LPDDR2: Renaming the PHY_RESET_VAL macro and fixing a minor typo.

In reply to Hatim Ali

The patch renames the macro PHY_RESET_VAL to LPDDR3PHY_CTRL_PHY_RESET for clarity and also fixes a minor typo error to make the bit description similar to as described in the Exynos user manual.

board/samsung/smdk5250/dmc_init_lpddr2.c +3 -3
index 7881074..846469e 100644
@@ -53,7 +53,7 @@ static void reset_phy_ctrl(void)
 {
 	struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
 
-	writel(PHY_RESET_VAL, &clk->lpddr3phy_ctrl);
+	writel(LPDDR3PHY_CTRL_PHY_RESET_OFF, &clk->lpddr3phy_ctrl);
 	sdelay(0x10000);
 }
 
@@ -246,9 +246,9 @@ static void config_rdlvl(struct exynos5_dmc *dmc,
 	/*
 	 * Set ctrl_gateadj, ctrl_readadj
 	 * ctrl_gateduradj, rdlvl_pass_adj
-	 * rdlvl_rddataPadj
+	 * rdlvl_rddata_adj
 	 */
-	val = SET_RDLVL_RDDATAPADJ;
+	val = SET_RDLVL_RDDATA_ADJ;
 	writel(val, &phy0_ctrl->phy_con1);
 	writel(val, &phy1_ctrl->phy_con1);
 
board/samsung/smdk5250/setup.h +5 -4
index 1276fd3..cf572ac 100644
@@ -353,7 +353,8 @@
 /* (Memory Interleaving Size = 1 << IV_SIZE) */
 #define CONFIG_IV_SIZE		0x07
 
-#define PHY_RESET_VAL	(0 << 0)
+#define LPDDR3PHY_CTRL_PHY_RESET	(1 << 0)
+#define LPDDR3PHY_CTRL_PHY_RESET_OFF	(0 << 0)
 
 /*ZQ Configurations */
 #define PHY_CON16_RESET_VAL	0x08000304
@@ -397,9 +398,9 @@
 #define SET_CTRL_DDR_MODE(x, y)	(x = (x & ~(0x3 << 11)) | y << 11)
 
 #define PHY_CON1_RESET_VAL	0x9210100
-#define RDLVL_RDDATAPADJ	0x1
-#define SET_RDLVL_RDDATAPADJ	((PHY_CON1_RESET_VAL & ~(0xFFFF << 0))\
-					| RDLVL_RDDATAPADJ << 0)
+#define RDLVL_RDDATA_ADJ	0x1
+#define SET_RDLVL_RDDATA_ADJ	((PHY_CON1_RESET_VAL & ~(0xFFFF << 0)) \
+					| RDLVL_RDDATA_ADJ << 0)
 
 #define PHY_CON2_RESET_VAL	0x00010004
 #define RDLVL_EN		(1 << 25)
Signature · 1 line
1.7.2.3
author
#3 lore raw

PATCH v3 3/5 SMDK5250: Creating a common file to be used by all variants of DDR

In reply to Hatim Ali

The patch creates a common file containing functions which will be used by all variants of DDR.

board/samsung/smdk5250/Makefile +1 -0
index b18002a..3b4aa06 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(BOARD).o
 SOBJS	:= lowlevel_init.o
 
 COBJS	:= clock_init.o
+COBJS	+= dmc_common.o
 COBJS	+= dmc_init_lpddr2.o
 COBJS	+= tzpc_init.o
 
board/samsung/smdk5250/dmc_common.c new file +133 -0

133 lines not on this page · raw message

board/samsung/smdk5250/dmc_init_lpddr2.c +3 -157

182 lines not on this page · raw message

board/samsung/smdk5250/setup.h +6 -0
index cf572ac..c061440 100644
@@ -28,6 +28,7 @@
 #include <config.h>
 #include <version.h>
 #include <asm/arch/cpu.h>
+#include <asm/arch/dmc.h>
 
 /* GPIO Offsets for UART: GPIO Contol Register */
 #define EXYNOS5_GPIO_A0_CON_OFFSET	0x0
@@ -448,5 +449,10 @@ void sdelay(unsigned long);
 void mem_ctrl_init(void);
 void system_clock_init(void);
 void tzpc_init(void);
+void config_zq(struct exynos5_phy_control *, struct exynos5_phy_control *);
+void update_reset_dll(struct exynos5_dmc *);
+void config_mrs(struct exynos5_dmc *);
+void config_prech(struct exynos5_dmc *);
+void config_memory(struct exynos5_dmc *);
 
 #endif
Signature · 1 line
1.7.2.3
author
#4 lore raw

PATCH v3 4/5 SMDK5250: DDR3: Add memory initialization code for DDR3.

In reply to Hatim Ali

The patch adds memory initialization sequence for DDR3 @667Mhz.

board/samsung/smdk5250/Makefile +6 -0
index 3b4aa06..291fcc6 100644
@@ -28,7 +28,13 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	:= clock_init.o
 COBJS	+= dmc_common.o
+ifdef CONFIG_DDR3
+COBJS	+= dmc_init_ddr3.o
+else
+ifdef CONFIG_LPDDR2
 COBJS	+= dmc_init_lpddr2.o
+endif
+endif
 COBJS	+= tzpc_init.o
 
 ifndef CONFIG_SPL_BUILD
board/samsung/smdk5250/clock_init.c +15 -0
index 305842d..b6d3214 100644
@@ -200,3 +200,18 @@ void system_clock_init()
 	 */
 	writel(CLK_SRC_TOP2_VAL, &clk->src_top2);
 }
+
+void mem_clk_setup(void)
+{
+	struct exynos5_clock *clk = (struct exynos5_clock *)EXYNOS5_CLOCK_BASE;
+
+	writel(0x0, &clk->src_cdrex);
+	writel(CLK_DIV_CDREX_VAL, &clk->div_cdrex);
+
+	writel(MPLL_CON1_VAL, &clk->mpll_con1);
+	writel(MPLL_CON0_VAL, &clk->mpll_con0);
+	writel(BPLL_CON1_VAL, &clk->bpll_con1);
+	writel(BPLL_CON0_VAL, &clk->bpll_con0);
+
+	writel(CLK_SRC_CDREX_VAL, &clk->src_cdrex);
+}
board/samsung/smdk5250/dmc_init_ddr3.c new file +297 -0

297 lines not on this page · raw message

board/samsung/smdk5250/setup.h +186 -26

306 lines not on this page · raw message

Signature · 1 line
1.7.2.3
author
#5 lore raw

PATCH v3 5/5 SMDK5250: Selecting DDR3 memory by default.

In reply to Hatim Ali

The patch selects DDR3 memory for SMDK5250 by default.

include/configs/smdk5250.h +6 -0
index 9659f9e..cc24be6 100644
@@ -37,6 +37,12 @@
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
+/* Choose DDR Type below:
+ * Uncomment the type of DDR present on your board
+ */
+#define CONFIG_DDR3
+/* #define CONFIG_LPDDR2 */
+
 /* Keep L2 Cache Disabled */
 #define CONFIG_SYS_DCACHE_OFF
 
Signature · 1 line
1.7.2.3