From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Date: Sat, 25 Aug 2012 12:42:07 +0200 Subject: [U-Boot] [PATCHv1] ARM: Add Altera SOCFPGA Cyclone5 In-Reply-To: <5037D383.2080105@ti.com> 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> Message-ID: <20120825104207.GA12281@elf.ucw.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@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 -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html