Skip to contentSkip to conversation

MX31: NAND boot for phyCORE and PDK boards.

RFC Superseded Magnus Lilja 2 participants 9 messages Apr 3, 2009 – Apr 6, 2009

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover MX31: NAND boot for phyCORE and PDK boards.

Hi all,

The following patches add NAND boot support for the i.MX31. I have cleaned up Maxim Artamonov's latest patch (which was for the phyCORE module) and also added i.MX31 PDK support.

The series applies on top of Wolfgang's main tree as of yesterday.

The original NAND SPL patch has been split into two patches, one that adds the NAND SPL framework for i.MX31 and one that contains only the phyCORE parts.

The last two patches first add i.MX31 PDK support and then NAND boot.

I haven't taken care of all comments that were presented to Maxim's latest patch so there's more work to be done before this can be added to the main U-boot tree. So this is a work in progress presented "as is" since some people on the list are interested in booting the PDK from NAND.

The code for i.MX31 PDK has been tested on real hardware and boots Linux from ethernet. phyCORE has only been compiled.

Regards, Magnus

Magnus Lilja (5):
MX31: Add NAND SPL for i.MX31.
MX31: Add NAND SPL support for phycore i.MX31 board. Add NAND SPL entries to gitignore.
MX31: Add basic support for Freescale i.MX31 PDK board.
MX31: Add NAND SPL boot support to i.MX31 PDK board.

 .gitignore                                  |    1 +
 MAKEALL                                     |    3 +
 Makefile                                    |   19 +++-
 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 ++++++++
 board/imx31_phycore/config.mk               |   10 ++
 board/imx31_phycore/lowlevel_init.S         |   26 ++++
 cpu/arm1136/start.S                         |   36 ++++--
 include/asm-arm/arch-mx31/mx31-regs.h       |   98 +++++++++++++
 include/configs/imx31_phycore.h             |   33 +++++
 include/configs/mx31pdk.h                   |  175 +++++++++++++++++++++++
 nand_spl/.gitignore                         |    7 +
 nand_spl/board/freescale/mx31pdk/.gitignore |    8 +
 nand_spl/board/freescale/mx31pdk/Makefile   |   66 +++++++++
 nand_spl/board/freescale/mx31pdk/config.mk  |    5 +
 nand_spl/board/freescale/mx31pdk/u-boot.lds |   36 +++++
 nand_spl/nand_boot_mx31.c                   |  204 +++++++++++++++++++++++++++
 21 files changed, 1066 insertions(+), 10 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/.gitignore
 create mode 100644 nand_spl/board/freescale/mx31pdk/.gitignore
 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
#1 lore raw

RFC 1/5 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).

--

