[U-Boot] [PATCH v2 3/3] MX31: Add NAND SPL boot support to i.MX31 PDK board.
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Sat May 9 23:28:10 CEST 2009
On 21:56 Sun 03 May , Magnus Lilja wrote:
> Signed-off-by: Magnus Lilja <lilja.magnus at gmail.com>
> ---
> MAKEALL | 3 +-
> Makefile | 9 ++-
> board/freescale/mx31pdk/config.mk | 4 +
> board/freescale/mx31pdk/lowlevel_init.S | 93 +++++++++++++++++++++++++++
> board/freescale/mx31pdk/u-boot-nand.lds | 33 ++++++++++
> include/configs/mx31pdk.h | 19 +++++-
> nand_spl/board/freescale/mx31pdk/Makefile | 54 +++++++++++++++
> nand_spl/board/freescale/mx31pdk/config.mk | 5 ++
> nand_spl/board/freescale/mx31pdk/u-boot.lds | 36 ++++++++++
> 9 files changed, 251 insertions(+), 5 deletions(-)
> create mode 100644 board/freescale/mx31pdk/u-boot-nand.lds
> create mode 100644 nand_spl/board/freescale/mx31pdk/Makefile
> create mode 100644 nand_spl/board/freescale/mx31pdk/config.mk
> create mode 100644 nand_spl/board/freescale/mx31pdk/u-boot.lds
>
> diff --git a/MAKEALL b/MAKEALL
> index aaa6dea..615acbb 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -548,7 +548,8 @@ LIST_ARM11=" \
> imx31_phycore \
> imx31_phycore_eet \
> mx31ads \
> - mx31pdk \
> + mx31pdk \
> + mx31pdk_nand \
> qong \
> smdk6400 \
> "
> diff --git a/Makefile b/Makefile
> index 99ebcc5..c377313 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -369,7 +369,7 @@ $(LDSCRIPT): depend
> $(NAND_SPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
> $(MAKE) -C nand_spl/board/$(BOARDDIR) all
>
> -$(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin
> +$(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
why?
> cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
>
> $(ONENAND_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
> @@ -3087,6 +3087,13 @@ mx31ads_config : unconfig
> mx31pdk_config : unconfig
> @$(MKCONFIG) $(@:_config=) arm arm1136 mx31pdk freescale mx31
>
> +mx31pdk_nand_config : unconfig
> + @mkdir -p $(obj)include $(obj)board/freescale/mx31pdk
> + @mkdir -p $(obj)nand_spl/board/freescale/mx31pdk
> + @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
> + @$(MKCONFIG) -n $@ -a mx31pdk arm arm1136 mx31pdk freescale mx31
> + @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
IIRC no need it will generate from the config.h
> +
> omap2420h4_config : unconfig
> @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
>
> diff --git a/board/freescale/mx31pdk/config.mk b/board/freescale/mx31pdk/config.mk
> index d34dc02..dcaa09f 100644
> --- a/board/freescale/mx31pdk/config.mk
> +++ b/board/freescale/mx31pdk/config.mk
> @@ -1 +1,5 @@
> +ifdef CONFIG_NAND_SPL
> +TEXT_BASE = 0x87ec0000
> +else
> TEXT_BASE = 0x87f00000
> +endif
> diff --git a/board/freescale/mx31pdk/lowlevel_init.S b/board/freescale/mx31pdk/lowlevel_init.S
> index ec5eedb..602eb53 100644
> --- a/board/freescale/mx31pdk/lowlevel_init.S
> +++ b/board/freescale/mx31pdk/lowlevel_init.S
> @@ -26,5 +26,98 @@
>
> .globl lowlevel_init
>
> +#ifdef CONFIG_NAND_SPL
> +#include <asm/arch/mx31-regs.h>
> +
> +.macro REG reg, val
> + ldr r2, =\reg
> + ldr r3, =\val
> + str r3, [r2]
> +.endm
> +
> +.macro REG8 reg, val
> + ldr r2, =\reg
> + ldr r3, =\val
> + strb r3, [r2]
> +.endm
> +
> +.macro DELAY loops
> + ldr r2, =\loops
> +1:
> + subs r2, r2, #1
> + nop
> + bcs 1b
> +.endm
NACK
as already reply to the kirwood patch we must have common macro
please use the attached file as based work
> +
> +.globl lowlevel_init
> +lowlevel_init:
> + /* Also setup the Peripheral Port Remap register inside the core */
> + ldr r0, =ARM_PPMRR /* start from AIPS 2GB region */
> + mcr p15, 0, r0, c15, c2, 4
> +
for all hard code value please use macro
and if possible macro to generate them
> + REG IPU_CONF, IPU_CONF_DI_EN
> + REG CCM_CCMR, 0x074B0BF5
> +
> + REG 0xB8001010, 0x0000000c
> +
<snip>
> + mov pc, lr
> +#else
> lowlevel_init:
> mov pc, lr
why?
> +#endif
> diff --git a/board/freescale/mx31pdk/u-boot-nand.lds b/board/freescale/mx31pdk/u-boot-nand.lds
> new file mode 100644
> index 0000000..b604480
> --- /dev/null
> +++ b/board/freescale/mx31pdk/u-boot-nand.lds
no need anymore
>
> /*
> * Size of malloc() pool
> @@ -158,5 +158,18 @@
>
> #define CONFIG_ENV_SIZE (128 * 1024)
>
> +#define CFG_NAND_U_BOOT_OFFS 0x800
please use CONFIG_ or CONFIG_SYS_
> +#define CFG_NAND_U_BOOT_SIZE 0x30000
<snip>
> +
> +SRCS := $(SRCTREE)/nand_spl/nand_boot_mx31.c
> +SRCS += $(SRCTREE)/cpu/arm1136/start.S
> +SRCS += $(SRCTREE)/board/freescale/mx31pdk/lowlevel_init.S
> +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 use $@ and $<
> +
> +#########################################################################
> +
> +$(obj)%.o: $(SRCTREE)/cpu/arm1136/%.S
> + $(CC) $(AFLAGS) -c -o $@ $<
> +
> new file mode 100644
> index 0000000..2780e11
> --- /dev/null
> +++ b/nand_spl/board/freescale/mx31pdk/u-boot.lds
> @@ -0,0 +1,36 @@
> +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
> +OUTPUT_ARCH(arm)
> +ENTRY(_start)
> +SECTIONS
> +{
> + . = 0x00000000;
> +
> + . = ALIGN(4);
> + .text :
^^^
whitespace please fix
and so on
Best Regards,
J.
More information about the U-Boot
mailing list