[U-Boot-Users] [PATCH 7/7 v6] ARM: Add support for S3C6400 based SMDK6400 board

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Aug 9 11:32:10 CEST 2008


On 21:42 Wed 06 Aug     , Guennadi Liakhovetski wrote:
> SMDK6400 can only boot U-Boot from NAND-flash. This patch adds a nand_spl
> driver for it too. The board can also boot from the NOR flash, but due to
> hardware limitations it can only address 64KiB on it, which is not enough
> for U-Boot. Based on the original sources by Samsung for U-Boot 1.1.6.
> 
> Signed-off-by: Guennadi Liakhovetski <lg at denx.de>
> ---
> 
> Changes since v5: adjust the configuration to more precisely desribe NAND 
> ECC layout.
> 
>  MAKEALL                                    |    1 +
>  Makefile                                   |   17 ++
please add your entry in MAINTAINERS
>  board/samsung/smdk6400/Makefile            |   54 +++++
>  board/samsung/smdk6400/config.mk           |   30 +++
>  board/samsung/smdk6400/lowlevel_init.S     |  316 ++++++++++++++++++++++++++++
>  board/samsung/smdk6400/smdk6400.c          |  130 ++++++++++++
>  board/samsung/smdk6400/u-boot-nand.lds     |   62 ++++++
>  include/configs/smdk6400.h                 |  306 +++++++++++++++++++++++++++
>  nand_spl/board/samsung/smdk6400/Makefile   |  106 ++++++++++
>  nand_spl/board/samsung/smdk6400/config.mk  |   40 ++++
>  nand_spl/board/samsung/smdk6400/u-boot.lds |   61 ++++++
>  11 files changed, 1123 insertions(+), 0 deletions(-)
>  create mode 100644 board/samsung/smdk6400/Makefile
>  create mode 100644 board/samsung/smdk6400/config.mk
>  create mode 100644 board/samsung/smdk6400/lowlevel_init.S
>  create mode 100644 board/samsung/smdk6400/smdk6400.c
>  create mode 100644 board/samsung/smdk6400/u-boot-nand.lds
>  create mode 100644 include/configs/smdk6400.h
>  create mode 100644 nand_spl/board/samsung/smdk6400/Makefile
>  create mode 100644 nand_spl/board/samsung/smdk6400/config.mk
>  create mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds

> +# 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 $(TOPDIR)/config.mk
> +
> +LIB	= $(obj)lib$(BOARD).a
> +
> +COBJS	:= smdk6400.o
> +SOBJS	:= lowlevel_init.o
> +OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
> +
> +$(LIB):	$(obj).depend $(OBJS)
> +	$(AR) crv $@ $(OBJS)
> +

please keep this Makefile as other new style

ex from atmel board

include $(TOPDIR)/config.mk

LIB	= $(obj)lib$(BOARD).a

COBJS-y += at91cap9adk.o
COBJS-y += led.o
COBJS-y += partition.o
COBJS-$(CONFIG_CMD_NAND) += nand.o

SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS	:= $(addprefix $(obj),$(COBJS-y))
SOBJS	:= $(addprefix $(obj),$(SOBJS))

$(LIB): $(obj).depend $(OBJS) $(SOBJS)
	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)

clean:
	rm -f $(SOBJS) $(OBJS)

distclean:	clean
	rm -f $(LIB) core *.bak $(obj).depend

#########################################################################

# defines $(obj).depend target
include $(SRCTREE)/rules.mk

sinclude $(obj).depend

