From patchwork Thu Mar 1 03:58:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 143895 X-Patchwork-Delegate: vapier@gentoo.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 9EC29B6FA1 for ; Thu, 1 Mar 2012 14:58:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5EEF728082; Thu, 1 Mar 2012 04:58:12 +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 5RM5ok-9oaJe; Thu, 1 Mar 2012 04:58:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BA3C52807C; Thu, 1 Mar 2012 04:58:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C624C2807C for ; Thu, 1 Mar 2012 04:58:07 +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 5sG0cVS0WCjd for ; Thu, 1 Mar 2012 04:58:06 +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 smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by theia.denx.de (Postfix) with ESMTPS id 43D7228078 for ; Thu, 1 Mar 2012 04:58:04 +0100 (CET) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id D0AEB1B4021 for ; Thu, 1 Mar 2012 03:58:00 +0000 (UTC) From: Mike Frysinger To: u-boot@lists.denx.de Date: Wed, 29 Feb 2012 22:58:04 -0500 Message-Id: <1330574284-1514-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.8.4 Subject: [U-Boot] [PATCH] Blackfin: move gd/bd to bss by default X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 We don't need these setup manually, so let the bss do the rest. On Blackfin systems, we clear the bss before executing any C code that would use these, so this should be fine. Signed-off-by: Mike Frysinger --- arch/blackfin/include/asm/config.h | 8 +---- arch/blackfin/lib/board.c | 58 ++++++++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/arch/blackfin/include/asm/config.h b/arch/blackfin/include/asm/config.h index 1a8de49..25cd833 100644 --- a/arch/blackfin/include/asm/config.h +++ b/arch/blackfin/include/asm/config.h @@ -109,14 +109,8 @@ #ifndef CONFIG_SYS_MALLOC_BASE # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN) #endif -#ifndef CONFIG_SYS_GBL_DATA_ADDR -# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - GENERATED_GBL_DATA_SIZE) -#endif -#ifndef CONFIG_SYS_BD_INFO_ADDR -# define CONFIG_SYS_BD_INFO_ADDR (CONFIG_SYS_GBL_DATA_ADDR - GENERATED_BD_INFO_SIZE) -#endif #ifndef CONFIG_STACKBASE -# define CONFIG_STACKBASE (CONFIG_SYS_BD_INFO_ADDR - 4) +# define CONFIG_STACKBASE (CONFIG_SYS_MALLOC_BASE - 4) #endif #ifndef CONFIG_SYS_MEMTEST_START # define CONFIG_SYS_MEMTEST_START 0 diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c index e3ee4cd..2d424a2 100644 --- a/arch/blackfin/lib/board.c +++ b/arch/blackfin/lib/board.c @@ -181,6 +181,46 @@ void init_cplbtables(void) } } +static int global_board_data_init(void) +{ +#ifndef CONFIG_SYS_GBL_DATA_ADDR +# define CONFIG_SYS_GBL_DATA_ADDR 0 +#endif +#ifndef CONFIG_SYS_BD_INFO_ADDR +# define CONFIG_SYS_BD_INFO_ADDR 0 +#endif + + bd_t *bd; + + if (CONFIG_SYS_GBL_DATA_ADDR) { + gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR); + memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE); + } else { + static gd_t _bfin_gd; + gd = &_bfin_gd; + } + + if (CONFIG_SYS_BD_INFO_ADDR) { + bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR); + memset(bd, 0, GENERATED_BD_INFO_SIZE); + } else { + static bd_t _bfin_bd; + bd = &_bfin_bd; + } + gd->bd = bd; + + bd->bi_r_version = version_string; + bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU); + bd->bi_board_name = BFIN_BOARD_NAME; + bd->bi_vco = get_vco(); + bd->bi_cclk = get_cclk(); + bd->bi_sclk = get_sclk(); + bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; + bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; + + return 0; +} + /* * All attempts to come up with a "common" initialization sequence * that works for all boards and architectures failed: some of the @@ -201,7 +241,6 @@ extern int timer_init(void); void board_init_f(ulong bootflag) { - bd_t *bd; char buf[32]; #ifdef CONFIG_BOARD_EARLY_INIT_F @@ -234,21 +273,8 @@ void board_init_f(ulong bootflag) hang(); #endif serial_early_puts("Init global data\n"); - gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR); - memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE); - - bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR); - gd->bd = bd; - memset((void *)bd, 0, GENERATED_BD_INFO_SIZE); - bd->bi_r_version = version_string; - bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU); - bd->bi_board_name = BFIN_BOARD_NAME; - bd->bi_vco = get_vco(); - bd->bi_cclk = get_cclk(); - bd->bi_sclk = get_sclk(); - bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; + global_board_data_init(); /* Initialize */ serial_early_puts("IRQ init\n"); @@ -276,7 +302,7 @@ void board_init_f(ulong bootflag) if (CONFIG_MEM_SIZE) { printf("RAM: "); - print_size(bd->bi_memsize, "\n"); + print_size(gd->bd->bi_memsize, "\n"); } #if defined(CONFIG_POST)