Skip to contentSkip to conversation

qi_lb60(Ben NanoNote): add nand spl and usbboot support

PATCH Superseded xiangfu at openmobilefree.net 2 participants 13 messages Oct 12, 2012 – Oct 13, 2012

Subsystems (3)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover qi_lb60(Ben NanoNote): add nand spl and usbboot support

From: Xiangfu <[email protected]>

Big thanks to Tom Rini and Daniel Schwierzeck for feedback.

V5:
* use puts instread of serial_puts (enable CONFIG_SPL_LIBCOMMON_SUPPORT)
* update my email address
* fix compiles warnings

V4:
* split to 2 patches (nand spl/usbbot)
* remove use define string.c using CONFIG_SPL_LIBGENERIC_SUPPORT
* fix checkputch.pl warnings

V3:
* add simpile string.c to mips/lib
* some cleanup on jz4740.c
* move to new spl/ structure
* support software usbboot mode

Xiangfu (2):
qi_lb60: add nand spl support
qi_lb60: add software usbboot support

 arch/mips/cpu/xburst/Makefile     |    7 +-
 arch/mips/cpu/xburst/cpu.c        |    4 +
 arch/mips/cpu/xburst/jz4740.c     |   84 ++--
 arch/mips/cpu/xburst/spl/Makefile |   47 +++
 arch/mips/cpu/xburst/spl/start.S  |   63 +++
 board/qi/qi_lb60/Makefile         |    5 +
 board/qi/qi_lb60/qi_lb60-spl.c    |   50 +++
 board/qi/qi_lb60/qi_lb60.c        |    8 +-
 board/qi/qi_lb60/u-boot-spl.lds   |   62 +++
 board/qi/qi_lb60/usbboot.S        |  838 +++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/jz4740_nand.c    |   39 +-
 include/configs/qi_lb60.h         |  175 ++++----
 12 files changed, 1235 insertions(+), 147 deletions(-)
 create mode 100644 arch/mips/cpu/xburst/spl/Makefile
 create mode 100644 arch/mips/cpu/xburst/spl/start.S
 create mode 100644 board/qi/qi_lb60/qi_lb60-spl.c
 create mode 100644 board/qi/qi_lb60/u-boot-spl.lds
 create mode 100644 board/qi/qi_lb60/usbboot.S
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v5 1/2 qi_lb60: add nand spl support

From: Xiangfu <[email protected]>

The JZ4740 CPU can load 8KB from two different addresses:
1. the normal area up to 8KB starting from NAND flash address 0x00000000
2. the backup area up to 8KB starting from NAND flash address 0x00002000

After create u-boot-spl.bin. it needs those 4 commands create final image for jz4740 cpu.
~~~~
dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192 count=1
dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin
~~~~

---
 arch/mips/cpu/xburst/Makefile     |    7 +-
 arch/mips/cpu/xburst/cpu.c        |    4 +
 arch/mips/cpu/xburst/jz4740.c     |   84 +++++++-----------
 arch/mips/cpu/xburst/spl/Makefile |   47 ++++++++++
 arch/mips/cpu/xburst/spl/start.S  |   63 +++++++++++++
 board/qi/qi_lb60/Makefile         |    5 ++
 board/qi/qi_lb60/qi_lb60-spl.c    |   30 +++++++
 board/qi/qi_lb60/qi_lb60.c        |    8 +-
 board/qi/qi_lb60/u-boot-spl.lds   |   62 +++++++++++++
 drivers/mtd/nand/jz4740_nand.c    |   39 ++++++++-
 include/configs/qi_lb60.h         |  175 ++++++++++++++++++-------------------
 11 files changed, 377 insertions(+), 147 deletions(-)
 create mode 100644 arch/mips/cpu/xburst/spl/Makefile
 create mode 100644 arch/mips/cpu/xburst/spl/start.S
 create mode 100644 board/qi/qi_lb60/qi_lb60-spl.c
 create mode 100644 board/qi/qi_lb60/u-boot-spl.lds