#########################################################################
> diff --git a/board/samsung/smdk6400/config.mk b/board/samsung/smdk6400/config.mk
> new file mode 100644
> index 0000000..298d387
> --- /dev/null
> +++ b/board/samsung/smdk6400/config.mk
> @@ -0,0 +1,30 @@
> +#
> +# (C) Copyright 2002
> +# Gary Jennejohn, DENX Software Engineering, <gj at denx.de>
> +# David Mueller, ELSOFT AG, <d.mueller at elsoft.ch>
> +#
> +# (C) Copyright 2008
> +# Guennadi Liakhovetki, DENX Software Engineering, <lg at denx.de>
> +#
> +# SAMSUNG SMDK6400 board with mDirac3 (ARM1176) cpu
> +#
> +# see http://www.samsung.com/ for more information on SAMSUNG
> +
> +# On SMDK6400 we use the 64 MB SDRAM bank at
> +#
> +# 0x50000000 to 0x58000000
> +#
> +# Linux-Kernel is expected to be at 0x50008000, entry 0x50008000
> +#
> +# we load ourselves to 0x57e00000 without MMU
> +# with MMU, load address is changed to 0xc7e00000
> +#
> +# download area is 0x5000c000
> +
> +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
> +
> +ifndef CONFIG_NAND_SPL
> +TEXT_BASE = $(RAM_TEXT)
> +else
> +TEXT_BASE = 0
> +endif
> +check_syncack:
> +	ldr	r1, [r0, #OTHERS_OFFSET]
> +	ldr	r2, =0xf00
> +	and	r1, r1, r2
> +	cmp	r1, #0xf00
> +	bne	check_syncack
> +#else	/* ASYNC Mode */
please use .rept
> +	nop
> +	nop
> +	nop
> +	nop
> +	nop
> +
and please be carefull with whitespaces
> index 0000000..77fd2c8
> --- /dev/null
> +++ b/board/samsung/smdk6400/smdk6400.c
> @@ -0,0 +1,130 @@
> +/*
> +static inline void delay(unsigned long loops)
> +{
> +	__asm__ volatile ("1:\n" "subs %0, %1, #1\n"
> +			  "bne 1b"
> +			  : "=r" (loops) : "0" (loops));
> +}
> +
> +/*
> + * Miscellaneous platform dependent initialisations
> + */
> +
> +{
> +	nand_probe(CFG_NAND_BASE);
> +	if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN)
> +		print_size(nand_dev_desc[0].totlen, "\n");
> +}
> +#endif
> +
> +ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
> +{
> +	if (banknum == 0) {	/* non-CFI boot flash */
> +		info->portwidth = FLASH_CFI_16BIT;
> +		info->chipwidth = FLASH_CFI_BY16;
> +		info->interface = FLASH_CFI_X16;
> +		return 1;
> +	} else
> +		return 0;
please replace with
	} else {
		return 0;
	}

or
	}

	return 0;
> +}
> diff --git a/include/configs/smdk6400.h b/include/configs/smdk6400.h
> new file mode 100644
> index 0000000..1bc8996
> --- /dev/null
> +++ b/include/configs/smdk6400.h
> @@ -0,0 +1,306 @@
> +/*
> +#define CONFIG_SMDK6400		1	/* on a SAMSUNG SMDK6400 Board  */
> +
> +#define CFG_SDRAM_BASE	0x50000000
> +
> +/* input clock of PLL: SMDK6400 has 12MHz input clock */
> +#define CONFIG_SYS_CLK_FREQ	12000000
> +
> +#if !defined(CONFIG_NAND_SPL) && (TEXT_BASE >= 0xc0000000)
> +#define CONFIG_ENABLE_MMU
> +#endif
> +
> +#define CONFIG_MEMORY_UPPER_CODE
> +
> +#define CONFIG_SETUP_MEMORY_TAGS
> +#define CONFIG_CMDLINE_TAG
> +#define CONFIG_INITRD_TAG
> +
> +/*
> + * Architecture magic and machine type
> + */
> +#define MACH_TYPE		1270
please use mach type from the hearder
> +
> +#define CONFIG_DISPLAY_CPUINFO
> +#define CONFIG_DISPLAY_BOARDINFO
> +
> +#undef CONFIG_SKIP_RELOCATE_UBOOT
> +
> +/*
> + * Size of malloc() pool
> + */
> +#define CFG_MALLOC_LEN		(CFG_ENV_SIZE + 1024 * 1024)
> +#define CFG_GBL_DATA_SIZE	128	/* size in bytes for initial data */
> +
> +/*
> + * Hardware drivers
> + */
> +#define CONFIG_DRIVER_CS8900	1	/* we have a CS8900 on-board	*/
> +#define CS8900_BASE	  	0x18800300
please remove the whitespace
> +#define CS8900_BUS16		1 	/* follow the Linux driver	*/
please remove the whitespace
> +
> +/*
> + * select serial console configuration
> + */
> +#define CONFIG_SERIAL1          1	/* we use SERIAL 1 on SMDK6400	*/
> +
> +#define CFG_HUSH_PARSER			/* use "hush" command parser	*/
> +#ifdef CFG_HUSH_PARSER
do you really want the idef?
> +#define CFG_PROMPT_HUSH_PS2	"> "
> +#endif
> +
> +#define CONFIG_CMDLINE_EDITING
> +
> +/* allow to overwrite serial and ethaddr */
> +#define CONFIG_ENV_OVERWRITE
> +
> +#define CONFIG_BAUDRATE		115200
> +
> +/***********************************************************
> + * Command definition
> + ***********************************************************/
> +#include <config_cmd_default.h>
> +
> +#define CONFIG_CMD_CACHE
> +#define CONFIG_CMD_REGINFO
> +#define CONFIG_CMD_LOADS
> +#define CONFIG_CMD_LOADB
> +#define CONFIG_CMD_ENV
> +#define CONFIG_CMD_NAND
> +#if defined(CONFIG_BOOT_ONENAND)
> +#define CONFIG_CMD_ONENAND
> +#endif
> +#define CONFIG_CMD_PING
> +#define CONFIG_CMD_ELF
> +
> +#define CONFIG_BOOTDELAY	3
> +
> +#define CONFIG_ZERO_BOOTDELAY_CHECK
> +
> +#if (CONFIG_COMMANDS & CONFIG_CMD_KGDB)
replace with
#ifdef CONFIG_CMD_KGDB

