Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r1113 - in
      trunk/src/target/OM-2007/applications/openmoko-contacts: .        src
      ([EMAIL PROTECTED])
   2. r1114 - trunk/src/host/dfu-util/src ([EMAIL PROTECTED])
   3. r1115 - trunk/src/host/dfu-util/src ([EMAIL PROTECTED])
   4. r1116 - trunk/src/host/dfu-util/src ([EMAIL PROTECTED])
   5. r1117 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
   6. r1118 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: thomas
Date: 2007-02-25 12:02:02 +0100 (Sun, 25 Feb 2007)
New Revision: 1113

Modified:
   trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
   
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
   
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
Log:
* src/contacts-contact-pane.c: (make_widget): Support custom field types
* src/contacts-groups-editor.c: (contacts_groups_new_cb): Ensure the
  add groups dialog will close


Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog   
2007-02-25 06:29:09 UTC (rev 1112)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog   
2007-02-25 11:02:02 UTC (rev 1113)
@@ -1,3 +1,9 @@
+2007-02-25  Thomas Wood  <[EMAIL PROTECTED]>
+
+       * src/contacts-contact-pane.c: (make_widget): Support custom field types
+       * src/contacts-groups-editor.c: (contacts_groups_new_cb): Ensure the
+       add groups dialog will close
+
 2007-02-21  Thomas Wood  <[EMAIL PROTECTED]>
 
        * src/contacts-main.c: (main): Fix some compiler warnings

Modified: 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
 2007-02-25 06:29:09 UTC (rev 1112)
+++ 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
 2007-02-25 11:02:02 UTC (rev 1113)
@@ -369,6 +369,7 @@
   box = gtk_hbox_new (FALSE, 0);
 
   type = get_type (attr);
+
   if (type == NULL && info->types != NULL)
     type = info->types[0];
 
@@ -404,17 +405,27 @@
     gtk_box_pack_start (GTK_BOX (box), type_label, FALSE, FALSE, 4);
     g_free (s);
   }
+
   if (info->types && pane->priv->editable)
   {
     GtkWidget *combo;
+    gboolean *is_custom_type = TRUE;
     combo = gtk_combo_box_new_text ();
     gtk_widget_set_size_request (combo, -1, 46);
     i = 0;
     for (s = info->types[i]; (s = info->types[i]); i++) {
       gtk_combo_box_append_text (GTK_COMBO_BOX (combo), s);
-      if (!strcmp (s, type))
+      if (!strcmp (s, type)) {
         gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
+        is_custom_type = FALSE;
+      }
     }
+    if (is_custom_type) {
+       /* type isn't in our list of types, so add it now */
+       gtk_combo_box_append_text (GTK_COMBO_BOX (combo), type);
+       gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
+    }
+
     g_object_set_data (G_OBJECT (combo), "contact-pane", pane);
     g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (set_type_cb), 
attr);
     if (size)

Modified: 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
        2007-02-25 06:29:09 UTC (rev 1112)
+++ 
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
        2007-02-25 11:02:02 UTC (rev 1113)
@@ -105,10 +105,13 @@
        gtk_widget_show (widget);
 
        if (gtk_dialog_run (GTK_DIALOG (input_dialog)) != GTK_RESPONSE_ACCEPT)
+       {
+               gtk_widget_destroy (input_dialog);
                return;
+       }
 
        text = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
-       gtk_widget_hide (input_dialog);
+       gtk_widget_destroy (input_dialog);
 
        if (!text || !strcmp (text, ""))
                return;




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-02-25 16:18:34 +0100 (Sun, 25 Feb 2007)
New Revision: 1114

Modified:
   trunk/src/host/dfu-util/src/main.c
Log:
gracefully restart from beginning (by issuing DFU_ABORT) if the device is left
in found in an 'incomplete {down,up}load' state


Modified: trunk/src/host/dfu-util/src/main.c
===================================================================
--- trunk/src/host/dfu-util/src/main.c  2007-02-25 11:02:02 UTC (rev 1113)
+++ trunk/src/host/dfu-util/src/main.c  2007-02-25 15:18:34 UTC (rev 1114)
@@ -535,6 +535,7 @@
                exit(1);
        }
 