Changes since V3 (original author's latest post):
* Updated to apply on the main U-boot tree as of 2009-04-02
* Split the patch into two parts, one with the NAND SPL framework and one which activates the NAND boot for the phycore board.
* Coding style corrections.

---
 cpu/arm1136/start.S                   |   36 +++++--
 include/asm-arm/arch-mx31/mx31-regs.h |   96 +++++++++++++++
 nand_spl/nand_boot_mx31.c             |  204 +++++++++++++++++++++++++++++++++
 3 files changed, 327 insertions(+), 9 deletions(-)
 create mode 100644 nand_spl/nand_boot_mx31.c
cpu/arm1136/start.S +27 -9
index e622338..e87bf99 100644
@@ -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,6 +35,15 @@
 #include <version.h>
 .globl _start
 _start: b	reset
+#ifdef CONFIG_NAND_SPL
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+#else
 #ifdef CONFIG_ONENAND_IPL
 	ldr	pc, _hang
 	ldr	pc, _hang
@@ -68,6 +80,7 @@ _irq:			.word irq
 _fiq:			.word fiq
 _pad:			.word 0x12345678 /* now 16*4=64 */
 #endif	/* CONFIG_ONENAND_IPL */
+#endif	/* CONFIG_NAND_SPL */
 .global _end_vect
 _end_vect:
 
@@ -156,9 +169,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 +188,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 +197,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 +213,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 +260,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,11 +373,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
  */
+#ifndef CONFIG_NAND_SPL
 #ifdef CONFIG_ONENAND_IPL
 	.align	5
 do_hang:
@@ -436,3 +453,4 @@ arm1136_cache_flush:
 		mcr	p15, 0, r1, c7, c5, 0	@ invalidate I cache
 		mov	pc, lr			@ back to caller
 #endif	/* CONFIG_ONENAND_IPL */
+#endif	/* !CONFIG_NAND_SPL*/
include/asm-arm/arch-mx31/mx31-regs.h +96 -0

100 lines not on this page · raw message

nand_spl/nand_boot_mx31.c new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
1.5.6
#2 lore raw

RFC 2/5 MX31: Add NAND SPL support for phycore i.MX31 board.

This patch is the phycore part of Maxim Artamonov's NAND SPL on phycore patch.

The note below is from the original patch.

Note: By default, Phytec phyCORE-i.MX31 board (pcm-037 and pcm-970) is not suitable for nand-bootloading, because of SW5 switchers block haven't appropriate modes (8-bit, 2k page or 16-bit, 512 page) for BOOTPINS[4:0] and nand-flash (8-bit mode, 512B page) contemporary. There is require to make RESOLDER for really nand-booting either BOOTPIN state or JN1/2 and RN41/42.

The original patch was signed-off-by Maxim Artamonov <[email protected] >.

---
 MAKEALL                             |    1 +
 Makefile                            |    9 ++++++++-
 board/imx31_phycore/config.mk       |   10 ++++++++++
 board/imx31_phycore/lowlevel_init.S |   26 ++++++++++++++++++++++++++
 include/configs/imx31_phycore.h     |   33 +++++++++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 1 deletions(-)
MAKEALL +1 -0
index 854f303..94ad389 100755
@@ -547,6 +547,7 @@ LIST_ARM11="			\
 	imx31_litekit		\
 	imx31_phycore		\
 	imx31_phycore_eet	\
+ 	imx31_phycore_nand	\
 	mx31ads			\
 	qong			\
 	smdk6400		\
Makefile +8 -1
index f857641..f0981ce 100644
@@ -367,7 +367,7 @@ $(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 $(obj)include/autoconf.mk
-		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+		cat $(obj)nand_spl/u-boot-spl-aligned.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
 
 $(ONENAND_IPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
@@ -3071,6 +3071,13 @@ imx31_phycore_config	: unconfig
 	fi
 	@$(MKCONFIG) -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
 
+imx31_phycore_nand_config	: unconfig
+	@mkdir -p $(obj)include $(obj)board/imx31_phycore
+	@mkdir -p $(obj)nand_spl/board/imx31_phycore
+	@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
+	@$(MKCONFIG) -n $@ -a imx31_phycore arm arm1136 imx31_phycore NULL mx31
+	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
+
 mx31ads_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
 
board/imx31_phycore/config.mk +10 -0
index d34dc02..412defc 100644
@@ -1 +1,11 @@
+#
+# (C) Copyright 2008
+# was changed by Maxim Artamonov, <[email protected]>
+#
+
+ifndef CONFIG_NAND_SPL
 TEXT_BASE = 0x87f00000
+else
+TEXT_BASE = 0x87ec0000
+endif
+
board/imx31_phycore/lowlevel_init.S +26 -0
index c5d6eb0..0733240 100644
@@ -1,5 +1,8 @@
 /*
  *
+ * (C) Copyright 2008
+ * Maxim Artamonov, <[email protected]>
+ * 
  * (c) 2007 Pengutronix, Sascha Hauer <[email protected]>
  *
  * See file CREDITS for list of people who contributed to this
@@ -43,6 +46,20 @@
 	bcs 1b
 .endm
 
+#ifdef CONFIG_NAND_SPL
+/* somewhat macro to reduce bin size for CONFIG_NAND_SPL*/
+.macro FILLREGS begreg, val, count, step
+	ldr r2, =\begreg
+	ldr r3, =\val
+	ldr	r4, =\count
+2:
+	str	r3,	[r2]
+	add	r2,	r2, #\step
+	subs	r4,	r4,	#1
+	bcs 2b
+.endm
+#endif
+
 .globl lowlevel_init
 lowlevel_init:
 
@@ -60,10 +77,18 @@ lowlevel_init:
 
 	REG	CCM_SPCTL, PLL_PD(1) | PLL_MFD(0x43) | PLL_MFI(12) | PLL_MFN(1)
 
+#ifdef CONFIG_NAND_SPL
+	FILLREGS 0x43FAC26C, 0, 0x3, 0x4
+#else
 	REG	0x43FAC26C, 0 /* SDCLK */
 	REG	0x43FAC270, 0 /* CAS */
 	REG	0x43FAC274, 0 /* RAS */
+#endif /* CONFIG_NAND_SPL */
 	REG	0x43FAC27C, 0x1000 /* CS2 (CSD0) */
+
+#ifdef CONFIG_NAND_SPL
+	FILLREGS 0x43FAC284, 0, 0x17, 0x4
+#else
 	REG	0x43FAC284, 0 /* DQM3 */
 	REG	0x43FAC288, 0 /* DQM2, DQM1, DQM0, SD31-SD0, A25-A0, MA10 (0x288..0x2DC) */
 	REG	0x43FAC28C, 0
@@ -87,6 +112,7 @@ lowlevel_init:
 	REG	0x43FAC2D4, 0
 	REG	0x43FAC2D8, 0
 	REG	0x43FAC2DC, 0
+#endif /* CONFIG_NAND_SPL */
 	REG	0xB8001010, 0x00000004
 	REG	0xB8001004, 0x006ac73a
 	REG	0xB8001000, 0x92100000
include/configs/imx31_phycore.h +33 -0
index cbc0b92..dbe415b 100644
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2008
+ * Maxim Artamonov, <[email protected]>
+ *
  * (C) Copyright 2004
  * Texas Instruments.
  * Richard Woodruff <[email protected]>
@@ -34,6 +37,11 @@
 #define CONFIG_MX31_HCLK_FREQ	26000000
 #define CONFIG_MX31_CLK32	32000
 
+#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+#endif
+
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 
@@ -172,6 +180,31 @@
 #define CONFIG_SYS_FLASH_ERASE_TOUT	(100*CONFIG_SYS_HZ) /* Timeout for Flash Erase */
 #define CONFIG_SYS_FLASH_WRITE_TOUT	(100*CONFIG_SYS_HZ) /* Timeout for Flash Write */
 
+/*-----------------------------------------------------------------------
+ * NAND flash
+ */
+
+#define NAND_MAX_CHIPS		1
+#define CFG_MAX_NAND_DEVICE	1
+#define CFG_NAND_BASE		0x40000000
+
+/*
+ * Because of small buffer size of NFC in iMX31, SPL has to fit into 2kB. 
+ */
+
+/*CFG_NAND_U_BOOT_OFFS and CFG_NAND_U_BOOT_SIZE must be align to full pages*/ 
+#define CFG_NAND_U_BOOT_OFFS	0x800
+#define CFG_NAND_U_BOOT_SIZE	0x30000
+#define CFG_NAND_U_BOOT_DST		0x87f00000	/* Load big U-Boot to this addr      */
+#define CFG_NAND_U_BOOT_START	CFG_NAND_U_BOOT_DST	 /* Start big U-Boot from  */
+#define CFG_NAND_SPL_DST		CFG_NAND_U_BOOT_DST-0x40000 /* Relocate NAND_SPL to this adress*/
+
+#define CFG_NAND_PAGE_SIZE		0x200
+#define CFG_NAND_BLOCK_SIZE		0x4000
+#define CFG_NAND_PAGES_PER_BLOCK	0x20
+/*for NAND_SPL*/
+#define CFG_NAND_CHIP_SIZE		0x4000000
+
 /*
  * JFFS2 partitions
  */
Signature · 1 line
1.5.6
#3 lore raw

RFC 3/5 Add NAND SPL entries to gitignore.

---
 .gitignore          |    1 +
 nand_spl/.gitignore |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
 create mode 100644 nand_spl/.gitignore
.gitignore +1 -0
index e13fc96..6c7406d 100644
@@ -29,6 +29,7 @@
 /u-boot.ldr.srec
 /u-boot-onenand.bin
 /u-boot-flexonenand.bin
+/u-boot-nand.bin
 
 #
 # Generated files
nand_spl/.gitignore new file +7 -0
new file mode 100644
index 0000000..af5f02b
@@ -0,0 +1,7 @@
+# NAND-SPL files
+/u-boot-spl
+/u-boot-spl-aligned.bin
+/u-boot-spl.bin
+/u-boot-spl.map
+/board/imx31_phycore/nand_boot_mx31.c
+/board/imx31_phycore/*.S
Signature · 1 line
1.5.6
#4 lore raw

RFC 4/5 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
index 94ad389..b581608 100755
@@ -549,6 +549,7 @@ LIST_ARM11="			\
 	imx31_phycore_eet	\
  	imx31_phycore_nand	\
 	mx31ads			\
+ 	mx31pdk			\
 	qong			\
 	smdk6400		\
 "
Makefile +3 -0
index f0981ce..40f3465 100644
@@ -3081,6 +3081,9 @@ imx31_phycore_nand_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
new file mode 100644
index 0000000..d34dc02
@@ -0,0 +1 @@
+TEXT_BASE = 0x87f00000
board/freescale/mx31pdk/lowlevel_init.S new file +30 -0
new file mode 100644
index 0000000..ec5eedb
@@ -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
index 45f2ae3..34da648 100644
@@ -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
#5 lore raw

RFC 5/5 MX31: Add NAND SPL boot support to i.MX31 PDK board.

---
 MAKEALL                                     |    3 +-
 Makefile                                    |    7 ++
 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/.gitignore |    8 ++
 nand_spl/board/freescale/mx31pdk/Makefile   |   66 +++++++++++++++++++
 nand_spl/board/freescale/mx31pdk/config.mk  |    5 ++
 nand_spl/board/freescale/mx31pdk/u-boot.lds |   36 ++++++++++
 10 files changed, 270 insertions(+), 4 deletions(-)
 create mode 100644 board/freescale/mx31pdk/u-boot-nand.lds
 create mode 100644 nand_spl/board/freescale/mx31pdk/.gitignore
 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
index b581608..2f55060 100755
@@ -549,7 +549,8 @@ LIST_ARM11="			\
 	imx31_phycore_eet	\
  	imx31_phycore_nand	\
 	mx31ads			\
- 	mx31pdk			\
+	mx31pdk			\
+	mx31pdk_nand		\
 	qong			\
 	smdk6400		\
 "
Makefile +7 -0
index 40f3465..9706cb2 100644
@@ -3084,6 +3084,13 @@ mx31ads_config		: unconfig
 mx31pdk_config		: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 mx31pdk freescale mx31
 
+mx31pdk_nand_config	: unconfig
+	@mkdir -p $(obj)include $(obj)board/mx31pdk
+	@mkdir -p $(obj)nand_spl/board/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
index d34dc02..dcaa09f 100644
@@ -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
new file mode 100644
index 0000000..b604480
@@ -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
index deda70d..29b1574 100644
@@ -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/.gitignore new file +8 -0
new file mode 100644
index 0000000..f3c743e
@@ -0,0 +1,8 @@
+#
+# Linked files.
+#
+
+/lowlevel_init.S
+/nand_boot_mx31.c
+/start.S
+
nand_spl/board/freescale/mx31pdk/Makefile new file +66 -0

66 lines not on this page · raw message

nand_spl/board/freescale/mx31pdk/config.mk new file +5 -0
new file mode 100644
index 0000000..119934b
@@ -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
new file mode 100644
index 0000000..2780e11
@@ -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
#6 lore raw

RFC 3/5 Add NAND SPL entries to gitignore.

In reply to Magnus Lilja

nand_spl/.gitignore line 7

Quoted 13 lines · Magnus Lilja
nand_spl/.gitignore new file +7 -0
new file mode 100644
index 0000000..af5f02b
@@ -0,0 +1,7 @@
+# NAND-SPL files
+/u-boot-spl
+/u-boot-spl-aligned.bin
+/u-boot-spl.bin
+/u-boot-spl.map
+/board/imx31_phycore/nand_boot_mx31.c
+/board/imx31_phycore/*.S

Hmm, can we create a directory for board-specific temporary files to go, so we don't need board-specific stuff in .gitignore?

Or better, add some makefile rules so we can produce nand_spl versions of .o files without having to symlink the source anywhere.

-Scott

#7 lore raw

RFC 3/5 Add NAND SPL entries to gitignore.

Hi

2009/4/3 Scott Wood <[email protected]>:

Quoted 19 lines
Quoted 7 lines · Magnus Lilja
nand_spl/.gitignore new file +0 -0
new file mode 100644
index 0000000..af5f02b

nand_spl/.gitignore line 7

Quoted 7 lines
nand_spl/.gitignore new file +7 -0
@@ -0,0 +1,7 @@
+# NAND-SPL files
+/u-boot-spl
+/u-boot-spl-aligned.bin
+/u-boot-spl.bin
+/u-boot-spl.map
+/board/imx31_phycore/nand_boot_mx31.c
+/board/imx31_phycore/*.S

Hmm, can we create a directory for board-specific temporary files to go, so we don't need board-specific stuff in .gitignore?

Quoted 2 lines

Or better, add some makefile rules so we can produce nand_spl versions of .o files without having to symlink the source anywhere.

Sounds like a good idea. I have one solution for this now, I'll see if there's a better one before posting a suggestion tomorrow evening.

/Magnus

#8 lore raw

RFC 3/5 Add NAND SPL entries to gitignore.

Hi

Quoted 13 lines
Quoted 13 lines

Review line 7

Quoted 9 lines

+++ b/nand_spl/.gitignore

(quoted diff) +7 -0
@@ -0,0 +1,7 @@
+# NAND-SPL files
+/u-boot-spl
+/u-boot-spl-aligned.bin
+/u-boot-spl.bin
+/u-boot-spl.map
+/board/imx31_phycore/nand_boot_mx31.c
+/board/imx31_phycore/*.S

Hmm, can we create a directory for board-specific temporary files to go, so we don't need board-specific stuff in .gitignore?

Quoted 5 lines
Quoted 2 lines

Or better, add some makefile rules so we can produce nand_spl versions of .o files without having to symlink the source anywhere.

Sounds like a good idea. I have one solution for this now, I'll see if there's a better one before posting a suggestion tomorrow evening.

Ok, I have an updated nand_spl/board/freescale/mx31pdk/Makefile below. It works for both in-tree and out of tree builds. I'm not particularly happy with the "$(obj)%.o: $(SRCTREE)..." lines but I couldn't make it work otherwise. Perhaps someone has a better solution.

I know gmail will mangle at least one long line, but I'll update my patch series later as well.

Thanks, Magnus

Makefile new file +23 -0
@@ -0,0 +1,54 @@
+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 lowlevel_init.o
+COBJS	= nand_boot_mx31.o
+
+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-aligned.bin
+
+all: $(obj).depend $(ALL)
+
+$(nandobj)u-boot-spl-aligned.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
+
+#########################################################################
+
+$(obj)%.o: $(SRCTREE)/cpu/arm1136/%.S
+ $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o: $(SRCTREE)/board/freescale/mx31pdk/%.S
+ $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o: $(SRCTREE)/nand_spl/%.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################