From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from relay2-v.mail.gandi.net ([217.70.178.76]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NkMbI-00006O-SD for barebox@lists.infradead.org; Wed, 24 Feb 2010 19:08:53 +0000 Received: from d4rwin.no-ip.org (146.Red-88-25-58.staticIP.rima-tde.net [88.25.58.146]) by relay2-v.mail.gandi.net (Postfix) with ESMTP id D9BD5135DD for ; Wed, 24 Feb 2010 20:08:41 +0100 (CET) Date: Wed, 24 Feb 2010 20:08:07 +0100 From: Matthias Kaehlcke Message-ID: <20100224190807.GW20201@darwin> MIME-Version: 1.0 Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] edb93xx: Fix SDRAM precharge To: barebox@lists.infradead.org edb93xx SDRAM initialization: Issue a precharge all command before forcing the precharge of all SDRAM banks. Write to the SDRAM in order to force a precharge, reading causes the edb93xx boards to hang Signed-off-by: Matthias Kaehlcke --- board/edb93xx/sdram_cfg.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/board/edb93xx/sdram_cfg.c b/board/edb93xx/sdram_cfg.c index 25b214b..3d4fe08 100644 --- a/board/edb93xx/sdram_cfg.c +++ b/board/edb93xx/sdram_cfg.c @@ -31,9 +31,9 @@ (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank | SDRAM_MODE_REG_VAL)) #define PRECHARGE_BANK(bank) (*(volatile uint32_t *) \ - (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank)) + (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank)) = 0 -static void force_precharge(void); +static void precharge_all_banks(void); static void setup_refresh_timer(void); static void program_mode_registers(void); @@ -48,7 +48,7 @@ void sdram_cfg(void) early_udelay(200); - force_precharge(); + precharge_all_banks(); setup_refresh_timer(); @@ -58,13 +58,22 @@ void sdram_cfg(void) writel(GLCONFIG_CKE, &sdram->glconfig); } -static void force_precharge(void) +static void precharge_all_banks(void) { + struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE; + + /* Issue PRECHARGE ALL commands */ + writel(GLCONFIG_INIT | GLCONFIG_CKE, &sdram->glconfig); + /* - * Errata most EP93xx revisions say that PRECHARGE ALL isn't always + * Errata of most EP93xx revisions say that PRECHARGE ALL isn't always * issued. * - * Do a read from each bank to make sure they're precharged + * Cirrus proposes a workaround which consists in performing a read from + * each bank to force the precharge. This causes some boards to hang. + * Writing to the SDRAM banks instead of reading has the same + * side-effect (the SDRAM controller issues the necessary precharges), + * but is known to work on all supported boards */ PRECHARGE_BANK(0); -- 1.6.5 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox