From patchwork Sat Aug 24 16:32:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeroen Hofstee X-Patchwork-Id: 269651 X-Patchwork-Delegate: albert.aribaud@free.fr 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 CBE1E2C009E for ; Sun, 25 Aug 2013 02:33:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DF2B4A0D2; Sat, 24 Aug 2013 18:33:51 +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 H2DFD6BQNolx; Sat, 24 Aug 2013 18:33:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CDDDF4A0BF; Sat, 24 Aug 2013 18:33:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 73F2A4A0C2 for ; Sat, 24 Aug 2013 18:33:42 +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 b9dVe0EhssAc for ; Sat, 24 Aug 2013 18:33:37 +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 smtp3.versatel.nl (smtp3.versatel.nl [62.58.50.90]) by theia.denx.de (Postfix) with ESMTPS id 099D84A0BF for ; Sat, 24 Aug 2013 18:33:30 +0200 (CEST) Received: (qmail 32226 invoked by uid 0); 24 Aug 2013 16:33:30 -0000 Received: from ip120-12-208-87.adsl2.static.versatel.nl (HELO router.myspectrum.nl) ([87.208.12.120]) (envelope-sender ) by smtp3.versatel.nl (qmail-ldap-1.03) with SMTP for < >; 24 Aug 2013 16:33:30 -0000 Received: from black (unknown [10.0.0.107]) by router.myspectrum.nl (Postfix) with ESMTP id 544A21BE35 for ; Sat, 24 Aug 2013 18:33:29 +0200 (CEST) Received: by black (Postfix, from userid 1000) id 244C31D80CA5; Sat, 24 Aug 2013 18:33:29 +0200 (CEST) From: Jeroen Hofstee To: u-boot@lists.denx.de Date: Sat, 24 Aug 2013 18:32:42 +0200 Message-Id: <1377361963-11381-3-git-send-email-jeroen@myspectrum.nl> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1377361963-11381-1-git-send-email-jeroen@myspectrum.nl> References: <1377361963-11381-1-git-send-email-jeroen@myspectrum.nl> Cc: Jeroen Hofstee Subject: [U-Boot] [RFC 2/3] ARM,crt0.S: optional init gd to gdata for spl 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 The common/spl changes gd to gdata in board_init_f. I fail to see why. The only reason I can think of to use the gdata is the case where is won't fit into the region where the stack lives. Move the init to crt0.S and make it a CONFIG. --- arch/arm/lib/crt0.S | 5 +++++ arch/arm/lib/spl.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 98d7881..b8fa10e 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -67,9 +67,14 @@ ENTRY(_main) ldr sp, =(CONFIG_SYS_INIT_SP_ADDR) #endif bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GD_GLOBAL) + ldr r8, =gdata /* SPL assigns GD directly to &gdata */ +#else sub sp, #GD_SIZE /* allocate one GD above SP */ bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ mov r8, sp /* GD is above SP */ +#endif bl s_init diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index 583bdb3..52dba2f 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -15,7 +15,9 @@ /* Pointer to as well as the global data structure for SPL */ DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_SPL_GD_GLOBAL gd_t gdata __attribute__ ((section(".data"))); +#endif /* * In the context of SPL, board_init_f must ensure that any clocks/etc for @@ -31,9 +33,6 @@ void __weak board_init_f(ulong dummy) /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start); - /* Set global data pointer. */ - gd = &gdata; - board_init_r(NULL, 0); }