> +#define CONFIG_KGDB_BAUDRATE	115200	/* speed to run kgdb serial port */
> +#define CONFIG_KGDB_SER_INDEX	1	/* which serial port to use	 */
> +#endif
> +
> +/*
> + * Miscellaneous configurable options
> + */
> +#define CFG_LONGHELP				/* undef to save memory	      */
> +#define CFG_PROMPT		"SMDK6400 # "	/* Monitor Command Prompt     */
> +#define CFG_CBSIZE		256		/* Console I/O Buffer Size    */
> +#define CFG_PBSIZE		384		/* Print Buffer Size          */
> +#define CFG_MAXARGS		16		/* max number of command args */
> +#define CFG_BARGSIZE		CFG_CBSIZE	/* Boot Argument Buffer Size  */
> +
> +#define CFG_MEMTEST_START	CFG_SDRAM_BASE	/* memtest works on	      */
> +#define CFG_MEMTEST_END		(CFG_SDRAM_BASE + 0x7e00000) /* 126MB in DRAM */
> +
> +#define CFG_LOAD_ADDR		CFG_SDRAM_BASE	/* default load address	*/
> +
> +#define CFG_HZ			1000
> +
> +/* valid baudrates */
> +#define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
> +
> +/*-----------------------------------------------------------------------
> + * Stack sizes
> + *
> + * The stack sizes are set up in start.S using the settings below
> + */
> +#define CONFIG_STACKSIZE	0x40000		/* regular stack 256KB */
> +
> +/**********************************
> + Support Clock Settings
> + **********************************
> + Setting	SYNC	ASYNC
> + ----------------------------------
> + 667_133_66	 X	  O
> + 533_133_66	 O	  O
> + 400_133_66	 X	  O
> + 400_100_50	 O	  O
> + **********************************/
> +
> +/*#define CONFIG_CLK_667_133_66*/
please remove if not need or use idef
> +#define CONFIG_CLK_533_133_66
> +/*
> +#define CONFIG_CLK_400_100_50
> +#define CONFIG_CLK_400_133_66
> +#define CONFIG_SYNC_MODE
> +*/
Ditto
> +
> +/* SMDK6400 has 2 banks of DRAM, but we use only one in U-Boot */
> +#define CONFIG_NR_DRAM_BANKS	1
> +#define PHYS_SDRAM_1		CFG_SDRAM_BASE	/* SDRAM Bank #1	*/
> +#define CONFIG_BOOT_MOVINAND
> +#define CONFIG_BOOT_ONENAND
> +*/
> +
> diff --git a/nand_spl/board/samsung/smdk6400/Makefile b/nand_spl/board/samsung/smdk6400/Makefile
> new file mode 100644
> index 0000000..ae9eb2a
> --- /dev/null
> +++ b/nand_spl/board/samsung/smdk6400/Makefile
> @@ -0,0 +1,106 @@
> +#
> +# (C) Copyright 2006-2007
> +# Stefan Roese, DENX Software Engineering, sr at denx.de.
> +#
> +# (C) Copyright 2008
> +# Guennadi Liakhovetki, DENX Software Engineering, <lg at 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
> +#
> +
> +CONFIG_NAND_SPL	= y
> +
> +include $(TOPDIR)/config.mk
> +include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
> +
> +LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
> +LDFLAGS	= -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
> +AFLAGS	+= -DCONFIG_NAND_SPL
> +CFLAGS	+= -DCONFIG_NAND_SPL
> +
> +SOBJS	= start.o cpu_init.o lowlevel_init.o
> +COBJS	= nand_boot.o nand_ecc.o s3c64xx.o
> +
> +SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
> +OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
> +__OBJS	:= $(SOBJS) $(COBJS)
> +LNDIR	:= $(OBJTREE)/nand_spl/board/$(BOARDDIR)
> +
> +nandobj	:= $(OBJTREE)/nand_spl/
> +
> +ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
> +
> +all:	$(obj).depend $(ALL)
> +
> +$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
> +	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
> +
> +$(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl
> +	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
> +
> +$(nandobj)u-boot-spl:	$(OBJS)
> +	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
> +		-Map $(nandobj)u-boot-spl.map \
> +		-o $(nandobj)u-boot-spl
please replace with
$(nandobj)u-boot-spl:	$(OBJS)
	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
		-Map $@.map -o $@

Best Regards,
J.




More information about the U-Boot mailing list