[U-Boot] [RFC PATCH 0/8] da850evm: Add SPL support for booting from SPI flash

Hi all, Heiko Schocher added patches for the low level configuration of the DA850 SoCs and I would like to use this code on my board. At the same time I would like to add support for this low level configuration for the da850evm board. This makes it possible to test/use the lowlevel functions also for developers who don't have access neither to Heiko's board nor to mine.
The patchset aims at implementing SPL support for the da850evm configuration to allow booting this board from SPI flash without using the UBL (see doc/README.davinci).
This patchset is not a complete implementation, it is missing the code that is actually used to load u-boot from SPI flash to the DDR memory. The code just hangs after the initialization is done. But I submit it nevertheless as RFC and I am looking forward to your comments.
The patches apply on top of git://git.denx.de/u-boot-ti.git and Heiko's patches
arm, arm926ejs: always do cpu critical inits http://patchwork.ozlabs.org/patch/124787/
arm, davinci: da850/dm365 lowlevel cleanup http://patchwork.ozlabs.org/patch/124788/
To build run
make da850evm_config make tools make u-boot.ais
Then program u-boot.ais to SPI flash. The board responds with an error message since we do hang() after the configuration.
Regards, Christian
Cc: Heiko Schocher hs@denx.de Cc: Wolfgang Denk wd@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Nagabhushana Netagunte nagabhushana.netagunte@ti.com Cc: Stefano Babic sbabic@denx.de Cc: Albert Aribaud albert.u.boot@aribaud.net
Christian Riesch (8): arm, davinci: Move pinmux functions from board to arch tree arm, davinci: Fix clear_bss for zero length bss arm, davinci: Add SPL support for DA850 SoCs arm: printf() is not available in the SPL arm, davinci: Replace pinmuxing in da850_lowlevel.c da850evm: Add a basic SPL for SPI boot mkimage: Fix variable length header support arm, davinci: Add support for generating AIS images to the Makefile
.gitignore | 1 + Makefile | 7 ++ arch/arm/cpu/arm926ejs/davinci/Makefile | 5 +- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++---- .../arm/cpu/arm926ejs/davinci/pinmux.c | 0 arch/arm/cpu/arm926ejs/davinci/spl.c | 11 ++- arch/arm/cpu/arm926ejs/start.S | 8 +- arch/arm/include/asm/arch-davinci/hardware.h | 2 + arch/arm/lib/eabi_compat.c | 3 + board/davinci/common/Makefile | 2 +- board/davinci/da8xxevm/da830evm.c | 2 - board/davinci/da8xxevm/da850evm.c | 2 - board/davinci/da8xxevm/hawkboard_nand_spl.c | 2 - board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++++++++ board/davinci/ea20/ea20.c | 2 - include/configs/da850evm.h | 70 ++++++++++++++- nand_spl/board/davinci/da8xxevm/Makefile | 6 +- tools/mkimage.c | 97 ++++++++++---------- 18 files changed, 239 insertions(+), 88 deletions(-) rename board/davinci/common/davinci_pinmux.c => arch/arm/cpu/arm926ejs/davinci/pinmux.c (100%) create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com --- arch/arm/cpu/arm926ejs/davinci/Makefile | 2 +- .../arm/cpu/arm926ejs/davinci/pinmux.c | 0 arch/arm/include/asm/arch-davinci/hardware.h | 2 ++ board/davinci/common/Makefile | 2 +- board/davinci/da8xxevm/da830evm.c | 2 -- board/davinci/da8xxevm/da850evm.c | 2 -- board/davinci/da8xxevm/hawkboard_nand_spl.c | 2 -- board/davinci/ea20/ea20.c | 2 -- nand_spl/board/davinci/da8xxevm/Makefile | 6 +++--- 9 files changed, 7 insertions(+), 13 deletions(-) rename board/davinci/common/davinci_pinmux.c => arch/arm/cpu/arm926ejs/davinci/pinmux.c (100%)
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index aeb058a..2105ec5 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).o
-COBJS-y += cpu.o timer.o psc.o +COBJS-y += cpu.o timer.o psc.o pinmux.o COBJS-$(CONFIG_DA850_LOWLEVEL) += da850_lowlevel.o COBJS-$(CONFIG_SOC_DM355) += dm355.o COBJS-$(CONFIG_SOC_DM365) += dm365.o diff --git a/board/davinci/common/davinci_pinmux.c b/arch/arm/cpu/arm926ejs/davinci/pinmux.c similarity index 100% rename from board/davinci/common/davinci_pinmux.c rename to arch/arm/cpu/arm926ejs/davinci/pinmux.c diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h index f80f312..927aee4 100644 --- a/arch/arm/include/asm/arch-davinci/hardware.h +++ b/arch/arm/include/asm/arch-davinci/hardware.h @@ -479,6 +479,8 @@ struct davinci_syscfg_regs { #define davinci_syscfg_regs \ ((struct davinci_syscfg_regs *)DAVINCI_BOOTCFG_BASE)
+#define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) + /* Emulation suspend bits */ #define DAVINCI_SYSCFG_SUSPSRC_EMAC (1 << 5) #define DAVINCI_SYSCFG_SUSPSRC_I2C (1 << 16) diff --git a/board/davinci/common/Makefile b/board/davinci/common/Makefile index 9d7b164..bc99da3 100644 --- a/board/davinci/common/Makefile +++ b/board/davinci/common/Makefile @@ -29,7 +29,7 @@ endif
LIB = $(obj)lib$(VENDOR).o
-COBJS := misc.o davinci_pinmux.o +COBJS := misc.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c index 2021e73..c45c94b 100644 --- a/board/davinci/da8xxevm/da830evm.c +++ b/board/davinci/da8xxevm/da830evm.c @@ -46,8 +46,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) - /* SPI0 pin muxer settings */ static const struct pinmux_config spi0_pins[] = { { pinmux(7), 1, 3 }, diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index e0a3bbe..844e585 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -34,8 +34,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) - /* SPI0 pin muxer settings */ static const struct pinmux_config spi1_pins[] = { { pinmux(5), 1, 1 }, diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c index e5e65e5..2285e7c 100644 --- a/board/davinci/da8xxevm/hawkboard_nand_spl.c +++ b/board/davinci/da8xxevm/hawkboard_nand_spl.c @@ -32,8 +32,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) - static const struct pinmux_config mii_pins[] = { { pinmux(2), 8, 1 }, { pinmux(2), 8, 2 }, diff --git a/board/davinci/ea20/ea20.c b/board/davinci/ea20/ea20.c index 720a360..9b6c4c0 100644 --- a/board/davinci/ea20/ea20.c +++ b/board/davinci/ea20/ea20.c @@ -40,8 +40,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) - static const struct da8xx_panel lcd_panel = { /* Casio COM57H531x */ .name = "Casio_COM57H531x", diff --git a/nand_spl/board/davinci/da8xxevm/Makefile b/nand_spl/board/davinci/da8xxevm/Makefile index accf716..7b06cd2 100644 --- a/nand_spl/board/davinci/da8xxevm/Makefile +++ b/nand_spl/board/davinci/da8xxevm/Makefile @@ -42,7 +42,7 @@ SOBJS = _divsi3.o \
COBJS = cpu.o \ davinci_nand.o \ - davinci_pinmux.o \ + pinmux.o \ div0.o \ hawkboard_nand_spl.o \ memsize.o \ @@ -78,9 +78,9 @@ $(nandobj)u-boot.lds: $(LDSCRIPT) # create symbolic links for common files
# from board directory -$(obj)davinci_pinmux.c: +$(obj)pinmux.c: @rm -f $@ - @ln -s $(TOPDIR)/board/davinci/common/davinci_pinmux.c $@ + @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/pinmux.c $@
# from drivers/mtd/nand directory $(obj)davinci_nand.c:

Hello Christian,
Christian Riesch wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/Makefile | 2 +- .../arm/cpu/arm926ejs/davinci/pinmux.c | 0 arch/arm/include/asm/arch-davinci/hardware.h | 2 ++ board/davinci/common/Makefile | 2 +- board/davinci/da8xxevm/da830evm.c | 2 -- board/davinci/da8xxevm/da850evm.c | 2 -- board/davinci/da8xxevm/hawkboard_nand_spl.c | 2 -- board/davinci/ea20/ea20.c | 2 -- nand_spl/board/davinci/da8xxevm/Makefile | 6 +++--- 9 files changed, 7 insertions(+), 13 deletions(-) rename board/davinci/common/davinci_pinmux.c => arch/arm/cpu/arm926ejs/davinci/pinmux.c (100%)
I have similiar patch in my queue, thanks!
Acked-by: Heiko Schocher hs@denx.de
bye, Heiko

This patch fixes the clear_bss loop for bss sections that have zero length, i.e., where __bss_start == __bss_end__.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Albert Aribaud albert.u.boot@aribaud.net --- arch/arm/cpu/arm926ejs/start.S | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S index 8b5355b..772793c 100644 --- a/arch/arm/cpu/arm926ejs/start.S +++ b/arch/arm/cpu/arm926ejs/start.S @@ -299,10 +299,12 @@ clear_bss: #endif mov r2, #0x00000000 /* clear */
-clbss_l:str r2, [r0] /* clear loop... */ +clbss_l:cmp r0, r1 /* clear loop... */ + beq clbss_e + str r2, [r0] add r0, r0, #4 - cmp r0, r1 - bne clbss_l + b clbss_l +clbss_e:
#ifndef CONFIG_SPL_BUILD bl coloured_LED_init

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com --- arch/arm/cpu/arm926ejs/davinci/Makefile | 3 ++- arch/arm/cpu/arm926ejs/davinci/spl.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index 2105ec5..99df0df 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -37,7 +37,8 @@ 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 +COBJS-$(CONFIG_SOC_DM365) += dm365_lowlevel.o +COBJS-$(CONFIG_SOC_DA8XX) += da850_lowlevel.o endif
SOBJS = reset.o diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index d9b9398..bb4ee13 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -50,14 +50,23 @@ inline void hang(void)
void board_init_f(ulong dummy) { +#ifdef CONFIG_SOC_DM365 dm36x_lowlevel_init(0); +#endif +#ifdef CONFIG_SOC_DA8XX + arch_cpu_init(); +#endif relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE); }
void board_init_r(gd_t *id, ulong dummy) { - +#ifdef CONFIG_SOC_DM365 nand_init(); puts("Nand boot...\n"); nand_boot(); +#endif +#ifdef CONFIG_SOC_DA8XX + hang(); +#endif }

Hello Christian,
Christian Riesch wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/Makefile | 3 ++- arch/arm/cpu/arm926ejs/davinci/spl.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index 2105ec5..99df0df 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -37,7 +37,8 @@ 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 +COBJS-$(CONFIG_SOC_DM365) += dm365_lowlevel.o +COBJS-$(CONFIG_SOC_DA8XX) += da850_lowlevel.o endif
SOBJS = reset.o diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index d9b9398..bb4ee13 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -50,14 +50,23 @@ inline void hang(void)
void board_init_f(ulong dummy) { +#ifdef CONFIG_SOC_DM365 dm36x_lowlevel_init(0); +#endif +#ifdef CONFIG_SOC_DA8XX
- arch_cpu_init();
+#endif relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE); }
void board_init_r(gd_t *id, ulong dummy) {
+#ifdef CONFIG_SOC_DM365 nand_init(); puts("Nand boot...\n"); nand_boot(); +#endif +#ifdef CONFIG_SOC_DA8XX
- hang();
+#endif
Maybe a comment why you call hang() here (I think because SPL code is not yet tried out on da8xx) would help here. Beside of that:
Acked-by: Heiko Schocher hs@denx.de
bye, Heiko

Hello Heiko, thanks for your comments!
On Wed, Nov 16, 2011 at 7:35 AM, Heiko Schocher hs@denx.de wrote:
Christian Riesch wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/Makefile | 3 ++- arch/arm/cpu/arm926ejs/davinci/spl.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
[...]
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index d9b9398..bb4ee13 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
[...]
void board_init_r(gd_t *id, ulong dummy) {
+#ifdef CONFIG_SOC_DM365 nand_init(); puts("Nand boot...\n"); nand_boot(); +#endif +#ifdef CONFIG_SOC_DA8XX
- hang();
+#endif
Maybe a comment why you call hang() here (I think because SPL code is not yet tried out on da8xx) would help here.
The code is tested on da8xx (the AM1808 I tested it on is part of the da8xx family) but as I didn't yet look into loading an u-boot image from SPI flash (which I should do here for the da850evm) I just call hang() here. I commented on this in the cover message:
---snip--- This patchset is not a complete implementation, it is missing the code that is actually used to load u-boot from SPI flash to the DDR memory. The code just hangs after the initialization is done. But I submit it nevertheless as RFC and I am looking forward to your comments. ---snip---
Regards, Christian

Hello Christian,
Christian Riesch wrote:
Hello Heiko, thanks for your comments!
On Wed, Nov 16, 2011 at 7:35 AM, Heiko Schocher hs@denx.de wrote:
Christian Riesch wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/Makefile | 3 ++- arch/arm/cpu/arm926ejs/davinci/spl.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
[...]
diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index d9b9398..bb4ee13 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
[...]
void board_init_r(gd_t *id, ulong dummy) {
+#ifdef CONFIG_SOC_DM365 nand_init(); puts("Nand boot...\n"); nand_boot(); +#endif +#ifdef CONFIG_SOC_DA8XX
hang();
+#endif
Maybe a comment why you call hang() here (I think because SPL code is not yet tried out on da8xx) would help here.
The code is tested on da8xx (the AM1808 I tested it on is part of the da8xx family) but as I didn't yet look into loading an u-boot image from SPI flash (which I should do here for the da850evm) I just call hang() here. I commented on this in the cover message:
---snip--- This patchset is not a complete implementation, it is missing the code that is actually used to load u-boot from SPI flash to the DDR memory. The code just hangs after the initialization is done. But I submit it nevertheless as RFC and I am looking forward to your comments. ---snip---
Ups .. sorry ... missed it. Hmm... have you no u-boot image on this board (for example in nand)? Then you could load as an example this code ...
Hmm.. as it is a RFC ... maybe we should go the following way: (just a fast idea):
create new file u-boot:spl/boot.c:
/* could be board specific */ static int __weak get_boot_method(void) { #if defined SPL_BOOTMETHOD_NAND return SPL_BOOTMETHOD_NAND #endif #if defined SPL_BOOTMETHOD_SPI return SPL_BOOTMETHOD_SPI #endif [...]
/* * if more options are defined for one board * board specific code has to be written, to decide * which boot method is used (gpio pin?) * So it is possible to boot from different * devices... */ }
void board_init_r(gd_t *id, ulong dummy) { int boot_method;
boot_method = get_boot_method(); switch (boot_ethod) { #if defined SPL_BOOTMETHOD_NAND case SPL_BOOTMETHOD_NAND: nand_init(); puts("Nand boot...\n"); nand_boot(); break; #endif #if defined SPL_BOOTMETHOD_SPI case SPL_BOOTMETHOD_NAND: puts("SPI boot...\n"); break; #endif default: /* error */ puts("no valid boot method\n"); hang(); break; } }
That should be usable from other architectures too ...
bye, Heiko

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de --- arch/arm/lib/eabi_compat.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..2d49a28 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,10 +13,13 @@
int raise (int signum) { +#ifndef CONFIG_SPL_BUILD printf("raise: Signal # %d caught\n", signum); +#endif return 0; }
+ /* Dummy function to avoid linker complaints */ void __aeabi_unwind_cpp_pr0(void) {

On Tue, Nov 15, 2011 at 3:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de
arch/arm/lib/eabi_compat.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..2d49a28 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,10 +13,13 @@
int raise (int signum) { +#ifndef CONFIG_SPL_BUILD printf("raise: Signal # %d caught\n", signum); +#endif return 0; }
/* Dummy function to avoid linker complaints */ void __aeabi_unwind_cpp_pr0(void) {
printf exists for omap3 SPL. But perhaps the question is, why isn't this code being gc'd away in your SPL?

Hi Tom, thanks for your comments!
On Tue, Nov 15, 2011 at 6:50 PM, Tom Rini tom.rini@gmail.com wrote:
On Tue, Nov 15, 2011 at 3:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de
arch/arm/lib/eabi_compat.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..2d49a28 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,10 +13,13 @@
int raise (int signum) { +#ifndef CONFIG_SPL_BUILD printf("raise: Signal # %d caught\n", signum); +#endif return 0; }
/* Dummy function to avoid linker complaints */ void __aeabi_unwind_cpp_pr0(void) {
printf exists for omap3 SPL.
Ok, I guess I should make this something like #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT).
But perhaps the question is, why isn't this code being gc'd away in your SPL?
I must admit that I have absolutely no idea what this function is used for. I only see a linker error due to the missing printf. Any ideas?
Christian

On Wed, Nov 16, 2011 at 12:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
Hi Tom, thanks for your comments!
On Tue, Nov 15, 2011 at 6:50 PM, Tom Rini tom.rini@gmail.com wrote:
On Tue, Nov 15, 2011 at 3:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de
arch/arm/lib/eabi_compat.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..2d49a28 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,10 +13,13 @@
int raise (int signum) { +#ifndef CONFIG_SPL_BUILD printf("raise: Signal # %d caught\n", signum); +#endif return 0; }
/* Dummy function to avoid linker complaints */ void __aeabi_unwind_cpp_pr0(void) {
printf exists for omap3 SPL.
Ok, I guess I should make this something like #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT).
If that fixes the link error, yes :)
But perhaps the question is, why isn't this code being gc'd away in your SPL?
I must admit that I have absolutely no idea what this function is used for. I only see a linker error due to the missing printf. Any ideas?
Not off-hand, but you can always run a for o in `find objdir -name *.o`;do echo $o ; arm-linux-gnueabi-nm $o | grep raise;done or so and see where it's coming from :)

This patch replaces the pinmuxing functions from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by those of arch/arm/cpu/arm926ejs/davinci/pinmux.c
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com --- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++++++++-------------- 1 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..8dd897b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -30,6 +30,7 @@ #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> +#include <asm/arch/davinci_misc.h>
void da850_waitloop(unsigned long loopcnt) { @@ -248,6 +249,16 @@ void board_gpio_init(void) return; }
+/* UART pin muxer settings */ +static const struct pinmux_config uart_pins[] = { +#if CONFIG_SYS_NS16550_COM1 == DAVINCI_UART2_BASE + { pinmux(0), 4, 6 }, + { pinmux(0), 4, 7 }, + { pinmux(4), 2, 4 }, + { pinmux(4), 2, 5 } +#endif +}; + int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +268,8 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, CONFIG_SYS_DA850_SYSCFG_SUSPSRC);
- /* Setup Pinmux */ - da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0); - da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1); - da850_pinmux_ctl(2, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX2); - da850_pinmux_ctl(3, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX3); - da850_pinmux_ctl(4, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX4); - da850_pinmux_ctl(5, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX5); - da850_pinmux_ctl(6, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX6); - da850_pinmux_ctl(7, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX7); - da850_pinmux_ctl(8, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX8); - da850_pinmux_ctl(9, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX9); - da850_pinmux_ctl(10, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX10); - da850_pinmux_ctl(11, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX11); - da850_pinmux_ctl(12, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX12); - da850_pinmux_ctl(13, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX13); - da850_pinmux_ctl(14, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX14); - da850_pinmux_ctl(15, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX15); - da850_pinmux_ctl(16, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX16); - da850_pinmux_ctl(17, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX17); - da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18); - da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19); + /* setup serial port */ + davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
/* PLL setup */ da850_pll_init(davinci_pllc0_regs, CONFIG_SYS_DA850_PLL0_PLLM);

Hello Christian,
Christian Riesch wrote:
This patch replaces the pinmuxing functions from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by those of arch/arm/cpu/arm926ejs/davinci/pinmux.c
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++++++++-------------- 1 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..8dd897b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -30,6 +30,7 @@ #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> +#include <asm/arch/davinci_misc.h>
void da850_waitloop(unsigned long loopcnt) { @@ -248,6 +249,16 @@ void board_gpio_init(void) return; }
+/* UART pin muxer settings */ +static const struct pinmux_config uart_pins[] = { +#if CONFIG_SYS_NS16550_COM1 == DAVINCI_UART2_BASE
- { pinmux(0), 4, 6 },
- { pinmux(0), 4, 7 },
- { pinmux(4), 2, 4 },
- { pinmux(4), 2, 5 }
+#endif +};
int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +268,8 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, CONFIG_SYS_DA850_SYSCFG_SUSPSRC);
- /* Setup Pinmux */
- da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0);
- da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1);
- da850_pinmux_ctl(2, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX2);
- da850_pinmux_ctl(3, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX3);
- da850_pinmux_ctl(4, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX4);
- da850_pinmux_ctl(5, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX5);
- da850_pinmux_ctl(6, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX6);
- da850_pinmux_ctl(7, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX7);
- da850_pinmux_ctl(8, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX8);
- da850_pinmux_ctl(9, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX9);
- da850_pinmux_ctl(10, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX10);
- da850_pinmux_ctl(11, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX11);
- da850_pinmux_ctl(12, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX12);
- da850_pinmux_ctl(13, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX13);
- da850_pinmux_ctl(14, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX14);
- da850_pinmux_ctl(15, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX15);
- da850_pinmux_ctl(16, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX16);
- da850_pinmux_ctl(17, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX17);
- da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18);
- da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19);
- /* setup serial port */
- davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
Why only the uart pins? We could use here something like "board_pins" and initialize here all pins for the board?
I reworked this for the enbw_cmc board too, and removed also the CONFIG_SYS_DA850_PINMUX* defines complete ... but I am not really happy with it. Why?
We have for example on the am1808 19 * 8 = 152 pins to setup up
If using the CONFIG_SYS_DA850_PINMUX* defines we have 19 register- writes and have setup them all (And you must think about all your pins, if we use such a struct, not defined pins are in default state ... which is good or bad ...)
With using davinci_configure_pin_mux() we have 152 * (read, write and some logic operations) ... and I have to code a "static const struct pinmux_config board_pins" with 152 lines in the code ...
What do others think?
bye, Heiko

Hello Heiko,
On Wed, Nov 16, 2011 at 7:49 AM, Heiko Schocher hs@denx.de wrote:
Hello Christian,
Christian Riesch wrote:
This patch replaces the pinmuxing functions from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by those of arch/arm/cpu/arm926ejs/davinci/pinmux.c
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++++++++-------------- 1 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..8dd897b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -30,6 +30,7 @@ #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> +#include <asm/arch/davinci_misc.h>
void da850_waitloop(unsigned long loopcnt) { @@ -248,6 +249,16 @@ void board_gpio_init(void) return; }
+/* UART pin muxer settings */ +static const struct pinmux_config uart_pins[] = { +#if CONFIG_SYS_NS16550_COM1 == DAVINCI_UART2_BASE
- { pinmux(0), 4, 6 },
- { pinmux(0), 4, 7 },
- { pinmux(4), 2, 4 },
- { pinmux(4), 2, 5 }
+#endif +};
int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +268,8 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, CONFIG_SYS_DA850_SYSCFG_SUSPSRC);
- /* Setup Pinmux */
- da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0);
- da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1);
- da850_pinmux_ctl(2, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX2);
- da850_pinmux_ctl(3, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX3);
- da850_pinmux_ctl(4, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX4);
- da850_pinmux_ctl(5, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX5);
- da850_pinmux_ctl(6, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX6);
- da850_pinmux_ctl(7, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX7);
- da850_pinmux_ctl(8, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX8);
- da850_pinmux_ctl(9, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX9);
- da850_pinmux_ctl(10, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX10);
- da850_pinmux_ctl(11, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX11);
- da850_pinmux_ctl(12, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX12);
- da850_pinmux_ctl(13, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX13);
- da850_pinmux_ctl(14, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX14);
- da850_pinmux_ctl(15, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX15);
- da850_pinmux_ctl(16, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX16);
- da850_pinmux_ctl(17, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX17);
- da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18);
- da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19);
- /* setup serial port */
- davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
Why only the uart pins? We could use here something like "board_pins" and initialize here all pins for the board?
Because only the UART pins are required here. Since the CPU has already loaded the SPL from SPI flash or is executing the SPL from NOR flash or whatever, the pins for memory access are already configured. Later the board specific file can do all the configuration that it actually needs, see board/davinci/da8xxevm/da850evm.c.
I reworked this for the enbw_cmc board too, and removed also the CONFIG_SYS_DA850_PINMUX* defines complete ... but I am not really happy with it. Why?
We have for example on the am1808 19 * 8 = 152 pins to setup up
If using the CONFIG_SYS_DA850_PINMUX* defines we have 19 register- writes and have setup them all (And you must think about all your pins, if we use such a struct, not defined pins are in default state ... which is good or bad ...)
With using davinci_configure_pin_mux() we have 152 * (read, write and some logic operations)
Actually the number of read, writes, logic operations will depend on the number of GPIO pins you use on your board. I guess you will not change the pinmux settings of pins you didn't connect on your board. But yes, these are a lot of operations that need to be done.
... and I have to code a "static const
struct pinmux_config board_pins" with 152 lines in the code ...
How about using an approach like in board/davinci/da8xxevm/da850evm.c. There we have several structs like
static const struct pinmux config_spi1_pins[] = { ... }
that defines pinmux for groups of pins that are usually used together.
Later, these groups are put together in
static const struct pinmux_resource pinmuxes[] = {
}
What do others think?
bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Heiko, sorry for my last (incomplete) mail.
On Wed, Nov 16, 2011 at 7:49 AM, Heiko Schocher hs@denx.de wrote:
Hello Christian,
Christian Riesch wrote:
This patch replaces the pinmuxing functions from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by those of arch/arm/cpu/arm926ejs/davinci/pinmux.c
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++++++++-------------- 1 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..8dd897b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -30,6 +30,7 @@ #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> +#include <asm/arch/davinci_misc.h>
void da850_waitloop(unsigned long loopcnt) { @@ -248,6 +249,16 @@ void board_gpio_init(void) return; }
+/* UART pin muxer settings */ +static const struct pinmux_config uart_pins[] = { +#if CONFIG_SYS_NS16550_COM1 == DAVINCI_UART2_BASE
- { pinmux(0), 4, 6 },
- { pinmux(0), 4, 7 },
- { pinmux(4), 2, 4 },
- { pinmux(4), 2, 5 }
+#endif +};
int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +268,8 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, CONFIG_SYS_DA850_SYSCFG_SUSPSRC);
- /* Setup Pinmux */
- da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0);
- da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1);
- da850_pinmux_ctl(2, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX2);
- da850_pinmux_ctl(3, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX3);
- da850_pinmux_ctl(4, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX4);
- da850_pinmux_ctl(5, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX5);
- da850_pinmux_ctl(6, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX6);
- da850_pinmux_ctl(7, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX7);
- da850_pinmux_ctl(8, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX8);
- da850_pinmux_ctl(9, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX9);
- da850_pinmux_ctl(10, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX10);
- da850_pinmux_ctl(11, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX11);
- da850_pinmux_ctl(12, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX12);
- da850_pinmux_ctl(13, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX13);
- da850_pinmux_ctl(14, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX14);
- da850_pinmux_ctl(15, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX15);
- da850_pinmux_ctl(16, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX16);
- da850_pinmux_ctl(17, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX17);
- da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18);
- da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19);
- /* setup serial port */
- davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
Why only the uart pins? We could use here something like "board_pins" and initialize here all pins for the board?
Because only the UART pins are required here. Since the CPU has already loaded the SPL from SPI flash or is executing the SPL from NOR flash or whatever, the pins for memory access are already configured. Later the board specific file can do all the configuration that it actually needs, see board/davinci/da8xxevm/da850evm.c.
I reworked this for the enbw_cmc board too, and removed also the CONFIG_SYS_DA850_PINMUX* defines complete ... but I am not really happy with it. Why?
We have for example on the am1808 19 * 8 = 152 pins to setup up
If using the CONFIG_SYS_DA850_PINMUX* defines we have 19 register- writes and have setup them all (And you must think about all your pins, if we use such a struct, not defined pins are in default state ... which is good or bad ...)
With using davinci_configure_pin_mux() we have 152 * (read, write and some logic operations) ...
Actually the number of read, writes, logic operations will depend on the number of GPIO pins you use on your board. I guess you will not change the pinmux settings of pins you didn't connect on your board. But yes, these are a lot of operations that need to be done.
and I have to code a "static const struct pinmux_config board_pins" with 152 lines in the code ...
How about using an approach like in board/davinci/da8xxevm/da850evm.c. There we have several structs like
static const struct pinmux config_spi1_pins[] = { ... }
that defines pinmux for groups of pins that are usually used together.
Later, these groups are put together in
static const struct pinmux_resource pinmuxes[] = {
What do others think?
bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hello Heiko, I hope this is the complete mail now :-/
On Wed, Nov 16, 2011 at 7:49 AM, Heiko Schocher hs@denx.de wrote:
Hello Christian,
Christian Riesch wrote:
This patch replaces the pinmuxing functions from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by those of arch/arm/cpu/arm926ejs/davinci/pinmux.c
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 34 +++++++++-------------- 1 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..8dd897b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -30,6 +30,7 @@ #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> +#include <asm/arch/davinci_misc.h>
void da850_waitloop(unsigned long loopcnt) { @@ -248,6 +249,16 @@ void board_gpio_init(void) return; }
+/* UART pin muxer settings */ +static const struct pinmux_config uart_pins[] = { +#if CONFIG_SYS_NS16550_COM1 == DAVINCI_UART2_BASE
{ pinmux(0), 4, 6 },
{ pinmux(0), 4, 7 },
{ pinmux(4), 2, 4 },
{ pinmux(4), 2, 5 }
+#endif +};
int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +268,8 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, CONFIG_SYS_DA850_SYSCFG_SUSPSRC);
/* Setup Pinmux */
da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0);
da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1);
da850_pinmux_ctl(2, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX2);
da850_pinmux_ctl(3, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX3);
da850_pinmux_ctl(4, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX4);
da850_pinmux_ctl(5, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX5);
da850_pinmux_ctl(6, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX6);
da850_pinmux_ctl(7, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX7);
da850_pinmux_ctl(8, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX8);
da850_pinmux_ctl(9, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX9);
da850_pinmux_ctl(10, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX10);
da850_pinmux_ctl(11, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX11);
da850_pinmux_ctl(12, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX12);
da850_pinmux_ctl(13, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX13);
da850_pinmux_ctl(14, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX14);
da850_pinmux_ctl(15, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX15);
da850_pinmux_ctl(16, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX16);
da850_pinmux_ctl(17, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX17);
da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18);
da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19);
/* setup serial port */
davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
Why only the uart pins? We could use here something like "board_pins" and initialize here all pins for the board?
Because only the UART pins are required here. Since the CPU has already loaded the SPL from SPI flash or is executing the SPL from NOR flash or whatever, the pins for memory access are already configured. Later the board specific file can do all the configuration that it actually needs, see board/davinci/da8xxevm/da850evm.c.
I reworked this for the enbw_cmc board too, and removed also the CONFIG_SYS_DA850_PINMUX* defines complete ... but I am not really happy with it. Why?
We have for example on the am1808 19 * 8 = 152 pins to setup up
If using the CONFIG_SYS_DA850_PINMUX* defines we have 19 register- writes and have setup them all (And you must think about all your pins, if we use such a struct, not defined pins are in default state ... which is good or bad ...)
With using davinci_configure_pin_mux() we have 152 * (read, write and some logic operations) ...
Actually the number of read, writes, logic operations will depend on the number of GPIO pins you use on your board. I guess you will not change the pinmux settings of pins you didn't connect on your board. But yes, these are a lot of operations that need to be done.
and I have to code a "static const struct pinmux_config board_pins" with 152 lines in the code ...
How about using an approach like in board/davinci/da8xxevm/da850evm.c. There we have several structs like
static const struct pinmux_config spi1_pins[] = { ... }
that defines pinmux for groups of pins that are usually used together.
Later, these groups are put together in
static const struct pinmux_resource pinmuxes[] = { { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */ { DAVINCI_LPSC_SPI1 }, /* Serial Flash */ { DAVINCI_LPSC_EMAC }, /* image download */ { DAVINCI_LPSC_UART2 }, /* console */ { DAVINCI_LPSC_GPIO }, };
We could move the pinmux_config structs to a header file which would reduce the code in your board config file to a few lines, you only would need a pinmux_resource struct.
Still we need to do pinmuxing for UART (and maybe also for other pins) in the SPL. How do you like the approach in static void set_mux_conf_regs(void) in arch/arm/cpu/armv7/omap-common/hwinit-common.c? Depending on the context either the pins that are essential for the SPL or all other pins are configured.
This would at least reduce the number of code lines that you need for a new board. And this code would be much easier to understand than this list of magic numbers.
What do others think?
bye, Heiko
Regards, Christian

Hello Christian,
Christian Riesch wrote:
Hello Heiko, I hope this is the complete mail now :-/
seems so ...
On Wed, Nov 16, 2011 at 7:49 AM, Heiko Schocher hs@denx.de wrote:
Hello Christian,
Christian Riesch wrote:
[...]
da850_pinmux_ctl(18, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX18);
da850_pinmux_ctl(19, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX19);
/* setup serial port */
davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins));
Why only the uart pins? We could use here something like "board_pins" and initialize here all pins for the board?
Because only the UART pins are required here. Since the CPU has
And if you need some other pins, for example gpio?
already loaded the SPL from SPI flash or is executing the SPL from NOR flash or whatever, the pins for memory access are already configured. Later the board specific file can do all the configuration that it actually needs, see board/davinci/da8xxevm/da850evm.c.
Yes, but, why not setup all pinmux settings immediately in the spl code?
I reworked this for the enbw_cmc board too, and removed also the CONFIG_SYS_DA850_PINMUX* defines complete ... but I am not really happy with it. Why?
We have for example on the am1808 19 * 8 = 152 pins to setup up
If using the CONFIG_SYS_DA850_PINMUX* defines we have 19 register- writes and have setup them all (And you must think about all your pins, if we use such a struct, not defined pins are in default state ... which is good or bad ...)
With using davinci_configure_pin_mux() we have 152 * (read, write and some logic operations) ...
Actually the number of read, writes, logic operations will depend on the number of GPIO pins you use on your board. I guess you will not change the pinmux settings of pins you didn't connect on your board. But yes, these are a lot of operations that need to be done.
Not with the define approach! ... There we have only 19 register writes.
and I have to code a "static const struct pinmux_config board_pins" with 152 lines in the code ...
How about using an approach like in board/davinci/da8xxevm/da850evm.c. There we have several structs like
static const struct pinmux_config spi1_pins[] = { ... }
that defines pinmux for groups of pins that are usually used together.
Later, these groups are put together in
static const struct pinmux_resource pinmuxes[] = { { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */ { DAVINCI_LPSC_SPI1 }, /* Serial Flash */ { DAVINCI_LPSC_EMAC }, /* image download */ { DAVINCI_LPSC_UART2 }, /* console */ { DAVINCI_LPSC_GPIO }, };
You mean here:
static const struct pinmux_resource pinmuxes[] = { #ifdef CONFIG_SPI_FLASH PINMUX_ITEM(spi1_pins), #endif PINMUX_ITEM(uart_pins), PINMUX_ITEM(i2c_pins), #ifdef CONFIG_NAND_DAVINCI PINMUX_ITEM(nand_pins), #elif defined(CONFIG_USE_NOR) PINMUX_ITEM(nor_pins), #endif };
right?
We could move the pinmux_config structs to a header file which would reduce the code in your board config file to a few lines, you only would need a pinmux_resource struct.
Yep, if we go this way, we should move them to a include file, so we can use them for all da8xx boards.
Still we need to do pinmuxing for UART (and maybe also for other pins) in the SPL. How do you like the approach in static void set_mux_conf_regs(void) in arch/arm/cpu/armv7/omap-common/hwinit-common.c? Depending on the context either the pins that are essential for the SPL or all other pins are configured.
Yes, looks good to me.
This would at least reduce the number of code lines that you need for a new board. And this code would be much easier to understand than this list of magic numbers.
Yes. Don't understand me wrong against the "struct pinmux_resource" approach, it looks good to me also, and I agree this is (maybe) better to read (maybe, because if something is setup wrong, you need in both approaches the help from the doc ...), but I didn't get the disadvantages of "my" define approach setting up the pinmux in one place ...
Advantages of it I think: - if settings are wrong i find it fast (because in one place) - setup with a minimum nr of instructions. - smaller code size - if using the pinmux setup tool from TI (URL: http://www-s.ti.com/sc/techlit/spraba2.zip) you can easy setup all pins and gets a check for pinmux conflicts for free ... and it exports a header file, from where you easy can get the values for the CONFIG_SYS_DA850_PINMUX* defines ... if you want to use this tool, it is more work to convert this to the "struct pinmux_resource" approach ...
So let us now decide which way to go ... (BTW: If we decide to go the "struct pinmux_resource" approach, can you provide a patch, which moves the pinmux settings from the existing da8xx boards to an include file (whats with arch/arm/include/asm/arch-davinci/da8xx_pinmux.h)?
bye, Heiko

The code does not actually load u-boot from the SPI flash but rather illustrates how SPL support for this board could look like. This patch is for discussion only.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Nagabhushana Netagunte nagabhushana.netagunte@ti.com --- board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 70 +++++++++++++++++++++++++++++++- 2 files changed, 142 insertions(+), 1 deletions(-) create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
diff --git a/board/davinci/da8xxevm/u-boot-spl.lds b/board/davinci/da8xxevm/u-boot-spl.lds new file mode 100644 index 0000000..6f6e065 --- /dev/null +++ b/board/davinci/da8xxevm/u-boot-spl.lds @@ -0,0 +1,73 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, garyj@denx.de + * + * (C) Copyright 2008 + * Guennadi Liakhovetki, DENX Software Engineering, lg@denx.de + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ + LENGTH = CONFIG_SPL_MAX_SIZE } + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + __start = .; + arch/arm/cpu/arm926ejs/start.o (.text) + *(.text*) + } >.sram + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + + . = ALIGN(4); + .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + . = ALIGN(4); + .rel.dyn : { + __rel_dyn_start = .; + *(.rel*) + __rel_dyn_end = .; + } >.sram + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + } >.sram + + .bss : + { + . = ALIGN(4); + __bss_start = .; + *(.bss*) + . = ALIGN(4); + __bss_end__ = .; + } >.sram + + __image_copy_end = .; + _end = .; +} diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 4c14370..3a03822 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -29,7 +29,6 @@ #define CONFIG_DRIVER_TI_EMAC #define CONFIG_USE_SPIFLASH
- /* * SoC Configuration */ @@ -64,6 +63,40 @@ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define CONFIG_STACKSIZE (256*1024) /* regular stack */
+#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16)) + +/* + * PLL configuration + */ +#define CONFIG_SYS_DV_CLKMODE 0 +#define CONFIG_SYS_DA850_PLL0_POSTDIV 1 +#define CONFIG_SYS_DA850_PLL0_PLLDIV1 0x8000 +#define CONFIG_SYS_DA850_PLL0_PLLDIV2 0x8001 +#define CONFIG_SYS_DA850_PLL0_PLLDIV3 0x8002 +#define CONFIG_SYS_DA850_PLL0_PLLDIV4 0x8003 +#define CONFIG_SYS_DA850_PLL0_PLLDIV5 0x8002 +#define CONFIG_SYS_DA850_PLL0_PLLDIV6 CONFIG_SYS_DA850_PLL0_PLLDIV1 +#define CONFIG_SYS_DA850_PLL0_PLLDIV7 0x8005 + +#define CONFIG_SYS_DA850_PLL1_POSTDIV 1 +#define CONFIG_SYS_DA850_PLL1_PLLDIV1 0x8000 +#define CONFIG_SYS_DA850_PLL1_PLLDIV2 0x8001 +#define CONFIG_SYS_DA850_PLL1_PLLDIV3 0x8002 + +#define CONFIG_SYS_DA850_PLL0_PLLM 24 +#define CONFIG_SYS_DA850_PLL1_PLLM 21 + +/* + * DDR2 memory configuration + */ +#define CONFIG_SYS_DA850_DDR2_DDRPHYCR 0x000000C4 +#define CONFIG_SYS_DA850_DDR2_SDBCR 0x0A034622 +#define CONFIG_SYS_DA850_DDR2_SDBCR2 0x00000000 +#define CONFIG_SYS_DA850_DDR2_SDTIMR 0x184929C8 +#define CONFIG_SYS_DA850_DDR2_SDTIMR2 0xB80FC700 +#define CONFIG_SYS_DA850_DDR2_SDRCR 0x00000406 +#define CONFIG_SYS_DA850_DDR2_PBBPR 0x30 + /* * Serial Driver info */ @@ -75,6 +108,7 @@ #define CONFIG_CONS_INDEX 1 /* use UART0 for console */ #define CONFIG_BAUDRATE 115200 /* Default baud rate */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } +#define CONFIG_SYS_DA850_LPSC_UART DAVINCI_LPSC_UART2
#define CONFIG_SPI #define CONFIG_SPI_FLASH @@ -241,8 +275,42 @@ #undef CONFIG_CMD_ENV #endif
+/* defines for SPL */ +#define CONFIG_SPL +#define CONFIG_SPL_SPI_SUPPORT +#define CONFIG_SPL_SPI_FLASH_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_LDSCRIPT "$(BOARDDIR)/u-boot-spl.lds" +#define CONFIG_SPL_STACK 0x8001ff00 +#define CONFIG_SPL_TEXT_BASE 0x80000000 +#define CONFIG_SPL_MAX_SIZE (20<<10) + /* additions for new relocation code, must added to all boards */ #define CONFIG_SYS_SDRAM_BASE 0xc0000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \ GENERATED_GBL_DATA_SIZE) + + +/* dummy defines to allow build of code that is never used */ +#define CONFIG_SYS_DA850_PINMUX0 0 +#define CONFIG_SYS_DA850_PINMUX1 0 +#define CONFIG_SYS_DA850_PINMUX2 0 +#define CONFIG_SYS_DA850_PINMUX3 0 +#define CONFIG_SYS_DA850_PINMUX4 0 +#define CONFIG_SYS_DA850_PINMUX5 0 +#define CONFIG_SYS_DA850_PINMUX6 0 +#define CONFIG_SYS_DA850_PINMUX7 0 +#define CONFIG_SYS_DA850_PINMUX8 0 +#define CONFIG_SYS_DA850_PINMUX9 0 +#define CONFIG_SYS_DA850_PINMUX10 0 +#define CONFIG_SYS_DA850_PINMUX11 0 +#define CONFIG_SYS_DA850_PINMUX12 0 +#define CONFIG_SYS_DA850_PINMUX13 0 +#define CONFIG_SYS_DA850_PINMUX14 0 +#define CONFIG_SYS_DA850_PINMUX15 0 +#define CONFIG_SYS_DA850_PINMUX16 0 +#define CONFIG_SYS_DA850_PINMUX17 0 +#define CONFIG_SYS_DA850_PINMUX18 0 +#define CONFIG_SYS_DA850_PINMUX19 0 + #endif /* __CONFIG_H */