arch/mips/cpu/xburst/Makefile +5 -2
index b1f2ae4..ec35e55 100644
@@ -24,9 +24,12 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).o
 
+COBJS-y	= cpu.o jz_serial.o
+
+ifneq ($(CONFIG_SPL_BUILD),y)
 START	= start.o
-SOBJS-y	=
-COBJS-y	= cpu.o timer.o jz_serial.o
+COBJS-y += timer.o
+endif
 
 COBJS-$(CONFIG_JZ4740) += jz4740.o
 
arch/mips/cpu/xburst/cpu.c +4 -0
index ddcbfaa..1432838 100644
@@ -42,6 +42,8 @@
 		:			\
 		: "i" (op), "R" (*(unsigned char *)(addr)))
 
+#ifndef CONFIG_SPL_BUILD
+
 void __attribute__((weak)) _machine_restart(void)
 {
 	struct jz4740_wdt *wdt = (struct jz4740_wdt *)JZ4740_WDT_BASE;
@@ -109,6 +111,8 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)
 		cache_op(Hit_Invalidate_D, addr);
 }
 
+#endif
+
 void flush_icache_all(void)
 {
 	u32 addr, t = 0;
arch/mips/cpu/xburst/jz4740.c +33 -51

171 lines not on this page · raw message

arch/mips/cpu/xburst/spl/Makefile new file +47 -0

47 lines not on this page · raw message

arch/mips/cpu/xburst/spl/start.S new file +63 -0

63 lines not on this page · raw message

board/qi/qi_lb60/Makefile +5 -0
index 5dae11b..6dd8c6f 100644
@@ -22,7 +22,12 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+ifeq ($(CONFIG_SPL_BUILD),y)
+SOBJS	:= usbboot.o
+COBJS	:= $(BOARD)-spl.o
+else
 COBJS	:= $(BOARD).o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
board/qi/qi_lb60/qi_lb60-spl.c new file +30 -0
new file mode 100644
index 0000000..3fe3fa3
@@ -0,0 +1,30 @@
+/*
+ * Authors: Xiangfu Liu <[email protected]>
+ *
+ * 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
+ * 3 of the License, or (at your option) any later version.
+ */
+
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/jz4740.h>
+
+void nand_spl_boot(void)
+{
+	__gpio_as_sdram_16bit_4720();
+	__gpio_as_uart0();
+	__gpio_jtag_to_uart0();
+
+	serial_init();
+
+	pll_init();
+	sdram_init();
+
+	nand_init();
+
+	puts("\nQi LB60 SPL: Starting U-Boot ...\n");
+	nand_boot();
+}
board/qi/qi_lb60/qi_lb60.c +5 -3
index d975209..3bd4e2f 100644
@@ -1,5 +1,5 @@
 /*
- * Authors: Xiangfu Liu <[email protected]>
+ * Authors: Xiangfu Liu <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -97,8 +97,10 @@ int board_early_init_f(void)
 /* U-Boot common routines */
 int checkboard(void)
 {
-	printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %ld MHz)\n",
-	       gd->cpu_clk / 1000000);
+	printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC)\n");
+	printf(" CPU: %ld\n", gd->cpu_clk);
+	printf(" MEM: %ld\n", gd->mem_clk);
+	printf(" DEV: %ld\n", gd->dev_clk);
 
 	return 0;
 }
board/qi/qi_lb60/u-boot-spl.lds new file +62 -0

62 lines not on this page · raw message

drivers/mtd/nand/jz4740_nand.c +36 -3
index 3ec34f3..24a4921 100644
@@ -15,6 +15,9 @@
 #include <asm/io.h>
 #include <asm/jz4740.h>
 
