[U-Boot] [PATCH v3 00/15] Add an SPL to boot the da850evm from SPI

Hi all,
Heiko Schocher added support 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).
Changes for v3: - removed definition of variables from header files (pinmux configs), added .c file for these definitions instead - removed noise and hardcoded values from drivers/mtd/spi/spi_spl_load.c - split large patches into smaller ones - replaced $(PAD_TO) in Makefile by $(CONFIG_SPL_MAX_SIZE) - moving the pinmux definitions for da830 is not included anymore, I'll do this later in a separate patch
Not changed for v3: - I kept the #if !defined... in arch/arm/lib/eabi_compat.c since I am afraid that this will cause problems when debugging SPLs, see my comment in [1].
Major changes for v2: - Added header files that contain the definition of the pinmux structs. - Added code that actually loads u-boot from SPI flash and starts it.
The first patches move the pinmux functions from the board tree to the arch tree and also use the in the lowlevel configuration in arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c.
Patches #8 and #9 fix two problems I had during development.
The other patches add the SPL and fix mkimage for the building of AIS images.
The patches apply on top of mainline u-boot and Heiko's patch
arm, arm926ejs: always do cpu critical inits http://patchwork.ozlabs.org/patch/124787/
To build run
make da850evm_config make u-boot.ais
Then program u-boot.ais to SPI flash on the da850evm.
Regards, Christian
[1] http://lists.denx.de/pipermail/u-boot/2011-November/110727.html [2] http://lists.denx.de/pipermail/u-boot/2011-November/109997.html
Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Christian Riesch (15): arm, davinci: Move pinmux functions from board to arch tree arm, hawkboard: Remove obsolete struct pinmux_config i2c_pins arm, da850evm: Do pinmux configuration for EMAC together with other pinmuxes arm, da850: Add pinmux configurations to the arch tree arm, da850evm: Use the pinmux configurations defined in the arch tree arm, hawkboard: Use the pinmux configurations defined in the arch tree arm, davinci: Remove duplication of pinmux configuration code arm, davinci: Fix clear bss loop for zero length bss arm: printf() is not available in some SPL configurations spl: display_options.o is required for SPI flash support in SPL sf: Add spi_boot() to allow booting from SPI flash in an SPL arm, davinci: Add SPL support for DA850 SoCs arm, da850evm: Add an SPL for SPI boot mkimage: Fix variable length header support arm, davinci: Add support for generating AIS images to the Makefile
.gitignore | 1 + Makefile | 13 ++ arch/arm/cpu/arm926ejs/davinci/Makefile | 6 +- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 36 +---- arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c | 166 ++++++++++++++++++++ .../arm/cpu/arm926ejs/davinci/pinmux.c | 0 arch/arm/cpu/arm926ejs/davinci/spl.c | 34 ++++- arch/arm/cpu/arm926ejs/start.S | 8 +- arch/arm/include/asm/arch-davinci/hardware.h | 2 + arch/arm/include/asm/arch-davinci/pinmux_defs.h | 50 ++++++ arch/arm/lib/eabi_compat.c | 2 + board/davinci/common/Makefile | 2 +- board/davinci/da8xxevm/config.mk | 5 + board/davinci/da8xxevm/da830evm.c | 2 - board/davinci/da8xxevm/da850evm.c | 163 ++++---------------- board/davinci/da8xxevm/hawkboard_nand_spl.c | 59 +------ board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++ board/davinci/ea20/ea20.c | 2 - doc/README.SPL | 1 + drivers/mtd/spi/Makefile | 6 + drivers/mtd/spi/spi_spl_load.c | 58 +++++++ include/configs/da850_am18xxevm.h | 1 + include/configs/da850evm.h | 54 +++++++ include/configs/hawkboard.h | 1 + include/spi_flash.h | 3 + lib/Makefile | 2 + nand_spl/board/davinci/da8xxevm/Makefile | 11 +- tools/mkimage.c | 97 ++++++------ 28 files changed, 584 insertions(+), 274 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c rename board/davinci/common/davinci_pinmux.c => arch/arm/cpu/arm926ejs/davinci/pinmux.c (100%) create mode 100644 arch/arm/include/asm/arch-davinci/pinmux_defs.h create mode 100644 board/davinci/da8xxevm/config.mk create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds create mode 100644 drivers/mtd/spi/spi_spl_load.c

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Nick Thompson nick.thompson@gefanuc.com Cc: Stefano Babic sbabic@denx.de --- 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 3e9a3b6..06819a6 100644 --- a/arch/arm/include/asm/arch-davinci/hardware.h +++ b/arch/arm/include/asm/arch-davinci/hardware.h @@ -480,6 +480,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 32b17ce..0fdccac 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 Cc: Heiko Schocher hs@denx.de Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Nick Thompson nick.thompson@gefanuc.com Cc: Stefano Babic sbabic@denx.de
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%)
Acked-by: Heiko Schocher hs@denx.de
bye, Heiko

Christian,
On 25/11/11 12:37, Christian Riesch wrote:
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Nick Thompson nick.thompson@gefanuc.com Cc: Stefano Babic sbabic@denx.de
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%)
The da830 parts of the complete patch set are pretty minor, but FWIW:
Acked-by: Nick Thompson nick.thompson@ge.com

The configuration in struct pinmux_config i2c_pins does not configure the pins for i2c but for uart. Since this function is already configured by struct pinmux_config uart2_pins the i2c_pins struct is obsolete.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Sandeep Paulraj s-paulraj@ti.com --- board/davinci/da8xxevm/hawkboard_nand_spl.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c index 0fdccac..fd130fa 100644 --- a/board/davinci/da8xxevm/hawkboard_nand_spl.c +++ b/board/davinci/da8xxevm/hawkboard_nand_spl.c @@ -71,15 +71,9 @@ static const struct pinmux_config uart2_pins[] = { { pinmux(4), 2, 5 } };
-static const struct pinmux_config i2c_pins[] = { - { pinmux(4), 2, 4 }, - { pinmux(4), 2, 5 } -}; - static const struct pinmux_resource pinmuxes[] = { PINMUX_ITEM(mii_pins), PINMUX_ITEM(mdio_pins), - PINMUX_ITEM(i2c_pins), PINMUX_ITEM(nand_pins), PINMUX_ITEM(uart2_pins), };

Hello Christian,
Christian Riesch wrote:
The configuration in struct pinmux_config i2c_pins does not configure the pins for i2c but for uart. Since this function is already configured by struct pinmux_config uart2_pins the i2c_pins struct is obsolete.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Sandeep Paulraj s-paulraj@ti.com
board/davinci/da8xxevm/hawkboard_nand_spl.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
Acked-by: Heiko Schocher<hsdenx.de>
bye, Heiko

