[Armadeus-commitlog] armadeus branch, master, updated. armadeus-4.1-208-gc8e2340
Brought to you by:
sszy
|
From: jorasse <jo...@us...> - 2012-03-28 08:07:44
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via c8e23408299d3142feead3145dee4933ffc7a949 (commit)
via e89aa4511cec22016bd2458f27ae3fe11176a949 (commit)
from 5281b043967c26bdae84b4fa57b93a12f1f7fc57 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c8e23408299d3142feead3145dee4933ffc7a949
Merge: e89aa45 5281b04
Author: Eric Jarrige <eri...@ar...>
Date: Wed Mar 28 10:18:46 2012 +0200
Merge branch 'master' of ssh://armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit e89aa4511cec22016bd2458f27ae3fe11176a949
Author: Eric Jarrige <eri...@ar...>
Date: Wed Mar 28 10:06:03 2012 +0200
[UBOOT] import patch to support NAND flashing large files
-----------------------------------------------------------------------
Summary of changes:
.../device/armadeus/apf27/apf27-u-boot-2011.12.h | 2 +-
.../device/armadeus/apf28/apf28-u-boot-2011.12.h | 2 +-
.../device/armadeus/apf51/apf51-u-boot-2011.12.h | 2 +-
.../2011.12/350-nand_large_file_download.patch | 221 ++++++++++++++++++++
4 files changed, 224 insertions(+), 3 deletions(-)
create mode 100644 patches/u-boot/2011.12/350-nand_large_file_download.patch
diff --git a/buildroot/target/device/armadeus/apf27/apf27-u-boot-2011.12.h b/buildroot/target/device/armadeus/apf27/apf27-u-boot-2011.12.h
index ce0215c..73df973 100644
--- a/buildroot/target/device/armadeus/apf27/apf27-u-boot-2011.12.h
+++ b/buildroot/target/device/armadeus/apf27/apf27-u-boot-2011.12.h
@@ -324,7 +324,7 @@
#define IMX27_NAND_16BITS
#define NAND_MAX_CHIPS 1
-/*#define CONFIG_SYS_DIRECT_FLASH_TFTP*/
+#define CONFIG_SYS_DIRECT_FLASH_TFTP
#define CONFIG_FLASH_SHOW_PROGRESS 45
#define CONFIG_SYS_NAND_QUIET 1
diff --git a/buildroot/target/device/armadeus/apf28/apf28-u-boot-2011.12.h b/buildroot/target/device/armadeus/apf28/apf28-u-boot-2011.12.h
index 20060f6..6ebc6f0 100644
--- a/buildroot/target/device/armadeus/apf28/apf28-u-boot-2011.12.h
+++ b/buildroot/target/device/armadeus/apf28/apf28-u-boot-2011.12.h
@@ -300,7 +300,7 @@
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
#define NAND_MAX_CHIPS 1
-/*#define CONFIG_SYS_DIRECT_FLASH_TFTP*/
+#define CONFIG_SYS_DIRECT_FLASH_TFTP
#define CONFIG_FLASH_SHOW_PROGRESS 45
#define CONFIG_SYS_NAND_QUIET 1
diff --git a/buildroot/target/device/armadeus/apf51/apf51-u-boot-2011.12.h b/buildroot/target/device/armadeus/apf51/apf51-u-boot-2011.12.h
index 2f5f8d8..92dac7c 100644
--- a/buildroot/target/device/armadeus/apf51/apf51-u-boot-2011.12.h
+++ b/buildroot/target/device/armadeus/apf51/apf51-u-boot-2011.12.h
@@ -313,7 +313,7 @@
#define CONFIG_SYS_NAND_LARGEPAGE
#define NAND_MAX_CHIPS 1
-/*#define CONFIG_SYS_DIRECT_FLASH_TFTP*/
+#define CONFIG_SYS_DIRECT_FLASH_TFTP
#define CONFIG_FLASH_SHOW_PROGRESS 45
#define CONFIG_SYS_NAND_QUIET 1
diff --git a/patches/u-boot/2011.12/350-nand_large_file_download.patch b/patches/u-boot/2011.12/350-nand_large_file_download.patch
new file mode 100644
index 0000000..e370e73
--- /dev/null
+++ b/patches/u-boot/2011.12/350-nand_large_file_download.patch
@@ -0,0 +1,221 @@
+--- u-boot-custom/common/cmd_net.c 2011-12-23 20:25:35.000000000 +0100
++++ u-boot-custom/common/cmd_net.c 2012-03-28 09:25:20.000000000 +0200
+@@ -28,6 +28,10 @@
+ #include <command.h>
+ #include <net.h>
+
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++int tftpboot2nand=0; /* set to 1 for tftp to nand direct */
++#endif
++
+ static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
+
+ int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+@@ -46,11 +50,19 @@ int do_tftpb (cmd_tbl_t *cmdtp, int flag
+ return netboot_common(TFTPGET, cmdtp, argc, argv);
+ }
+
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++U_BOOT_CMD(
++ tftpboot, 4, 1, do_tftpb,
++ "boot image via network using TFTP protocol",
++ "[loadAddress] [[hostIPaddr:]bootfilename] [nand]"
++);
++#else
+ U_BOOT_CMD(
+ tftpboot, 3, 1, do_tftpb,
+ "boot image via network using TFTP protocol",
+ "[loadAddress] [[hostIPaddr:]bootfilename]"
+ );
++#endif
+
+ #ifdef CONFIG_CMD_TFTPPUT
+ int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+@@ -192,6 +204,10 @@ static int netboot_common(enum proto_t p
+ int size;
+ ulong addr;
+
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++ tftpboot2nand = 0;
++#endif
++
+ /* pre-set load_addr */
+ if ((s = getenv("loadaddr")) != NULL) {
+ load_addr = simple_strtoul(s, NULL, 16);
+@@ -219,8 +235,16 @@ static int netboot_common(enum proto_t p
+
+ break;
+
+-#ifdef CONFIG_CMD_TFTPPUT
+ case 4:
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++ if( strcmp(argv[3],"nand") == 0 ) {
++ tftpboot2nand = 1;
++ load_addr = simple_strtoul(argv[1], NULL, 16);
++ copy_filename (BootFile, argv[2], sizeof(BootFile));
++ break;
++ }
++#endif
++#ifdef CONFIG_CMD_TFTPPUT
+ if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
+ strict_strtoul(argv[2], 16, &save_size) < 0) {
+ printf("Invalid address/size\n");
+--- u-boot-custom/net/tftp.c 2011-12-23 20:25:35.000000000 +0100
++++ u-boot-custom/net/tftp.c 2012-03-28 09:39:40.000000000 +0200
+@@ -12,6 +12,11 @@
+ #include "tftp.h"
+ #include "bootp.h"
+
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++#include <nand.h>
++extern int tftpboot2nand;
++#endif
++
+ /* Well known TFTP port # */
+ #define WELL_KNOWN_PORT 69
+ /* Millisecs to timeout for lost pkt */
+@@ -113,8 +118,10 @@ static char default_filename[DEFAULT_NAM
+ static char tftp_filename[MAX_LEN];
+
+ #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
++#ifndef CONFIG_SYS_NO_FLASH
+ extern flash_info_t flash_info[];
+ #endif
++#endif
+
+ /* 512 is poor choice for ethernet, MTU is typically 1500.
+ * Minus eth.hdrs thats 1468. Can get 2x better throughput with
+@@ -157,12 +164,104 @@ mcast_cleanup(void)
+
+ #endif /* CONFIG_MCAST_TFTP */
+
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++static int tftp_nand_write(nand_info_t *meminfo, uchar *src, unsigned long *offset, size_t *length )
++{
++ size_t written ;
++ int ret = 0;
++ loff_t offs;
++ int blockstart = -1;
++
++ /* find first non bad block */
++ do {
++ blockstart = (*offset) & (~meminfo->erasesize+1);
++ offs = blockstart;
++ ret = meminfo->block_isbad(meminfo, offs);
++
++ if (ret < 0) {
++ printf("Bad block check failed\n");
++ return -1;
++ }
++ if (ret == 1) {
++ (*offset) = blockstart + meminfo->erasesize;
++/* printf("\rBad block at 0x%lx "
++ "in erase block from "
++ "0x%x will be skipped. new offset %x\n",
++ (long) offs,
++ blockstart, *offset);*/
++ }
++ } while ((ret!=0) && (*offset < meminfo->size) );
++
++ if (*offset < meminfo->size)
++ /* write out the page data */
++ ret = nand_write(meminfo, *offset, length, src);
++/* ret = meminfo->write(meminfo,
++ *offset,
++ meminfo->oobblock,
++ &written,
++ src);*/
++ if (ret != 0) {
++ printf("writing NAND page at offset 0x%lx failed\n",
++ *offset);
++ return -1;
++ }
++ return ret;
++}
++
++static void tftp_2_nand(uchar * src, unsigned len)
++{
++ #define TFTP2NAND_BUFFER_SIZE 4096
++ static int temp_buf_offset;
++ static unsigned long nand_offset;
++ static u_char temp_buf[TFTP2NAND_BUFFER_SIZE];
++ size_t nand_page_size;
++ /* retrieve current nand infos */
++ nand_info_t *nand;
++ nand = &nand_info[nand_curr_device];
++
++ nand_page_size = nand->writesize;
++ if ((nand_page_size<<1) > TFTP2NAND_BUFFER_SIZE) {
++ printf("error: NAND page size too big\n");
++ NetState = NETLOOP_FAIL;
++ return;
++ }
++
++ if ((TftpBlkSize<<1) > TFTP2NAND_BUFFER_SIZE) {
++ printf("error: tftp block size too big\n");
++ NetState = NETLOOP_FAIL;
++ return;
++ }
++
++
++ if (TftpBlock == 1) { /* reset local nand buffer */
++ temp_buf_offset = 0;
++ nand_offset = load_addr;
++ }
++
++ if (len)
++ (void)memcpy((void *)(temp_buf + temp_buf_offset), src, len);
++ temp_buf_offset += len;
++ if ((temp_buf_offset >= nand_page_size) || (!len) ){
++ if( tftp_nand_write(nand, temp_buf, &nand_offset, &nand_page_size) ){
++ NetState = NETLOOP_FAIL;
++ return;
++ }
++ nand_offset += nand_page_size;
++ if (len){
++ temp_buf_offset -= nand_page_size;
++ (void)memcpy((void *)(temp_buf), (void *)(temp_buf+nand_page_size), temp_buf_offset);
++ }
++ }
++}
++#endif
++
+ static __inline__ void
+ store_block(unsigned block, uchar *src, unsigned len)
+ {
+ ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
+ ulong newsize = offset + len;
+ #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
++#ifndef CONFIG_SYS_NO_FLASH
+ int i, rc = 0;
+
+ for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
+@@ -184,6 +283,13 @@ store_block(unsigned block, uchar *src,
+ }
+ }
+ else
++#endif /* CONFIG_SYS_NO_FLASH */
++#ifdef CONFIG_CMD_NAND
++ if (tftpboot2nand) {
++ tftp_2_nand(src, len);
++ }
++ else
++#endif /* CONFIG_CMD_NAND */
+ #endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
+ {
+ (void)memcpy((void *)(load_addr + offset), src, len);
+@@ -295,6 +401,13 @@ static void update_block_number(void)
+ /* The TFTP get or put is complete */
+ static void tftp_complete(void)
+ {
++#if defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP)
++ /* complete write to nand with last buffer */
++ if (tftpboot2nand)
++ tftp_2_nand(NULL, 0);
++
++#endif /* defined(CONFIG_CMD_NAND) && defined(CONFIG_SYS_DIRECT_FLASH_TFTP) */
++
+ #ifdef CONFIG_TFTP_TSIZE
+ /* Print hash marks for the last packet received */
+ while (TftpTsize && TftpNumchars < 49) {
+
hooks/post-receive
--
armadeus
|