[U-Boot] [PATCH 2/2] Add board support for hawkboard

Wolfgang Denk wd at denx.de
Thu Oct 21 22:44:35 CEST 2010


Dear Sughosh Ganu,

In message <1287690234-6109-1-git-send-email-urwithsughosh at gmail.com> you wrote:
> The patch adds basic board support for TI's OMAP-L138 based
> Hawkboard. This board is pretty similar to the da850 EVM. Support for
> nand and network access is added in this version.
> 
> The following bootup procedure is used.
> 
> At reset, the Rom Boot Loader(RBL), initialises the ddr and the nand
> controllers and copies the second stage bootloader(nand_spl) to
> RAM. The secondary bootloader then copies u-boot from a predefined
> location in the nand flash to the RAM, and passes control to the
> u-boot image.
> 
> Three config options are supported
> * hawkboard_config - Used to create the u-boot.bin. Tftp the
>  u-boot.bin image to the RAM from u-boot, and flash to the nand flash
>  at address 0xe0000.
> 
> * hawkboard_nand_config - Used to generate the secondary
>  bootloader(nand_spl) image. This creates an elf file u-boot-spl
>  under nand_spl/. Create an AIS signed image using this file, and
>  flash it to the nand flash at address 0x20000. The ais file should
>  fit in one block.
> 
> * hawkboard_uart_config - This is same as the first image, but with
>  the TEXT_BASE as expected by the RBL(0xc1080000). Create the AIS
>  Signed bin, as use the normal UART boot procedure to boot the image.
> 
> Signed-off-by: Sughosh Ganu <urwithsughosh at gmail.com>
> ---
>  Makefile                                     |   17 +++
>  arch/arm/cpu/arm926ejs/davinci/cpu.c         |    2 +
>  arch/arm/include/asm/arch-davinci/hardware.h |    5 +-
>  board/davinci/common/misc.c                  |    2 +
>  board/davinci/da8xxevm/Makefile              |    1 +
>  board/davinci/da8xxevm/config.mk             |    3 +
>  board/davinci/da8xxevm/hawkboard.c           |  201 ++++++++++++++++++++++++++
>  drivers/mtd/nand/davinci_nand.c              |    1 +
>  include/configs/hawkboard.h                  |  200 +++++++++++++++++++++++++
>  nand_spl/board/davinci/da8xxevm/Makefile     |  141 ++++++++++++++++++
>  nand_spl/board/davinci/da8xxevm/config.mk    |   40 +++++
>  nand_spl/board/davinci/da8xxevm/u-boot.lds   |   75 ++++++++++
>  nand_spl/nand_boot.c                         |    3 +-
>  13 files changed, 689 insertions(+), 2 deletions(-)
>  create mode 100644 board/davinci/da8xxevm/hawkboard.c
>  create mode 100644 include/configs/hawkboard.h
>  create mode 100644 nand_spl/board/davinci/da8xxevm/Makefile
>  create mode 100644 nand_spl/board/davinci/da8xxevm/config.mk
>  create mode 100644 nand_spl/board/davinci/da8xxevm/u-boot.lds

Entries to MAINTAINERS and boards.cfg missing.

> diff --git a/Makefile b/Makefile
> index 06c71a2..7b8152c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -911,6 +911,23 @@ cp922_XA10_config	\
>  cp1026_config: unconfig
>  	@board/armltd/integrator/split_by_variant.sh cp $@
>  
> +hawkboard_config \
> +hawkboard_uart_config \
> +hawkboard_nand_config	: unconfig
> +	@mkdir -p $(obj)include
> +	@mkdir -p $(obj)board/davinci/da8xxevm
> +	@if [ -n "$(findstring _nand_,$@)" ]; then							\
> +		echo "#define CONFIG_NAND_U_BOOT" >> $(obj)include/config.h;				\
> +		echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk;				\
> +		echo "CONFIG_SYS_TEXT_BASE = 0xc1080000" >$(obj)board/davinci/da8xxevm/config.tmp;	\
> +	elif [ -n "$(findstring _uart_,$@)" ]; then							\
> +		echo "CONFIG_SYS_TEXT_BASE = 0xc1080000" >$(obj)board/davinci/da8xxevm/config.tmp;	\
> +	else 												\
> +		echo "CONFIG_SYS_TEXT_BASE = 0xc1180000" >$(obj)board/davinci/da8xxevm/config.tmp;	\
> +	fi

We don;t allow and don;t need any such scripting in the Makefile any
more. Please add your board to boards.cfg instead..

> diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> index fc3551c..b4a7382 100644
> --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
> +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> @@ -109,6 +109,7 @@ out:
>  }
>  #endif /* CONFIG_SOC_DA8XX */
>  
> +#if !defined(CONFIG_NAND_SPL)
>  #ifdef CONFIG_DISPLAY_CPUINFO
>  
>  static unsigned pll_div(volatile void *pllbase, unsigned offset)
> @@ -189,3 +190,4 @@ int cpu_eth_init(bd_t *bis)
>  #endif
>  	return 0;
>  }
> +#endif /* !CONFIG_NAND_SPL */

Why exactly is this change needed?  What happens if you just do not
define CONFIG_DISPLAY_CPUINFO in your NAND config?


> index 28750b1..546fd93 100644
> --- a/board/davinci/common/misc.c
> +++ b/board/davinci/common/misc.c
> @@ -33,6 +33,7 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +#if !defined(CONFIG_NAND_SPL)
>  #if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>  int dram_init(void)
>  {
> @@ -105,6 +106,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
>  }
>  
>  #endif	/* DAVINCI_EMAC */
> +#endif	/* !CONFIG_NAND_SPL */

Is there not a better way than adding such a huge #ifdef block?


> index e176f7d..9fc7ad9 100644
> --- a/board/davinci/da8xxevm/config.mk
> +++ b/board/davinci/da8xxevm/config.mk
> @@ -38,6 +38,9 @@
>  #
>  # we load ourself to C108 '0000
>  
> +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
>  
>  #Provide at least 16MB spacing between us and the Linux Kernel image
> +ifndef CONFIG_SYS_TEXT_BASE
>  CONFIG_SYS_TEXT_BASE = 0xC1080000
> +endif

No. We don't need config.mk files for this any more. Please move
settings to board config file.

> diff --git a/board/davinci/da8xxevm/hawkboard.c b/board/davinci/da8xxevm/hawkboard.c
> new file mode 100644
....
> +#if !defined(CONFIG_NAND_SPL)
> +int board_init(void)

Again: can we not avoid such a huge #ifdef block here?


> +int misc_init_r (void)
> +{
> +	printf ("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));

Would it make sense to use strmhz() here?


> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index d41579c..ad70dd9 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -635,6 +635,7 @@ void davinci_nand_init(struct nand_chip *nand)
>  	nand->write_buf = nand_davinci_write_buf;
>  
>  	nand->dev_ready = nand_davinci_dev_ready;
> +	nand->select_chip = NULL;

Hm... maybe we should rather use memset() to set the whole struct
nand_chip to zero?

...
> +#define CONFIG_SYS_NAND_ECCBYTES	10
> +#define CONFIG_SYS_NAND_ECCSTEPS	(CONFIG_SYS_NAND_PAGE_SIZE/ CONFIG_SYS_NAND_ECCSIZE)
> +#define CONFIG_SYS_NAND_OOBSIZE		64
> +#define CONFIG_SYS_NAND_ECCTOTAL	(CONFIG_SYS_NAND_ECCBYTES * CONFIG_SYS_NAND_ECCSTEPS)

Lines too long; please fix globally.

> diff --git a/nand_spl/board/davinci/da8xxevm/config.mk b/nand_spl/board/davinci/da8xxevm/config.mk
> new file mode 100644
> index 0000000..ea071eb
> --- /dev/null
> +++ b/nand_spl/board/davinci/da8xxevm/config.mk
...
> +include $(TOPDIR)/board/$(BOARDDIR)/config.mk
> +
> +# PAD_TO used to generate a 4kByte binary needed for the combined image
> +# -> PAD_TO = TEXT_BASE + 4096
> +PAD_TO	:= $(shell expr $$[$(CONFIG_SYS_TEXT_BASE) + 4096])
> +
> +ifeq ($(debug),1)
> +PLATFORM_CPPFLAGS += -DDEBUG
> +endif

Is this really needed? Please get rid of this file.


> diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c
> index ccd0af2..3cda41c 100644
> --- a/nand_spl/nand_boot.c
> +++ b/nand_spl/nand_boot.c
> @@ -222,11 +222,12 @@ static int nand_load(struct mtd_info *mtd, unsigned int offs,
>  }
>  
>  #if defined(CONFIG_ARM) && !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> -void board_init_f (ulong bootflag)
> +void __board_init_f (ulong bootflag)
>  {
>  	relocate_code (CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
>  		       CONFIG_SYS_TEXT_BASE);
>  }
> +void board_init_f (ulong bootflag)__attribute__((weak, alias("__board_init_f")));
>  #endif

This is a global change that affects all NAND booting boards. This
must be submitted spearately, and you must explain in detail why you
think you need that.  Also please mention on which systems this change
has been tested.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"An open mind has but one disadvantage: it collects dirt."
                                                    - a saying at RPI


More information about the U-Boot mailing list