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

Pavel Machek
2012-08-29T12:27:00Z

Hi!

> > Ok, this is promissed patch for comments. socfpga spl.c now got
> > reasonably smaller. It is on top of
>
> Looks good overall. I don't see asm/arch/spl.h but that's where you
> could put the extern for __stack_start and then define CONFIG_SPL_STACK
> to &__stack_start.

Yep, that works, thanks!

> > http://github.com/trini/u-boot WIP/spl-improvements
> >
> > Now... can I leave spl_ram_load_image() where it is? Probably add some
> > #ifdef?
>
> Yeah, I think that's OK to start with, we can move things more later if
> needed.

Cool.

> > +static void spl_console_init(void)
>
> Looks like preloader_console_init :)

And works the same, too. Shared. Thanks!

> > + /* setup MALLOC after clocks going faster */
> > + mem_malloc_init((ulong) &__malloc_start,
> > + (&__malloc_end - &__malloc_start));
>
> Shouldn't need this, should already be called before you get to
> spl_board_init.

Yep, I set up CONFIG_SYS_... and it seems to work.

> [snip]
> > diff --git a/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds b/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds
>
> You should setup MEMORY declarations like the other u-boot-spl linker
> scripts do so we get build-time confirmation that we haven't exceeded
> our size limitations.

Ok, I'll do that as a next step.

> > + . = . + 4;
> > + . = ALIGN(8);
> > + __malloc_start = .;
> > + . = . + CONFIG_SPL_MALLOC_SIZE;
> > + __malloc_end = .;
> > +
> > + . = . + 4;
> > + . = . + CONFIG_SPL_STACK_SIZE;
> > + . = ALIGN(8);
> > + __stack_start = .;
>
> Do you really need to do . = . + 4 and then align statements?

Probably not. Removed.

> > +LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o
> q
> Er? There's already a line for lib/libgeneric.o

Sorry. Deleted.

Thanks,
Pavel

diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index c12e339..bf03333 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -46,9 +46,5 @@ void spl_board_init(void)
/* enable console uart printing */
preloader_console_init();

- /* setup MALLOC after clocks going faster */
- mem_malloc_init((ulong) &__malloc_start,
- (&__malloc_end - &__malloc_start));
-
puts("SPL Boot\n");
}
diff --git a/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds b/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds
index de74341..2c90753 100644
--- a/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds
+++ b/arch/arm/cpu/armv7/socfpga/u-boot-spl.lds
@@ -47,13 +47,11 @@ SECTIONS
__bss_end__ = .;
}

- . = . + 4;
. = ALIGN(8);
__malloc_start = .;
. = . + CONFIG_SPL_MALLOC_SIZE;
__malloc_end = .;

- . = . + 4;
. = . + CONFIG_SPL_STACK_SIZE;
. = ALIGN(8);
__stack_start = .;
diff --git a/arch/arm/include/asm/arch-socfpga/spl.h b/arch/arm/include/asm/arch-socfpga/spl.h
index 43efa67..c9e5f50 100644
--- a/arch/arm/include/asm/arch-socfpga/spl.h
+++ b/arch/arm/include/asm/arch-socfpga/spl.h
@@ -22,6 +22,8 @@
extern void __malloc_start, __malloc_end, __stack_start;

#define CONFIG_SPL_STACK (&__stack_start)
+#define CONFIG_SYS_SPL_MALLOC_START (&__malloc_start)
+#define CONFIG_SYS_SPL_MALLOC_SIZE (&__malloc_end - &__malloc_start)

#define BOOT_DEVICE_RAM 1

diff --git a/common/spl/spl.c b/common/spl/spl.c
index b87df65..5adbf0e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -118,7 +118,6 @@ static void __noreturn jump_to_image_no_args(void)

static void spl_ram_load_image(void)
{
- u32 err;
const struct image_header *header;

/* get the header */
diff --git a/spl/Makefile b/spl/Makefile
index d757448..f96c08e4 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -58,7 +58,6 @@ LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o
LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o
LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/libdma.o
LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o
-LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o

ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
LIBS-y += $(CPUDIR)/omap-common/libomap-common.o

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