+#ifdef CONFIG_SPL_BUILD
+#define printf(s) puts(s)
+#endif
 #define JZ_NAND_DATA_ADDR ((void __iomem *)0xB8000000)
 #define JZ_NAND_CMD_ADDR (JZ_NAND_DATA_ADDR + 0x8000)
 #define JZ_NAND_ADDR_ADDR (JZ_NAND_DATA_ADDR + 0x10000)
@@ -176,7 +179,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
 		for (k = 0; k < 9; k++)
 			writeb(read_ecc[k], &emc->nfpar[k]);
 	}
-	/* Set PRDY */
+
 	writel(readl(&emc->nfecr) | EMC_NFECR_PRDY, &emc->nfecr);
 
 	/* Wait for completion */
@@ -184,7 +187,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
 		status = readl(&emc->nfints);
 	} while (!(status & EMC_NFINTS_DECF));
 
-	/* disable ecc */
+	/* Disable ECC */
 	writel(readl(&emc->nfecr) & ~EMC_NFECR_ECCE, &emc->nfecr);
 
 	/* Check decoding */
@@ -192,7 +195,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
 		return 0;
 
 	if (status & EMC_NFINTS_UNCOR) {
-		printf("uncorrectable ecc\n");
+		printf("JZ4740 uncorrectable ECC\n");
 		return -1;
 	}
 
@@ -230,6 +233,32 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat,
 	return errcnt;
 }
 
+#ifdef CONFIG_SPL_BUILD
+static void jz_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+	int i;
+	struct nand_chip *this = mtd->priv;
+
+#if (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R3) || \
+	(JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R2)
+	for (i = 0; i < len; i += 2)
+		buf[i] = readw(this->IO_ADDR_R);
+#elif (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R3) || \
+	(JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R2)
+	for (i = 0; i < len; i++)
+		buf[i] = readb(this->IO_ADDR_R);
+#else
+	#error JZ4740_NANDBOOT_CFG not defined or wrong
+#endif
+}
+
+static uint8_t jz_nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *this = mtd->priv;
+	return readb(this->IO_ADDR_R);
+}
+#endif
+
 /*
  * Main initialization routine
  */
@@ -254,6 +283,10 @@ int board_nand_init(struct nand_chip *nand)
 	nand->ecc.size		= CONFIG_SYS_NAND_ECCSIZE;
 	nand->ecc.bytes		= CONFIG_SYS_NAND_ECCBYTES;
 	nand->ecc.layout	= &qi_lb60_ecclayout_2gb;
+#ifdef CONFIG_SPL_BUILD
+	nand->read_byte		= jz_nand_read_byte;
+	nand->read_buf		= jz_nand_read_buf;
+#endif
 	nand->chip_delay	= 50;
 	nand->options		= NAND_USE_FLASH_BBT;
 
include/configs/qi_lb60.h +87 -88

255 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

From: Xiangfu <[email protected]>

JZ4740 CPU have a internal ROM have such kind of code, that make JZ4740 can boot from USB

usbboot.S can downloads user program from the USB port to internal SRAM and branches to the internal SRAM to execute the program

---
 board/qi/qi_lb60/qi_lb60-spl.c |   20 +
 board/qi/qi_lb60/usbboot.S     |  838 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 858 insertions(+)
 create mode 100644 board/qi/qi_lb60/usbboot.S
board/qi/qi_lb60/qi_lb60-spl.c +20 -0
index 3fe3fa3..aea459c 100644
@@ -12,6 +12,24 @@
 #include <asm/io.h>
 #include <asm/jz4740.h>
 