+status_again:
        printf("Determining device status: ");
        if (dfu_get_status(dif->dev_handle, dif->interface, &status ) < 0) {
                fprintf(stderr, "error get_status: %s\n", usb_strerror());
@@ -543,18 +544,28 @@
        printf("state = %s, status = %d\n", dfu_state_to_string(status.bState), 
status.bStatus);
 
        switch (status.bState) {
-       case STATE_APP_IDLE:
+       case DFU_STATE_appIDLE:
+       case DFU_STATE_appDETACH:
                fprintf(stderr, "Device still in Runtime Mode!\n");
                exit(1);
                break;
-       case STATE_DFU_ERROR:
+       case DFU_STATE_dfuERROR:
                printf("dfuERROR, clearing status\n");
                if (dfu_clear_status(dif->dev_handle, dif->interface) < 0) {
                        fprintf(stderr, "error clear_status: %s\n", 
usb_strerror());
                        exit(1);
                }
                break;
-       case STATE_DFU_IDLE:
+       case DFU_STATE_dfuDNLOAD_IDLE:
+       case DFU_STATE_dfuUPLOAD_IDLE:
+               printf("aborting previous incomplete transfer\n");
+               if (dfu_abort(dif->dev_handle, dif->interface) < 0) {
+                       fprintf(stderr, "can't send DFU_ABORT: %s\n", 
usb_strerror());
+                       exit(1);
+               }
+               goto status_again;
+               break;
+       case DFU_STATE_dfuIDLE:
                printf("dfuIDLE, continuing\n");
                break;
        }




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-02-25 16:43:05 +0100 (Sun, 25 Feb 2007)
New Revision: 1115

Modified:
   trunk/src/host/dfu-util/src/dfu.c
   trunk/src/host/dfu-util/src/dfu.h
Log:
add new dfu_status_to_string() function to stringify DFU_STATUS_* values


Modified: trunk/src/host/dfu-util/src/dfu.c
===================================================================
--- trunk/src/host/dfu-util/src/dfu.c   2007-02-25 15:18:34 UTC (rev 1114)
+++ trunk/src/host/dfu-util/src/dfu.c   2007-02-25 15:43:05 UTC (rev 1115)
@@ -374,3 +374,47 @@
 
     return message;
 }
+
+/* Chapter 6.1.2 */
+static const char *dfu_status_names[] = {
+       [DFU_STATUS_OK]                 = "No error condition is present",
+       [DFU_STATUS_errTARGET]          = 
+               "File is not targeted for use by this device",
+       [DFU_STATUS_errFILE]            =
+               "File is for this device but fails some vendor-specific test",
+       [DFU_STATUS_errWRITE]           =
+               "Device is unable to write memory",
+       [DFU_STATUS_errERASE]           =
+               "Memory erase function failed",
+       [DFU_STATUS_errCHECK_ERASED]    =
+               "Memory erase check failed",
+       [DFU_STATUS_errPROG]            =
+               "Program memory function failed",
+       [DFU_STATUS_errVERIFY]          =
+               "Programmed emmory failed verification",
+       [DFU_STATUS_errADDRESS]         =
+               "Cannot program memory due to received address that is out of 
range",
+       [DFU_STATUS_errNOTDONE]         =
+               "Received DFU_DNLOAD with wLength = 0, but device does not 
think that it has all data yet",
+       [DFU_STATUS_errFIRMWARE]        =
+               "Device's firmware is corrupt. It cannot return to run-time 
(non-DFU) operations",
+       [DFU_STATUS_errVENDOR]          =
+               "iString indicates a vendor specific error",
+       [DFU_STATUS_errUSBR]            =
+               "Device detected unexpected USB reset signalling",
+       [DFU_STATUS_errPOR]             =
+               "Device detected unexpected power on reset",
+       [DFU_STATUS_errUNKNOWN]         =
+               "Something went wrong, but the device does not know what it 
was",
+       [DFU_STATUS_errSTALLEDPKT]      =
+               "Device stalled an unexpected request",
+};
+
+
+const char *dfu_status_to_string(int status)
+{
+       if (status > DFU_STATUS_errSTALLEDPKT)
+               return "INVALID";
+       return dfu_status_names[status];
+}
+

Modified: trunk/src/host/dfu-util/src/dfu.h
===================================================================
--- trunk/src/host/dfu-util/src/dfu.h   2007-02-25 15:18:34 UTC (rev 1114)
+++ trunk/src/host/dfu-util/src/dfu.h   2007-02-25 15:43:05 UTC (rev 1115)
@@ -97,5 +97,7 @@
 
 char* dfu_state_to_string( int state );
 
