Skip to contentSkip to conversation

arm, davinci: add support for new spl framework

PATCH Superseded Heiko Schocher 3 participants 4 messages Oct 5, 2011 – Oct 6, 2011

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/10 arm, davinci: add support for new spl framework

Cc Albert ARIBAUD <[email protected]>
Cc Sandeep Paulraj <[email protected]>
---
 Makefile                                  |    8 +++-
 arch/arm/cpu/arm926ejs/davinci/Makefile   |    8 ++++
 arch/arm/cpu/arm926ejs/davinci/spl.c      |   63 +++++++++++++++++++++++++++++
 arch/arm/cpu/arm926ejs/davinci/spl_nand.c |   57 ++++++++++++++++++++++++++
 arch/arm/cpu/arm926ejs/start.S            |   25 +++++++++++-
 5 files changed, 158 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl.c
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c
Makefile +6 -2
index ddcf533..cc4a036 100644
@@ -396,9 +396,13 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)u-boot-nand.bin
+$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
-		-e $(CONFIG_SYS_TEXT_BASE) -d $< $@
+		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
+		rm $(obj)u-boot-ubl.bin
+		rm $(obj)spl/u-boot-spl-pad.bin
 
 GEN_UBOOT = \
 		UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
arch/arm/cpu/arm926ejs/davinci/Makefile +8 -0
index 0310957..d9e71bc 100644
@@ -35,6 +35,14 @@ COBJS-$(CONFIG_SOC_DM644X)	+= dm644x.o
 COBJS-$(CONFIG_SOC_DM646X)	+= dm646x.o
 COBJS-$(CONFIG_DRIVER_TI_EMAC)	+= lxt972.o dp83848.o et1011c.o ksz8873.o
 
+ifdef CONFIG_SPL_BUILD
+COBJS-y	+= spl.o
+COBJS-y	+= dm365_lowlevel.o
+ifdef CONFIG_SPL_NAND_SUPPORT
+COBJS-y	+= spl_nand.o
+endif
+endif
+
 SOBJS	= reset.o
 
 ifndef CONFIG_SKIP_LOWLEVEL_INIT
arch/arm/cpu/arm926ejs/davinci/spl.c new file +63 -0

63 lines not on this page · raw message

arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +57 -0

57 lines not on this page · raw message

arch/arm/cpu/arm926ejs/start.S +24 -1
index 86a0dc2..339c5ed 100644
@@ -126,7 +126,15 @@ _fiq:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
 	.word	CONFIG_SYS_TEXT_BASE
+#else
+#ifdef CONFIG_SPL_BUILD
+	.word	CONFIG_SPL_TEXT_BASE
+#else
+	.word	CONFIG_SYS_TEXT_BASE
+#endif
+#endif
 
 /*
  * These are defined in the board-specific linker script.
@@ -192,7 +200,15 @@ reset:
 
 /* Set stackpointer in internal RAM to call board_init_f */
 call_board_init_f:
+#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
+	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#else
+#ifdef CONFIG_SPL_BUILD
+	ldr	sp, =(CONFIG_SPL_STACK)
+#else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#endif
+#endif
 	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */
 	ldr	r0,=0x00000000
 	bl	board_init_f
@@ -217,6 +233,7 @@ stack_setup:
 	mov	sp, r4
 
 	adr	r0, _start
+	sub	r9, r6, r0		/* r9 <- relocation offset */
 	cmp	r0, r6
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
@@ -271,12 +288,17 @@ fixnext:
 #endif
 
 clear_bss:
-#ifndef CONFIG_SPL_BUILD
+#ifdef CONFIG_SPL_BUILD
+	/* No relocation for SPL */
+	ldr	r0, =__bss_start
+	ldr	r1, =__bss_end__
+#else
 	ldr	r0, _bss_start_ofs
 	ldr	r1, _bss_end_ofs
 	mov	r4, r6			/* reloc addr */
 	add	r0, r0, r4
 	add	r1, r1, r4
+#endif
 	mov	r2, #0x00000000		/* clear			    */
 
 clbss_l:str	r2, [r0]		/* clear loop...		    */
@@ -284,6 +306,7 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 	cmp	r0, r1
 	bne	clbss_l
 
+#ifndef CONFIG_SPL_BUILD
 	bl coloured_LED_init
 	bl red_led_on
 #endif
Signature · 1 line
1.7.6.2
#1 lore raw

PATCH v2 4/10 arm, davinci: add support for new spl framework

Hello Heiko,

Quoted 12 lines · Heiko Schocher
Cc Albert ARIBAUD <[email protected]>
Cc Sandeep Paulraj <[email protected]>

