All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/8] mpc512x: Adjust the DRAM init sequence to the datasheet spec
Date: Fri,  8 Feb 2013 11:03:49 +0100	[thread overview]
Message-ID: <1360317830-28525-8-git-send-email-agust@denx.de> (raw)
In-Reply-To: <1360317830-28525-1-git-send-email-agust@denx.de>

Do maintain a 200 usecs period of stable power and clock before
asserting the CKE signal and sending commands, have at least 200
DRAM clock cycles pass after initialization before data access.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 arch/powerpc/cpu/mpc512x/fixed_sdram.c |   17 ++++++++++++++++-
 arch/powerpc/include/asm/immap_512x.h  |    1 +
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/fixed_sdram.c b/arch/powerpc/cpu/mpc512x/fixed_sdram.c
index 550cbd0..6635fb0 100644
--- a/arch/powerpc/cpu/mpc512x/fixed_sdram.c
+++ b/arch/powerpc/cpu/mpc512x/fixed_sdram.c
@@ -99,7 +99,19 @@ long int fixed_sdram(ddr512x_config_t *mddrc_config,
 	sync_law(&im->sysconf.ddrlaw.ar);
 
 	/* DDR Enable */
-	out_be32(&im->mddrc.ddr_sys_config, MDDRC_SYS_CFG_EN);
+	/*
+	 * the "enable" combination: DRAM controller out of reset,
+	 * clock enabled, command mode -- BUT leave CKE low for now
+	 */
+	i = MDDRC_SYS_CFG_EN & ~MDDRC_SYS_CFG_CKE_MASK;
+	out_be32(&im->mddrc.ddr_sys_config, i);
+	/* maintain 200 microseconds of stable power and clock */
+	udelay(200);
+	/* apply a NOP, it shouldn't harm */
+	out_be32(&im->mddrc.ddr_command, CONFIG_SYS_DDRCMD_NOP);
+	/* now assert CKE (high) */
+	i |= MDDRC_SYS_CFG_CKE_MASK;
+	out_be32(&im->mddrc.ddr_sys_config, i);
 
 	/* Initialize DDR Priority Manager */
 	out_be32(&im->mddrc.prioman_config1, CONFIG_SYS_MDDRCGRP_PM_CFG1);
@@ -148,6 +160,9 @@ long int fixed_sdram(ddr512x_config_t *mddrc_config,
 	out_be32(&im->mddrc.ddr_time_config0, mddrc_config->ddr_time_config0);
 	out_be32(&im->mddrc.ddr_sys_config, mddrc_config->ddr_sys_config);
 
+	/* Allow for the DLL to startup before accessing data */
+	udelay(10);
+
 	msize = get_ram_size(CONFIG_SYS_DDR_BASE, CONFIG_SYS_MAX_RAM_SIZE);
 	/* Fix DDR Local Window for new size */
 	out_be32(&im->sysconf.ddrlaw.ar, __ilog2(msize) - 1);
diff --git a/arch/powerpc/include/asm/immap_512x.h b/arch/powerpc/include/asm/immap_512x.h
index a330ad6..d96e536 100644
--- a/arch/powerpc/include/asm/immap_512x.h
+++ b/arch/powerpc/include/asm/immap_512x.h
@@ -351,6 +351,7 @@ typedef struct ddr512x {
 
 /* MDDRC SYS CFG and Timing CFG0 Registers */
 #define MDDRC_SYS_CFG_EN	0xF0000000
+#define MDDRC_SYS_CFG_CKE_MASK	0x40000000
 #define MDDRC_SYS_CFG_CMD_MASK	0x10000000
 #define MDDRC_REFRESH_ZERO_MASK	0x0000FFFF
 
-- 
1.7.5.4

  parent reply	other threads:[~2013-02-08 10:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 10:03 [U-Boot] [PATCH 0/8] mpc512x updates for current merge window Anatolij Gustschin
2013-02-08 10:03 ` [U-Boot] [PATCH 1/8] mpc512x: add common LAW and Chip Select configuration Anatolij Gustschin
2013-03-09 13:45   ` Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 2/8] mpc512x: use common code for CSx configuration Anatolij Gustschin
2013-03-09 13:45   ` Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 3/8] mpc512x: use common code for clock setting for all mpc512x boards Anatolij Gustschin
2013-03-09 13:46   ` Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 4/8] mpc512x: optionally configure DIU, LPC and NFC deviders Anatolij Gustschin
2013-03-09 13:46   ` Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 5/8] mpc512x: allow configuring board specific IPS divider Anatolij Gustschin
2013-03-09 13:46   ` Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 6/8] mpc512x: add ifm ac14xx board Anatolij Gustschin
2013-03-09 13:46   ` Wolfgang Denk
2013-02-08 10:03 ` Anatolij Gustschin [this message]
2013-03-09 13:46   ` [U-Boot] [PATCH 7/8] mpc512x: Adjust the DRAM init sequence to the datasheet spec Wolfgang Denk
2013-02-08 10:03 ` [U-Boot] [PATCH 8/8] mpc512x: pdm360ng: drop not needed memory node fixup Anatolij Gustschin
2013-03-09 13:46   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360317830-28525-8-git-send-email-agust@denx.de \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.