+const char *dfu_status_to_string(int status);
+
 int debug;
 #endif




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-02-25 16:43:38 +0100 (Sun, 25 Feb 2007)
New Revision: 1116

Modified:
   trunk/src/host/dfu-util/src/main.c
Log:
* print non-OK DFU STATUS
* fix error message (copy+paste mistake)


Modified: trunk/src/host/dfu-util/src/main.c
===================================================================
--- trunk/src/host/dfu-util/src/main.c  2007-02-25 15:43:05 UTC (rev 1115)
+++ trunk/src/host/dfu-util/src/main.c  2007-02-25 15:43:38 UTC (rev 1116)
@@ -578,8 +578,8 @@
                ret = usb_get_descriptor(dif->dev_handle, 0x21, dif->interface,
                                         &func_dfu, sizeof(func_dfu));
                if (ret < 0) {
-                       fprintf(stderr, "error clear_status: %s\n",
-                               usb_strerror());
+                       fprintf(stderr, "Error obtaining DFU functional "
+                               "descriptor: %s\n", usb_strerror());
                        exit(1);
                }
                /* FIXME: Endian! */
@@ -593,6 +593,8 @@
        }
        
        if (DFU_STATUS_OK != status.bStatus ) {
+               printf("WARNING: DFU Status: '%s'\n",
+                       dfu_status_to_string(status.bStatus));
                /* Clear our status & try again. */
                dfu_clear_status(dif->dev_handle, dif->interface);
                dfu_get_status(dif->dev_handle, dif->interface, &status);




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-02-25 16:50:19 +0100 (Sun, 25 Feb 2007)
New Revision: 1117

Modified:
   trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch
   trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
Log:
* correctly handle gross/net partition sizes.  I.e., if we erase a partition,
  we want to erase all non-bad blocks in it.  but if we write to it [skipping
  blocks], then we definitely do not want to exceed the end of the partition.
  This introduces one additional argument to the arg_off_size() function.
* Fix nand_isbad_bbt() to also consider 'factory default bad-blocks' as being 
bad


Modified: trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch
===================================================================
--- trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch    2007-02-25 
15:43:38 UTC (rev 1116)
+++ trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch    2007-02-25 
15:50:19 UTC (rev 1117)
@@ -1,10 +1,10 @@
 Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.orig/drivers/nand/nand_bbt.c        2007-02-16 23:53:57.000000000 
+0100
-+++ u-boot/drivers/nand/nand_bbt.c     2007-02-16 23:54:02.000000000 +0100
-@@ -1062,6 +1062,15 @@
- static unsigned int part_size[] = { 0x30000, 0x4000, 0x200000, 0x130000, 
0x3c9c000 };
- static char *part_names[] = { "u-boot", "u-boot_env", "kernel", "splash", 
"rootfs" };
+--- u-boot.orig/drivers/nand/nand_bbt.c        2007-02-25 14:57:29.000000000 
+0100
++++ u-boot/drivers/nand/nand_bbt.c     2007-02-25 15:03:52.000000000 +0100
+@@ -1065,6 +1065,15 @@
+ static char *part_names[] = {
+     "u-boot", "u-boot_env", "kernel", "splash", "rootfs" };
  
 +
 +static int skip_offs(const struct nand_chip *this, unsigned int offs)
@@ -18,20 +18,23 @@
  int nand_create_mtd_dynpart(struct mtd_info *mtd)
  {
        struct nand_chip *this = mtd->priv;
-@@ -1080,11 +1089,22 @@
+@@ -1083,12 +1092,23 @@
                unsigned int bb_delta = 0;
                unsigned int offs = 0;
                char mtdpart[32];
--              for (offs = cur_offs; offs < cur_offs + part_size[part] + 
bb_delta; offs += 0x4000) {
+-              for (offs = cur_offs; offs < cur_offs + part_size[part] + 
bb_delta;
+-                   offs += this->erasesize) {
 -                      int block = (int) (offs >> (this->bbt_erase_shift - 1));
 -                      u_int8_t bbt = (this->bbt[block >> 3] >> (block & 
0x06)) & 0x03;
 -                      if (bbt == 0x03)
+-                              bb_delta += this->erasesize;
 +
 +              for (offs = cur_offs;
-+                  offs < cur_offs + part_size[part] + bb_delta;
-+                  offs += 0x4000)
++                   offs < cur_offs + part_size[part] + bb_delta;
++                   offs += mtd->erasesize) {
 +                      if (skip_offs(this, offs))
-                               bb_delta += 0x4000;
++                              bb_delta += mtd->erasesize;
++              }
 +
 +              /*
 +               * Absorb bad blocks immediately following this partition also
@@ -40,8 +43,8 @@
 +               * environment partition.
 +               */
 +              while (offs < this->chipsize && skip_offs(this, offs)) {
-+                      bb_delta += 0x4000;
-+                      offs += 0x4000;
++                      bb_delta += mtd->erasesize;
++                      offs += mtd->erasesize;
                }
  
                if (cur_offs + part_size[part] + bb_delta > this->chipsize)

Modified: trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
===================================================================
--- trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch       
2007-02-25 15:43:38 UTC (rev 1116)
+++ trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch       
2007-02-25 15:50:19 UTC (rev 1117)
@@ -17,9 +17,15 @@
 
 Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.orig/drivers/nand/nand_bbt.c
-+++ u-boot/drivers/nand/nand_bbt.c
-@@ -1049,4 +1049,63 @@ int nand_isbad_bbt (struct mtd_info *mtd
+--- u-boot.orig/drivers/nand/nand_bbt.c        2007-02-25 15:36:10.000000000 
+0100
++++ u-boot/drivers/nand/nand_bbt.c     2007-02-25 15:36:51.000000000 +0100
+@@ -1044,9 +1044,70 @@
+       switch ((int)res) {
+       case 0x00:      return 0;
+       case 0x01:      return 1;
++      case 0x03:      return 1;
+       case 0x02:      return allowbbt ? 0 : 1;
+       }
        return 1;
  }
  
@@ -54,11 +60,12 @@
 +              unsigned int bb_delta = 0;
 +              unsigned int offs = 0;
 +              char mtdpart[32];
-+              for (offs = cur_offs; offs < cur_offs + part_size[part] + 
bb_delta; offs += 0x4000) {
++              for (offs = cur_offs; offs < cur_offs + part_size[part] + 
bb_delta;
++                   offs += this->erasesize) {
 +                      int block = (int) (offs >> (this->bbt_erase_shift - 1));
 +                      u_int8_t bbt = (this->bbt[block >> 3] >> (block & 
0x06)) & 0x03;
 +                      if (bbt == 0x03)
-+                              bb_delta += 0x4000;
++                              bb_delta += this->erasesize;
 +              }
 +
 +              if (cur_offs + part_size[part] + bb_delta > this->chipsize)
@@ -85,8 +92,8 @@
  #endif
 Index: u-boot/include/configs/neo1973.h
 ===================================================================
---- u-boot.orig/include/configs/neo1973.h
-+++ u-boot/include/configs/neo1973.h
+--- u-boot.orig/include/configs/neo1973.h      2007-02-25 15:36:18.000000000 
+0100
++++ u-boot/include/configs/neo1973.h   2007-02-25 15:36:51.000000000 +0100
 @@ -99,7 +99,7 @@
                        CFG_CMD_ELF      | \
                        CFG_CMD_MISC     | \
@@ -123,9 +130,39 @@
  #endif        /* __CONFIG_H */
 Index: u-boot/common/cmd_jffs2.c
 ===================================================================
---- u-boot.orig/common/cmd_jffs2.c
-+++ u-boot/common/cmd_jffs2.c
-@@ -2132,6 +2132,18 @@ int do_jffs2_mtdparts(cmd_tbl_t *cmdtp, 
+--- u-boot.orig/common/cmd_jffs2.c     2007-02-25 15:36:10.000000000 +0100
++++ u-boot/common/cmd_jffs2.c  2007-02-25 15:36:18.000000000 +0100
+@@ -1841,6 +1841,29 @@
+       return NULL;
+ }
+ 
++/* Return the 'net size' of the partition (i.e. excluding any bad blocks) */
++unsigned int nand_net_part_size(struct part_info *part)
++{
++      struct mtd_info *mtd;
++      unsigned int offs;
++      unsigned int bb_delta = 0;
++
++      if (!part || !part->dev || !part->dev->id ||
++          part->dev->id->num >= CFG_MAX_NAND_DEVICE)
++              return 0;
++
++      mtd = &nand_info[part->dev->id->num];
++
++      for (offs = part->offset; offs < part->offset + part->size;
++           offs += mtd->erasesize) {
++              if (nand_isbad_bbt(mtd, offs, 0))
++                      bb_delta += mtd->erasesize;
++      }
++
++      return part->size - bb_delta;
++}
++
++
+ /***************************************************/
+ /* U-boot commands                               */
+ /***************************************************/
+@@ -2132,6 +2155,20 @@
        printf ("Usage:\n%s\n", cmdtp->usage);
        return 1;
  }
@@ -140,11 +177,13 @@
 +              return -EINVAL;
 +#endif
 +      nand_create_mtd_dynpart(&nand_info[0]);
++
++      return 0;
 +}
  #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
  
  /***************************************************/
-@@ -2197,6 +2209,13 @@ U_BOOT_CMD(
+@@ -2197,6 +2234,13 @@
        "<name>     := '(' NAME ')'\n"
        "<ro-flag>  := when set to 'ro' makes partition read-only (not used, 
passed to kernel)\n"
  );
@@ -158,3 +197,89 @@
  #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
  
  /***************************************************/
+Index: u-boot/common/cmd_nand.c
+===================================================================
+--- u-boot.orig/common/cmd_nand.c      2007-02-25 15:36:10.000000000 +0100
++++ u-boot/common/cmd_nand.c   2007-02-25 15:36:50.000000000 +0100
+@@ -101,7 +101,7 @@
+ }
+ 
+ int
+-arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong 
*size)
++arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, ulong 
*size, int net)
+ {
+       int idx = nand_curr_device;
+ #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+@@ -122,10 +122,17 @@
+                                       printf("'%s' is not a number\n", 
argv[1]);
+                                       return -1;
+                               }
+-                              if (*size > part->size)
+-                                      *size = part->size;
++                              if (*size > part->size) {
++                                      if (net)
++                                              *size = 
nand_net_part_size(part);
++                                      else
++                                              *size = part->size;
++                              }
+                       } else {
+-                              *size = part->size;
++                              if (net)
++                                      *size = nand_net_part_size(part);
++                              else
++                                      *size = part->size;
+                       }
+                       idx = dev->id->num;
+                       *nand = nand_info[idx];
+@@ -261,7 +268,7 @@
+ 
+               printf("\nNAND %s: ", scrub ? "scrub" : "erase");
+               /* skip first two or three arguments, look for offset and size 
*/
+-              if (arg_off_size(argc - o, argv + o, nand, &off, &size) != 0)
++              if (arg_off_size(argc - o, argv + o, nand, &off, &size, 0) != 0)
+                       return 1;
+ 
+               memset(&opts, 0, sizeof(opts));
+@@ -323,7 +330,7 @@
+ 
+               read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */
+               printf("\nNAND %s: ", read ? "read" : "write");
+-              if (arg_off_size(argc - 3, argv + 3, nand, &off, &size) != 0)
++              if (arg_off_size(argc - 3, argv + 3, nand, &off, &size, 1) != 0)
+                       return 1;
+ 
+               s = strchr(cmd, '.');
+@@ -445,7 +452,7 @@
+       }
+ 
+       if (strcmp(cmd, "unlock") == 0) {
+-              if (arg_off_size(argc - 2, argv + 2, nand, &off, &size) < 0)
++              if (arg_off_size(argc - 2, argv + 2, nand, &off, &size, 0) < 0)
+                       return 1;
+ 
+               if (!nand_unlock(nand, off, size)) {
+Index: u-boot/common/cmd_dynenv.c
+===================================================================
+--- u-boot.orig/common/cmd_dynenv.c    2007-02-25 15:37:32.000000000 +0100
++++ u-boot/common/cmd_dynenv.c 2007-02-25 15:37:39.000000000 +0100
+@@ -60,7 +60,7 @@
+               buf[2] = 'V';
+               buf[3] = '0';
+ 
+-              if (arg_off_size(argc-2, argv+2, mtd, &addr, &dummy) < 0) {
++              if (arg_off_size(argc-2, argv+2, mtd, &addr, &dummy, 1) < 0) {
+                       printf("Offset or partition name expected\n");
+                       goto fail;
+               }
+Index: u-boot/include/util.h
+===================================================================
+--- u-boot.orig/include/util.h 2007-02-25 15:37:43.000000000 +0100
++++ u-boot/include/util.h      2007-02-25 15:37:49.000000000 +0100
+@@ -28,6 +28,6 @@
+ 
+ /* common/cmd_nand.c */
+ int arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off,
+-  ulong *size);
++  ulong *size, int net);
+ 
+ #endif /* UTIL_H */




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-02-25 16:55:29 +0100 (Sun, 25 Feb 2007)
New Revision: 1118

Modified:
   trunk/src/target/u-boot/patches/uboot-dfu.patch
Log:
* disable DFU debugging
* correctly use gross/net partition sizes
* correctly deal with bad blcoks in splash/kernel/rootfs partitions
* make sure we have a valid mtdparts environment variable before starting
* correctly restore dynenv OOB marker after flashing u-boot
* don't touch dfu_status when entering MANIFEST_SYNC


Modified: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch     2007-02-25 15:50:19 UTC 
(rev 1117)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch     2007-02-25 15:55:29 UTC 
(rev 1118)
@@ -1,7 +1,7 @@
 Index: u-boot/drivers/usbdcore_ep0.c
 ===================================================================
---- u-boot.orig/drivers/usbdcore_ep0.c 2007-02-25 00:49:47.000000000 +0100
-+++ u-boot/drivers/usbdcore_ep0.c      2007-02-25 00:49:47.000000000 +0100
+--- u-boot.orig/drivers/usbdcore_ep0.c 2007-02-25 15:37:52.000000000 +0100
++++ u-boot/drivers/usbdcore_ep0.c      2007-02-25 15:37:53.000000000 +0100
 @@ -42,10 +42,15 @@
   */
  
@@ -88,8 +88,8 @@
 Index: u-boot/drivers/usbdfu.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/drivers/usbdfu.c    2007-02-25 00:53:15.000000000 +0100
-@@ -0,0 +1,838 @@
++++ u-boot/drivers/usbdfu.c    2007-02-25 16:40:12.000000000 +0100
+@@ -0,0 +1,863 @@
 +/*
 + * (C) 2007 by OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -122,8 +122,6 @@
 + *   while DFU transfer is in progress, and return to commandline once
 + *   we're finished
 + * - add VERIFY support after writing to flash
-+ * - switch into runtime mode after successful transfer, so we can
-+ *   start all over again
 + * - sanely free() resources allocated during first uppload/download
 + *   request when aborting
 + * - sanely free resources when another alternate interface is selected
@@ -137,7 +135,7 @@
 +#include <config.h>
 +#if defined(CONFIG_USBD_DFU)
 +
-+#define DEBUG
++//#define DEBUG
 +
 +#include <common.h>
 +DECLARE_GLOBAL_DATA_PTR;
@@ -162,8 +160,9 @@
 +#define RET_STALL     2
 +
 +struct dnload_state {
++      nand_info_t *nand;
 +      struct part_info *part;
-+      nand_info_t *nand;
++      unsigned int part_net_size;     /* net sizee (excl. bad blocks) of part 
*/
 +
 +      nand_erase_options_t erase_opts;
 +      nand_write_options_t write_opts;
@@ -218,6 +217,7 @@
 +      }
 +      ds->nand = &nand_info[ds->part->dev->id->num];
 +      ds->off = ds->part->offset;
