From patchwork Sat Nov 13 17:00:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Gala X-Patchwork-Id: 71058 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 09091B70ED for ; Sun, 14 Nov 2010 04:01:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5708E282D7; Sat, 13 Nov 2010 18:01:04 +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 1Ws4yssup2pW; Sat, 13 Nov 2010 18:01:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A92C282DB; Sat, 13 Nov 2010 18:01:01 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 104FB282DB for ; Sat, 13 Nov 2010 18:01:00 +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 ssgVghFx4LEo for ; Sat, 13 Nov 2010 18:00:58 +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 08150282D7 for ; Sat, 13 Nov 2010 18:00:56 +0100 (CET) Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id oADH0lVx026620; Sat, 13 Nov 2010 11:00:48 -0600 From: Kumar Gala Date: Sat, 13 Nov 2010 11:00:46 -0600 Message-Id: To: Wolfgang Denk , Stefan Roese Mime-Version: 1.0 (Apple Message framework v1081) X-Mailer: Apple Mail (2.1081) Cc: U-Boot List , Kim Phillips Subject: [U-Boot] RFC: Move when we call cpu_init_r on PPC 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 Wolfgang, Stefan, Kim, (other PPC arch maintainers) I'd like to move cpu_init_r to after env_relocate(). This is desirable on 85xx based systems to deal with an issue when we boot from NAND (and probably SPI or SDHC/MMC) in which we use the L2 cache in SRAM mode to load the u-boot image from the storage device (NAND, SPI, SDHC/MMC, etc.). In these cases we have an ordering issue between freeing up the L2 cache and when the environment is relocated. If we move cpu_init_r() after env_relocate() that addresses the issue. I did an audit of all the other PPC chips and I dont believe it impacts any of them if we move cpu_init_r after spi_init_{f,r}, nand_init, mmc_initialize, & env_relocate. Please let me know if this is acceptable solution to my problem. I've provided both the 'audit' details and example diff. - k ---- My audit of what we do in cpu_init_r on all PPCs: 74xx_7xx/cpu_init.c:int cpu_init_r (void) Does nothing mpc512x/cpu_init.c:int cpu_init_r (void) Does nothing mpc5xx/cpu_init.c:int cpu_init_r (void) Does nothing mpc5xxx/cpu_init.c:int cpu_init_r (void) Mask interrupts, loadtask/microcode mpc8220/cpu_init.c:int cpu_init_r (void) Mask interrupts, loadtask/microcode mpc824x/cpu_init.c:int cpu_init_r (void) init EUMMBAR on MPC10x mpc8260/cpu_init.c:int cpu_init_r (void) init RISC Controller Cfg Register (most boards either 0 or modify TIMEP) mpc83xx/cpu_init.c:int cpu_init_r (void) init QE mpc85xx/cpu_init.c:int cpu_init_r(void) init L2/L3 caches init QE init SERDES setup secondary cores (MP) set LCRR mpc86xx/cpu_init.c:int cpu_init_r(void) setup secondary cores (MP) mpc8xx/cpu_init.c:int cpu_init_r (void) setup RTCSC setup RMDS ppc4xx/cpu_init.c:int cpu_init_r (void) sets edge conditioning circuitry on PPC405GPr ---- diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 2e0749d..aaa5d1e 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -754,11 +754,6 @@ void board_init_r (gd_t *id, ulong dest_addr) WATCHDOG_RESET (); - /* initialize higher level parts of CPU like time base and timers */ - cpu_init_r (); - - WATCHDOG_RESET (); - #ifdef CONFIG_SPI # if !defined(CONFIG_ENV_IS_IN_EEPROM) spi_init_f (); @@ -786,6 +781,11 @@ void board_init_r (gd_t *id, ulong dest_addr) /* relocate environment function pointers etc. */ env_relocate (); + /* initialize higher level parts of CPU like time base and timers */ + cpu_init_r (); + + WATCHDOG_RESET (); + /* * Fill in missing fields of bd_info. * We do this here, where we have "normal" access to the