From patchwork Sat Aug 25 10:42:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 179964 X-Patchwork-Delegate: trini@ti.com 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 4CEFD2C00F6 for ; Sat, 25 Aug 2012 20:42:22 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6A4DD28089; Sat, 25 Aug 2012 12:42:18 +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 aedudEZ2lQwc; Sat, 25 Aug 2012 12:42:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6ECFD2807E; Sat, 25 Aug 2012 12:42:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 310202807E for ; Sat, 25 Aug 2012 12:42:13 +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 02gQ6ID4w2jQ for ; Sat, 25 Aug 2012 12:42:11 +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 atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz [195.113.26.193]) by theia.denx.de (Postfix) with ESMTP id 1F9C12807D for ; Sat, 25 Aug 2012 12:42:09 +0200 (CEST) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id D0EBEF0739; Sat, 25 Aug 2012 12:42:08 +0200 (CEST) Date: Sat, 25 Aug 2012 12:42:07 +0200 From: Pavel Machek To: Tom Rini Message-ID: <20120825104207.GA12281@elf.ucw.cz> References: <1345157139-19585-1-git-send-email-dinguyen@altera.com> <201208230026.53389.marex@denx.de> <20120823011353.GB3476@bill-the-cat> <20120823104342.GA28214@elf.ucw.cz> <5037D383.2080105@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5037D383.2080105@ti.com> X-Warning: Reading this can be dangerous to your mental health. User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Marek Vasut , u-boot@lists.denx.de, dinh.linux@gmail.com, clsee@altera.com Subject: Re: [U-Boot] [PATCHv1] ARM: Add Altera SOCFPGA Cyclone5 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On Fri 2012-08-24 12:18:27, Tom Rini wrote: > On 08/23/2012 03:43 AM, Pavel Machek wrote: > > [snip] > >> It's the omap-common/spl.c code with the bits for IH_OS_LINUX taken out > >> :) Can you please re-do your series on top of the SPL series I just > >> posted that provides a common SPL framework? Thanks! > > > > I'll take a look. OTOH, ammount of code duplication here is quite low, > > and redoing it on top of SPL series will mean delaying merge, right? > > My hope is that since I got the SPL patches posted in time we can get > them in for v2012.10 so no, this will only help your chances :) Got it. I pulled Stefan's version -- he seems to have your changes as a git tree. I merged altera code into that, and with these quick hacks on top of that, it boots. Good sign :-). diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c index 7bd1e2f..74ac8e6 100644 --- a/arch/arm/cpu/armv7/socfpga/spl.c +++ b/arch/arm/cpu/armv7/socfpga/spl.c @@ -33,7 +33,7 @@ static struct spl_image_info spl_image; extern void __malloc_start, __malloc_end, __stack_start; /* Define global data structure pointer to it */ -static gd_t gdata __attribute__ ((section(".data"))); +gd_t gdata __attribute__ ((section(".data"))); /* * Error action @@ -134,27 +134,6 @@ static void spl_console_init(void) } /* - * Board initialization prior bss clearance - * Do note below concerns when inserting your function here. - * Please refer to README for more details. - - * Initialized global data (data segment) is read-only. Do not attempt - to write it. - - * Do not use any uninitialized global data (or implicitely initialized - as zero data - BSS segment) at all - this is undefined, initiali- - zation is performed later (when relocating to RAM). - - * Stack space is very limited. Avoid big data buffers or things like - that. - */ -void board_init_f(ulong dummy) -{ - /* Will clear bss then jump back to function board_init_r */ - relocate_code((ulong) &__stack_start, &gdata, CONFIG_SPL_TEXT_BASE); -} - -/* * Board initialization after bss clearance */ void board_init_r(gd_t *id, ulong dummy) diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index c892f82..9db93d8 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -45,7 +45,7 @@ COBJS-y += reset.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o else -COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o +COBJS-y += spl.o endif COBJS-y += cache.o diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index 2d1f47a..8c8806e 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -41,8 +41,9 @@ extern char __bss_start[], __bss_end__[]; */ void __weak board_init_f(ulong dummy) { + extern void __stack_start; /* Set the stack pointer. */ - asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK)); + asm volatile("mov sp, %0\n" : : "r"(&__stack_start)); /* Clear the BSS. */ memset(__bss_start, 0, __bss_end__ - __bss_start); diff --git a/include/configs/socfpga_cyclone5.h b/include/configs/socfpga_cyclone5.h index 29aa9da..ac52e57 100644 --- a/include/configs/socfpga_cyclone5.h +++ b/include/configs/socfpga_cyclone5.h @@ -109,6 +109,7 @@ #define CONFIG_DOS_PARTITION 1 #ifdef CONFIG_SPL_BUILD +#define CONFIG_SPL_FRAMEWORK #undef CONFIG_PARTITIONS #endif