++      ds->part_net_size = nand_net_part_size(ds->part);
 +
 +      if (ds->nand->erasesize > sizeof(ds->_buf)) {
 +              printf("*** Warning - NAND ERASESIZE bigger than static 
buffer\n");
@@ -253,16 +253,26 @@
 +}
 +
 +static int erase_flash_verify_nand(struct urb *urb, struct dnload_state *ds,
-+                                 unsigned long size)
++                                 unsigned long erasesize, unsigned long size)
 +{
 +      struct usb_device_instance *dev = urb->device;
 +      int rc;
 +
-+      debug("erase_flash_verify_nand(urb=%p, ds=%p, size=%p)\n", urb, ds, 
size);
++      debug("erase_flash_verify_nand(urb=%p, ds=%p, erase=0x%x size=0x%x)\n",
++              urb, ds, erasesize, size);
 +
++      if (erasesize == ds->nand->erasesize) {
++              /* we're only writing a single block and need to
++               * do bad block skipping / offset adjustments our own */
++              while (ds->nand->block_isbad(ds->nand, ds->off)) {
++                      debug("SKIP_ONE_BLOCK(0x%08x)!!\n", ds->off);
++                      ds->off += ds->nand->erasesize;
++              }
++      }
++
 +      /* we have finished one eraseblock, flash it */
 +      ds->erase_opts.offset = ds->off;
-+      ds->erase_opts.length = size;
++      ds->erase_opts.length = erasesize;
 +      debug("Erasing 0x%x bytes @ offset 0x%x (jffs=%u)\n",
 +              ds->erase_opts.length, ds->erase_opts.offset,
 +              ds->erase_opts.jffs2);
@@ -285,6 +295,7 @@
 +              dev->dfu_status = DFU_STATUS_errWRITE;
 +              return RET_STALL;
 +      }