Support for variable length images like AIS image was introduced in commit f0662105b674a3874227316abf8536bebc9b5995. A parameter "-s" was also introduced to prohibit copying of the image file automatically in the main program. However, this parameter was implemented incorrectly and the image file was copied nevertheless.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Stefano Babic sbabic@denx.de Cc: Heiko Schocher hs@denx.de --- tools/mkimage.c | 97 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 49 insertions(+), 48 deletions(-)
diff --git a/tools/mkimage.c b/tools/mkimage.c index 36e28ec..eeb1b10 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -383,65 +383,66 @@ NXTARG: ; exit (EXIT_FAILURE); }
- if (!params.skipcpy && - (params.type == IH_TYPE_MULTI || - params.type == IH_TYPE_SCRIPT)) { - char *file = params.datafile; - uint32_t size; - - for (;;) { - char *sep = NULL; - - if (file) { - if ((sep = strchr(file, ':')) != NULL) { - *sep = '\0'; + if (!params.skipcpy) { + if (params.type == IH_TYPE_MULTI || + params.type == IH_TYPE_SCRIPT) { + char *file = params.datafile; + uint32_t size; + + for (;;) { + char *sep = NULL; + + if (file) { + if ((sep = strchr(file, ':')) != NULL) { + *sep = '\0'; + } + + if (stat (file, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + params.cmdname, file, strerror(errno)); + exit (EXIT_FAILURE); + } + size = cpu_to_uimage (sbuf.st_size); + } else { + size = 0; }
- if (stat (file, &sbuf) < 0) { - fprintf (stderr, "%s: Can't stat %s: %s\n", - params.cmdname, file, strerror(errno)); + if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { + fprintf (stderr, "%s: Write error on %s: %s\n", + params.cmdname, params.imagefile, + strerror(errno)); exit (EXIT_FAILURE); } - size = cpu_to_uimage (sbuf.st_size); - } else { - size = 0; - }
- if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { - fprintf (stderr, "%s: Write error on %s: %s\n", - params.cmdname, params.imagefile, - strerror(errno)); - exit (EXIT_FAILURE); - } + if (!file) { + break; + }
- if (!file) { - break; + if (sep) { + *sep = ':'; + file = sep + 1; + } else { + file = NULL; + } }
- if (sep) { - *sep = ':'; - file = sep + 1; - } else { - file = NULL; - } - } + file = params.datafile;
- file = params.datafile; - - for (;;) { - char *sep = strchr(file, ':'); - if (sep) { - *sep = '\0'; - copy_file (ifd, file, 1); - *sep++ = ':'; - file = sep; - } else { - copy_file (ifd, file, 0); - break; + for (;;) { + char *sep = strchr(file, ':'); + if (sep) { + *sep = '\0'; + copy_file (ifd, file, 1); + *sep++ = ':'; + file = sep; + } else { + copy_file (ifd, file, 0); + break; + } } + } else { + copy_file (ifd, params.datafile, 0); } - } else { - copy_file (ifd, params.datafile, 0); }
/* We're a bit of paranoid */

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Stefano Babic sbabic@denx.de Cc: Heiko Schocher hs@denx.de --- .gitignore | 1 + Makefile | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore index 70a11f7..1c5defd 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ /u-boot.dis /u-boot.lds /u-boot.ubl +/u-boot.ais /u-boot.dtb
# diff --git a/Makefile b/Makefile index 294c762..2fbc032 100644 --- a/Makefile +++ b/Makefile @@ -424,6 +424,13 @@ $(obj)u-boot.ubl: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin rm $(obj)u-boot-ubl.bin rm $(obj)spl/u-boot-spl-pad.bin
+$(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin + $(obj)tools/mkimage -s -n /dev/null -T aisimage \ + -e $(CONFIG_SPL_TEXT_BASE) -d $(obj)spl/u-boot-spl-pad.bin \ + $(obj)u-boot.ais + rm $(obj)spl/u-boot-spl-pad.bin + ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \ cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
participants (3)
-
Christian Riesch
-
Heiko Schocher
-
Tom Rini