---

?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?8 +++-
?arch/arm/cpu/arm926ejs/davinci/Makefile ? | ? ?8 ++++
?arch/arm/cpu/arm926ejs/davinci/spl.c ? ? ?| ? 63 +++++++++++++++++++++++++++++
?arch/arm/cpu/arm926ejs/davinci/spl_nand.c | ? 57 ++++++++++++++++++++++++++
?arch/arm/cpu/arm926ejs/start.S ? ? ? ? ? ?| ? 25 +++++++++++-

?5 files changed, 158 insertions(+), 3 deletions(-) ?create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl.c ?create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c

[...]

Quoted 5 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +0 -0
new file mode 100644
index 0000000..d9b9398

[...]

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +4 -0
+void puts(const char *str)
+{
+ ? ? ? while (*str)
+ ? ? ? ? ? ? ? putc(*str++);

arch/arm/cpu/arm926ejs/davinci/spl.c line 43

Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +10 -0
+}
+
+void putc(char c)
+{
+ ? ? ? if (c == '\n')
+ ? ? ? ? ? ? ? NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r');
+
+ ? ? ? NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
+}
+

Are these functions really required? I am currently also working on an SPL for davinci (the AM1808 SoC) and had a look at the code in arch/arm/cpu/armv7/omap-common/spl.c:

        gd = &gdata;
        gd->bd = &bdata;
        gd->flags |= GD_FLG_RELOC;
        gd->baudrate = CONFIG_BAUDRATE;

        serial_init();          /* serial communications setup */

After that they use putc, printf... from common/console.c

However, I had to add a gd->have_console = true; to the code above since this is required due to commit e3e454cd72f319908355427b1a3ae54b3dd53356.

Regards, Christian

#2 lore raw

PATCH v2 4/10 arm, davinci: add support for new spl framework

Hello Christian,

Quoted 36 lines · Christian Riesch

Hello Heiko,

Quoted 12 lines · Heiko Schocher
Cc Albert ARIBAUD <[email protected]>
Cc Sandeep Paulraj <[email protected]>
---
 Makefile                                  |    8 +++-
 arch/arm/cpu/arm926ejs/davinci/Makefile   |    8 ++++
 arch/arm/cpu/arm926ejs/davinci/spl.c      |   63 +++++++++++++++++++++++++++++
 arch/arm/cpu/arm926ejs/davinci/spl_nand.c |   57 ++++++++++++++++++++++++++
 arch/arm/cpu/arm926ejs/start.S            |   25 +++++++++++-
 5 files changed, 158 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl.c
 create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c

[...]

Quoted 5 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +0 -0
new file mode 100644
index 0000000..d9b9398

[...]

Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +10 -0
+void puts(const char *str)
+{
+       while (*str)
+               putc(*str++);
+}
+
+void putc(char c)
+{
+       if (c == '\n')
+               NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), '\r');
Quoted 8 lines

arch/arm/cpu/arm926ejs/davinci/spl.c line 43

Quoted 4 lines
arch/arm/cpu/arm926ejs/davinci/spl.c new file +4 -0
+
+       NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
+}
+

Are these functions really required? I am currently also working on an SPL for davinci (the AM1808 SoC) and had a look at the code in arch/arm/cpu/armv7/omap-common/spl.c:

Yes, I know this code, but the disadvantage of it is, you need printf(), which blows up code. I only use puts(), which result in a smaller code.

Quoted 8 lines
        gd = &gdata;
        gd->bd = &bdata;
        gd->flags |= GD_FLG_RELOC;
        gd->baudrate = CONFIG_BAUDRATE;

        serial_init();          /* serial communications setup */

After that they use putc, printf... from common/console.c

see above comment, I don;t want to use this code ... also I don;t need the gd pointer at all in spl ...

Quoted 3 lines

However, I had to add a gd->have_console = true; to the code above since this is required due to commit e3e454cd72f319908355427b1a3ae54b3dd53356.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH v2 4/10 arm, davinci: add support for new spl framework

In reply to Christian Riesch

Dear Christian Riesch,

Quoted 4 lines · In message <CABkLObrZtiGdQEpP2sxdJy6PgDgb3qRszi8b7npBCHBYr9af=w@mail.gmail.com>…

However, I had to add a gd->have_console = true; to the code above since this is required due to commit e3e454cd72f319908355427b1a3ae54b3dd53356.

I think this is a bad idea. Instead, you should make sure to run console_init_f() at the right place.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Another dream that failed.  There's nothing sadder.
	-- Kirk, "This side of Paradise", stardate 3417.3