+#define KEY_U_OUT       (32 * 2 + 16)
+#define KEY_U_IN        (32 * 3 + 19)
+
+extern void usb_boot(void);
+
+static void check_usb_boot(void)
+{
+	__gpio_as_input(KEY_U_IN);
+	__gpio_enable_pull(KEY_U_IN);
+	__gpio_as_output(KEY_U_OUT);
+	__gpio_clear_pin(KEY_U_OUT);
+
+	if (!__gpio_get_pin(KEY_U_IN)) {
+		puts("[U] pressed, goto USBBOOT mode\n");
+		usb_boot();
+	}
+}
+
 void nand_spl_boot(void)
 {
 	__gpio_as_sdram_16bit_4720();
@@ -23,6 +41,8 @@ void nand_spl_boot(void)
 	pll_init();
 	sdram_init();
 
+	check_usb_boot();
+
 	nand_init();
 
 	puts("\nQi LB60 SPL: Starting U-Boot ...\n");
board/qi/qi_lb60/usbboot.S new file +838 -0

838 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Dear xiangfu at openmobilefree.net,

Quoted 8 lines

From: Xiangfu <[email protected]>

JZ4740 CPU have a internal ROM have such kind of code, that make JZ4740 can boot from USB

usbboot.S can downloads user program from the USB port to internal SRAM and branches to the internal SRAM to execute the program

Quoted 8 lines
---
 board/qi/qi_lb60/qi_lb60-spl.c |   20 +
 board/qi/qi_lb60/usbboot.S     |  838
++++++++++++++++++++++++++++++++++++++++ 2 files changed, 858
insertions(+)
 create mode 100644 board/qi/qi_lb60/usbboot.S

[...]

UGH. Simply ... UGH.

Can that assembler blob not be rewritten into C ?

Best regards,
Marek Vasut

#4 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Hi Marek

This file was wrote by Ingenic people. I don't have time to convert it to C(I am not very good in mips assembler). the .S file implement basic USB stack. this C code (
http://projects.qi-hardware.com/index.php/p/xburst-tools/source/tree/master/xbboot)
implement the host app. the host app source code even clear then the original Ingenic document. so feel free to send patch.

Xiangfu

Quoted 27 lines · Marek Vasut

Dear xiangfu at openmobilefree.net,

Quoted 8 lines

From: Xiangfu <[email protected]>

JZ4740 CPU have a internal ROM have such kind of code, that make JZ4740 can boot from USB

usbboot.S can downloads user program from the USB port to internal SRAM and branches to the internal SRAM to execute the program

Quoted 8 lines
---
 board/qi/qi_lb60/qi_lb60-spl.c |   20 +
 board/qi/qi_lb60/usbboot.S     |  838
++++++++++++++++++++++++++++++++++++++++ 2 files changed, 858
insertions(+)
 create mode 100644 board/qi/qi_lb60/usbboot.S

[...]

UGH. Simply ... UGH.

Can that assembler blob not be rewritten into C ?

Best regards,
Marek Vasut

#5 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Dear xiangfu liu,

Quoted 5 lines

Hi Marek

This file was wrote by Ingenic people. I don't have time to convert it to C(I am not very good in mips assembler). the .S file implement basic USB stack.

We already do have an USB stack.

Quoted 4 lines

this C code (
http://projects.qi-hardware.com/index.php/p/xburst-tools/source/tree/master
/xbboot) implement the host app. the host app source code even clear then the original Ingenic document. so feel free to send patch.

Sorry, but it is my duty as a USB custodian to NAK patches which try to circumvent the constant effort to keep the code clean. Obviously, implementing yet another USB stack is violation of this.

Quoted 32 lines

Xiangfu

Quoted 29 lines · Marek Vasut

Dear xiangfu at openmobilefree.net,

Quoted 11 lines

From: Xiangfu <[email protected]>

JZ4740 CPU have a internal ROM have such kind of code, that make JZ4740 can boot from USB

usbboot.S can downloads user program from the USB port to internal SRAM and branches to the internal SRAM to execute the program

---

Quoted 7 lines
 board/qi/qi_lb60/qi_lb60-spl.c |   20 +
 board/qi/qi_lb60/usbboot.S     |  838

++++++++++++++++++++++++++++++++++++++++ 2 files changed, 858 insertions(+)

 create mode 100644 board/qi/qi_lb60/usbboot.S

[...]

UGH. Simply ... UGH.

Can that assembler blob not be rewritten into C ?

Best regards,
Marek Vasut

Best regards,
Marek Vasut

#6 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Hi Marek

Quoted 10 lines · Marek Vasut

Dear xiangfu liu,

Quoted 5 lines

Hi Marek

This file was wrote by Ingenic people. I don't have time to convert it to C(I am not very good in mips assembler). the .S file implement basic USB stack.

We already do have an USB stack.

This usbboot.S implement a very base usb-client protocol and it implement a jz4740 hardware feature. (jz4740 have a hard-code rom inside cpu. that have the same feature, they named it 'boot from usb'). so this usbboot.S is for implement the same feature in a software way. and I think this usbboot.S can move to 'arch/mips/cpu/xburst/spl/jz4740_usbboot.s' in future. and I don't think
it will impact with other usb code in u-boot.

Quoted 12 lines
Quoted 3 lines

this C code (

http://projects.qi-hardware.com/index.php/p/xburst-tools/source/tree/master

Quoted 2 lines

/xbboot) implement the host app. the host app source code even clear then the original Ingenic document. so feel free to send patch.

Sorry, but it is my duty as a USB custodian to NAK patches which try to circumvent the constant effort to keep the code clean. Obviously, implementing
yet another USB stack is violation of this.

Yes. I understand your duty. and keep a project code clean is not easy. thanks for
feedback. (I never look into u-boot usb code. don't have much experience on u-boot
usb structure. :)

All the best
Xiangfu

#7 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Dear xiangfu liu,

Quoted 7 lines

Hi Marek

Quoted 4 lines · Marek Vasut

Dear xiangfu liu,

Quoted 2 lines

Hi Marek

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

This file was wrote by Ingenic people. I don't have time to convert it to C(I am not very good in mips assembler). the .S file implement basic USB stack.

We already do have an USB stack.

This usbboot.S implement a very base usb-client protocol and it implement a jz4740 hardware feature.

We have that too -- see drivers/usb/gadget/

Quoted 3 lines

(jz4740 have a hard-code rom inside cpu. that have
the same feature, they named it 'boot from usb'). so this usbboot.S is for implement the same feature in a software way.

Won't DFU work then?

Quoted 4 lines

and I think this usbboot.S
can move to 'arch/mips/cpu/xburst/spl/jz4740_usbboot.s' in future. and I don't think
it will impact with other usb code in u-boot.

That's even worse, the USB code shall be in drivers/usb/

Quoted 13 lines
Quoted 5 lines
Quoted 1 line

this C code (

http://projects.qi-hardware.com/index.php/p/xburst-tools/source/tree/mast
er

Quoted 7 lines
Quoted 2 lines

/xbboot) implement the host app. the host app source code even clear then the original Ingenic document. so feel free to send patch.

Sorry, but it is my duty as a USB custodian to NAK patches which try to circumvent the constant effort to keep the code clean. Obviously, implementing
yet another USB stack is violation of this.

Quoted 8 lines

Yes. I understand your duty. and keep a project code clean is not easy. thanks for
feedback. (I never look into u-boot usb code. don't have much experience on u-boot
usb structure. :)

All the best
Xiangfu

Best regards,
Marek Vasut

#8 lore raw

PATCH v5 2/2 qi_lb60: add software usbboot support

Quoted 13 lines · Marek Vasut

Dear xiangfu liu,

Quoted 11 lines
Quoted 11 lines

Hi Marek

Quoted 8 lines · Marek Vasut
Quoted 8 lines

Dear xiangfu liu,

Quoted 5 lines
Quoted 5 lines

Hi Marek

This file was wrote by Ingenic people. I don't have time to convert it to C(I am not very good in mips assembler). the .S file implement basic USB stack.

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

We already do have an USB stack.

This usbboot.S implement a very base usb-client protocol and it implement a jz4740 hardware feature.

We have that too -- see drivers/usb/gadget/

Hi Marek

I will look into this issue later, try to integrate this jz4740 feature with u-boot usb structure. but I am not sure that if I can finish this fast. wait my patches on jz4740 software usb boot. :)

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

