Patchwork [U-Boot] am335x_evm: Add better timings for the new BeagleBoard DDR3 part

login
register
mail settings
Submitter Tom Rini
Date March 21, 2013, 2:30 p.m.
Message ID <1363876202-22710-1-git-send-email-trini@ti.com>
Download mbox | patch
Permalink /patch/229706/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Tom Rini - March 21, 2013, 2:30 p.m.
Tested-by: Rao Bodapati <rao@circuitco.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   17 ++++++++++++
 board/ti/am335x/board.c                     |   39 ++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletion(-)
Tom Rini - March 26, 2013, 2:53 p.m.
On Thu, Mar 21, 2013 at 04:30:02AM -0000, Tom Rini wrote:

> Tested-by: Rao Bodapati <rao@circuitco.com>
> Signed-off-by: Tom Rini <trini@ti.com>

Applied to u-boot-ti/master (and already pulled into u-boot-arm),
thanks!

Patch

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index ae43ef8..6689825 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -82,6 +82,23 @@ 
 #define MT41J256M8HX15E_PHY_FIFO_WE		0x100
 #define MT41J256M8HX15E_IOCTRL_VALUE		0x18B
 
+/* Micron MT41K256M16HA-125E */
+#define MT41K256M16HA125E_EMIF_READ_LATENCY	0x100006
+#define MT41K256M16HA125E_EMIF_TIM1		0x0888A39B
+#define MT41K256M16HA125E_EMIF_TIM2		0x26517FDA
+#define MT41K256M16HA125E_EMIF_TIM3		0x501F84EF
+#define MT41K256M16HA125E_EMIF_SDCFG		0x61C04BB2
+#define MT41K256M16HA125E_EMIF_SDREF		0x0000093B
+#define MT41K256M16HA125E_ZQ_CFG		0x50074BE4
+#define MT41K256M16HA125E_DLL_LOCK_DIFF		0x1
+#define MT41K256M16HA125E_RATIO			0x40
+#define MT41K256M16HA125E_INVERT_CLKOUT		0x0
+#define MT41K256M16HA125E_RD_DQS		0x3C
+#define MT41K256M16HA125E_WR_DQS		0x45
+#define MT41K256M16HA125E_PHY_WR_DATA		0x7F
+#define MT41K256M16HA125E_PHY_FIFO_WE		0x9B
+#define MT41K256M16HA125E_IOCTRL_VALUE		0x18B
+
 /* Micron MT41J512M8RH-125 on EVM v1.5 */
 #define MT41J512M8RH125_EMIF_READ_LATENCY	0x06
 #define MT41J512M8RH125_EMIF_TIM1		0x0888A39B
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index f4b972b..53c0357 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -208,6 +208,14 @@  static const struct ddr_data ddr3_data = {
 	.datadldiff0 = PHY_DLL_LOCK_DIFF,
 };
 
+static const struct ddr_data ddr3_beagleblack_data = {
+	.datardsratio0 = MT41K256M16HA125E_RD_DQS,
+	.datawdsratio0 = MT41K256M16HA125E_WR_DQS,
+	.datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
+	.datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
+	.datadldiff0 = PHY_DLL_LOCK_DIFF,
+};
+
 static const struct ddr_data ddr3_evm_data = {
 	.datardsratio0 = MT41J512M8RH125_RD_DQS,
 	.datawdsratio0 = MT41J512M8RH125_WR_DQS,
@@ -230,6 +238,20 @@  static const struct cmd_control ddr3_cmd_ctrl_data = {
 	.cmd2iclkout = MT41J128MJT125_INVERT_CLKOUT,
 };
 
+static const struct cmd_control ddr3_beagleblack_cmd_ctrl_data = {
+	.cmd0csratio = MT41K256M16HA125E_RATIO,
+	.cmd0dldiff = MT41K256M16HA125E_DLL_LOCK_DIFF,
+	.cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+	.cmd1csratio = MT41K256M16HA125E_RATIO,
+	.cmd1dldiff = MT41K256M16HA125E_DLL_LOCK_DIFF,
+	.cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+	.cmd2csratio = MT41K256M16HA125E_RATIO,
+	.cmd2dldiff = MT41K256M16HA125E_DLL_LOCK_DIFF,
+	.cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+};
+
 static const struct cmd_control ddr3_evm_cmd_ctrl_data = {
 	.cmd0csratio = MT41J512M8RH125_RATIO,
 	.cmd0dldiff = MT41J512M8RH125_DLL_LOCK_DIFF,
@@ -254,6 +276,16 @@  static struct emif_regs ddr3_emif_reg_data = {
 	.emif_ddr_phy_ctlr_1 = MT41J128MJT125_EMIF_READ_LATENCY,
 };
 
+static struct emif_regs ddr3_beagleblack_emif_reg_data = {
+	.sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
+	.ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
+	.sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
+	.sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
+	.sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
+	.zq_config = MT41K256M16HA125E_ZQ_CFG,
+	.emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
+};
+
 static struct emif_regs ddr3_evm_emif_reg_data = {
 	.sdram_config = MT41J512M8RH125_EMIF_SDCFG,
 	.ref_ctrl = MT41J512M8RH125_EMIF_SDREF,
@@ -341,9 +373,14 @@  void s_init(void)
 		gpio_direction_output(GPIO_DDR_VTT_EN, 1);
 	}
 
-	if (board_is_evm_sk() || board_is_bone_lt())
+	if (board_is_evm_sk())
 		config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data,
 			   &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data);
+	else if (board_is_bone_lt())
+		config_ddr(303, MT41K256M16HA125E_IOCTRL_VALUE,
+			   &ddr3_beagleblack_data,
+			   &ddr3_beagleblack_cmd_ctrl_data,
+			   &ddr3_beagleblack_emif_reg_data);
 	else if (board_is_evm_15_or_later())
 		config_ddr(303, MT41J512M8RH125_IOCTRL_VALUE, &ddr3_evm_data,
 			   &ddr3_evm_cmd_ctrl_data, &ddr3_evm_emif_reg_data);