r4031 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Sat Feb 9 16:36:28 CET 2008


Author: werner
Date: 2008-02-09 16:36:23 +0100 (Sat, 09 Feb 2008)
New Revision: 4031

Modified:
   trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
   trunk/src/target/u-boot/patches/uboot-dfu.patch
Log:
If we started without "mtdparts" set, DFU did not recognize partition names
even after a subsequent "dynpart". This patch makes "dynpart" update DFU's
partition name table.

uboot-dfu.patch:
- drivers/usb/usbdfu.c (dfu_update_strings): new function to update the USB
  string table after "dynpart"

nand-dynamic_partitions.patch:
- common/cmd_jffs2.c (nand_create_mtd_dynpart): if we have DFU, invoke 
  "dfu_update_strings" after "dynpart"



Modified: trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
===================================================================
--- trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch	2008-02-08 18:02:15 UTC (rev 4030)
+++ trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch	2008-02-09 15:36:23 UTC (rev 4031)
@@ -15,7 +15,7 @@
 
 Signed-off-by: Harald Welte <laforge at openmoko.org>
 
-Index: u-boot/drivers/nand/nand_bbt.c
+Index: u-boot/drivers/mtd/nand/nand_bbt.c
 ===================================================================
 --- u-boot.orig/drivers/mtd/nand/nand_bbt.c
 +++ u-boot/drivers/mtd/nand/nand_bbt.c
@@ -110,7 +110,7 @@
 ===================================================================
 --- u-boot.orig/include/configs/neo1973_gta01.h
 +++ u-boot/include/configs/neo1973_gta01.h
-@@ -91,6 +91,7 @@
+@@ -92,6 +92,7 @@
  #define CONFIG_CMD_BSP
  #define CONFIG_CMD_ELF
  #define CONFIG_CMD_MISC
@@ -118,7 +118,7 @@
  #define CONFIG_CMD_DIAG
  #define CONFIG_CMD_SAVES
  #define CONFIG_CMD_NAND
-@@ -199,13 +200,13 @@
+@@ -201,13 +202,13 @@
  #define CONFIG_FAT		1
  #define CONFIG_SUPPORT_VFAT
  
@@ -135,7 +135,7 @@
  #endif
  
  /* ATAG configuration */
-@@ -245,4 +246,9 @@
+@@ -249,4 +250,9 @@
  #define CONFIG_DRIVER_PCF50606		1
  #define CONFIG_RTC_PCF50606		1
  
@@ -149,7 +149,7 @@
 ===================================================================
 --- u-boot.orig/common/cmd_jffs2.c
 +++ u-boot/common/cmd_jffs2.c
-@@ -1841,6 +1841,29 @@
+@@ -1838,6 +1838,29 @@
  	return NULL;
  }
  
@@ -179,7 +179,7 @@
  /***************************************************/
  /* U-boot commands				   */
  /***************************************************/
-@@ -2132,6 +2155,24 @@
+@@ -2129,6 +2152,30 @@
  	printf ("Usage:\n%s\n", cmdtp->usage);
  	return 1;
  }
@@ -189,6 +189,8 @@
 +
 +int do_dynpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 +{
++	extern void dfu_update_strings(void);
++
 +#if 0
 +	int i = simple_strtoul(argv[1], NULL, 0);
 +	if (i >= CFG_MAX_NAND_DEVICE)
@@ -196,6 +198,10 @@
 +#endif
 +	nand_create_mtd_dynpart(&nand_info[0]);
 +
++#ifdef CONFIG_USBD_DFU
++	dfu_update_strings();
++#endif
++
 +	return 0;
 +}
 +#endif /* CONFIG_NAND_DYNPART */
@@ -204,7 +210,7 @@
  #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
  
  /***************************************************/
-@@ -2197,6 +2238,15 @@
+@@ -2194,6 +2241,15 @@
  	"<name>     := '(' NAME ')'\n"
  	"<ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)\n"
  );
@@ -254,7 +260,7 @@
  			}
  			idx = dev->id->num;
  			*nand = nand_info[idx];
-@@ -253,7 +260,7 @@
+@@ -257,7 +264,7 @@
  
  		printf("\nNAND %s: ", scrub ? "scrub" : "erase");
  		/* skip first two or three arguments, look for offset and size */
@@ -263,7 +269,7 @@
  			return 1;
  
  		memset(&opts, 0, sizeof(opts));
-@@ -315,7 +322,7 @@
+@@ -319,7 +326,7 @@
  
  		read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */
  		printf("\nNAND %s: ", read ? "read" : "write");
@@ -272,7 +278,7 @@
  			return 1;
  
  		s = strchr(cmd, '.');
-@@ -437,7 +444,7 @@
+@@ -441,7 +448,7 @@
  	}
  
  	if (strcmp(cmd, "unlock") == 0) {
@@ -324,10 +330,10 @@
 ===================================================================
 --- u-boot.orig/board/neo1973/gta01/gta01.c
 +++ u-boot/board/neo1973/gta01/gta01.c
-@@ -425,3 +425,14 @@
- 	return 0;
+@@ -494,3 +494,14 @@
  }
  
+ 
 +
 +/* The sum of all part_size[]s must equal to the NAND size, i.e., 0x4000000.
 +   "initrd" is sized such that it can hold two uncompressed 16 bit 640*480

Modified: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch	2008-02-08 18:02:15 UTC (rev 4030)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch	2008-02-09 15:36:23 UTC (rev 4031)
@@ -90,7 +90,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/drivers/usb/usbdfu.c
-@@ -0,0 +1,1018 @@
+@@ -0,0 +1,1050 @@
 +/*
 + * (C) 2007 by OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -1007,6 +1007,38 @@
 +	}
 +}
 +
++
++#ifdef CONFIG_NAND_DYNPART
++
++void dfu_update_strings(void)
++{
++	int i;
++
++	if (!system_dfu_state) {
++		printf("NASTY SURPRISE: system_dfu_state not set\n");
++		return;
++	}
++
++	for (i = 1; i != DFU_NUM_ALTERNATES; i++) {
++		struct part_info *part = get_partition_nand(i-1);
++		struct usb_string_descriptor *strdesc, **slot;
++
++		if (part)
++			strdesc = create_usbstring(part->name);
++		else
++			strdesc = create_usbstring("undefined partition");
++		if (!strdesc)
++			continue;
++		slot = usb_strings+STR_COUNT+i+1;
++		if (*slot)
++			free(*slot);
++		*slot = strdesc;
++	}
++}
++
++#endif /* CONFIG_NAND_DYNPART */
++
++
 +int dfu_init_instance(struct usb_device_instance *dev)
 +{
 +	int i;





More information about the commitlog mailing list