(jz4740 have a hard-code rom inside cpu. that have
the same feature, they named it 'boot from usb'). so this usbboot.S is for implement the same feature in a software way.

Won't DFU work then?

I know this DFU. but it will different with the hardware-feature.

Thanks again for feedback.
Xiangfu

#9 lore raw

PATCH v5 1/2 qi_lb60: add nand spl support

In reply to xiangfu at openmobilefree.net

Dear xiangfu at openmobilefree.net,

Quoted 6 lines

From: Xiangfu <[email protected]>

The JZ4740 CPU can load 8KB from two different addresses:
1. the normal area up to 8KB starting from NAND flash address 0x00000000
2. the backup area up to 8KB starting from NAND flash address 0x00002000

Quoted 8 lines

After create u-boot-spl.bin. it needs those 4 commands create final image
for jz4740 cpu. ~~~~
dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192 count=1 dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync,notrunc
oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin
~~~~

Can you not do this in the linker script? Or implement CPU-specific build target that does this?

[...]

Best regards,
Marek Vasut

#10 lore raw

PATCH v5 1/2 qi_lb60: add nand spl support

Quoted 14 lines · Marek Vasut
Quoted 14 lines

From: Xiangfu <[email protected]>

Quoted 13 lines

The JZ4740 CPU can load 8KB from two different addresses:
1. the normal area up to 8KB starting from NAND flash address 0x00000000
2. the backup area up to 8KB starting from NAND flash address 0x00002000

