From patchwork Mon Dec 13 21:06:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Becky Bruce X-Patchwork-Id: 75409 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 2CF83B708B for ; Tue, 14 Dec 2010 08:07:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4BA42280CC; Mon, 13 Dec 2010 22:07:40 +0100 (CET) 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 9ZAn6Oow-nTU; Mon, 13 Dec 2010 22:07:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CBA128099; Mon, 13 Dec 2010 22:07:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 95D5F2807D for ; Mon, 13 Dec 2010 22:07:15 +0100 (CET) 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 uVJZmfdV2opH for ; Mon, 13 Dec 2010 22:07:12 +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 gate.crashing.org (gate.crashing.org [63.228.1.57]) by theia.denx.de (Postfix) with ESMTPS id 148EE28078 for ; Mon, 13 Dec 2010 22:07:09 +0100 (CET) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id oBDL6tPa022610; Mon, 13 Dec 2010 15:06:55 -0600 From: Becky Bruce To: u-boot@lists.denx.de, robertlazarski@gmail.com, galak@kernel.crashing.org, sr@denx.de, dan@embeddedalley.com, wd@denx.de, ptyser@xes-inc.com Date: Mon, 13 Dec 2010 15:06:41 -0600 Message-Id: <1292274412-11340-2-git-send-email-beckyb@kernel.crashing.org> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1292274412-11340-1-git-send-email-beckyb@kernel.crashing.org> References: <1292274412-11340-1-git-send-email-beckyb@kernel.crashing.org> Subject: [U-Boot] [PATCH V2 01/12] mpc8540eval: Split initdram() into initdram() and sdram_init() 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Modeled after the MPC8540DS code; this will allow us to use a common initdram() once that is available. There should be no functional change. Signed-off-by: Becky Bruce --- board/mpc8540eval/mpc8540eval.c | 64 +++++++++++++++++++++----------------- 1 files changed, 35 insertions(+), 29 deletions(-) diff --git a/board/mpc8540eval/mpc8540eval.c b/board/mpc8540eval/mpc8540eval.c index 054d644..f1ab360 100644 --- a/board/mpc8540eval/mpc8540eval.c +++ b/board/mpc8540eval/mpc8540eval.c @@ -64,41 +64,15 @@ int checkboard (void) return (0); } -phys_size_t initdram (int board_type) +void sdram_init(void) { - long dram_size = 0; - -#if !defined(CONFIG_RAM_AS_FLASH) +#if !defined(CONFIG_RAM_AS_FLASH) /* LocalBus is not emulating flash */ volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; + volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); sys_info_t sysinfo; uint temp_lbcdll = 0; -#endif -#if !defined(CONFIG_RAM_AS_FLASH) || defined(CONFIG_DDR_DLL) - volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); -#endif -#if defined(CONFIG_DDR_DLL) - uint temp_ddrdll = 0; - /* Work around to stabilize DDR DLL */ - temp_ddrdll = gur->ddrdllcr; - gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000; - asm("sync;isync;msync"); -#endif - -#if defined(CONFIG_SPD_EEPROM) - dram_size = fsl_ddr_sdram(); - dram_size = setup_ddr_tlbs(dram_size / 0x100000); - dram_size *= 0x100000; -#else - dram_size = fixed_sdram (); -#endif - -#if defined(CONFIG_SYS_RAMBOOT) - return dram_size; -#endif - -#if !defined(CONFIG_RAM_AS_FLASH) /* LocalBus is not emulating flash */ get_sys_info(&sysinfo); /* if localbus freq is less than 66MHz,we use bypass mode,otherwise use DLL */ if(sysinfo.freqSystemBus/(CONFIG_SYS_LBC_LCRR & LCRR_CLKDIV) < 66000000) { @@ -132,6 +106,38 @@ phys_size_t initdram (int board_type) lbc->mrtpr = CONFIG_SYS_LBC_MRTPR; asm("sync"); #endif +} + +phys_size_t initdram(int board_type) +{ + long dram_size = 0; + +#if !defined(CONFIG_RAM_AS_FLASH) || defined(CONFIG_DDR_DLL) + volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +#endif + +#if defined(CONFIG_DDR_DLL) + uint temp_ddrdll = 0; + + /* Work around to stabilize DDR DLL */ + temp_ddrdll = gur->ddrdllcr; + gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000; + asm("sync;isync;msync"); +#endif + +#if defined(CONFIG_SPD_EEPROM) + dram_size = fsl_ddr_sdram(); + dram_size = setup_ddr_tlbs(dram_size / 0x100000); + dram_size *= 0x100000; +#else + dram_size = fixed_sdram(); +#endif + +#if defined(CONFIG_SYS_RAMBOOT) + return dram_size; +#endif + + sdram_init(); #if defined(CONFIG_DDR_ECC) {