Pinmux configuration for the EMAC was done in a separate call of davinci_configure_pin_mux(). This patch moves all the pinmux configuration that is done for this board to a common place.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com --- board/davinci/da8xxevm/da850evm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 844e585..9b68c5c 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -223,6 +223,9 @@ int misc_init_r(void) }
static const struct pinmux_resource pinmuxes[] = { +#ifdef CONFIG_DRIVER_TI_EMAC + PINMUX_ITEM(emac_pins), +#endif #ifdef CONFIG_SPI_FLASH PINMUX_ITEM(spi1_pins), #endif @@ -344,9 +347,6 @@ int board_init(void) #endif
#ifdef CONFIG_DRIVER_TI_EMAC - if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0) - return 1; - davinci_emac_mii_mode_sel(HAS_RMII); #endif /* CONFIG_DRIVER_TI_EMAC */

Hello Christian,
Christian Riesch wrote:
Pinmux configuration for the EMAC was done in a separate call of davinci_configure_pin_mux(). This patch moves all the pinmux configuration that is done for this board to a common place.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com
board/davinci/da8xxevm/da850evm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Acked-by: Heiko Schocherhs@denx.de
bye, Heiko

Up to now nearly every davinci board has separate code for the definition of pinmux configurations. This patch adds pinmux configurations for the DA850 SoCs to the arch tree which may later be used for all DA850 based boards.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Mike Frysinger vapier@gentoo.org --- arch/arm/cpu/arm926ejs/davinci/Makefile | 1 + arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c | 166 +++++++++++++++++++++++ arch/arm/include/asm/arch-davinci/pinmux_defs.h | 50 +++++++ 3 files changed, 217 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c create mode 100644 arch/arm/include/asm/arch-davinci/pinmux_defs.h
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index 2105ec5..4ac187a 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -33,6 +33,7 @@ COBJS-$(CONFIG_SOC_DM355) += dm355.o COBJS-$(CONFIG_SOC_DM365) += dm365.o COBJS-$(CONFIG_SOC_DM644X) += dm644x.o COBJS-$(CONFIG_SOC_DM646X) += dm646x.o +COBJS-$(CONFIG_SOC_DA850) += da850_pinmux.o COBJS-$(CONFIG_DRIVER_TI_EMAC) += lxt972.o dp83848.o et1011c.o ksz8873.o
ifdef CONFIG_SPL_BUILD diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c new file mode 100644 index 0000000..a3472ea --- /dev/null +++ b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c @@ -0,0 +1,166 @@ +/* + * Pinmux configurations for the DA850 SoCs + * + * Copyright (C) 2011 OMICRON electronics GmbH + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <common.h> +#include <asm/arch/davinci_misc.h> +#include <asm/arch/hardware.h> +#include <asm/arch/pinmux_defs.h> + +/* SPI pin muxer settings */ +const struct pinmux_config spi1_pins_base[] = { + { pinmux(5), 1, 2 }, /* SPI1_CLK */ + { pinmux(5), 1, 4 }, /* SPI1_SOMI */ + { pinmux(5), 1, 5 }, /* SPI1_SIMO */ +}; + +const struct pinmux_config spi1_pins_scs0[] = { + { pinmux(5), 1, 1 }, /* SPI1_SCS[0] */ +}; + +/* UART pin muxer settings */ +const struct pinmux_config uart2_pins_txrx[] = { + { pinmux(4), 2, 4 }, /* UART2_RXD */ + { pinmux(4), 2, 5 }, /* UART2_TXD */ +}; + +const struct pinmux_config uart2_pins_rtscts[] = { + { pinmux(0), 4, 6 }, /* UART2_RTS */ + { pinmux(0), 4, 7 }, /* UART2_CTS */ +}; + +/* EMAC pin muxer settings*/ +const struct pinmux_config emac_pins_rmii[] = { + { pinmux(14), 8, 2 }, /* RMII_TXD[1] */ + { pinmux(14), 8, 3 }, /* RMII_TXD[0] */ + { pinmux(14), 8, 4 }, /* RMII_TXEN */ + { pinmux(14), 8, 5 }, /* RMII_RXD[1] */ + { pinmux(14), 8, 6 }, /* RMII_RXD[0] */ + { pinmux(14), 8, 7 }, /* RMII_RXER */ + { pinmux(15), 8, 1 }, /* RMII_CRS_DV */ +}; + +const struct pinmux_config emac_pins_mii[] = { + { pinmux(2), 8, 1 }, /* MII_TXEN */ + { pinmux(2), 8, 2 }, /* MII_TXCLK */ + { pinmux(2), 8, 3 }, /* MII_COL */ + { pinmux(2), 8, 4 }, /* MII_TXD[3] */ + { pinmux(2), 8, 5 }, /* MII_TXD[2] */ + { pinmux(2), 8, 6 }, /* MII_TXD[1] */ + { pinmux(2), 8, 7 }, /* MII_TXD[0] */ + { pinmux(3), 8, 0 }, /* MII_RXCLK */ + { pinmux(3), 8, 1 }, /* MII_RXDV */ + { pinmux(3), 8, 2 }, /* MII_RXER */ + { pinmux(3), 8, 3 }, /* MII_CRS */ + { pinmux(3), 8, 4 }, /* MII_RXD[3] */ + { pinmux(3), 8, 5 }, /* MII_RXD[2] */ + { pinmux(3), 8, 6 }, /* MII_RXD[1] */ + { pinmux(3), 8, 7 }, /* MII_RXD[0] */ +}; + +const struct pinmux_config emac_pins_mdio[] = { + { pinmux(4), 8, 0 }, /* MDIO_CLK */ + { pinmux(4), 8, 1 }, /* MDIO_D */ +}; + +/* I2C pin muxer settings */ +const struct pinmux_config i2c0_pins[] = { + { pinmux(4), 2, 2 }, /* I2C0_SCL */ + { pinmux(4), 2, 3 }, /* I2C0_SDA */ +}; + +const struct pinmux_config i2c1_pins[] = { + { pinmux(4), 4, 4 }, /* I2C1_SCL */ + { pinmux(4), 4, 5 }, /* I2C1_SDA */ +}; + +/* EMIFA pin muxer settings */ +const struct pinmux_config emifa_pins_cs2[] = { + { pinmux(7), 1, 0 }, /* EMA_CS2 */ +}; + +const struct pinmux_config emifa_pins_cs3[] = { + { pinmux(7), 1, 1 }, /* EMA_CS[3] */ +}; + +const struct pinmux_config emifa_pins_cs4[] = { + { pinmux(7), 1, 2 }, /* EMA_CS[4] */ +}; + +const struct pinmux_config emifa_pins_nand[] = { + { pinmux(7), 1, 4 }, /* EMA_WE */ + { pinmux(7), 1, 5 }, /* EMA_OE */ + { pinmux(9), 1, 0 }, /* EMA_D[7] */ + { pinmux(9), 1, 1 }, /* EMA_D[6] */ + { pinmux(9), 1, 2 }, /* EMA_D[5] */ + { pinmux(9), 1, 3 }, /* EMA_D[4] */ + { pinmux(9), 1, 4 }, /* EMA_D[3] */ + { pinmux(9), 1, 5 }, /* EMA_D[2] */ + { pinmux(9), 1, 6 }, /* EMA_D[1] */ + { pinmux(9), 1, 7 }, /* EMA_D[0] */ + { pinmux(12), 1, 5 }, /* EMA_A[2] */ + { pinmux(12), 1, 6 }, /* EMA_A[1] */ +}; + +/* NOR pin muxer settings */ +const struct pinmux_config emifa_pins_nor[] = { + { pinmux(5), 1, 6 }, /* EMA_BA[1] */ + { pinmux(6), 1, 6 }, /* EMA_WAIT[1] */ + { pinmux(7), 1, 4 }, /* EMA_WE */ + { pinmux(7), 1, 5 }, /* EMA_OE */ + { pinmux(8), 1, 0 }, /* EMA_D[15] */ + { pinmux(8), 1, 1 }, /* EMA_D[14] */ + { pinmux(8), 1, 2 }, /* EMA_D[13] */ + { pinmux(8), 1, 3 }, /* EMA_D[12] */ + { pinmux(8), 1, 4 }, /* EMA_D[11] */ + { pinmux(8), 1, 5 }, /* EMA_D[10] */ + { pinmux(8), 1, 6 }, /* EMA_D[9] */ + { pinmux(8), 1, 7 }, /* EMA_D[8] */ + { pinmux(9), 1, 0 }, /* EMA_D[7] */ + { pinmux(9), 1, 1 }, /* EMA_D[6] */ + { pinmux(9), 1, 2 }, /* EMA_D[5] */ + { pinmux(9), 1, 3 }, /* EMA_D[4] */ + { pinmux(9), 1, 4 }, /* EMA_D[3] */ + { pinmux(9), 1, 5 }, /* EMA_D[2] */ + { pinmux(9), 1, 6 }, /* EMA_D[1] */ + { pinmux(9), 1, 7 }, /* EMA_D[0] */ + { pinmux(10), 1, 1 }, /* EMA_A[22] */ + { pinmux(10), 1, 2 }, /* EMA_A[21] */ + { pinmux(10), 1, 3 }, /* EMA_A[20] */ + { pinmux(10), 1, 4 }, /* EMA_A[19] */ + { pinmux(10), 1, 5 }, /* EMA_A[18] */ + { pinmux(10), 1, 6 }, /* EMA_A[17] */ + { pinmux(10), 1, 7 }, /* EMA_A[16] */ + { pinmux(11), 1, 0 }, /* EMA_A[15] */ + { pinmux(11), 1, 1 }, /* EMA_A[14] */ + { pinmux(11), 1, 2 }, /* EMA_A[13] */ + { pinmux(11), 1, 3 }, /* EMA_A[12] */ + { pinmux(11), 1, 4 }, /* EMA_A[11] */ + { pinmux(11), 1, 5 }, /* EMA_A[10] */ + { pinmux(11), 1, 6 }, /* EMA_A[9] */ + { pinmux(11), 1, 7 }, /* EMA_A[8] */ + { pinmux(12), 1, 0 }, /* EMA_A[7] */ + { pinmux(12), 1, 1 }, /* EMA_A[6] */ + { pinmux(12), 1, 2 }, /* EMA_A[5] */ + { pinmux(12), 1, 3 }, /* EMA_A[4] */ + { pinmux(12), 1, 4 }, /* EMA_A[3] */ + { pinmux(12), 1, 5 }, /* EMA_A[2] */ + { pinmux(12), 1, 6 }, /* EMA_A[1] */ + { pinmux(12), 1, 7 }, /* EMA_A[0] */ +}; diff --git a/arch/arm/include/asm/arch-davinci/pinmux_defs.h b/arch/arm/include/asm/arch-davinci/pinmux_defs.h new file mode 100644 index 0000000..191494b --- /dev/null +++ b/arch/arm/include/asm/arch-davinci/pinmux_defs.h @@ -0,0 +1,50 @@ +/* + * Pinmux configurations for the DAxxx SoCs + * + * Copyright (C) 2011 OMICRON electronics GmbH + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ASM_ARCH_PINMUX_DEFS_H +#define __ASM_ARCH_PINMUX_DEFS_H + +#include <asm/arch/davinci_misc.h> + +/* SPI pin muxer settings */ +extern const struct pinmux_config spi1_pins_base[3]; +extern const struct pinmux_config spi1_pins_scs0[1]; + +/* UART pin muxer settings */ +extern const struct pinmux_config uart2_pins_txrx[2]; +extern const struct pinmux_config uart2_pins_rtscts[2]; + +/* EMAC pin muxer settings*/ +extern const struct pinmux_config emac_pins_rmii[7]; +extern const struct pinmux_config emac_pins_mii[15]; +extern const struct pinmux_config emac_pins_mdio[2]; + +/* I2C pin muxer settings */ +extern const struct pinmux_config i2c0_pins[2]; +extern const struct pinmux_config i2c1_pins[2]; + +/* EMIFA pin muxer settings */ +extern const struct pinmux_config emifa_pins_cs2[1]; +extern const struct pinmux_config emifa_pins_cs3[1]; +extern const struct pinmux_config emifa_pins_cs4[1]; +extern const struct pinmux_config emifa_pins_nand[12]; +extern const struct pinmux_config emifa_pins_nor[43]; + +#endif

Hello Christian,
Christian Riesch wrote:
Up to now nearly every davinci board has separate code for the definition of pinmux configurations. This patch adds pinmux configurations for the DA850 SoCs to the arch tree which may later be used for all DA850 based boards.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Mike Frysinger vapier@gentoo.org
arch/arm/cpu/arm926ejs/davinci/Makefile | 1 + arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c | 166 +++++++++++++++++++++++ arch/arm/include/asm/arch-davinci/pinmux_defs.h | 50 +++++++ 3 files changed, 217 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c create mode 100644 arch/arm/include/asm/arch-davinci/pinmux_defs.h
Acked-by: Heiko Schocherhs@denx.de
bye, Heiko

The boards in board/davinci/da8xxevm/ define pinmux_config[] vectors that contain pinmux configurations for emac, uarts, memory controllers... In an earlier patch such pinmux configurations were added to the arch tree. This patch makes the da850evm use these definitions instead of defining its own.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com Cc: Mike Frysinger vapier@gentoo.org --- board/davinci/da8xxevm/da850evm.c | 153 ++++++------------------------------- include/configs/da850_am18xxevm.h | 1 + include/configs/da850evm.h | 1 + 3 files changed, 27 insertions(+), 128 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 9b68c5c..e827256 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -28,135 +28,14 @@ #include <asm/arch/hardware.h> #include <asm/arch/emif_defs.h> #include <asm/arch/emac_defs.h> +#include <asm/arch/pinmux_defs.h> #include <asm/io.h> #include <asm/arch/davinci_misc.h> #include <hwconfig.h>
DECLARE_GLOBAL_DATA_PTR;
-/* SPI0 pin muxer settings */ -static const struct pinmux_config spi1_pins[] = { - { pinmux(5), 1, 1 }, - { pinmux(5), 1, 2 }, - { pinmux(5), 1, 4 }, - { pinmux(5), 1, 5 } -}; - -/* UART pin muxer settings */ -static const struct pinmux_config uart_pins[] = { - { pinmux(0), 4, 6 }, - { pinmux(0), 4, 7 }, - { pinmux(4), 2, 4 }, - { pinmux(4), 2, 5 } -}; - #ifdef CONFIG_DRIVER_TI_EMAC -static const struct pinmux_config emac_pins[] = { -#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII - { pinmux(14), 8, 2 }, - { pinmux(14), 8, 3 }, - { pinmux(14), 8, 4 }, - { pinmux(14), 8, 5 }, - { pinmux(14), 8, 6 }, - { pinmux(14), 8, 7 }, - { pinmux(15), 8, 1 }, -#else /* ! CONFIG_DRIVER_TI_EMAC_USE_RMII */ - { pinmux(2), 8, 1 }, - { pinmux(2), 8, 2 }, - { pinmux(2), 8, 3 }, - { pinmux(2), 8, 4 }, - { pinmux(2), 8, 5 }, - { pinmux(2), 8, 6 }, - { pinmux(2), 8, 7 }, - { pinmux(3), 8, 0 }, - { pinmux(3), 8, 1 }, - { pinmux(3), 8, 2 }, - { pinmux(3), 8, 3 }, - { pinmux(3), 8, 4 }, - { pinmux(3), 8, 5 }, - { pinmux(3), 8, 6 }, - { pinmux(3), 8, 7 }, -#endif /* CONFIG_DRIVER_TI_EMAC_USE_RMII */ - { pinmux(4), 8, 0 }, - { pinmux(4), 8, 1 } -}; - -/* I2C pin muxer settings */ -static const struct pinmux_config i2c_pins[] = { - { pinmux(4), 2, 2 }, - { pinmux(4), 2, 3 } -}; - -#ifdef CONFIG_NAND_DAVINCI -const struct pinmux_config nand_pins[] = { - { pinmux(7), 1, 1 }, - { pinmux(7), 1, 2 }, - { pinmux(7), 1, 4 }, - { pinmux(7), 1, 5 }, - { pinmux(9), 1, 0 }, - { pinmux(9), 1, 1 }, - { pinmux(9), 1, 2 }, - { pinmux(9), 1, 3 }, - { pinmux(9), 1, 4 }, - { pinmux(9), 1, 5 }, - { pinmux(9), 1, 6 }, - { pinmux(9), 1, 7 }, - { pinmux(12), 1, 5 }, - { pinmux(12), 1, 6 } -}; -#elif defined(CONFIG_USE_NOR) -/* NOR pin muxer settings */ -const struct pinmux_config nor_pins[] = { - /* GP0[11] is required for NOR to work on Rev 3 EVMs */ - { pinmux(0), 8, 4 }, /* GP0[11] */ - { pinmux(5), 1, 6 }, - { pinmux(6), 1, 6 }, - { pinmux(7), 1, 0 }, - { pinmux(7), 1, 4 }, - { pinmux(7), 1, 5 }, - { pinmux(8), 1, 0 }, - { pinmux(8), 1, 1 }, - { pinmux(8), 1, 2 }, - { pinmux(8), 1, 3 }, - { pinmux(8), 1, 4 }, - { pinmux(8), 1, 5 }, - { pinmux(8), 1, 6 }, - { pinmux(8), 1, 7 }, - { pinmux(9), 1, 0 }, - { pinmux(9), 1, 1 }, - { pinmux(9), 1, 2 }, - { pinmux(9), 1, 3 }, - { pinmux(9), 1, 4 }, - { pinmux(9), 1, 5 }, - { pinmux(9), 1, 6 }, - { pinmux(9), 1, 7 }, - { pinmux(10), 1, 0 }, - { pinmux(10), 1, 1 }, - { pinmux(10), 1, 2 }, - { pinmux(10), 1, 3 }, - { pinmux(10), 1, 4 }, - { pinmux(10), 1, 5 }, - { pinmux(10), 1, 6 }, - { pinmux(10), 1, 7 }, - { pinmux(11), 1, 0 }, - { pinmux(11), 1, 1 }, - { pinmux(11), 1, 2 }, - { pinmux(11), 1, 3 }, - { pinmux(11), 1, 4 }, - { pinmux(11), 1, 5 }, - { pinmux(11), 1, 6 }, - { pinmux(11), 1, 7 }, - { pinmux(12), 1, 0 }, - { pinmux(12), 1, 1 }, - { pinmux(12), 1, 2 }, - { pinmux(12), 1, 3 }, - { pinmux(12), 1, 4 }, - { pinmux(12), 1, 5 }, - { pinmux(12), 1, 6 }, - { pinmux(12), 1, 7 } -}; -#endif - #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII #define HAS_RMII 1 #else @@ -222,20 +101,38 @@ int misc_init_r(void) return 0; }
+static const struct pinmux_config gpio_pins[] = { +#ifdef CONFIG_USE_NOR + /* GP0[11] is required for NOR to work on Rev 3 EVMs */ + { pinmux(0), 8, 4 }, /* GP0[11] */ +#endif +}; + static const struct pinmux_resource pinmuxes[] = { #ifdef CONFIG_DRIVER_TI_EMAC - PINMUX_ITEM(emac_pins), + PINMUX_ITEM(emac_pins_mdio), +#ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII + PINMUX_ITEM(emac_pins_rmii), +#else + PINMUX_ITEM(emac_pins_mii), +#endif #endif #ifdef CONFIG_SPI_FLASH - PINMUX_ITEM(spi1_pins), + PINMUX_ITEM(spi1_pins_base), + PINMUX_ITEM(spi1_pins_scs0), #endif - PINMUX_ITEM(uart_pins), - PINMUX_ITEM(i2c_pins), + PINMUX_ITEM(uart2_pins_txrx), + PINMUX_ITEM(uart2_pins_rtscts), + PINMUX_ITEM(i2c0_pins), #ifdef CONFIG_NAND_DAVINCI - PINMUX_ITEM(nand_pins), + PINMUX_ITEM(emifa_pins_cs3), + PINMUX_ITEM(emifa_pins_cs4), + PINMUX_ITEM(emifa_pins_nand), #elif defined(CONFIG_USE_NOR) - PINMUX_ITEM(nor_pins), + PINMUX_ITEM(emifa_pins_cs2), + PINMUX_ITEM(emifa_pins_nor), #endif + PINMUX_ITEM(gpio_pins), };
static const struct lpsc_resource lpsc[] = { diff --git a/include/configs/da850_am18xxevm.h b/include/configs/da850_am18xxevm.h index 92b83ff..2885ece 100644 --- a/include/configs/da850_am18xxevm.h +++ b/include/configs/da850_am18xxevm.h @@ -36,6 +36,7 @@ #define CONFIG_MACH_DAVINCI_DA850_EVM #define CONFIG_ARM926EJS /* arm926ejs CPU core */ #define CONFIG_SOC_DA8XX /* TI DA8xx SoC */ +#define CONFIG_SOC_DA850 /* TI DA850 SoC */ #define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID) #define CONFIG_SYS_OSCIN_FREQ 24000000 #define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 4c14370..2e2aa19 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -36,6 +36,7 @@ #define CONFIG_MACH_DAVINCI_DA850_EVM #define CONFIG_ARM926EJS /* arm926ejs CPU core */ #define CONFIG_SOC_DA8XX /* TI DA8xx SoC */ +#define CONFIG_SOC_DA850 /* TI DA850 SoC */ #define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID) #define CONFIG_SYS_OSCIN_FREQ 24000000 #define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE

Hello Christian,
Christian Riesch wrote:
The boards in board/davinci/da8xxevm/ define pinmux_config[] vectors that contain pinmux configurations for emac, uarts, memory controllers... In an earlier patch such pinmux configurations were added to the arch tree. This patch makes the da850evm use these definitions instead of defining its own.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com Cc: Mike Frysinger vapier@gentoo.org
board/davinci/da8xxevm/da850evm.c | 153 ++++++------------------------------- include/configs/da850_am18xxevm.h | 1 + include/configs/da850evm.h | 1 + 3 files changed, 27 insertions(+), 128 deletions(-)
Acked-by: Heiko Schocherhs@denx.de
bye, Heiko

The boards in board/davinci/da8xxevm/ define pinmux_config[] vectors that contain pinmux configurations for emac, uarts, memory controllers... In an earlier patch such pinmux configurations were added to the arch tree. This patch makes the hawkboard use these definitions instead of defining its own.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Mike Frysinger vapier@gentoo.org --- board/davinci/da8xxevm/hawkboard_nand_spl.c | 51 ++++---------------------- include/configs/hawkboard.h | 1 + nand_spl/board/davinci/da8xxevm/Makefile | 5 +++ 3 files changed, 14 insertions(+), 43 deletions(-)
diff --git a/board/davinci/da8xxevm/hawkboard_nand_spl.c b/board/davinci/da8xxevm/hawkboard_nand_spl.c index fd130fa..df97963 100644 --- a/board/davinci/da8xxevm/hawkboard_nand_spl.c +++ b/board/davinci/da8xxevm/hawkboard_nand_spl.c @@ -27,55 +27,20 @@ #include <asm/arch/hardware.h> #include <asm/io.h> #include <asm/arch/davinci_misc.h> +#include <asm/arch/pinmux_defs.h> #include <ns16550.h> #include <nand.h>
DECLARE_GLOBAL_DATA_PTR;
-static const struct pinmux_config mii_pins[] = { - { pinmux(2), 8, 1 }, - { pinmux(2), 8, 2 }, - { pinmux(2), 8, 3 }, - { pinmux(2), 8, 4 }, - { pinmux(2), 8, 5 }, - { pinmux(2), 8, 6 }, - { pinmux(2), 8, 7 } -}; - -static const struct pinmux_config mdio_pins[] = { - { pinmux(4), 8, 0 }, - { pinmux(4), 8, 1 } -}; - -static const struct pinmux_config nand_pins[] = { - { pinmux(7), 1, 1 }, - { pinmux(7), 1, 2 }, - { pinmux(7), 1, 4 }, - { pinmux(7), 1, 5 }, - { pinmux(9), 1, 0 }, - { pinmux(9), 1, 1 }, - { pinmux(9), 1, 2 }, - { pinmux(9), 1, 3 }, - { pinmux(9), 1, 4 }, - { pinmux(9), 1, 5 }, - { pinmux(9), 1, 6 }, - { pinmux(9), 1, 7 }, - { pinmux(12), 1, 5 }, - { pinmux(12), 1, 6 } -}; - -static const struct pinmux_config uart2_pins[] = { - { pinmux(0), 4, 6 }, - { pinmux(0), 4, 7 }, - { pinmux(4), 2, 4 }, - { pinmux(4), 2, 5 } -}; - static const struct pinmux_resource pinmuxes[] = { - PINMUX_ITEM(mii_pins), - PINMUX_ITEM(mdio_pins), - PINMUX_ITEM(nand_pins), - PINMUX_ITEM(uart2_pins), + PINMUX_ITEM(emac_pins_mii), + PINMUX_ITEM(emac_pins_mdio), + PINMUX_ITEM(emifa_pins_cs3), + PINMUX_ITEM(emifa_pins_cs4), + PINMUX_ITEM(emifa_pins_nand), + PINMUX_ITEM(uart2_pins_txrx), + PINMUX_ITEM(uart2_pins_rtscts), };
static const struct lpsc_resource lpsc[] = { diff --git a/include/configs/hawkboard.h b/include/configs/hawkboard.h index 638643a..12acb27 100644 --- a/include/configs/hawkboard.h +++ b/include/configs/hawkboard.h @@ -34,6 +34,7 @@ #define CONFIG_MACH_DAVINCI_HAWK #define CONFIG_ARM926EJS /* arm926ejs CPU core */ #define CONFIG_SOC_DA8XX /* TI DA8xx SoC */ +#define CONFIG_SOC_DA850 /* TI DA850 SoC */ #define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID) #define CONFIG_SYS_OSCIN_FREQ 24000000 #define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE diff --git a/nand_spl/board/davinci/da8xxevm/Makefile b/nand_spl/board/davinci/da8xxevm/Makefile index 7b06cd2..616e6f1 100644 --- a/nand_spl/board/davinci/da8xxevm/Makefile +++ b/nand_spl/board/davinci/da8xxevm/Makefile @@ -43,6 +43,7 @@ SOBJS = _divsi3.o \ COBJS = cpu.o \ davinci_nand.o \ pinmux.o \ + da850_pinmux.o \ div0.o \ hawkboard_nand_spl.o \ memsize.o \ @@ -82,6 +83,10 @@ $(obj)pinmux.c: @rm -f $@ @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/pinmux.c $@
+$(obj)da850_pinmux.c: + @rm -f $@ + @ln -s $(TOPDIR)/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c $@ + # from drivers/mtd/nand directory $(obj)davinci_nand.c: @rm -f $@

Hello Christian,
Christian Riesch wrote:
The boards in board/davinci/da8xxevm/ define pinmux_config[] vectors that contain pinmux configurations for emac, uarts, memory controllers... In an earlier patch such pinmux configurations were added to the arch tree. This patch makes the hawkboard use these definitions instead of defining its own.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de Cc: Syed Mohammed Khasim sm.khasim@gmail.com Cc: Sughosh Ganu urwithsughosh@gmail.com Cc: Mike Frysinger vapier@gentoo.org
board/davinci/da8xxevm/hawkboard_nand_spl.c | 51 ++++---------------------- include/configs/hawkboard.h | 1 + nand_spl/board/davinci/da8xxevm/Makefile | 5 +++ 3 files changed, 14 insertions(+), 43 deletions(-)
Acked-by: Heiko Schocherhs@denx.de
bye, Heiko

This patch replaces the pinmux configuration code in arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by the code from arch/arm/cpu/arm926ejs/davinci/pinmux.c.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de --- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 36 +++++----------------- 1 files changed, 8 insertions(+), 28 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index c7ec70f..a532f8a 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -27,6 +27,7 @@ #include <post.h> #include <asm/arch/da850_lowlevel.h> #include <asm/arch/hardware.h> +#include <asm/arch/davinci_misc.h> #include <asm/arch/ddr2_defs.h> #include <asm/arch/emif_defs.h> #include <asm/arch/pll_defs.h> @@ -235,19 +236,16 @@ int da850_ddr_setup(void) return 0; }
-void da850_pinmux_ctl(unsigned long offset, unsigned long mask, - unsigned long value) -{ - clrbits_le32(&davinci_syscfg_regs->pinmux[offset], mask); - setbits_le32(&davinci_syscfg_regs->pinmux[offset], (mask & value)); -} - __attribute__((weak)) void board_gpio_init(void) { return; }
+/* pinmux_resource[] vector is defined in the board specific file */ +extern const struct pinmux_resource pinmuxes[]; +extern const int pinmuxes_size; + int arch_cpu_init(void) { /* Unlock kick registers */ @@ -257,27 +255,9 @@ 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); + /* configure pinmux settings */ + if (davinci_configure_pin_mux_items(pinmuxes, pinmuxes_size)) + return 1;
/* PLL setup */ da850_pll_init(davinci_pllc0_regs, CONFIG_SYS_DA850_PLL0_PLLM);

Hello Christian,
Christian Riesch wrote:
This patch replaces the pinmux configuration code in arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c by the code from arch/arm/cpu/arm926ejs/davinci/pinmux.c.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Heiko Schocher hs@denx.de
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 36 +++++----------------- 1 files changed, 8 insertions(+), 28 deletions(-)
Acked-by: Heiko Schocherhs@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 Cc: Heiko Schocher hs@denx.de --- 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

This patch avoids build breakage for SPLs that do not support printf.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de Cc: Tom Rini tom.rini@gmail.com Cc: Andreas Bie�mann andreas.devel@googlemail.com Cc: Scott Wood scottwood@freescale.com --- arch/arm/lib/eabi_compat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..e1b87be 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,7 +13,9 @@
int raise (int signum) { +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) printf("raise: Signal # %d caught\n", signum); +#endif return 0; }

Dear Christian,
I can live with this solution. Therefore
Am 25.11.2011 um 13:37 schrieb Christian Riesch:
This patch avoids build breakage for SPLs that do not support printf.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de Cc: Tom Rini tom.rini@gmail.com Cc: Andreas Bießmann andreas.devel@googlemail.com
Acked-by: Andreas Bießmann andreas.devel@googlemail.com
Cc: Scott Wood scottwood@freescale.com
best regards
Andreas Bießmann

On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This patch avoids build breakage for SPLs that do not support printf.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Wolfgang Denk wd@denx.de Cc: Tom Rini tom.rini@gmail.com Cc: Andreas Bießmann andreas.devel@googlemail.com Cc: Scott Wood scottwood@freescale.com
Acked-by: Tom Rini trini@ti.com
arch/arm/lib/eabi_compat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/lib/eabi_compat.c b/arch/arm/lib/eabi_compat.c index eb3e26d..e1b87be 100644 --- a/arch/arm/lib/eabi_compat.c +++ b/arch/arm/lib/eabi_compat.c @@ -13,7 +13,9 @@
int raise (int signum) { +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) printf("raise: Signal # %d caught\n", signum); +#endif return 0; }
-- 1.7.0.4

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Mike Frysinger vapier@gentoo.org --- lib/Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/Makefile b/lib/Makefile index 54708c2..35ba7ff 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -50,6 +50,8 @@ COBJS-$(CONFIG_SHA1) += sha1.o COBJS-$(CONFIG_SHA256) += sha256.o COBJS-y += strmhz.o COBJS-$(CONFIG_RBTREE) += rbtree.o +else +COBJS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += display_options.o endif
COBJS-y += ctype.o

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Mike Frysinger vapier@gentoo.org Cc: Scott Wood scottwood@freescale.com --- doc/README.SPL | 1 + drivers/mtd/spi/Makefile | 6 ++++ drivers/mtd/spi/spi_spl_load.c | 58 ++++++++++++++++++++++++++++++++++++++++ include/spi_flash.h | 3 ++ 4 files changed, 68 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/spi/spi_spl_load.c
diff --git a/doc/README.SPL b/doc/README.SPL index 89d24a7..f01a8bd 100644 --- a/doc/README.SPL +++ b/doc/README.SPL @@ -65,3 +65,4 @@ CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o) CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) +CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index 57112af..071e2b6 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -25,6 +25,12 @@ include $(TOPDIR)/config.mk
LIB := $(obj)libspi_flash.o
+ifdef CONFIG_SPL_BUILD +ifdef CONFIG_SPL_SPI_LOAD +COBJS-y += spi_spl_load.o +endif +endif + COBJS-$(CONFIG_SPI_FLASH) += spi_flash.o COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c new file mode 100644 index 0000000..7e3c1b6 --- /dev/null +++ b/drivers/mtd/spi/spi_spl_load.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011 OMICRON electronics GmbH + * + * based on drivers/mtd/nand/nand_spl_load.c + * + * Copyright (C) 2011 + * Heiko Schocher, DENX Software Engineering, hs@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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <spi_flash.h> + +/* + * The main entry for SPI booting. It's necessary that SDRAM is already + * configured and available since this code loads the main U-Boot image + * from SPI into SDRAM and starts it from there. + */ +void spi_boot(void) +{ + struct spi_flash *flash; + __attribute__((noreturn)) void (*uboot)(void); + + /* + * Load U-Boot image from SPI flash into RAM + */ + + flash = spi_flash_probe(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS, + CONFIG_SF_DEFAULT_SPEED, SPI_MODE_3); + if (!flash) { + puts("failed.\n"); + hang(); + } + + spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, + CONFIG_SYS_SPI_U_BOOT_SIZE, + (void *) CONFIG_SYS_TEXT_BASE); + + /* + * Jump to U-Boot image + */ + uboot = (void *) CONFIG_SYS_TEXT_BASE; + (*uboot)(); +} diff --git a/include/spi_flash.h b/include/spi_flash.h index 2671ab5..9da9062 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -25,6 +25,7 @@
#include <spi.h> #include <linux/types.h> +#include <linux/compiler.h>
struct spi_flash { struct spi_slave *spi; @@ -68,4 +69,6 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset, return flash->erase(flash, offset, len); }
+void spi_boot(void) __noreturn; + #endif /* _SPI_FLASH_H_ */

On Friday 25 November 2011 07:37:40 Christian Riesch wrote:
--- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile
+ifdef CONFIG_SPL_BUILD +ifdef CONFIG_SPL_SPI_LOAD +COBJS-y += spi_spl_load.o +endif +endif
COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.o
--- /dev/null +++ b/drivers/mtd/spi/spi_spl_load.c
- __attribute__((noreturn)) void (*uboot)(void);
__noreturn -mike

Hello Mike, thanks for your comments!
On Fri, Nov 25, 2011 at 10:32 PM, Mike Frysinger vapier@gentoo.org wrote:
On Friday 25 November 2011 07:37:40 Christian Riesch wrote:
--- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile
+ifdef CONFIG_SPL_BUILD +ifdef CONFIG_SPL_SPI_LOAD +COBJS-y += spi_spl_load.o +endif +endif
COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.o
Ok, I'll change that.
--- /dev/null +++ b/drivers/mtd/spi/spi_spl_load.c
- __attribute__((noreturn)) void (*uboot)(void);
__noreturn -mike
Ok. Regards, Christian

This code adds an SPL for booting from SPI flash on DA850 SoCs.
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 | 34 ++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index 4ac187a..3e9ac41 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -38,7 +38,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..20f798e 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -26,6 +26,16 @@ #include <nand.h> #include <asm/arch/dm365_lowlevel.h> #include <ns16550.h> +#include <malloc.h> +#include <spi_flash.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* Define global data structure pointer to it*/ +static gd_t gdata __attribute__ ((section(".data"))); +static bd_t bdata __attribute__ ((section(".data"))); + +#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
void puts(const char *str) { @@ -41,6 +51,8 @@ void putc(char c) NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c); }
+#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ + inline void hang(void) { puts("### ERROR ### Please RESET the board ###\n"); @@ -50,14 +62,34 @@ 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 + mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN, + CONFIG_SYS_MALLOC_LEN); + + gd = &gdata; + gd->bd = &bdata; + gd->flags |= GD_FLG_RELOC; + gd->baudrate = CONFIG_BAUDRATE; + serial_init(); /* serial communications setup */ + gd->have_console = 1; + + puts("SPI boot...\n"); + spi_boot(); +#endif }