After create u-boot-spl.bin. it needs those 4 commands create final image
for jz4740 cpu. ~~~~
dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192 count=1 dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync,notrunc
oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin
~~~~

Quoted 2 lines

Can you not do this in the linker script? Or implement CPU-specific build target that does this?

Hi Marex

Thanks for reply, I don't know how to do this in linker script. but I have plan to send out a patch on Makefile.

Attachment is the patch. do you think it is ok for upstream? if it's ok. I will send out this patch in another email.

Xiangfu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-jz4740-target-rules.patch
Type: text/x-diff
Size: 934 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121013/0312b5cd/attachment.patch>

#11 lore raw

PATCH v5 1/2 qi_lb60: add nand spl support

Dear Xiangfu Liu,

Quoted 26 lines · Marek Vasut
Quoted 16 lines
Quoted 16 lines

From: Xiangfu <[email protected]>

Quoted 14 lines

The JZ4740 CPU can load 8KB from two different addresses:
1. the normal area up to 8KB starting from NAND flash address 0x00000000 2. the backup area up to 8KB starting from NAND flash address 0x00002000

After create u-boot-spl.bin. it needs those 4 commands create final image

for jz4740 cpu. ~~~~

dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192 count=1 dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync,notrunc

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin

~~~~

Can you not do this in the linker script? Or implement CPU-specific build target that does this?

Quoted 7 lines

Hi Marex

Thanks for reply, I don't know how to do this in linker script. but I have plan to send out a patch on Makefile.

Attachment is the patch. do you think it is ok for upstream? if it's ok. I will send out this patch in another email.

This is CPU-specific , right? So it should be some kind of CPU-specific override in CPU-specific directory, not polute the main Makefile.

Best regards,
Marek Vasut

#12 lore raw

PATCH v5 1/2 qi_lb60: add nand spl support

Hi Marek

I will look into CPU-specific. come out with new patches.

Xiangfu

Quoted 6 lines · Marek Vasut

This is CPU-specific , right? So it should be some kind of CPU-specific override in CPU-specific directory, not polute the main Makefile.

Best regards,
Marek Vasut