[U-Boot] [PATCHv1] ARM: Add Altera SOCFPGA Cyclone5

Pavel Machek pavel at denx.de
Sat Aug 25 12:42:07 CEST 2012


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


More information about the U-Boot mailing list