From patchwork Fri Feb 12 17:24:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 71726 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 7A22DE1C7CB for ; Fri, 12 Feb 2010 18:25:30 +0100 (CET) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 6AB96C8C5CB4 for ; Fri, 12 Feb 2010 18:25:30 +0100 (CET) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Fri, 12 Feb 2010 18:25:30 +0100 (CET) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Fri, 12 Feb 2010 18:25:11 +0100 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Fri, 12 Feb 2010 18:25:10 +0100 Received: from scanner-1.m-online.net (unknown [192.168.8.165]) by mail.m-online.net (Postfix) with ESMTP id 6DF87200162; Fri, 12 Feb 2010 18:25:10 +0100 (CET) Received: from mxin-3.m-online.net ([192.168.6.165]) by scanner-1.m-online.net (scanner-1.m-online.net [192.168.8.165]) (amavisd-new, port 10026) with ESMTP id 13399-02-3; Fri, 12 Feb 2010 18:25:08 +0100 (CET) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 5107947A500; Fri, 12 Feb 2010 18:25:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40ACC280F2; Fri, 12 Feb 2010 18:25:03 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dry0fJ1Q9VG1; Fri, 12 Feb 2010 18:25:03 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B195B280DB; Fri, 12 Feb 2010 18:24:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A2DD4280D6 for ; Fri, 12 Feb 2010 18:24:55 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y2sdTk6BMhVV for ; Fri, 12 Feb 2010 18:24:53 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from relay1-v.mail.gandi.net (relay1-v.mail.gandi.net [217.70.178.75]) by theia.denx.de (Postfix) with ESMTP id 07928280D3 for ; Fri, 12 Feb 2010 18:24:51 +0100 (CET) Received: from d4rwin.no-ip.org (221.Red-88-25-56.staticIP.rima-tde.net [88.25.56.221]) by relay1-v.mail.gandi.net (Postfix) with ESMTP id BB035362BF; Fri, 12 Feb 2010 18:24:49 +0100 (CET) Received: by d4rwin.no-ip.org (Postfix, from userid 1000) id E02764CD52; Fri, 12 Feb 2010 18:24:31 +0100 (CET) Date: Fri, 12 Feb 2010 18:24:31 +0100 From: Matthias Kaehlcke To: Alessandro Rubini Message-ID: <20100212172431.GN15905@darwin> References: <20100211223238.GH15905@darwin> <9f7307fc105747976bae44df5dae51357f54d578.1265920498.git.rubini@unipv.it> <20100212070126.GA3406@morgana.gnudd.com> <20100212092358.GI15905@darwin> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100212092358.GI15905@darwin> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH 2/2] edb93xx sdram: fix initialization X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net hi alessandro, El Fri, Feb 12, 2010 at 10:23:58AM +0100 Matthias Kaehlcke ha dit: > El Fri, Feb 12, 2010 at 08:01:26AM +0100 Alessandro Rubini ha dit: > > > > i gave my ack after a visual review of the patch, without having > > > tested it. i just installed a patched u-boot on one of my boards and > > > it doesn't boot :( > > > > Oh. The opposite of my board. > > > > Then, since I don't have a 9315A but only a similar one, it's better > > to drop the patch. I'll have a different sdram_cfg file for mine, > > then. > > i'm pretty sure we'll be able to track this down, the purpose of your > patch is correct, i actually wonder why the current code works ... > > if we can't solve the issue in the next days, you could still send a > patch which only writes the GlConfig register in > program_mode_registers(). this would fix at least on of the issues and > make your code less different from the one in the tree maybe i have found a clue: i think the original assembly code wasn't correct either. the comment talks about reading from each bank, but then code like this is excuted: ldr r0, =0x00000000 /* A[22:21] = b00 */ str r0, [r0] which *writes* to the bank, but doesn't read from it. according to the errata note a bank is precharged by reading from it. the current code does this, but before the bank is configured properly. i suspect that is the cause for the hang i see on my boards. i've put together some code which does the precharge after setting up the mode registers. on my boards based on the edb9301 and edb9307a design u-boot boots with this code. below you find a patch, could you give it a try on your board, when you find some time and feel well enough? thanks Matthias diff --git a/board/edb93xx/sdram_cfg.c b/board/edb93xx/sdram_cfg.c index 6155f0e..f3db750 100644 --- a/board/edb93xx/sdram_cfg.c +++ b/board/edb93xx/sdram_cfg.c @@ -47,25 +47,27 @@ void sdram_cfg(void) early_udelay(200); - force_precharge(); + /* + * Errata of most EP93xx revisions say that PRECHARGE ALL isn't always + * issued, so we omit it at this point. Instead we force a precharge + * after having programmed the mode registers + */ setup_refresh_timer(); program_mode_registers(); - /* Select normal operation mode */ - writel(GLCONFIG_CKE, &sdram->glconfig); + force_precharge(); } static void force_precharge(void) { - /* - * Errata most EP93xx revisions say that PRECHARGE ALL isn't always - * issued. - * - * Do a read from each bank to make sure they're precharged - */ + struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE; + + /* Select normal operation mode */ + writel(GLCONFIG_CKE, &sdram->glconfig); + /* Do a read from each bank to make sure they're precharged */ PRECHARGE_BANK(0); PRECHARGE_BANK(1); PRECHARGE_BANK(2); @@ -101,6 +103,11 @@ static void setup_refresh_timer(void) static void program_mode_registers(void) { + struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE; + + /* Select mode register update mode */ + writel(GLCONFIG_MRS | GLCONFIG_CKE, &sdram->glconfig); + /* * The mode registers are programmed by performing a read from each * SDRAM bank. The value of the address that is read defines the value