From patchwork Mon Jul 18 23:49:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Becky Bruce X-Patchwork-Id: 105367 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A707BB6F70 for ; Tue, 19 Jul 2011 09:49:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0BCA528174; Tue, 19 Jul 2011 01:49:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 X5o74abuB0T9; Tue, 19 Jul 2011 01:49:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F10E28179; Tue, 19 Jul 2011 01:49:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 99B0628139 for ; Tue, 19 Jul 2011 01:49:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 X0Nfd8pDggbh for ; Tue, 19 Jul 2011 01:49:25 +0200 (CEST) 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 VA3EHSOBE001.bigfish.com (va3ehsobe001.messaging.microsoft.com [216.32.180.11]) by theia.denx.de (Postfix) with ESMTPS id 4274C28100 for ; Tue, 19 Jul 2011 01:49:24 +0200 (CEST) Received: from mail145-va3-R.bigfish.com (10.7.14.235) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 14.1.225.22; Mon, 18 Jul 2011 23:49:21 +0000 Received: from mail145-va3 (localhost.localdomain [127.0.0.1]) by mail145-va3-R.bigfish.com (Postfix) with ESMTP id 8D5F618D81E2 for ; Mon, 18 Jul 2011 23:49:21 +0000 (UTC) X-SpamScore: 2 X-BigFish: VS2(zzzz1202h10c0jzz8275dhz2dh2a8h668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail145-va3 (localhost.localdomain [127.0.0.1]) by mail145-va3 (MessageSwitch) id 1311032961380063_17125; Mon, 18 Jul 2011 23:49:21 +0000 (UTC) Received: from VA3EHSMHS030.bigfish.com (unknown [10.7.14.253]) by mail145-va3.bigfish.com (Postfix) with ESMTP id 592AA1C8046 for ; Mon, 18 Jul 2011 23:49:21 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS030.bigfish.com (10.7.99.40) with Microsoft SMTP Server (TLS) id 14.1.225.22; Mon, 18 Jul 2011 23:49:19 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.289.8; Mon, 18 Jul 2011 18:49:18 -0500 Received: from localhost (right.am.freescale.net [10.82.193.13]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p6INnI9b011361 for ; Mon, 18 Jul 2011 18:49:18 -0500 (CDT) From: Becky Bruce To: Date: Mon, 18 Jul 2011 18:49:16 -0500 Message-ID: <13110329582097-git-send-email-beckyb@kernel.crashing.org> X-Mailer: git-send-email 1.5.3.rc2.29.gc4640f In-Reply-To: <13110329572704-git-send-email-beckyb@kernel.crashing.org> References: <13110329563254-git-send-email-beckyb@kernel.crashing.org> <13110329572704-git-send-email-beckyb@kernel.crashing.org> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH V2 2/2] board/tqm85xx: Create and tear down TLB for get_ram_size() 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 We need a TLB entry to call get_ram_size(); the common code doesn't create one until *after* fixed_sdram() has determined the size. So we set up tlbs for the max possible size and tear them down once we're done with get_ram_size(); the common 85xx code will then set up a final set of tlb entries for the *actual* detected size of ddr. This prevents us from having TLB entries that are larger than DDR sitting around for very long, which is not a recommended scenario. Signed-off-by: Becky Bruce Tested-by: Wolfgang Denk Acked-by: Wolfgang Denk --- board/tqc/tqm85xx/sdram.c | 7 +++++++ include/configs/TQM85xx.h | 6 ++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/board/tqc/tqm85xx/sdram.c b/board/tqc/tqm85xx/sdram.c index 39a9e21..baf073e 100644 --- a/board/tqc/tqm85xx/sdram.c +++ b/board/tqc/tqm85xx/sdram.c @@ -363,6 +363,12 @@ static phys_size_t sdram_setup(int casl) udelay (1000); #endif /* CONFIG_TQM8548 */ + /* + * get_ram_size() depends on having tlbs for the DDR, but they are + * not yet setup because we don't know the size. Set up a temp + * mapping and delete it when done. + */ + setup_ddr_tlbs(CONFIG_SYS_DDR_EARLY_SIZE_MB); for (i = 0; i < N_DDR_CS_CONF; i++) { ddr->cs0_config = ddr_cs_conf[i].reg; @@ -376,6 +382,7 @@ static phys_size_t sdram_setup(int casl) break; } } + clear_ddr_tlbs(CONFIG_SYS_DDR_EARLY_SIZE_MB); #ifdef CONFIG_TQM8548 if (i < N_DDR_CS_CONF) { diff --git a/include/configs/TQM85xx.h b/include/configs/TQM85xx.h index 79a958d..b336723 100644 --- a/include/configs/TQM85xx.h +++ b/include/configs/TQM85xx.h @@ -147,10 +147,16 @@ * DDR Setup */ #define CONFIG_SYS_DDR_SDRAM_BASE 0x00000000 /* DDR is system memory */ + #if defined(CONFIG_TQM_BIGFLASH) || \ (!defined(CONFIG_TQM8548_AG) && !defined(CONFIG_TQM8548_BE)) #define CONFIG_SYS_PPC_DDR_WIMGE (MAS2_I | MAS2_G) +#define CONFIG_SYS_DDR_EARLY_SIZE_MB (512) +#else +#define CONFIG_SYS_PPC_DDR_WIMGE (0) +#define CONFIG_SYS_DDR_EARLY_SIZE_MB (2 * 1024) #endif + #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE #ifdef CONFIG_TQM8548_AG #define CONFIG_VERY_BIG_RAM