MX31: NAND boot for phyCORE and PDK boards.
Subsystems (2)
v2 cover MX31: NAND boot for phyCORE and PDK boards.
Hi all,
I have now updated the i.MX31 NAND boot patches. It applies to the -next tree (aka v2009.06-rc1) as of now.
I've taken care of most of the comments/questions that were sent to Maxim Artamonov when he posted his latest (last?) patch. The comments received on my parts has been taken care of as well.
Some general comments:
* phyCORE support has not been updated. I don't have such a board to test on.
* The code has been tested on real hardware an boots Linux from ethernet.
* There are infinite loops on nand_boot_mx31.c and looking at other nand_spl boards, they're there as well. If something goes wrong that early in the boot process there's really not a lot to do and remember that the NAND_SPL code has to fit in 2048 bytes.
Regards, Magnus
Magnus Lilja (3):
MX31: Add NAND SPL for i.MX31.
MX31: Add basic support for Freescale i.MX31 PDK board.
MX31: Add NAND SPL boot support to i.MX31 PDK board.
MAKEALL | 2 + Makefile | 12 ++- board/freescale/mx31pdk/Makefile | 53 +++++++ board/freescale/mx31pdk/config.mk | 5 + board/freescale/mx31pdk/lowlevel_init.S | 123 +++++++++++++++ board/freescale/mx31pdk/mx31pdk.c | 76 +++++++++ board/freescale/mx31pdk/u-boot-nand.lds | 33 ++++ board/freescale/mx31pdk/u-boot.lds | 59 +++++++ cpu/arm1136/start.S | 29 ++-- include/asm-arm/arch-mx31/mx31-regs.h | 92 +++++++++++ include/configs/mx31pdk.h | 175 +++++++++++++++++++++ nand_spl/board/freescale/mx31pdk/Makefile | 54 +++++++ nand_spl/board/freescale/mx31pdk/config.mk | 5 + nand_spl/board/freescale/mx31pdk/u-boot.lds | 36 +++++ nand_spl/nand_boot_mx31.c | 223 +++++++++++++++++++++++++++ 15 files changed, 965 insertions(+), 12 deletions(-) create mode 100644 board/freescale/mx31pdk/Makefile create mode 100644 board/freescale/mx31pdk/config.mk create mode 100644 board/freescale/mx31pdk/lowlevel_init.S create mode 100644 board/freescale/mx31pdk/mx31pdk.c create mode 100644 board/freescale/mx31pdk/u-boot-nand.lds create mode 100644 board/freescale/mx31pdk/u-boot.lds create mode 100644 include/configs/mx31pdk.h 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 create mode 100644 nand_spl/nand_boot_mx31.c
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
This patch adds the NAND SPL framework needed to boot i.MX31 boards from NAND.
The patch is based on the work by Maxim Artamonov <[email protected] > (which was signed-off-by him).
--- cpu/arm1136/start.S | 29 +++-- include/asm-arm/arch-mx31/mx31-regs.h | 90 +++++++++++++ nand_spl/nand_boot_mx31.c | 223 +++++++++++++++++++++++++++++++++ 3 files changed, 331 insertions(+), 11 deletions(-) create mode 100644 nand_spl/nand_boot_mx31.c
cpu/arm1136/start.S +18 -11
@@ -1,6 +1,9 @@ /* * armboot - Startup Code for OMP2420/ARM1136 CPU-core * + * + * Copyright (c) 2008 Maxim Artamonov, <[email protected]> + * * Copyright (c) 2004 Texas Instruments <[email protected]> * * Copyright (c) 2001 Marius Gr?ger <[email protected]>
@@ -32,7 +35,7 @@ #include <version.h> .globl _start _start: b reset -#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL) ldr pc, _hang ldr pc, _hang ldr pc, _hang
@@ -156,9 +159,9 @@ relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ cmp r0, r1 /* don't reloc during debug */ -#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL) beq stack_setup -#endif /* CONFIG_ONENAND_IPL */ +#endif /* !CONFIG_ONENAND_IPL && !CONFIG_NAND_SPL*/ ldr r2, _armboot_start ldr r3, _bss_start
@@ -175,7 +178,7 @@ copy_loop: /* Set up the stack */ stack_setup: ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ -#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined (CONFIG_NAND_SPL) sub sp, r0, #128 /* leave 32 words for abort-stack */ #else sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */
@@ -184,14 +187,14 @@ stack_setup: sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) #endif sub sp, r0, #12 /* leave 3 words for abort-stack */ -#endif /* CONFIG_ONENAND_IPL */ +#endif /* CONFIG_ONENAND_IPL || CONFIG_NAND_SPL*/ clear_bss: ldr r0, _bss_start /* find start of bss segment */ ldr r1, _bss_end /* stop here */ mov r2, #0x00000000 /* clear */ -#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL) clbss_l:str r2, [r0] /* clear loop... */ add r0, r0, #4 cmp r0, r1
@@ -200,12 +203,15 @@ clbss_l:str r2, [r0] /* clear loop... */ ldr pc, _start_armboot +#ifdef CONFIG_NAND_SPL +_start_armboot: .word nand_boot +#else #ifdef CONFIG_ONENAND_IPL _start_armboot: .word start_oneboot #else _start_armboot: .word start_armboot -#endif - +#endif /* CONFIG_ONENAND_IPL */ +#endif /* CONFIG_NAND_SPL */ /* *************************************************************************
@@ -244,7 +250,7 @@ cpu_init_crit: mov lr, ip /* restore link */ mov pc, lr /* back to my caller */ -#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL) /* ************************************************************************* *
@@ -357,12 +363,12 @@ cpu_init_crit: .macro get_fiq_stack @ setup FIQ stack ldr sp, FIQ_STACK_START .endm -#endif /* CONFIG_ONENAND_IPL */ +#endif /* !CONFIG_ONENAND_IPL && !CONFIG_NAND_SPL*/ /* * exception handlers */ -#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL) .align 5 do_hang: ldr sp, _TEXT_BASE /* use 32 words about stack */
@@ -436,3 +442,4 @@ arm1136_cache_flush: mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache mov pc, lr @ back to caller #endif /* CONFIG_ONENAND_IPL */ +
include/asm-arm/arch-mx31/mx31-regs.h +90 -0
94 lines not on this page · raw message
nand_spl/nand_boot_mx31.c new file +223 -0
223 lines not on this page · raw message
Signature · 1 line
1.5.6
PATCH v2 2/3 MX31: Add basic support for Freescale i.MX31 PDK board.
Add support for Freescale's i.MX31 PDK board (a.k.a. 3 stack board).
This patch assumes that some other program performs the actual NAND boot.
--- MAKEALL | 1 + Makefile | 3 + board/freescale/mx31pdk/Makefile | 53 ++++++++++ board/freescale/mx31pdk/config.mk | 1 + board/freescale/mx31pdk/lowlevel_init.S | 30 ++++++ board/freescale/mx31pdk/mx31pdk.c | 76 ++++++++++++++ board/freescale/mx31pdk/u-boot.lds | 59 +++++++++++ include/asm-arm/arch-mx31/mx31-regs.h | 2 + include/configs/mx31pdk.h | 162 +++++++++++++++++++++++++++++++ 9 files changed, 387 insertions(+), 0 deletions(-) create mode 100644 board/freescale/mx31pdk/Makefile create mode 100644 board/freescale/mx31pdk/config.mk create mode 100644 board/freescale/mx31pdk/lowlevel_init.S create mode 100644 board/freescale/mx31pdk/mx31pdk.c create mode 100644 board/freescale/mx31pdk/u-boot.lds create mode 100644 include/configs/mx31pdk.h
MAKEALL +1 -0
@@ -548,6 +548,7 @@ LIST_ARM11=" \ imx31_phycore \ imx31_phycore_eet \ mx31ads \ + mx31pdk \ qong \ smdk6400 \ "
Makefile +3 -0
@@ -3084,6 +3084,9 @@ imx31_phycore_config : unconfig mx31ads_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31 +mx31pdk_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm1136 mx31pdk freescale mx31 + omap2420h4_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
board/freescale/mx31pdk/Makefile new file +53 -0
53 lines not on this page · raw message
board/freescale/mx31pdk/config.mk new file +1 -0
@@ -0,0 +1 @@ +TEXT_BASE = 0x87f00000
board/freescale/mx31pdk/lowlevel_init.S new file +30 -0
@@ -0,0 +1,30 @@ +/* + * (C) Copyright 2008 Magnus Lilja <[email protected]> + * + * 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 + */ + +/* + * This is just to keep the linker happy. + */ + +.globl lowlevel_init + +lowlevel_init: + mov pc, lr
board/freescale/mx31pdk/mx31pdk.c new file +76 -0
76 lines not on this page · raw message
board/freescale/mx31pdk/u-boot.lds new file +59 -0
59 lines not on this page · raw message
include/asm-arm/arch-mx31/mx31-regs.h +2 -0
@@ -84,6 +84,8 @@#define IPU_CONF_IC_EN (1<<1)#define IPU_CONF_SCI_EN (1<<0) +#define ARM_PPMRR 0x40000015 +#define WDOG_BASE 0x53FDC000/*
include/configs/mx31pdk.h new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
1.5.6
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
--- 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
MAKEALL +2 -1
@@ -548,7 +548,8 @@ LIST_ARM11=" \ imx31_phycore \ imx31_phycore_eet \ mx31ads \ - mx31pdk \ + mx31pdk \ + mx31pdk_nand \ qong \ smdk6400 \ "
Makefile +8 -1
@@ -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 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 + omap2420h4_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
board/freescale/mx31pdk/config.mk +4 -0
@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else TEXT_BASE = 0x87f00000 +endif
board/freescale/mx31pdk/lowlevel_init.S +93 -0
98 lines not on this page · raw message
board/freescale/mx31pdk/u-boot-nand.lds new file +33 -0
@@ -0,0 +1,33 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + cpu/arm1136/start.o (.text) + *(.text) + } + + . = ALIGN(4); + .rodata : { *(.rodata) } + + . = ALIGN(4); + .data : { *(.data) } + + . = ALIGN(4); + .got : { *(.got) } + + . = .; + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss) } + _end = .; +}
include/configs/mx31pdk.h +16 -3
@@ -45,10 +45,10 @@#define CONFIG_SETUP_MEMORY_TAGS 1#define CONFIG_INITRD_TAG 1 -/* No support for NAND boot for i.MX31 PDK yet, so we rely on some other -* program to initialize the SDRAM. -*/ +#if defined(CONFIG_NAND_U_BOOT ) && !defined(CONFIG_NAND_SPL )#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_SKIP_RELOCATE_UBOOT +#endif /* * Size of malloc() pool
@@ -158,5 +158,18 @@#define CONFIG_ENV_SIZE (128 * 1024) +#define CFG_NAND_U_BOOT_OFFS 0x800 +#define CFG_NAND_U_BOOT_SIZE 0x30000 +#define CFG_NAND_U_BOOT_DST 0x87f00000/* Load U-Boot to this address */ +#define CFG_NAND_U_BOOT_START CFG_NAND_U_BOOT_DST +#define CFG_NAND_SPL_DST (CFG_NAND_U_BOOT_DST - 0x40000) + +#define CFG_NAND_PAGE_SIZE 0x800 +#define CFG_NAND_BLOCK_SIZE (128 * 1024) +#define CFG_NAND_PAGE_COUNT 64 +/* for NAND_SPL */ +#define CFG_NAND_CHIP_SIZE (256 * 1024 * 1024) +#define CFG_NAND_PAGES_PER_BLOCK CFG_NAND_PAGE_COUNT +#endif /* __CONFIG_H */
nand_spl/board/freescale/mx31pdk/Makefile new file +54 -0
54 lines not on this page · raw message
nand_spl/board/freescale/mx31pdk/config.mk new file +5 -0
@@ -0,0 +1,5 @@ +PAD_TO := $(shell expr $$[$(TEXT_BASE) + 2048]) + +ifeq ($(debug),1) +PLATFORM_CPPFLAGS += -DDEBUG +endif
nand_spl/board/freescale/mx31pdk/u-boot.lds new file +36 -0
@@ -0,0 +1,36 @@ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + start.o (.text) + lowlevel_init.o (.text) + nand_boot_mx31.o (.text) + *(.text) + . = 2K; + } + + . = ALIGN(4); + .rodata : { *(.rodata) } + + . = ALIGN(4); + .data : { *(.data) } + + . = ALIGN(4); + .got : { *(.got) } + + . = .; + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss) } + _end = .; +}
Signature · 1 line
1.5.6
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 36 lines · Magnus Lilja
Signed-off-by Magnus Lilja <[email protected]>--- 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.ldsMAKEALL +2
-1@@ -548,7 +548,8 @@ LIST_ARM11=" \ imx31_phycore \ imx31_phycore_eet \ mx31ads \ - mx31pdk \ + mx31pdk \ + mx31pdk_nand \ qong \ smdk6400 \ "Makefile +0
-0
Makefile $(LDSCRIPT): depend · line 372
Quoted 5 lines
Makefile +1
-1@@ -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?
Makefile mx31ads_config : unconfig · line 3095
Quoted 13 lines
Makefile +6
-0cat $(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
Quoted 34 lines
Makefile +1
-0+ omap2420h4_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xxboard/freescale/mx31pdk/config.mk +4
-0@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else TEXT_BASE = 0x87f00000 +endifboard/freescale/mx31pdk/lowlevel_init.S +12
-0@@ -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
board/freescale/mx31pdk/lowlevel_init.S line 50
Quoted 10 lines
board/freescale/mx31pdk/lowlevel_init.S +10
-0+ 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
board/freescale/mx31pdk/lowlevel_init.S line 57
Quoted 7 lines
board/freescale/mx31pdk/lowlevel_init.S +7
-0+ +.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
Quoted 5 lines
board/freescale/mx31pdk/lowlevel_init.S +5
-0+ REG IPU_CONF, IPU_CONF_DI_EN + REG CCM_CCMR, 0x074B0BF5 + + REG 0xB8001010, 0x0000000c +
<snip>
board/freescale/mx31pdk/lowlevel_init.S line 122
Quoted 4 lines
board/freescale/mx31pdk/lowlevel_init.S +2
-0+ mov pc, lr +#else lowlevel_init: mov pc, lr
why?
board/freescale/mx31pdk/u-boot-nand.lds
Quoted 6 lines
board/freescale/mx31pdk/lowlevel_init.S +1
-0+#endifboard/freescale/mx31pdk/u-boot-nand.lds new file +0
-0
no need anymore
board/freescale/mx31pdk/u-boot-nand.lds line 161
Quoted 8 lines
/*
* Size ofmalloc()poolboard/freescale/mx31pdk/u-boot-nand.lds new file +1
-0@@ -158,5 +158,18 @@ #define CONFIG_ENV_SIZE (128 * 1024) +#define CFG_NAND_U_BOOT_OFFS 0x800
please use CONFIG_ or CONFIG_SYS_
Quoted 1 line
board/freescale/mx31pdk/u-boot-nand.lds new file +1
-0+#define CFG_NAND_U_BOOT_SIZE 0x30000
<snip>
Quoted 14 lines
board/freescale/mx31pdk/u-boot-nand.lds new file +14
-0+ +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) +
board/freescale/mx31pdk/u-boot-nand.lds
Quoted 10 lines
board/freescale/mx31pdk/u-boot-nand.lds new file +10
-0+$(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 $<
Quoted 11 lines
board/freescale/mx31pdk/u-boot-nand.lds new file +6
-0+ +######################################################################### + +$(obj)%.o: $(SRCTREE)/cpu/arm1136/%.S + $(CC) $(AFLAGS) -c -o $@ $< +new file mode 100644
index 0000000..2780e11
nand_spl/board/freescale/mx31pdk/u-boot.lds line 9
Quoted 9 lines
nand_spl/board/freescale/mx31pdk/u-boot.lds new file +9
-0@@ -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.
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 40 lines · Magnus Lilja
Quoted 39 lines
Signed-off-by Magnus Lilja <[email protected]>---
?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 100644nand_spl/board/freescale/mx31pdk/config.mk?create mode 100644nand_spl/board/freescale/mx31pdk/u-boot.ldsMAKEALL +2
-1@@ -548,7 +548,8 @@ LIST_ARM11=" ? ? ? ? ? ? ? ? ? ? ?\ ? ? ? imx31_phycore ? ? ? ? ? \ ? ? ? imx31_phycore_eet ? ? ? \ ? ? ? mx31ads ? ? ? ? ? ? ? ? \ - ? ? mx31pdk ? ? ? ? ? ? ? ? \ + ? ? mx31pdk ? ? ? ? ? ? ? ? \ + ? ? mx31pdk_nand ? ? ? ? ? ?\ ? ? ? qong ? ? ? ? ? ? ? ? ? ?\ ? ? ? smdk6400 ? ? ? ? ? ? ? ?\?"
Makefile +0
-0@@ -369,7 +369,7 @@ $(LDSCRIPT): ? ? ?depend?$(NAND_SPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk ? ? ? ? ? ? ? $(MAKE) -C nand_spl/board/$(BOARDDIR) all
Quoted 3 lines
Quoted 2 lines
-$(U_BOOT_NAND): ? ? ?$(NAND_SPL) $(obj)u-boot.bin +$(U_BOOT_NAND): ? ? ?$(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
why?
Maxim added this, I haven't investigated if the dependency is needed or not.
Quoted 7 lines
Quoted 7 lines
? ? ? ? ? ? ? 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
Makefile +0
-0@@ -3087,6 +3087,13 @@ mx31ads_config ? ? ? ? : unconfig?mx31pdk_config ? ? ? ? ? ? ? : unconfig
? ? ? @$(MKCONFIG) $(@:_config=) arm arm1136 mx31pdk freescale mx31
Quoted 7 lines
Quoted 6 lines
+mx31pdk_nand_config ?: unconfig
+ ? ? @mkdir -p $(obj)include $(obj)board/freescale/mx31pdk
+ ? ? @mkdir -p $(obj)nand_spl/board/freescale/mx31pdk
+ ? ? @echo "#defineCONFIG_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.mkIIRC no need it will generate from the
config.h
I don't understand the comment. What will generate what from config.h?
Quoted 39 lines
Quoted 39 lines
+
?omap2420h4_config ? ?: unconfig
? ? ? @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xxboard/freescale/mx31pdk/config.mk +3
-0@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else?TEXT_BASE =
0x87f00000board/freescale/mx31pdk/config.mk +1
-0+endifboard/freescale/mx31pdk/lowlevel_init.S +0
-0@@ -26,5 +26,98 @@?.globl
lowlevel_initboard/freescale/mx31pdk/lowlevel_init.S +17
-0+#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
Quoted 8 lines
Quoted 5 lines
+1:
+ ? ? subs ? ?r2, r2, #1
+ ? ? nop
+ ? ? bcs ? ? 1b
+.endmNACK
as already reply to the kirwood patch we must have common macro please use the attached file as based work
I don't see any file attached to you e-mail, so which attached file? Can you point to the relevant kirkwood patch? Is the patch in some git-tree?
Quoted 9 lines
board/freescale/mx31pdk/lowlevel_init.S line 57
Quoted 7 lines
board/freescale/mx31pdk/lowlevel_init.S +7
-0+ +.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
Hmm. You want me to create a macro that expands to the above code?
Quoted 11 lines
Quoted 5 lines
+ ? ? REG ? ?
IPU_CONF,IPU_CONF_DI_EN
+ ? ? REG ? ?CCM_CCMR,0x074B0BF5board/freescale/mx31pdk/lowlevel_init.S +3
-0+ + ? ? REG ? ? 0xB8001010, 0x0000000c +<snip>
Quoted 4 lines
+ ? ? mov ? ? pc, lr
+#else
?lowlevel_init:
? ? ? mov ? ? pc, lrwhy?
See my answer in patch 2.
Quoted 7 lines
board/freescale/mx31pdk/u-boot-nand.lds
Quoted 6 lines
board/freescale/mx31pdk/lowlevel_init.S +1
-0+#endifboard/freescale/mx31pdk/u-boot-nand.lds new file +0
-0no need anymore
I'll try with your lds cleanup patch.
Thanks, Magnus
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
+mx31pdk_nand_config ?: unconfig
+ ? ? @mkdir -p $(obj)include $(obj)board/freescale/mx31pdk
+ ? ? @mkdir -p $(obj)nand_spl/board/freescale/mx31pdk
+ ? ? @echo "#defineCONFIG_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.mkIIRC no need it will generate from the
config.hI don't understand the comment. What will generate what from
config.h?
the automake.mk
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+
?omap2420h4_config ? ?: unconfig
? ? ? @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xxboard/freescale/mx31pdk/config.mk +3
-0@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else?TEXT_BASE =
0x87f00000board/freescale/mx31pdk/config.mk +4
-0+endif + +.macro DELAY loops + ? ? ldr ? ? r2, =\loopsQuoted 8 lines
Quoted 5 lines
+1:
+ ? ? subs ? ?r2, r2, #1
+ ? ? nop
+ ? ? bcs ? ? 1b
+.endmNACK
as already reply to the kirwood patch we must have common macro please use the attached file as based work
Quoted 3 lines
I don't see any file attached to you e-mail, so which attached file? Can you point to the relevant kirkwood patch? Is the patch in some git-tree?
no not yet
so I've forget to re-attached it
Quoted 11 lines
Quoted 10 lines
board/freescale/mx31pdk/config.mk
Quoted 8 lines
board/freescale/mx31pdk/config.mk +7
-0+ +.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
Quoted 1 line
Hmm. You want me to create a macro that expands to the above code?
no I mean macro for 0xB8001010, 0x0000000c, etc... and if possible macro to generate these value
Quoted 6 lines
Quoted 6 lines
board/freescale/mx31pdk/config.mk
Quoted 6 lines
+ ? ? REG ? ?
IPU_CONF,IPU_CONF_DI_EN
+ ? ? REG ? ?CCM_CCMR,0x074B0BF5board/freescale/mx31pdk/config.mk +3
-0+ + ? ? REG ? ? 0xB8001010, 0x0000000c +
Best Regards,
J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macro.h
Type: text/x-chdr
Size: 1374 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090510/05f901ed/attachment-0001.h
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 10 lines
Quoted 8 lines
Makefile mx31ads_config : unconfig · line 3095
Quoted 7 lines
Makefile +6
-0+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.mkIIRC no need it will generate from the
config.hI don't understand the comment. What will generate what from
config.h?the automake.mk
automake.mk ? What's that?
Best regards,
Wolfgang Denk
Signature · 6 lines
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
Q: How do you play religious roulette?
A: You stand around in a circle and blaspheme and see who gets
struck by lightning first.PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 10 lines · Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Makefile +6
-0+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
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
IIRC no need it will generate from the
config.hI don't understand the comment. What will generate what from
config.h?the automake.mk
automake.mk ? What's that?
autoconf.mk I mean
Best Regards,
J.
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Makefile +6
-0+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
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
IIRC no need it will generate from the
config.hI don't understand the comment. What will generate what from
config.h?the automake.mk
automake.mk ? What's that?
autoconf.mk I mean
I still don't understand what your terse comment is supposed to mean. Could ypou please try to answer in a complete sentence, and explain your thoughts in a little detail?
Best regards,
Wolfgang Denk
Signature · 5 lines
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 This restaurant was advertising breakfast any time. So I ordered french toast in the renaissance. - Steven Wright, comedian
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 13 lines · Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +6
-0+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.mkIIRC no need it will generate from the
config.hI don't understand the comment. What will generate what from
config.h?
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
the automake.mk
automake.mk ? What's that?
autoconf.mk I mean
I still don't understand what your terse comment is supposed to mean. Could ypou please try to answer in a complete sentence, and explain your thoughts in a little detail?
simpleCONFIG_NAND_U_BOOT = y
will already be generated from config.h in autoconf.mk
Best Regards,
J.
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
In reply to Jean-Christophe PLAGNIOL-VILLARD2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
+.macro DELAY loops
+ ? ? ldr ? ? r2, =\loops
+1:
+ ? ? subs ? ?r2, r2, #1
+ ? ? nop
+ ? ? bcs ? ? 1b
+.endmNACK
as already reply to the kirwood patch we must have common macro please use the attached file as based work
Quoted 5 lines
Quoted 3 lines
I don't see any file attached to you e-mail, so which attached file? Can you point to the relevant kirkwood patch? Is the patch in some git-tree?
no not yet
so I've forget to re-attached it
Ok.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
board/freescale/mx31pdk/lowlevel_init.S line 57
Quoted 8 lines
board/freescale/mx31pdk/lowlevel_init.S +7
-0+ +.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
Quoted 3 lines
Quoted 1 line
Hmm. You want me to create a macro that expands to the above code?
no I mean macro for
0xB8001010,0x0000000c, etc... and if possible macro to generate these value
I'm no .macro expert so I can't promise anything.
Regards, Magnus
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
board/freescale/mx31pdk/lowlevel_init.S line 57
Quoted 9 lines
board/freescale/mx31pdk/lowlevel_init.S +7
-0+ +.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
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Hmm. You want me to create a macro that expands to the above code?
no I mean macro for
0xB8001010,0x0000000c, etc... and if possible macro to generate these valueI'm no .macro expert so I can't promise anything.
there nothing to do with .macro
it's somthing like this
#define TOTO1
#define TOTO2
#define TOTO3
and use TOTOx to generate 0x0000000c
please take a look in drivers/net/smc911x.h
as example
Best Regards,
J.
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 9 lines
board/freescale/mx31pdk/config.mk +3
-0@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else?TEXT_BASE =
0x87f00000board/freescale/mx31pdk/config.mk
Quoted 9 lines
board/freescale/mx31pdk/config.mk +9
-0+endif + +.macro DELAY loops + ? ? ldr ? ? r2, =\loops +1: + ? ? subs ? ?r2, r2, #1 + ? ? nop + ? ? bcs ? ? 1b +.endmNACK
as already reply to the kirwood patch we must have common macro please use the attached file as based work
Quoted 5 lines
Quoted 3 lines
I don't see any file attached to you e-mail, so which attached file? Can you point to the relevant kirkwood patch? Is the patch in some git-tree?
no not yet
so I've forget to re-attached it
There's a minor problem in the timer macro, fixed by replacing "sub" with "subs".
Are you OK with me posting the file as a separate patch with your From+signed-off as part of my patch series or will you add the file to arm-next yourself?
Regards, Magnus
PATCH v2 3/3 MX31: Add NAND SPL boot support to i.MX31 PDK board.
Quoted 28 lines · Magnus Lilja
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 9 lines
board/freescale/mx31pdk/config.mk +3
-0@@ -1 +1,5 @@ +ifdef CONFIG_NAND_SPL +TEXT_BASE = 0x87ec0000 +else?TEXT_BASE =
0x87f00000board/freescale/mx31pdk/config.mk
Quoted 9 lines
board/freescale/mx31pdk/config.mk +9
-0+endif + +.macro DELAY loops + ? ? ldr ? ? r2, =\loops +1: + ? ? subs ? ?r2, r2, #1 + ? ? nop + ? ? bcs ? ? 1b +.endmNACK
as already reply to the kirwood patch we must have common macro please use the attached file as based workQuoted 5 lines
Quoted 3 lines
I don't see any file attached to you e-mail, so which attached file? Can you point to the relevant kirkwood patch? Is the patch in some git-tree?
no not yet
so I've forget to re-attached it
Quoted 6 lines
There's a minor problem in the timer macro, fixed by replacing "sub" with "subs".
Are you OK with me posting the file as a separate patch with your From+signed-off as part of my patch series or will you add the file to arm-next yourself?
ok please do tks
Best Regards,
J.
PATCH v2 2/3 MX31: Add basic support for Freescale i.MX31 PDK board.
In reply to Magnus LiljaQuoted 22 lines
+++
b/board/freescale/mx31pdk/lowlevel_init.Sboard/freescale/mx31pdk/lowlevel_init.S new file +20
-0@@ -0,0 +1,30 @@ +/* + * (C) Copyright 2008 Magnus Lilja <[email protected]> + * + * 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
board/freescale/mx31pdk/lowlevel_init.S line 30
Quoted 10 lines
board/freescale/mx31pdk/lowlevel_init.S new file +10
-0+ */ + +/* + * This is just to keep the linker happy. + */ + +.globl lowlevel_init + +lowlevel_init: + mov pc, lr
why do you need it?
Quoted 48 lines
board/freescale/mx31pdk/mx31pdk.c new file +42
-0@@ -0,0 +1,76 @@ +/* +* +* (C) Copyright 2008 Magnus Lilja <[email protected]> +* +* (c) 2007 Pengutronix, Sascha Hauer <[email protected]> +* +* 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 +*/ + + +#include <common.h> +#include <asm/arch/mx31.h> +#include <asm/arch/mx31-regs.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ + gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; + gd->bd->bi_dram[0 ].size =PHYS_SDRAM_1_SIZE ; + +return 0 ; +} + +int board_init (void ) +{
board/freescale/mx31pdk/mx31pdk.c line 52
Quoted 10 lines
board/freescale/mx31pdk/mx31pdk.c new file +10
-0+/* CS5: CPLD incl. network controller */ +__REG (CSCR_U (5 )) =0x0000d843 ; +__REG (CSCR_L (5 )) =0x22252521 ; +__REG (CSCR_A (5 )) =0x22220a00 ; + +/* setup pins for UART1 */ +mx31_gpio_mux (MUX_RXD1__UART1_RXD_MUX ); +mx31_gpio_mux (MUX_TXD1__UART1_TXD_MUX ); +mx31_gpio_mux (MUX_RTS1__UART1_RTS_B ); +mx31_gpio_mux (MUX_CTS1__UART1_CTS_B );
I think it's time to create common device init functions as done for davinci or at91
board/freescale/mx31pdk/mx31pdk.c line 61
Quoted 9 lines
board/freescale/mx31pdk/mx31pdk.c new file +9
-0+ +/* SPI2 */ +mx31_gpio_mux (MUX_CSPI2_SS2__CSPI2_SS2_B ); +mx31_gpio_mux (MUX_CSPI2_SCLK__CSPI2_CLK ); +mx31_gpio_mux (MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B ); +mx31_gpio_mux (MUX_CSPI2_MOSI__CSPI2_MOSI ); +mx31_gpio_mux (MUX_CSPI2_MISO__CSPI2_MISO ); +mx31_gpio_mux (MUX_CSPI2_SS0__CSPI2_SS0_B ); +mx31_gpio_mux (MUX_CSPI2_SS1__CSPI2_SS1_B );
ditto
board/freescale/mx31pdk/mx31pdk.c line 67
Quoted 6 lines
board/freescale/mx31pdk/mx31pdk.c new file +6
-0+ +/* start SPI2 clock */ +__REG (CCM_CGR2 ) =__REG (CCM_CGR2 ) | (3 <<4 ); + + gd->bd->bi_arch_number =MACH_TYPE_MX31_3DS ;/* board id for linux */ + gd->bd->bi_boot_params =0x80000100 ;/* adress of boot parameters */
please use this style
RAM_BASE + 0x100
as other arm board
board/freescale/mx31pdk/u-boot.lds
Quoted 9 lines
board/freescale/mx31pdk/mx31pdk.c new file +4
-0+ +return 0 ; +} +board/freescale/mx31pdk/u-boot.lds new file +0
-0
I've send a patch that unify all arm lds so this one is not anymore needed
board/freescale/mx31pdk/u-boot.lds line 11
Quoted 12 lines
board/freescale/mx31pdk/u-boot.lds new file +11
-0@@ -0,0 +1,59 @@ +/* + * 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 + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/arch/mx31-regs.h>
why?
board/freescale/mx31pdk/u-boot.lds line 14
Quoted 3 lines
board/freescale/mx31pdk/u-boot.lds new file +3
-0+ +/* High Level Configuration Options */ +#define CONFIG_ARM1136 1 /* This is an arm1136 CPU core */
^^^^
whitespate please remove
board/freescale/mx31pdk/u-boot.lds line 15
Quoted 1 line
board/freescale/mx31pdk/u-boot.lds new file +1
-0+#define CONFIG_MX31 1 /* in a mx31 */
^^^^
whitespate please remove
board/freescale/mx31pdk/u-boot.lds line 22
Quoted 7 lines
board/freescale/mx31pdk/u-boot.lds new file +7
-0+#define CONFIG_MX31_HCLK_FREQ 26000000 +#define CONFIG_MX31_CLK32 32768 + +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
^^^^
whitespate please remove
Quoted 43 lines
board/freescale/mx31pdk/u-boot.lds new file +43
-0+#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_INITRD_TAG 1 + +/* No support for NAND boot for i.MX31 PDK yet, so we rely on some other + * program to initialize the SDRAM. + */ +#define CONFIG_SKIP_LOWLEVEL_INIT + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024) +/* Bytes reserved for initial data */ +#define CONFIG_SYS_GBL_DATA_SIZE 128 + +/* + * Hardware drivers + */ + +#define CONFIG_MX31_UART 1 +#define CONFIG_SYS_MX31_UART1 1 + +#define CONFIG_HARD_SPI 1 +#define CONFIG_MXC_SPI 1 +#define CONFIG_DEFAULT_SPI_BUS 1 +#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_2 | SPI_CS_HIGH) + +#define CONFIG_RTC_MC13783 1 + +/* MC13783 connected to CSPI2 and SS2 */ +#define CONFIG_MC13783_SPI_BUS 1 +#define CONFIG_MC13783_SPI_CS 2 + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_CONS_INDEX 1 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} + +/*********************************************************** + * Command definition + ***********************************************************/ +
board/freescale/mx31pdk/u-boot.lds
Quoted 10 lines
board/freescale/mx31pdk/u-boot.lds new file +10
-0+#include <config_cmd_default.h> + +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_SPI +#define CONFIG_CMD_DATE + +/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require + * that CFG_NO_FLASH is undefined). + */
please remove the comment
Quoted 12 lines
board/freescale/mx31pdk/u-boot.lds new file +12
-0+#undef CONFIG_CMD_IMLS + +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootargs_base=setenv bootargs console=ttymxc0,115200\0" \ + "bootargs_nfs=setenv bootargs $(bootargs) root=/dev/nfs " \ + "ip=dhcp nfsroot=$(serverip):$(nfsrootfs),v3,tcp\0" \ + "bootcmd=run bootcmd_net\0" \ + "bootcmd_net=run bootargs_base bootargs_mtd bootargs_nfs; " \ + "tftpboot 0x81000000 uImage-mx31; bootm\0" +
board/freescale/mx31pdk/u-boot.lds
Quoted 10 lines
board/freescale/mx31pdk/u-boot.lds new file +10
-0+#define CONFIG_DRIVER_SMC911X 1 +#define CONFIG_DRIVER_SMC911X_BASE CS5_BASE +#define CONFIG_DRIVER_SMC911X_32_BIT 1 + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_PROMPT "uboot> " +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
^^
whitespate please remove
board/freescale/mx31pdk/u-boot.lds
Quoted 9 lines
board/freescale/mx31pdk/u-boot.lds new file +9
-0+/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT)+16) +/* max number of command args */ +#define CONFIG_SYS_MAXARGS 16 +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1 /* memtest works on */
^^
whitespate please remove
Quoted 19 lines
board/freescale/mx31pdk/u-boot.lds new file +19
-0+#define CONFIG_SYS_MEMTEST_END 0x10000 + +#define CONFIG_SYS_LOAD_ADDR 0x81000000 /* default load address */ + +#define CONFIG_SYS_HZ 1000 + +#define CONFIG_CMDLINE_EDITING 1 + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */ + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1
board/freescale/mx31pdk/u-boot.lds
Quoted 10 lines
board/freescale/mx31pdk/u-boot.lds new file +10
-0+#define PHYS_SDRAM_1 CSD0_BASE +#define PHYS_SDRAM_1_SIZE (128 * 1024 * 1024) + +/*----------------------------------------------------------------------- + * FLASH and environment organization + */ +/* No NOR flash present */ +#define CONFIG_SYS_NO_FLASH 1 + +#define CONFIG_ENV_IS_NOWHERE 1
^
whitespate please remove
Best Regards,
J.
PATCH v2 2/3 MX31: Add basic support for Freescale i.MX31 PDK board.
2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 25 lines
Quoted 25 lines
+++
b/board/freescale/mx31pdk/lowlevel_init.Sboard/freescale/mx31pdk/lowlevel_init.S new file +23
-0@@ -0,0 +1,30 @@ +/* + * (C) Copyright 2008 Magnus Lilja <[email protected]> + * + * 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 + */ + +/*
Quoted 8 lines
board/freescale/mx31pdk/lowlevel_init.S
Quoted 7 lines
board/freescale/mx31pdk/lowlevel_init.S new file +7
-0+ * This is just to keep the linker happy. + */ + +.globl lowlevel_init + +lowlevel_init: + ? ? mov ? ? pc, lrwhy do you need it?
start.S:cpu_init_crit needs it and I haven't defined SKIP_LOWLEVEL. Might be possible to define SKIP_LOWLEVEL_INIT and get rid of the above line.
Quoted 52 lines
Quoted 52 lines
board/freescale/mx31pdk/mx31pdk.c new file +46
-0@@ -0,0 +1,76 @@ +/* +* +* (C) Copyright 2008 Magnus Lilja <[email protected]> +* +* (c) 2007 Pengutronix, Sascha Hauer <[email protected]> +* +* 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 +*/ + + +#include <common.h> +#include <asm/arch/mx31.h> +#include <asm/arch/mx31-regs.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ + ? ? gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + ? ? gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + + ? ? return 0; +} + +int board_init (void ) +{ + ? ? /* CS5: CPLD incl. network controller */ + ? ? __REG(CSCR_U(5)) = 0x0000d843; + ? ? __REG(CSCR_L(5)) = 0x22252521; + ? ? __REG(CSCR_A(5)) = 0x22220a00;
Quoted 8 lines
board/freescale/mx31pdk/mx31pdk.c line 52
Quoted 6 lines
board/freescale/mx31pdk/mx31pdk.c new file +6
-0+ + ? ? /* setup pins for UART1 */ + ? ? mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX); + ? ? mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX); + ? ? mx31_gpio_mux(MUX_RTS1__UART1_RTS_B); + ? ? mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);I think it's time to create common device init functions as done for davinci or at91
I think I prefer the at91 way of doing this, I can create cpu/arm1136/mx31/serial.c and spi.c.
Quoted 20 lines
board/freescale/mx31pdk/mx31pdk.c line 61
Quoted 9 lines
board/freescale/mx31pdk/mx31pdk.c new file +9
-0+ + ? ? /* SPI2 */ + ? ? mx31_gpio_mux(MUX_CSPI2_SS2__CSPI2_SS2_B); + ? ? mx31_gpio_mux(MUX_CSPI2_SCLK__CSPI2_CLK); + ? ? mx31_gpio_mux(MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B); + ? ? mx31_gpio_mux(MUX_CSPI2_MOSI__CSPI2_MOSI); + ? ? mx31_gpio_mux(MUX_CSPI2_MISO__CSPI2_MISO); + ? ? mx31_gpio_mux(MUX_CSPI2_SS0__CSPI2_SS0_B); + ? ? mx31_gpio_mux(MUX_CSPI2_SS1__CSPI2_SS1_B);ditto
board/freescale/mx31pdk/mx31pdk.c line 67
Quoted 6 lines
board/freescale/mx31pdk/mx31pdk.c new file +6
-0+ + ? ? /* start SPI2 clock */ + ? ? __REG(CCM_CGR2) = __REG(CCM_CGR2) | (3 << 4); + + ? ? gd->bd->bi_arch_number = MACH_TYPE_MX31_3DS; /* board id for linux */ + ? ? gd->bd->bi_boot_params = 0x80000100; /* adress of boot parameters */please use this style
RAM_BASE+0x100
as other arm board
Quoted 10 lines
board/freescale/mx31pdk/u-boot.lds
Quoted 9 lines
board/freescale/mx31pdk/mx31pdk.c new file +4
-0+ + ? ? return 0; +} +board/freescale/mx31pdk/u-boot.lds new file +0
-0I've send a patch that unify all arm lds so this one is not anymore needed
I'll try it. Are you planning other major changes that will affect these patches in the near future?
Quoted 5 lines
Quoted 5 lines
board/freescale/mx31pdk/u-boot.lds new file +4
-0@@ -0,0 +1,59 @@ +/* + * 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,
Quoted 8 lines
board/freescale/mx31pdk/u-boot.lds line 11
Quoted 7 lines
board/freescale/mx31pdk/u-boot.lds new file +7
-0+ * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/arch/mx31-regs.h>why?
So we can use symbolic names for Ethernet base address, SDRAM base address. I.e. instead of writing e.g. 0xB6000000 we can write CS5_BASE. I can switch to hard coded numerical values and get rid of the #include if requested.
Quoted 7 lines
Quoted 7 lines
board/freescale/mx31pdk/u-boot.lds new file +7
-0+/*********************************************************** + * Command definition + ***********************************************************/ + +#include <config_cmd_default.h> + +#define CONFIG_CMD_MII
Quoted 8 lines
board/freescale/mx31pdk/u-boot.lds line 25
Quoted 7 lines
board/freescale/mx31pdk/u-boot.lds new file +7
-0+#define CONFIG_CMD_PING +#define CONFIG_CMD_SPI +#define CONFIG_CMD_DATE + +/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require + * that CFG_NO_FLASH is undefined). + */please remove the comment
The comment was added since Wolfgang asked why IMLS was disabled when I posted a similar set of patches last year, so I'm going to keep the comment.
Quoted 1 line
board/freescale/mx31pdk/u-boot.lds line 26
Quoted 1 line
board/freescale/mx31pdk/u-boot.lds new file +1
-0+#undef CONFIG_CMD_IMLS
Thanks, Magnus
PATCH v2 2/3 MX31: Add basic support for Freescale i.MX31 PDK board.
Quoted 11 lines
Quoted 10 lines
board/freescale/mx31pdk/lowlevel_init.S
Quoted 9 lines
board/freescale/mx31pdk/lowlevel_init.S new file +9
-0+ +/* + * This is just to keep the linker happy. + */ + +.globl lowlevel_init + +lowlevel_init: + ? ? mov ? ? pc, lrwhy do you need it?
Quoted 3 lines
start.S:cpu_init_crit needs it and I haven't defined
SKIP_LOWLEVEL. Might be possible to defineSKIP_LOWLEVEL_INITand get rid of the above line.
if you do not need to do any lowlevel_init yes please
Quoted 26 lines
Quoted 10 lines
Quoted 9 lines
board/freescale/mx31pdk/mx31pdk.c new file +2
-0@@ -0,0 +1,76 @@ +/* +* Quoted 15 lines
board/freescale/mx31pdk/mx31pdk.c line 15
Quoted 13 lines
board/freescale/mx31pdk/mx31pdk.c new file +13
-0+ +int board_init (void ) +{ + ? ? /* CS5: CPLD incl. network controller */ + ? ? __REG(CSCR_U(5)) = 0x0000d843; + ? ? __REG(CSCR_L(5)) = 0x22252521; + ? ? __REG(CSCR_A(5)) = 0x22220a00; + + ? ? /* setup pins for UART1 */ + ? ? mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX); + ? ? mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX); + ? ? mx31_gpio_mux(MUX_RTS1__UART1_RTS_B); + ? ? mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);I think it's time to create common device init functions as done for davinci or at91
Quoted 2 lines
I think I prefer the at91 way of doing this, I can create
cpu/arm1136/mx31/serial.candspi.c.
as I
tks
please note I'll regroup all devices init fuctions in one file per cpu
maybe you can create a devices.c
Quoted 17 lines
Quoted 16 lines
board/freescale/mx31pdk/u-boot.lds
Quoted 15 lines
board/freescale/mx31pdk/mx31pdk.c new file +9
-0+ + ? ? /* SPI2 */ + ? ? mx31_gpio_mux(MUX_CSPI2_SS2__CSPI2_SS2_B); + ? ? mx31_gpio_mux(MUX_CSPI2_SCLK__CSPI2_CLK); + ? ? mx31_gpio_mux(MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B); + ? ? mx31_gpio_mux(MUX_CSPI2_MOSI__CSPI2_MOSI); + ? ? mx31_gpio_mux(MUX_CSPI2_MISO__CSPI2_MISO); + ? ? mx31_gpio_mux(MUX_CSPI2_SS0__CSPI2_SS0_B); + ? ? mx31_gpio_mux(MUX_CSPI2_SS1__CSPI2_SS1_B);board/freescale/mx31pdk/u-boot.lds new file +0
-0I've send a patch that unify all arm lds so this one is not anymore needed
Quoted 2 lines
I'll try it. Are you planning other major changes that will affect these patches in the near future?
no
Quoted 15 lines
Quoted 14 lines
board/freescale/mx31pdk/u-boot.lds line 11
Quoted 13 lines
board/freescale/mx31pdk/u-boot.lds new file +11
-0@@ -0,0 +1,59 @@ +/* + * 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 + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/arch/mx31-regs.h>why?
Quoted 4 lines
So we can use symbolic names for Ethernet base address, SDRAM base address. I.e. instead of writing e.g.
0xB6000000we can writeCS5_BASE. I can switch to hard coded numerical values and get rid of the #include if requested.
if you include it in the final c files
you do not need to include mx31-regs.h always
Quoted 17 lines
Quoted 16 lines
Quoted 5 lines
board/freescale/mx31pdk/u-boot.lds new file +4
-0+/*********************************************************** + * Command definition + ***********************************************************/ +board/freescale/mx31pdk/u-boot.lds line 25
Quoted 10 lines
board/freescale/mx31pdk/u-boot.lds new file +10
-0+#include <config_cmd_default.h> + +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_SPI +#define CONFIG_CMD_DATE + +/* Disabled due to compilation errors in cmd_bootm.c (IMLS seems to require + * that CFG_NO_FLASH is undefined). + */please remove the comment
Quoted 3 lines
The comment was added since Wolfgang asked why IMLS was disabled when I posted a similar set of patches last year, so I'm going to keep the comment.
ok
Best Regards,
J.
PATCH v2 2/3 MX31: Add basic support for Freescale i.MX31 PDK board.
2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
include/configs/mx31pdk.h line 11
Quoted 12 lines
include/configs/mx31pdk.h new file +11
-0@@ -0,0 +1,59 @@ +/* +* 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 +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/arch/mx31-regs.h> why?
Quoted 6 lines
Quoted 4 lines
So we can use symbolic names for Ethernet base address, SDRAM base address. I.e. instead of writing e.g.
0xB6000000we can writeCS5_BASE. I can switch to hard coded numerical values and get rid of the #include if requested.if you include it in the final c files
you do not need to includemx31-regs.halways
That works for SoC files, but not for the Ethernet-driver. I don't think the idea is to add #include mx31-regs.h to drivers/net/sms911x.c so I think I have to write the 0xB6.... there.
Regards, Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
In reply to Magnus LiljaQuoted 5 lines · Magnus Lilja
This patch adds the NAND SPL framework needed to boot i.MX31 boards from NAND.
The patch is based on the work by Maxim Artamonov <[email protected] > (which was signed-off-by him).
so please add it too
and please fix the @
Quoted 14 lines
Signed-off-by Magnus Lilja <[email protected]>--- cpu/arm1136/start.S | 29 +++-- include/asm-arm/arch-mx31/mx31-regs.h | 90 +++++++++++++ nand_spl/nand_boot_mx31.c | 223 +++++++++++++++++++++++++++++++++ 3 files changed, 331 insertions(+), 11 deletions(-) create mode 100644 nand_spl/nand_boot_mx31.ccpu/arm1136/start.S +0
-0
cpu/arm1136/start.S line 6
Quoted 6 lines
cpu/arm1136/start.S +3
-0@@ -1,6 +1,9 @@ /* * armboot - Startup Code for OMP2420/ARM1136 CPU-core * + * + * Copyright (c) 2008 Maxim Artamonov, <[email protected]> + *
please remove
cpu/arm1136/start.S line 38
Quoted 9 lines
cpu/arm1136/start.S +1
-1* Copyright (c) 2004 Texas Instruments <[email protected]> * * Copyright (c) 2001 Marius Gr?ger <[email protected]>@@ -32,7 +35,7 @@ #include <version.h> .globl _start _start: b reset -#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL)
create a better CONFIG_
because we could need for other boot mode
Quoted 15 lines
cpu/arm1136/start.S +3
-2ldr pc, _hang ldr pc, _hang ldr pc, _hang@@ -156,9 +159,9 @@ relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ cmp r0, r1 /* don't reloc during debug */ -#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL) beq stack_setup -#endif /* CONFIG_ONENAND_IPL */ +#endif /* !CONFIG_ONENAND_IPL && !CONFIG_NAND_SPL*/ #endif /* CONFIG_ONENAND_IPL */ +
<snip>
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +0
-0@@ -0,0 +1,223 @@
<snip>
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +6
-0+static void mx31_nand_page_address (unsigned int page_address) +{ +unsigned int page_count; + +writew (0x00 ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 );
nand_spl/nand_boot_mx31.c line 73
Quoted 10 lines
nand_spl/nand_boot_mx31.c new file +10
-0+mx31_wait_ready (); + +/* code only for 2kb flash */ +if (CFG_NAND_PAGE_SIZE ==0x800 ) { +writew (0x00 ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 ); +mx31_wait_ready (); + } + + page_count =CFG_NAND_CHIP_SIZE /CFG_NAND_PAGE_SIZE ;
please use CONFIG_SYS_ or CONFIG_ and why not detect it?
Quoted 13 lines
nand_spl/nand_boot_mx31.c new file +13
-0+ +if (page_address <= page_count) { + page_count--;/* transform 0x01000000 to 0x00ffffff */ +do { +writew (page_address &0xff ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 ); +mx31_wait_ready (); + page_address = page_address >>8 ; + page_count = page_count >>8 ; + }while (page_count); + } +} +
<snip>
Quoted 14 lines
nand_spl/nand_boot_mx31.c new file +14
-0+ +static int nand_load (unsigned int from,unsigned int size,unsigned char *buf) +{ +int i, bb; + +mx31_nand_init (); + +/* convert from to page number */ + from = from /CFG_NAND_PAGE_SIZE ; + + i =0 ; + +while (i < (size/CFG_NAND_PAGE_SIZE )) { +if ((from *CFG_NAND_PAGE_SIZE ) >=CFG_NAND_CHIP_SIZE )
nand_spl/nand_boot_mx31.c line 178
Quoted 10 lines
nand_spl/nand_boot_mx31.c new file +10
-0+return 2 ;/* memory segment violation */ + + bb =mx31_read_page (from, buf); + +if (bb <0 ) +return -1 ; + +/* checking first page of each block */ +/* if this page has bb marker, then skip whole block */ +if ((!(from %CFG_NAND_PAGES_PER_BLOCK )) && bb) {
please use CONFIG_SYS_ or CONFIG_ and why not detect it?
nand_spl/nand_boot_mx31.c line 183
Quoted 5 lines
nand_spl/nand_boot_mx31.c new file +5
-0+ from = from +CFG_NAND_PAGES_PER_BLOCK ; + }else { + i++; + from++; + buf = buf +CFG_NAND_PAGE_SIZE ;
please use CONFIG_SYS_ or CONFIG_ and why not detect it?
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +6
-0+ } + } + +return 0 ; +} +
nand_spl/nand_boot_mx31.c line 199
Quoted 10 lines
nand_spl/nand_boot_mx31.c new file +10
-0+/* +* The main entry for NAND booting. It's necessary that SDRAM is already +* configured and available since this code loads the main U-Boot image +* from NAND into SDRAM and starts it from there. +*/ +void nand_boot (void ) +{ + __attribute__((noreturn))void (*uboot)(void ); + +/* CFG_NAND_U_BOOT_OFFS and CFG_NAND_U_BOOT_SIZE must */
please use CONFIG_SYS_ or CONFIG_ and so on
nand_spl/nand_boot_mx31.c line 200
Quoted 1 line
nand_spl/nand_boot_mx31.c new file +1
-0+/* be aligned to full pages */
please use this style of multiple ligne comment /*
*
*/
Best Regards,
J.
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 9 lines · Magnus Lilja
Review
Quoted 6 lines
(quoted diff) +0
-0@@ -32,7 +35,7 @@?#include <
version.h>
?.globl_start
?_start: b ? ?reset(quoted diff) +1
-1-#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL)create a better
CONFIG_
because we could need for other boot mode
A better CONFIG_ than what? CONFIG_NAND_SPL is already used elsewhere in U-boot when booting from NAND.
Quoted 32 lines
Quoted 15 lines
? ? ? ldr ? ? pc,
_hang
? ? ? ldr ? ? pc,_hang
? ? ? ldr ? ? pc,_hang(quoted diff) +0
-0@@ -156,9 +159,9 @@ relocate: ? ? ? ? ? ? ? ? ? ? ? ? /* relocate U-Boot to RAM ? ? ? ? ? */? ? ? adr ? ? r0,
_start? ? ? ? ? ? ?/* r0 <- current position of code ? */ ? ? ? ldr ? ? r1,_TEXT_BASE? ? ? ? ?/* test if we run from flash or RAM */ ? ? ? cmp ? ? r0, r1 ? ? ? ? ? ? ? ? ?/* don't reloc during debug ? ? ? ? */(quoted diff) +1
-1-#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL)? ? ? beq ? ?
stack_setup(quoted diff) +1
-1-#endif ? ? ? /* CONFIG_ONENAND_IPL */ +#endif ? ? ? /* !CONFIG_ONENAND_IPL && !CONFIG_NAND_SPL*/?#endif ? ? ? /*
CONFIG_ONENAND_IPL*/
+<snip>
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +0
-0@@ -0,0 +1,223 @@<snip>
Quoted 9 lines
nand_spl/nand_boot_mx31.c new file +9
-0+static void mx31_nand_page_address (unsigned int page_address) +{ + ? ? unsigned int page_count; + + ? ? writew(0x00, NFC_FLASH_ADDR); + ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? mx31_wait_ready(); + + ? ? /* code only for 2kb flash */
Quoted 8 lines
Quoted 7 lines
+ ? ? if (
CFG_NAND_PAGE_SIZE==0x800) {
+ ? ? ? ? ? ?writew(0x00, NFC_FLASH_ADDR);
+ ? ? ? ? ? ?writew(NFC_ADDR, NFC_CONFIG2);
+ ? ? ? ? ? ?mx31_wait_ready();
+ ? ? }
+
+ ? ?page_count=CFG_NAND_CHIP_SIZE/CFG_NAND_PAGE_SIZE;please use
CONFIG_SYS_orCONFIG_
Will do.
Quoted 1 line
and why not detect it?
Might be possible, I'll look into it to see if it's doable.
Thanks; Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Quoted 11 lines · Magnus Lilja
2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 9 lines · Magnus Lilja
Review
Quoted 6 lines
(quoted diff) +0
-0@@ -32,7 +35,7 @@?#include <
version.h>
?.globl_start
?_start: b ? ?reset(quoted diff) +1
-1-#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL)create a better
CONFIG_
because we could need for other boot mode
Quoted 2 lines
A better
CONFIG_than what?CONFIG_NAND_SPLis already used elsewhere in U-boot when booting from NAND.
IIRC in this case the purpose is to reduce the size of the start.S to allow more code in the ipl & spl
Quoted 21 lines
Quoted 14 lines
Quoted 14 lines
? ? ? ldr ? ? pc,
_hang
? ? ? ldr ? ? pc,_hang
? ? ? ldr ? ? pc,_hang(quoted diff) +0
-0@@ -156,9 +159,9 @@ relocate: ? ? ? ? ? ? ? ? ? ? ? ? /* relocate U-Boot to RAM ? ? ? ? ? */? ? ? adr ? ? r0,
_start? ? ? ? ? ? ?/* r0 <- current position of code ? */ ? ? ? ldr ? ? r1,_TEXT_BASE? ? ? ? ?/* test if we run from flash or RAM */ ? ? ? cmp ? ? r0, r1 ? ? ? ? ? ? ? ? ?/* don't reloc during debug ? ? ? ? */(quoted diff) +1
-1-#ifndef CONFIG_ONENAND_IPL +#if !defined(CONFIG_ONENAND_IPL) && !defined(CONFIG_NAND_SPL)? ? ? beq ? ?
stack_setup(quoted diff) +1
-1-#endif ? ? ? /* CONFIG_ONENAND_IPL */ +#endif ? ? ? /* !CONFIG_ONENAND_IPL && !CONFIG_NAND_SPL*/Quoted 6 lines
include/asm-arm/arch-mx31/mx31-regs.h
Quoted 5 lines
?#endif ? ? ? /*
CONFIG_ONENAND_IPL*/include/asm-arm/arch-mx31/mx31-regs.h +4
-0+ + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE;please use
CONFIG_SYS_orCONFIG_
Quoted 5 lines
Will do.
Quoted 1 line
and why not detect it?
Might be possible, I'll look into it to see if it's doable.
tks
Best Regards,
J.
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 12 lines · Magnus Lilja
Quoted 11 lines
2009/5/9 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 9 lines · Magnus Lilja
Review
Quoted 6 lines
(quoted diff) +0
-0@@ -32,7 +35,7 @@?#include <
version.h>
?.globl_start
?_start: b ? ?reset(quoted diff) +1
-1-#ifdef CONFIG_ONENAND_IPL +#if defined(CONFIG_ONENAND_IPL) || defined(CONFIG_NAND_SPL)create a better
CONFIG_
because we could need for other boot mode
Quoted 4 lines
Quoted 2 lines
A better
CONFIG_than what?CONFIG_NAND_SPLis already used elsewhere in U-boot when booting from NAND.IIRC in this case the purpose is to reduce the size of the
start.Sto allow more code in the ipl & spl
The main purpose of CONFIG_ONENAND_IPL and NAND_SPL in start.S is to change the behaviour a bit, not so much to save some space.
Regards, Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
In reply to Jean-Christophe PLAGNIOL-VILLARD2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
include/asm-arm/arch-mx31/mx31-regs.h
Quoted 4 lines
include/asm-arm/arch-mx31/mx31-regs.h +4
-0+ + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE;please use
CONFIG_SYS_orCONFIG_
Quoted 6 lines
Quoted 5 lines
Will do.
Quoted 1 line
and why not detect it?
Might be possible, I'll look into it to see if it's doable.
tks
It's not really doable. In order for this to be worthwhile the nand_flash_ids array from drivers/mtd/nand/nand_ids.c would have to fit into the available space (2048 byte in total) and it didn't even though I removed the text-strings.
So it's going to be controlled from the board config file.with CONFIG_something.
Regards, Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Quoted 11 lines · Magnus Lilja
2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
include/asm-arm/arch-mx31/mx31-regs.h
Quoted 4 lines
include/asm-arm/arch-mx31/mx31-regs.h +4
-0+ + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE;please use
CONFIG_SYS_orCONFIG_Will do.
Quoted 1 line
and why not detect it?
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Might be possible, I'll look into it to see if it's doable.
tks
It's not really doable. In order for this to be worthwhile the
nand_flash_idsarray fromdrivers/mtd/nand/nand_ids.cwould have to fit into the available space (2048 byte in total) and it didn't even though I removed the text-strings.
as you mention here there is only 2K so the start.S was reduced to allow more code so CONFIG_xxx_IPL/SPL do not describe this so please chance it to a better one
Best Regards,
J.
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
2009/5/12 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 15 lines · Magnus Lilja
Quoted 14 lines
2009/5/10 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
include/asm-arm/arch-mx31/mx31-regs.h
Quoted 4 lines
include/asm-arm/arch-mx31/mx31-regs.h +4
-0+ + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE;please use
CONFIG_SYS_orCONFIG_Will do.
Quoted 1 line
and why not detect it?
Might be possible, I'll look into it to see if it's doable.
tks
Quoted 8 lines
Quoted 4 lines
It's not really doable. In order for this to be worthwhile the
nand_flash_idsarray fromdrivers/mtd/nand/nand_ids.cwould have to fit into the available space (2048 byte in total) and it didn't even though I removed the text-strings.as you mention here there is only 2K so the
start.Swas reduced to allow more code so CONFIG_xxx_IPL/SPL do not describe this so please chance it to a better one
As I said in another email:
"The main purpose of CONFIG_ONENAND_IPL and NAND_SPL in start.S is to change the behaviour a bit, not so much to save some space." Given that those CONFIG_s are used in other places as well to indicate the type of boot I don't think it's good to create a new CONFIG_ that one has to specify in addition to one of the above.
Regards, Magnus
Quoted 4 lines
Best Regards,
J.
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Quoted 6 lines · Magnus Lilja
As I said in another email:
"The main purpose ofCONFIG_ONENAND_IPLandNAND_SPLinstart.Sis to change the behaviour a bit, not so much to save some space." Given that thoseCONFIG_sare used in other places as well to indicate the type of boot I don't think it's good to create a newCONFIG_that one has to specify in addition to one of the above.
Better to define one more in order to test only one... and use the new one for things that are generally applicable to pre-loaders regardless of type.
-Scott
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
In reply to Magnus LiljaQuoted 2 lines · Magnus Lilja
This patch adds the NAND SPL framework needed to boot i.MX31 boards from NAND.
Sorry for the delay...
Quoted 10 lines
include/asm-arm/arch-mx31/mx31-regs.h +2
-0@@ -194,4 +194,94 @@#define CS5_BASE 0xB6000000#define PCMCIA_MEM_BASE 0xC0000000 +/* +* NAND controller
include/asm-arm/arch-mx31/mx31-regs.h line 208
Quoted 10 lines
include/asm-arm/arch-mx31/mx31-regs.h +10
-0+*/ +#define NFC_BASE_ADDR 0xB8000000 + +/* +* Addresses for NFC registers +*/ +#define NFC_BUF_SIZE (NFC_BASE_ADDR + 0xE00) +#define NFC_BUF_ADDR (NFC_BASE_ADDR + 0xE04) +#define NFC_FLASH_ADDR (NFC_BASE_ADDR + 0xE06) +#define NFC_FLASH_CMD (NFC_BASE_ADDR + 0xE08)
The NFC register info should go in its own header, as it exists on more than just MX31 (e.g. mpc5xxx). Should probably use register structs rather than #defines.
Quoted 5 lines
include/asm-arm/arch-mx31/mx31-regs.h +5
-0+/* +* Addresses for NFC RAM BUFFER Main area 0 +*/ +#define MAIN_AREA0 (NFC_BASE_ADDR + 0x000) +#define MAIN_AREA1 (NFC_BASE_ADDR + 0x200)
include/asm-arm/arch-mx31/mx31-regs.h line 234
Quoted 10 lines
include/asm-arm/arch-mx31/mx31-regs.h +10
-0+#define MAIN_AREA2 (NFC_BASE_ADDR + 0x400) +#define MAIN_AREA3 (NFC_BASE_ADDR + 0x600) + +/* +* Addresses for NFC SPARE BUFFER Spare area 0 +*/ +#define SPARE_AREA0 (NFC_BASE_ADDR + 0x800) +#define SPARE_AREA1 (NFC_BASE_ADDR + 0x810) +#define SPARE_AREA2 (NFC_BASE_ADDR + 0x820) +#define SPARE_AREA3 (NFC_BASE_ADDR + 0x830)
NFC_MAIN_AREA0, etc.
nand_spl/nand_boot_mx31.c
Quoted 5 lines
nand_spl/nand_boot_mx31.c new file +0
-0
What in this file is MX31-specific? Even if you don't have other chips to test on, please try to provide a framework for generic NFC support so the next chip only needs to tweak the details. That may be as simple as s/mx31/nfc/.
nand_spl/nand_boot_mx31.c line 40
Quoted 13 lines
nand_spl/nand_boot_mx31.c new file +13
-0+static void mx31_wait_ready (void ) +{ +while (1 ) { +if (readw (NFC_CONFIG2 ) &NFC_INT ) { +uint32_t tmp; +/* Reset interrupt flag */ + tmp =readw (NFC_CONFIG2 ); + tmp &= ~NFC_INT ; +writew (tmp,NFC_CONFIG2 ); +break ; + } + } +}
while (!(readw(NFC_CONFIG2) & NFC_INT))
;
tmp = readw(NFC_CONFIG2);
...
Quoted 17 lines
nand_spl/nand_boot_mx31.c new file +17
-0+static void mx31_nand_page_address (unsigned int page_address) +{ +unsigned int page_count; + +writew (0x00 ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 ); +mx31_wait_ready (); + +/* code only for 2kb flash */ +if (CFG_NAND_PAGE_SIZE ==0x800 ) { +writew (0x00 ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 ); +mx31_wait_ready (); + } + + page_count =CFG_NAND_CHIP_SIZE /CFG_NAND_PAGE_SIZE ; +
nand_spl/nand_boot_mx31.c line 84
Quoted 10 lines
nand_spl/nand_boot_mx31.c new file +10
-0+if (page_address <= page_count) { + page_count--;/* transform 0x01000000 to 0x00ffffff */ +do { +writew (page_address &0xff ,NFC_FLASH_ADDR ); +writew (NFC_ADDR ,NFC_CONFIG2 ); +mx31_wait_ready (); + page_address = page_address >>8 ; + page_count = page_count >>8 ; + }while (page_count); + }
Does the number of address bytes really need to depend on the size of the flash chip, or can you base it on the number of non-zero bytes in page_address (the chip will know when the address phase is over because ALE drops)?
nand_spl/nand_boot_mx31.c line 112
Quoted 10 lines
nand_spl/nand_boot_mx31.c new file +10
-0+static int mx31_nand_check_ecc (void ) +{ +unsigned short ecc_status_register; + + ecc_status_register =readw (NFC_ECC_STATUS_RESULT ); + +if (ecc_status_register !=0 ) +return 1 ;/* error */ +return 0 ; +}
How about just "return readw(NFC_ECC_STATUS_RESULT);"?
nand_spl/nand_boot_mx31.c line 119
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +6
-0+static int mx31_read_page (unsigned int page_address,unsigned char *buf) +{ +int i; +volatile u32 *p1; +volatile u32 *p2; +u32 a;
s/p1/src/
s/p2/dest/
s/a/something (just a little) more descriptive/ -- my first guess was "address", but that doesn't seem right...
No volatile; use I/O accessors.
nand_spl/nand_boot_mx31.c line 126
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +6
-0+writew (0 ,NFC_BUF_ADDR );/* read in first 0 buffer */ +mx31_nand_command (NAND_CMD_READ0 ); +mx31_nand_page_address (page_address); + +if (CFG_NAND_CHIP_SIZE >=0x08000000 ) +mx31_nand_command (NAND_CMD_READSTART );
Is it guaranteed that all NAND chips above that size will be large page and all chips below that size will be small page?
nand_spl/nand_boot_mx31.c line 153
Quoted 9 lines
nand_spl/nand_boot_mx31.c new file +9
-0+/* it is hardware specific code for 8-bit 512B NAND-flash spare area */ + p1++; + a = *p1; + a = (a &0x0000ff00 ) >>8 ; + +if (a !=0xff )/* bad block marker verify */ +return 1 ;/* potential bad block */ + +return 0 ;
The bad block location is typically different (offset 0 rather than 5) with large page flash.
nand_spl/nand_boot_mx31.c line 176
Quoted 1 line
nand_spl/nand_boot_mx31.c new file +1
-0+/* checking first page of each block */
I believe some NAND chips may mark a block bad in its second page...
-Scott
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
2009/5/29 Scott Wood <[email protected]>:
Quoted 5 lines · Magnus Lilja
Quoted 2 lines
This patch adds the NAND SPL framework needed to boot i.MX31 boards from NAND.
Sorry for the delay...
Well, better now than the next time I post these patches.
Quoted 8 lines
Quoted 8 lines
include/asm-arm/arch-mx31/mx31-regs.h +0
-0@@ -194,4 +194,94 @@?#define
CS5_BASE? ?0xB6000000
?#definePCMCIA_MEM_BASE? ? ?0xC0000000
Quoted 16 lines
include/asm-arm/arch-mx31/mx31-regs.h
Quoted 12 lines
include/asm-arm/arch-mx31/mx31-regs.h +12
-0+/* +* NAND controller +*/ +#define NFC_BASE_ADDR ? ? ? ?0xB8000000 + +/* +* Addresses for NFC registers +*/ +#define NFC_BUF_SIZE ? ? ? ? (NFC_BASE_ADDR + 0xE00) +#define NFC_BUF_ADDR ? ? ? ? (NFC_BASE_ADDR + 0xE04) +#define NFC_FLASH_ADDR ? ? ? ? ? ? ? (NFC_BASE_ADDR + 0xE06) +#define NFC_FLASH_CMD ? ? ? ? ? ? ? ?(NFC_BASE_ADDR + 0xE08)The NFC register info should go in its own header, as it exists on more than just MX31 (e.g. mpc5xxx). ?Should probably use register structs rather than #defines.
Yes, will do that. I'm converting the #define's to struct {} and all accesses will be in the readl/writel(&nfc->flash_cmd) format.
Quoted 10 lines
nand_spl/nand_boot_mx31.c
Quoted 5 lines
nand_spl/nand_boot_mx31.c new file +0
-0What in this file is MX31-specific? ?Even if you don't have other chips to test on, please try to provide a framework for generic NFC support so the next chip only needs to tweak the details. ?That may be as simple as s/mx31/nfc/.
I'll look into that.
Quoted 17 lines
nand_spl/nand_boot_mx31.c
Quoted 13 lines
nand_spl/nand_boot_mx31.c new file +13
-0+static void mx31_wait_ready (void ) +{ + ? ? while (1) { + ? ? ? ? ? ? if (readw(NFC_CONFIG2) & NFC_INT) { + ? ? ? ? ? ? ? ? ? ? uint32_t tmp; + ? ? ? ? ? ? ? ? ? ? /* Reset interrupt flag */ + ? ? ? ? ? ? ? ? ? ? tmp = readw(NFC_CONFIG2); + ? ? ? ? ? ? ? ? ? ? tmp &= ~NFC_INT; + ? ? ? ? ? ? ? ? ? ? writew(tmp, NFC_CONFIG2); + ? ? ? ? ? ? ? ? ? ? break; + ? ? ? ? ? ? } + ? ? } +}while (!(readw(NFC_CONFIG2) &
NFC_INT))
? ? ? ?;
Quoted 3 lines
tmp =
readw(NFC_CONFIG2);
...
Ok.
Quoted 24 lines
Quoted 24 lines
nand_spl/nand_boot_mx31.c new file +24
-0+static void mx31_nand_page_address (unsigned int page_address) +{ + ? ? unsigned int page_count; + + ? ? writew(0x00, NFC_FLASH_ADDR); + ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? mx31_wait_ready(); + + ? ? /* code only for 2kb flash */ + ? ? if (CFG_NAND_PAGE_SIZE == 0x800) { + ? ? ? ? ? ? writew(0x00, NFC_FLASH_ADDR); + ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? ? ? ? ? mx31_wait_ready(); + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE; + + ? ? if (page_address <= page_count) { + ? ? ? ? ? ? page_count--; /* transform 0x01000000 to 0x00ffffff */ + ? ? ? ? ? ? do { + ? ? ? ? ? ? ? ? ? ? writew(page_address & 0xff, NFC_FLASH_ADDR); + ? ? ? ? ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? ? ? ? ? ? ? ? ? mx31_wait_ready(); + ? ? ? ? ? ? ? ? ? ? page_address = page_address >> 8;
Quoted 8 lines
Quoted 3 lines
+ ? ? ? ? ? ? ? ? ? ?
page_count=page_count>> 8;
+ ? ? ? ? ? ? } while (page_count);
+ ? ? }Does the number of address bytes really need to depend on the size of the flash chip, or can you base it on the number of non-zero bytes in
page_address(the chip will know when the address phase is over because ALE drops)?
Ok, will try to look into it.
Quoted 4 lines
Quoted 4 lines
nand_spl/nand_boot_mx31.c new file +4
-0+static int mx31_nand_check_ecc (void ) +{ + ? ? unsigned short ecc_status_register; +
Quoted 8 lines
nand_spl/nand_boot_mx31.c
Quoted 6 lines
+ ? ?
ecc_status_register=readw(NFC_ECC_STATUS_RESULT);nand_spl/nand_boot_mx31.c new file +5
-0+ + ? ? if (ecc_status_register != 0) + ? ? ? ? ? ? return 1; /* error */ + ? ? return 0; +}How about just "return
readw(NFC_ECC_STATUS_RESULT);"?
ok
Quoted 10 lines
nand_spl/nand_boot_mx31.c
Quoted 6 lines
nand_spl/nand_boot_mx31.c new file +6
-0+static int mx31_read_page (unsigned int page_address,unsigned char *buf) +{ + ? ? int i; + ? ? volatile u32 *p1; + ? ? volatile u32 *p2; + ? ? u32 a;s/p1/src/
s/p2/dest/
Quoted 2 lines
s/a/something (just a little) more descriptive/ -- my first guess was "address", but that doesn't seem right...
Ok
Quoted 1 line
No volatile; use I/O accessors.
Yes, already on todo-list.
Quoted 9 lines
Quoted 6 lines
+ ? ?
writew(0, NFC_BUF_ADDR); /* read in first 0 buffer */
+ ? ?mx31_nand_command(NAND_CMD_READ0);
+ ? ?mx31_nand_page_address(page_address);
+
+ ? ? if (CFG_NAND_CHIP_SIZE>=0x08000000)
+ ? ? ? ? ? ?mx31_nand_command(NAND_CMD_READSTART);Is it guaranteed that all NAND chips above that size will be large page and all chips below that size will be small page?
No, I'll change to use the CONFIG_SYS_NAND_PAGE_SIZE to do different stuff depending on the page size.
Quoted 4 lines
Quoted 4 lines
+ ? ? /* it is hardware specific code for 8-bit 512B NAND-flash spare area */
+ ? ? p1++;
+ ? ? a = *p1;
+ ? ? a = (a &0x0000ff00) >> 8;
Quoted 8 lines
nand_spl/nand_boot_mx31.c
Quoted 5 lines
nand_spl/nand_boot_mx31.c new file +5
-0+ + ? ? if (a != 0xff) /* bad block marker verify */ + ? ? ? ? ? ? return 1; /* potential bad block */ + + ? ? return 0;The bad block location is typically different (offset 0 rather than 5) with large page flash.
I think that's because of the non-standard imlementation of large page support in the i.MX31 NFC.
Quoted 3 lines
Quoted 1 line
+ ? ? ? ? ? ? /* checking first page of each block */
I believe some NAND chips may mark a block bad in its second page...
I'll see what I can do.
/Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Quoted 6 lines · Magnus Lilja
2009/5/29 Scott Wood <[email protected]>:
Quoted 2 lines
The bad block location is typically different (offset 0 rather than 5) with large page flash.
I think that's because of the non-standard imlementation of large page support in the i.MX31 NFC.
We should have comments in the code explaining what's going on in such cases.
-Scott
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Hi
2009/6/1 Scott Wood <[email protected]>:
Quoted 10 lines · Magnus Lilja
Quoted 6 lines
2009/5/29 Scott Wood <[email protected]>:
Quoted 2 lines
The bad block location is typically different (offset 0 rather than 5) with large page flash.
I think that's because of the non-standard imlementation of large page support in the i.MX31 NFC.
We should have comments in the code explaining what's going on in such cases.
Yes, I'll add that.
/Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
In reply to Magnus LiljaHi
2009/5/30 Magnus Lilja <[email protected]>:
Quoted 35 lines
2009/5/29 Scott Wood <[email protected]>:
Quoted 25 lines · Magnus Lilja
Quoted 24 lines
(quoted diff) +24
-0+static void mx31_nand_page_address(unsigned int page_address) +{ + ? ? unsigned int page_count; + + ? ? writew(0x00, NFC_FLASH_ADDR); + ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? mx31_wait_ready(); + + ? ? /* code only for 2kb flash */ + ? ? if (CFG_NAND_PAGE_SIZE == 0x800) { + ? ? ? ? ? ? writew(0x00, NFC_FLASH_ADDR); + ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? ? ? ? ? mx31_wait_ready(); + ? ? } + + ? ? page_count = CFG_NAND_CHIP_SIZE / CFG_NAND_PAGE_SIZE; + + ? ? if (page_address <= page_count) { + ? ? ? ? ? ? page_count--; /* transform 0x01000000 to 0x00ffffff */ + ? ? ? ? ? ? do { + ? ? ? ? ? ? ? ? ? ? writew(page_address & 0xff, NFC_FLASH_ADDR); + ? ? ? ? ? ? ? ? ? ? writew(NFC_ADDR, NFC_CONFIG2); + ? ? ? ? ? ? ? ? ? ? mx31_wait_ready(); + ? ? ? ? ? ? ? ? ? ? page_address = page_address >> 8;Quoted 8 lines
Quoted 3 lines
+ ? ? ? ? ? ? ? ? ? ?
page_count=page_count>> 8;
+ ? ? ? ? ? ? } while (page_count);
+ ? ? }Does the number of address bytes really need to depend on the size of the flash chip, or can you base it on the number of non-zero bytes in
page_address(the chip will know when the address phase is over because ALE drops)?
Quoted 1 line
Ok, will try to look into it.
I did try to output only the non-zero bytes in the page_address but that didn't work at all, u-boot didn't boot Don't know why though.
/Magnus
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
Quoted 10 lines · Magnus Lilja
2009/5/30 Magnus Lilja <[email protected]>:
Quoted 6 lines
2009/5/29 Scott Wood <[email protected]>:
Quoted 4 lines
Does the number of address bytes really need to depend on the size of the flash chip, or can you base it on the number of non-zero bytes in
page_address(the chip will know when the address phase is over because ALE drops)?Ok, will try to look into it.
I did try to output only the non-zero bytes in the
page_addressbut that didn't work at all, u-boot didn't boot Don't know why though.
Yes, I was a bit confused -- it looks like we can't omit high-order zero bytes, but I don't think it'll hurt (at least one chip manual explicitly says it won't) to have extra bytes. So we could still keep the number of bytes fixed at the number for the largest supported chip.
Or, we could leave it the way it is, if you're not having any problems with the extra code fitting in the boot page, and if you don't need to dynamically support multiple chip sizes.
-Scott
PATCH v2 1/3 MX31: Add NAND SPL for i.MX31.
2009/6/1 Scott Wood <[email protected]>:
Quoted 17 lines
Quoted 11 lines · Magnus Lilja
2009/5/30 Magnus Lilja <[email protected]>:
Quoted 9 lines
2009/5/29 Scott Wood <[email protected]>:
Quoted 6 lines
Does the number of address bytes really need to depend on the size of the
flash chip, or can you base it on the number of non-zero bytes inpage_address(the chip will know when the address phase is over because ALE drops)?Quoted 4 lines
Quoted 1 line
Ok, will try to look into it.
I did try to output only the non-zero bytes in the
page_addressbut that didn't work at all, u-boot didn't boot Don't know why though.
Quoted 8 lines
Yes, I was a bit confused -- it looks like we can't omit high-order zero bytes, but I don't think it'll hurt (at least one chip manual explicitly says it won't) to have extra bytes. ?So we could still keep the number of bytes fixed at the number for the largest supported chip.
Or, we could leave it the way it is, if you're not having any problems with the extra code fitting in the boot page, and if you don't need to dynamically support multiple chip sizes.
I think I'll leave it as is. There is no need to support multiple chip sizes dynamically, in order to do that we have to detect the chip type during boot and I couldn't fit that code into the boot page.
/Magnus