On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions. Aside, what are the size limitations you're dealing with here? Thanks!

Hi Tom,
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
Regards, Christian

Hello Christian,
Christian Riesch wrote:
Hi Tom,
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
If we are using the "nor boot method" in "Legacy NOR Boot" mode on the am1808 we must take care, that we can copy only 16kB from NOR to the internal SRAM! (But I think, we don't need to take care of this mode, as we can use when booting from NOR the "direct NOR Boot" mode, where code is exectuted directly from NOR. This mode is used on the enbw_cmc board)
bye, Heiko

Hello Heiko,
On Wed, Nov 30, 2011 at 8:41 AM, Heiko Schocher hs@denx.de wrote:
Christian Riesch wrote:
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
If we are using the "nor boot method" in "Legacy NOR Boot" mode on the am1808 we must take care, that we can copy only 16kB from NOR to the internal SRAM! (But I think, we don't need to take care of this mode, as we can use when booting from NOR the "direct NOR Boot" mode, where code is exectuted directly from NOR. This mode is used on the enbw_cmc board)
I agree, there is a restriction for the "legacy nor boot method", but if someone can't execute the code directly from NOR with the "direct NOR boot" for some reason, the "AIS NOR boot" method could be used [1], which allows copying larger memory areas to the internal SRAM. So I think there is virtually no restriction from the ROM bootloader.
Regards, Christian

On Wed, Nov 30, 2011 at 12:22 AM, Christian Riesch christian.riesch@omicron.at wrote:
Hi Tom,
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
OK, note made on my TODO list
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
That's what I figured. What's the reason behind turning off libcommon support? Mimicing existing quite boots?

Hi Tom,
On Wed, Nov 30, 2011 at 3:18 PM, Tom Rini tom.rini@gmail.com wrote:
On Wed, Nov 30, 2011 at 12:22 AM, Christian Riesch christian.riesch@omicron.at wrote:
Hi Tom,
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
[...]
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
That's what I figured. What's the reason behind turning off libcommon support? Mimicing existing quite boots?
I turned on libcommon in my patchset for the da850evm since I need it for the SPI flash code. Heiko, I think you wrote something about code size when I asked you the same question some weeks ago for the cam_enc_4xx board (which afaik does not use libcommon), right? Regards, Christian

Hello Christian,
Christian Riesch wrote:
Hi Tom,
On Wed, Nov 30, 2011 at 3:18 PM, Tom Rini tom.rini@gmail.com wrote:
On Wed, Nov 30, 2011 at 12:22 AM, Christian Riesch christian.riesch@omicron.at wrote:
Hi Tom,
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
[...]
Aside, what are the size limitations you're dealing with here? Thanks!
Size limitation of the SPL? I am using the AM1808 which has 128kB internal SRAM, i think it is the same for all DA8xx SoCs.
That's what I figured. What's the reason behind turning off libcommon support? Mimicing existing quite boots?
I turned on libcommon in my patchset for the da850evm since I need it for the SPI flash code. Heiko, I think you wrote something about code size when I asked you the same question some weeks ago for the cam_enc_4xx board (which afaik does not use libcommon), right?
Yes, on tha cam_enc_4xx board (Davinci DM368 based) I boot from NAND and we have an internal RAM size from 16K. And yes, I do not use libcommon there.
bye, Heiko

Hi Tom,
On Wed, Nov 30, 2011 at 3:18 PM, Tom Rini tom.rini@gmail.com wrote:
On Wed, Nov 30, 2011 at 12:22 AM, Christian Riesch christian.riesch@omicron.at wrote:
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
OK, note made on my TODO list
Maybe we could then also implement this idea from Heiko to select the boot method, see http://lists.denx.de/pipermail/u-boot/2011-November/109997.html
---snip--- 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 ... ---snip---
Regards, Christian

On Wed, Nov 30, 2011 at 9:39 AM, Christian Riesch christian.riesch@omicron.at wrote:
Hi Tom,
On Wed, Nov 30, 2011 at 3:18 PM, Tom Rini tom.rini@gmail.com wrote:
On Wed, Nov 30, 2011 at 12:22 AM, Christian Riesch christian.riesch@omicron.at wrote:
On Tue, Nov 29, 2011 at 7:27 PM, Tom Rini tom.rini@gmail.com wrote:
On Fri, Nov 25, 2011 at 5:37 AM, Christian Riesch christian.riesch@omicron.at wrote:
This code adds an SPL for booting from SPI flash on DA850 SoCs.
Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com
Parts of this remind me of omap-common/spl.c so I think longer term we need to figure out if we can make everyone live with a few more common SPL files and functions.
I stole some ideas from omap-common/spl.c and yes, there are similarities :-)
OK, note made on my TODO list
Maybe we could then also implement this idea from Heiko to select the boot method, see http://lists.denx.de/pipermail/u-boot/2011-November/109997.html
Something along these lines, yeah. We've got platforms (omap3/4/5/am33xx) that we can run-time tell who booted and Davinci stuff where I don't know off-hand, but it sounds like we don't and have special-purpose builds.

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Heiko Schocher hs@denx.de Cc: Sandeep Paulraj s-paulraj@ti.com Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com --- board/davinci/da8xxevm/da850evm.c | 4 +- board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 53 ++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 1 deletions(-) create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index e827256..8e66c35 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -108,7 +108,7 @@ static const struct pinmux_config gpio_pins[] = { #endif };
-static const struct pinmux_resource pinmuxes[] = { +const struct pinmux_resource pinmuxes[] = { #ifdef CONFIG_DRIVER_TI_EMAC PINMUX_ITEM(emac_pins_mdio), #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII @@ -135,6 +135,8 @@ static const struct pinmux_resource pinmuxes[] = { PINMUX_ITEM(gpio_pins), };
+const int pinmuxes_size = ARRAY_SIZE(pinmuxes); + static const struct lpsc_resource lpsc[] = { { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */ { DAVINCI_LPSC_SPI1 }, /* Serial Flash */ 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 2e2aa19..23eed0f 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -65,6 +65,41 @@ #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 */ @@ -76,6 +111,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 @@ -242,6 +278,23 @@ #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_SPI_LOAD +#define CONFIG_SPL_SPI_BUS 0 +#define CONFIG_SPL_SPI_CS 0 +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_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 32768 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000 +#define CONFIG_SYS_SPI_U_BOOT_SIZE 0x30000 + /* 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 */ \

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 Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com
board/davinci/da8xxevm/da850evm.c | 4 +- board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 53 ++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 1 deletions(-) create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
[...]
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 2e2aa19..23eed0f 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -65,6 +65,41 @@ #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))
Please use here the DAVINCI_SYSCFG_SUSPSRC_* defines from arch/arm/include/asm/arch-davinci/hardware.h
+/*
- 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
Could you use here the DV_DDR_* defines from arch/arm/include/asm/arch-davinci/ddr2_defs.h
+#define CONFIG_SYS_DA850_DDR2_PBBPR 0x30
/*
- Serial Driver info
*/ @@ -76,6 +111,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 @@ -242,6 +278,23 @@ #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_SPI_LOAD +#define CONFIG_SPL_SPI_BUS 0 +#define CONFIG_SPL_SPI_CS 0 +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_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 32768 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000 +#define CONFIG_SYS_SPI_U_BOOT_SIZE 0x30000
/* 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 */ \
Could you use here some space from On-Chip RAM?
bye, Heiko

Hello Heiko, thanks for your comments!
On Mon, Nov 28, 2011 at 11:00 AM, Heiko Schocher hs@denx.de wrote:
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 Cc: Sudhakar Rajashekhara sudhakar.raj@ti.com
board/davinci/da8xxevm/da850evm.c | 4 +- board/davinci/da8xxevm/u-boot-spl.lds | 73 +++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 53 ++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 1 deletions(-) create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
[...]
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index 2e2aa19..23eed0f 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -65,6 +65,41 @@ #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))
Please use here the DAVINCI_SYSCFG_SUSPSRC_* defines from arch/arm/include/asm/arch-davinci/hardware.h
Ok.
+/*
- 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
Could you use here the DV_DDR_* defines from arch/arm/include/asm/arch-davinci/ddr2_defs.h
Yes, I'll use them.
+#define CONFIG_SYS_DA850_DDR2_PBBPR 0x30
/* * Serial Driver info */ @@ -76,6 +111,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 @@ -242,6 +278,23 @@ #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_SPI_LOAD +#define CONFIG_SPL_SPI_BUS 0 +#define CONFIG_SPL_SPI_CS 0 +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_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 32768 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000 +#define CONFIG_SYS_SPI_U_BOOT_SIZE 0x30000
/* 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 */ \
Could you use here some space from On-Chip RAM?
The SPL initializes the stack pointer with CONFIG_SPL_STACK, which is in On-Chip RAM. CONFIG_SYS_INIT_SP_ADDR is not used by my code.
Regards, Christian

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 */

On 25/11/2011 13:37, Christian Riesch wrote:
Hi Christian,
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
Acked-by: Stefano Babic sbabic@denx.de
Best regards, Stefano Babic

Signed-off-by: Christian Riesch christian.riesch@omicron.at Cc: Stefano Babic sbabic@denx.de Cc: Heiko Schocher hs@denx.de Cc: Mike Frysinger vapier@gentoo.org --- .gitignore | 1 + Makefile | 13 +++++++++++++ board/davinci/da8xxevm/config.mk | 5 +++++ 3 files changed, 19 insertions(+), 0 deletions(-) create mode 100644 board/davinci/da8xxevm/config.mk
diff --git a/.gitignore b/.gitignore index ff4bae0..e4e95e2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ /u-boot.dis /u-boot.lds /u-boot.ubl +/u-boot.ais /u-boot.dtb /u-boot.sb
diff --git a/Makefile b/Makefile index d84b350..484a05c 100644 --- a/Makefile +++ b/Makefile @@ -417,6 +417,18 @@ $(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 $(obj)u-boot.bin + $(obj)tools/mkimage -s -n /dev/null -T aisimage \ + -e $(CONFIG_SPL_TEXT_BASE) -d $(obj)spl/u-boot-spl.bin \ + $(obj)spl/u-boot-spl.ais + $(OBJCOPY) ${OBJCFLAGS} -I binary \ + --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ + $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais + cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \ + $(obj)u-boot.ais + rm $(obj)spl/u-boot-spl.ais + rm $(obj)spl/u-boot-spl-pad.ais + $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \ -o $(obj)u-boot.sb @@ -788,6 +800,7 @@ clobber: clean @rm -f $(obj)u-boot.kwb @rm -f $(obj)u-boot.imx @rm -f $(obj)u-boot.ubl + @rm -f $(obj)u-boot.ais @rm -f $(obj)u-boot.dtb @rm -f $(obj)u-boot.sb @rm -f $(obj)tools/inca-swap-bytes diff --git a/board/davinci/da8xxevm/config.mk b/board/davinci/da8xxevm/config.mk new file mode 100644 index 0000000..05cf77f --- /dev/null +++ b/board/davinci/da8xxevm/config.mk @@ -0,0 +1,5 @@ +# required for SPI flash SPL +# + +PAD_TO := 32768 +

On Fri, Nov 25, 2011 at 1:37 PM, Christian Riesch christian.riesch@omicron.at wrote:
diff --git a/board/davinci/da8xxevm/config.mk b/board/davinci/da8xxevm/config.mk new file mode 100644 index 0000000..05cf77f --- /dev/null +++ b/board/davinci/da8xxevm/config.mk @@ -0,0 +1,5 @@ +# required for SPI flash SPL +#
+PAD_TO := 32768
Uh, this file is not required anymore of course. Missed that. Christian
participants (7)
-
Andreas Bießmann
-
Christian Riesch
-
Heiko Schocher
-
Mike Frysinger
-
Nick Thompson
-
Stefano Babic
-
Tom Rini