++
 +      ds->off += size;
 +      ds->ptr = ds->buf;
 +
@@ -339,10 +350,16 @@
 +              return RET_STALL;
 +      }
 +
++      if (first) {
++              /* Make sure that we have a valid mtd partition table */
++              char *mtdp = getenv("mtdparts");
++              if (!mtdp)
++                      run_command("dynpart", 0);
++      }
++
 +      if (len == 0) {
 +              debug("zero-size write -> MANIFEST_SYNC ");
 +              dev->dfu_state = DFU_STATE_dfuMANIFEST_SYNC;
-+              dev->dfu_status = DFU_STATUS_errADDRESS;
 +
 +              /* cleanup */
 +              switch (dev->alternate) {
@@ -353,16 +370,21 @@
 +                      ds->ptr = ds->buf;
 +                      break;
 +              case 1:
-+                      if (ds->ptr > ds->buf)
++                      if (ds->ptr > ds->buf) {
 +                              rc = erase_flash_verify_nand(urb, ds,
-+                                                      ds->part->size);
-+                      ds->nand = NULL;
++                                                      ds->part->size,
++                                                      ds->part_net_size);
++                              /* re-write dynenv marker in OOB */
++                              run_command("dynenv set u-boot_env", 0);
++                      }
++                      ds->nand = NULL;-EINVAL;
 +                      free(ds->buf);
 +                      ds->ptr = ds->buf = ds->_buf;
 +                      break;
 +              default:
 +                      if (ds->ptr > ds->buf)
 +                              rc = erase_flash_verify_nand(urb, ds,
++                                                      ds->nand->erasesize,
 +                                                      ds->nand->erasesize);
 +                      ds->nand = NULL;
 +                      break;
@@ -396,7 +418,7 @@
 +                      rc = initialize_ds_nand(dev, ds);
 +                      if (rc)
 +                              return rc;
-+                      ds->buf = malloc(ds->part->size);
++                      ds->buf = malloc(ds->part_net_size);
 +                      if (!ds->buf) {
 +                              printf("No memory for atomic buffer!!\n");
 +                              dev->dfu_state = DFU_STATE_dfuERROR;
@@ -408,7 +430,7 @@
 +                              ds->part->name);
 +              }
 +
