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

Pavel Machek
2012-08-29T12:07:33Z

Hi!

> > Some observations:
> >
> > Not sure what to do with CONFIG_SPL_STACK: altera was just using
> > symbol from linker script. Is there way to keep it like that? I'd hate
> > to invent magic constant.
>
> Well, lets think about this. Previously, everyone has been saying "use
> this spot in SRAM" or "use this spot in DRAM (which has been setup
> previously)". But I think you should be able to do
> #define CONFIG_SPL_STACK __linker_symbol and be done with it.

Yes, that seems to do the trick... if it is acceptable.

Pavel

commit 2cc99bcf39dc90ec4f43b949b8db75d5b019c92f
Author: Pavel <pavel@ucw.cz>
Date: Wed Aug 29 14:04:47 2012 +0200

Use CONFIG_SPL_START as suggested by Tom Rini.

Signed-off-by: Pavel Machek <pavel@denx.de>

diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index ca5f4cf..88f809d 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -27,8 +27,6 @@

DECLARE_GLOBAL_DATA_PTR;

-extern void __malloc_start, __malloc_end, __stack_start;
-
/*
* Console Initialization
*/
diff --git a/arch/arm/include/asm/arch-socfpga/spl.h b/arch/arm/include/asm/arch-socfpga/spl.h
index 68ceec6..43efa67 100644
--- a/arch/arm/include/asm/arch-socfpga/spl.h
+++ b/arch/arm/include/asm/arch-socfpga/spl.h
@@ -1 +1,28 @@
+/*
+ * Copyright (C) 2012 Pavel Machek <pavel@denx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SOCFPGA_SPL_H_
+#define _SOCFPGA_SPL_H_
+
+/* Symbols from linker script */
+extern void __malloc_start, __malloc_end, __stack_start;
+
+#define CONFIG_SPL_STACK (&__stack_start)
+
#define BOOT_DEVICE_RAM 1
+
+#endif
diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index 8c8806e..2d1f47a 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -41,9 +41,8 @@ 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"(&__stack_start));
+ asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK));

/* Clear the BSS. */
memset(__bss_start, 0, __bss_end__ - __bss_start);

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html