-+              remain_len = (ds->buf + ds->part->size) - ds->ptr;
++              remain_len = (ds->buf + ds->part_net_size) - ds->ptr;
 +              if (remain_len < len) {
 +                      len = remain_len;
 +                      printf("End of write exceeds partition end\n");
@@ -445,7 +467,9 @@
 +              }
 +
 +              if (ds->ptr >= ds->buf + size) {
-+                      rc = erase_flash_verify_nand(urb, ds, 
ds->nand->erasesize);
++                      rc = erase_flash_verify_nand(urb, ds,
++                                                   ds->nand->erasesize,
++                                                   ds->nand->erasesize);
 +                      if (rc)
 +                              return rc;
 +                      /* copy remainder of data into buffer */
@@ -520,7 +544,7 @@
 +              urb->actual_length = remain;
 +
 +              if (ds->ptr >= ds->buf + ds->nand->erasesize &&
-+                  ds->off < ds->part->offset + ds->part->size)  {
++                  ds->off < ds->part->offset + ds->part->size) {
 +                      rc = read_next_nand(urb, ds);
 +                      if (rc)
 +                              return -EINVAL;
@@ -709,7 +733,8 @@
 +      u_int16_t len = urb->device_request.wLength;
 +      struct usb_device_instance *dev = urb->device;
 +
-+      debug("old_state = %u ", dev->dfu_state);
++      debug("dfu_ep0(req=0x%x, val=0x%x, len=%u) old_state = %u ",
++              req, val, len, dev->dfu_state);
 +
 +      switch (dev->dfu_state) {
 +      case DFU_STATE_appIDLE:
@@ -930,8 +955,8 @@
 +#endif /* CONFIG_USBD_DFU */
 Index: u-boot/drivers/Makefile
 ===================================================================
---- u-boot.orig/drivers/Makefile       2007-02-25 00:49:47.000000000 +0100
-+++ u-boot/drivers/Makefile    2007-02-25 00:49:47.000000000 +0100
+--- u-boot.orig/drivers/Makefile       2007-02-25 15:37:52.000000000 +0100
++++ u-boot/drivers/Makefile    2007-02-25 15:37:53.000000000 +0100
 @@ -46,7 +46,7 @@
          sl811_usb.o sm501.o smc91111.o smiLynxEM.o \
          status_led.o sym53c8xx.o ahci.o \
@@ -943,8 +968,8 @@
          pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o  \
 Index: u-boot/drivers/usbdcore.c
 ===================================================================
---- u-boot.orig/drivers/usbdcore.c     2007-02-25 00:47:56.000000000 +0100
-+++ u-boot/drivers/usbdcore.c  2007-02-25 01:01:43.000000000 +0100
+--- u-boot.orig/drivers/usbdcore.c     2007-02-25 15:36:49.000000000 +0100
++++ u-boot/drivers/usbdcore.c  2007-02-25 15:37:53.000000000 +0100
 @@ -31,6 +31,7 @@
  
  #include <malloc.h>
@@ -1010,8 +1035,8 @@
        case DEVICE_ADDRESS_ASSIGNED:
 Index: u-boot/drivers/usbtty.c
 ===================================================================
---- u-boot.orig/drivers/usbtty.c       2007-02-25 00:49:47.000000000 +0100
-+++ u-boot/drivers/usbtty.c    2007-02-25 00:49:48.000000000 +0100
+--- u-boot.orig/drivers/usbtty.c       2007-02-25 15:37:52.000000000 +0100
++++ u-boot/drivers/usbtty.c    2007-02-25 15:37:53.000000000 +0100
 @@ -31,6 +31,8 @@
  #include "usbtty.h"
  #include "usb_cdc_acm.h"
@@ -1068,8 +1093,8 @@
        memset (bus_instance, 0, sizeof (struct usb_bus_instance));
 Index: u-boot/include/configs/neo1973.h
 ===================================================================
---- u-boot.orig/include/configs/neo1973.h      2007-02-25 00:49:47.000000000 
+0100
-+++ u-boot/include/configs/neo1973.h   2007-02-25 00:49:48.000000000 +0100
+--- u-boot.orig/include/configs/neo1973.h      2007-02-25 15:37:53.000000000 
+0100
++++ u-boot/include/configs/neo1973.h   2007-02-25 15:37:53.000000000 +0100
 @@ -165,7 +165,7 @@
   */
  #define CONFIG_STACKSIZE      (128*1024)      /* regular stack */
@@ -1093,7 +1118,7 @@
 Index: u-boot/include/usb_dfu.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/include/usb_dfu.h   2007-02-25 00:49:48.000000000 +0100
++++ u-boot/include/usb_dfu.h   2007-02-25 15:37:53.000000000 +0100
 @@ -0,0 +1,91 @@
 +#ifndef _DFU_H
 +#define _DFU_H
@@ -1189,7 +1214,7 @@
 Index: u-boot/include/usb_dfu_descriptors.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/include/usb_dfu_descriptors.h       2007-02-25 00:49:48.000000000 
+0100
++++ u-boot/include/usb_dfu_descriptors.h       2007-02-25 15:37:53.000000000 
+0100
 @@ -0,0 +1,94 @@
 +#ifndef _USB_DFU_H
 +#define _USB_DFU_H
@@ -1287,8 +1312,8 @@
 +#endif /* _USB_DFU_H */
 Index: u-boot/include/usbdcore.h
 ===================================================================
---- u-boot.orig/include/usbdcore.h     2007-02-25 00:49:47.000000000 +0100
-+++ u-boot/include/usbdcore.h  2007-02-25 00:49:48.000000000 +0100
+--- u-boot.orig/include/usbdcore.h     2007-02-25 15:37:52.000000000 +0100
++++ u-boot/include/usbdcore.h  2007-02-25 15:37:53.000000000 +0100
 @@ -33,6 +33,7 @@
  
  #include <common.h>




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to