Merge branch 'master' of git://git.denx.de/u-boot-mmc
authorTom Rini <trini@ti.com>
Fri, 28 Mar 2014 12:24:01 +0000 (08:24 -0400)
committerTom Rini <trini@ti.com>
Fri, 28 Mar 2014 12:24:01 +0000 (08:24 -0400)
README
common/Makefile
common/cmd_lzmadec.c [new file with mode: 0644]
drivers/dfu/dfu.c
drivers/usb/gadget/f_dfu.c
include/configs/sandbox.h
include/configs/siemens-am33x-common.h
include/dfu.h
tools/patman/README
tools/patman/patchstream.py

diff --git a/README b/README
index 216f0c7..7cb7c4f 100644 (file)
--- a/README
+++ b/README
@@ -1525,6 +1525,16 @@ The following options need to be configured:
                this to the maximum filesize (in bytes) for the buffer.
                Default is 4 MiB if undefined.
 
+               DFU_DEFAULT_POLL_TIMEOUT
+               Poll timeout [ms], is the timeout a device can send to the
+               host. The host must wait for this timeout before sending
+               a subsequent DFU_GET_STATUS request to the device.
+
+               DFU_MANIFEST_POLL_TIMEOUT
+               Poll timeout [ms], which the device sends to the host when
+               entering dfuMANIFEST state. Host waits this timeout, before
+               sending again an USB request to the device.
+
 - Journaling Flash filesystem support:
                CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
                CONFIG_JFFS2_NAND_DEV
index e2ff0cb..cecd81a 100644 (file)
@@ -159,6 +159,9 @@ obj-$(CONFIG_CMD_UBI) += cmd_ubi.o
 obj-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o
 obj-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
 obj-$(CONFIG_CMD_UNZIP) += cmd_unzip.o
+ifdef CONFIG_LZMA
+obj-$(CONFIG_CMD_LZMADEC) += cmd_lzmadec.o
+endif
 ifdef CONFIG_CMD_USB
 obj-y += cmd_usb.o
 obj-y += usb.o usb_hub.o
diff --git a/common/cmd_lzmadec.c b/common/cmd_lzmadec.c
new file mode 100644 (file)
index 0000000..7b0b3fd
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2013 Patrice Bouchand <pbfwdlist_gmail_com>
+ * lzma uncompress command in Uboot
+ *
+ * made from existing cmd_unzip.c file of Uboot
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/io.h>
+
+#include <lzma/LzmaTools.h>
+
+static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       unsigned long src, dst;
+       unsigned long src_len = ~0UL, dst_len = ~0UL;
+       int ret;
+
+       switch (argc) {
+       case 4:
+               dst_len = simple_strtoul(argv[3], NULL, 16);
+               /* fall through */
+       case 3:
+               src = simple_strtoul(argv[1], NULL, 16);
+               dst = simple_strtoul(argv[2], NULL, 16);
+               break;
+       default:
+               return CMD_RET_USAGE;
+       }
+
+       ret = lzmaBuffToBuffDecompress(map_sysmem(dst, dst_len), &src_len,
+                                      map_sysmem(src, 0), dst_len);
+
+       if (ret != SZ_OK)
+               return 1;
+       printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
+       setenv_hex("filesize", src_len);
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       lzmadec,    4,    1,    do_lzmadec,
+       "lzma uncompress a memory region",
+       "srcaddr dstaddr [dstsize]"
+);
index 07011e9..f94c412 100644 (file)
@@ -126,6 +126,28 @@ static int dfu_write_buffer_drain(struct dfu_entity *dfu)
        return ret;
 }
 
+int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
+{
+       int ret = 0;
+
+       if (dfu->flush_medium)
+               ret = dfu->flush_medium(dfu);
+
+       printf("\nDFU complete CRC32: 0x%08x\n", dfu->crc);
+
+       /* clear everything */
+       dfu_free_buf();
+       dfu->crc = 0;
+       dfu->offset = 0;
+       dfu->i_blk_seq_num = 0;
+       dfu->i_buf_start = dfu_buf;
+       dfu->i_buf_end = dfu_buf;
+       dfu->i_buf = dfu->i_buf_start;
+       dfu->inited = 0;
+
+       return ret;
+}
+
 int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 {
        int ret = 0;
@@ -196,26 +218,6 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
                        ret = tret;
        }
 
-       /* end? */
-       if (size == 0) {
-               /* Now try and flush to the medium if needed. */
-               if (dfu->flush_medium)
-                       ret = dfu->flush_medium(dfu);
-               printf("\nDFU complete CRC32: 0x%08x\n", dfu->crc);
-
-               /* clear everything */
-               dfu_free_buf();
-               dfu->crc = 0;
-               dfu->offset = 0;
-               dfu->i_blk_seq_num = 0;
-               dfu->i_buf_start = dfu_buf;
-               dfu->i_buf_end = dfu_buf;
-               dfu->i_buf = dfu->i_buf_start;
-
-               dfu->inited = 0;
-
-       }
-
        return ret = 0 ? size : ret;
 }
 
index a045864..de75ff1 100644 (file)
@@ -164,9 +164,14 @@ static void dnload_request_complete(struct usb_ep *ep, struct usb_request *req)
 
        dfu_write(dfu_get_entity(f_dfu->altsetting), req->buf,
                  req->length, f_dfu->blk_seq_num);
+}
 
-       if (req->length == 0)
-               puts("DOWNLOAD ... OK\nCtrl+C to exit ...\n");
+static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req)
+{
+       struct f_dfu *f_dfu = req->context;
+
+       dfu_flush(dfu_get_entity(f_dfu->altsetting), req->buf,
+                 req->length, f_dfu->blk_seq_num);
 }
 
 static void handle_getstatus(struct usb_request *req)
@@ -174,19 +179,22 @@ static void handle_getstatus(struct usb_request *req)
        struct dfu_status *dstat = (struct dfu_status *)req->buf;
        struct f_dfu *f_dfu = req->context;
 
+       dfu_set_poll_timeout(dstat, 0);
+
        switch (f_dfu->dfu_state) {
        case DFU_STATE_dfuDNLOAD_SYNC:
        case DFU_STATE_dfuDNBUSY:
                f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_IDLE;
                break;
        case DFU_STATE_dfuMANIFEST_SYNC:
+               f_dfu->dfu_state = DFU_STATE_dfuMANIFEST;
                break;
+       case DFU_STATE_dfuMANIFEST:
+               dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT);
        default:
                break;
        }
 
-       dfu_set_poll_timeout(dstat, 0);
-
        if (f_dfu->poll_timeout)
                if (!(f_dfu->blk_seq_num %
                      (dfu_get_buf_size() / DFU_USB_BUFSIZ)))
@@ -446,10 +454,11 @@ static int state_dfu_manifest_sync(struct f_dfu *f_dfu,
        switch (ctrl->bRequest) {
        case USB_REQ_DFU_GETSTATUS:
                /* We're MainfestationTolerant */
-               f_dfu->dfu_state = DFU_STATE_dfuIDLE;
+               f_dfu->dfu_state = DFU_STATE_dfuMANIFEST;
                handle_getstatus(req);
                f_dfu->blk_seq_num = 0;
                value = RET_STAT_LEN;
+               req->complete = dnload_request_flush;
                break;
        case USB_REQ_DFU_GETSTATE:
                handle_getstate(req);
@@ -463,6 +472,33 @@ static int state_dfu_manifest_sync(struct f_dfu *f_dfu,
        return value;
 }
 
+static int state_dfu_manifest(struct f_dfu *f_dfu,
+                             const struct usb_ctrlrequest *ctrl,
+                             struct usb_gadget *gadget,
+                             struct usb_request *req)
+{
+       int value = 0;
+
+       switch (ctrl->bRequest) {
+       case USB_REQ_DFU_GETSTATUS:
+               /* We're MainfestationTolerant */
+               f_dfu->dfu_state = DFU_STATE_dfuIDLE;
+               handle_getstatus(req);
+               f_dfu->blk_seq_num = 0;
+               value = RET_STAT_LEN;
+               puts("DOWNLOAD ... OK\nCtrl+C to exit ...\n");
+               break;
+       case USB_REQ_DFU_GETSTATE:
+               handle_getstate(req);
+               break;
+       default:
+               f_dfu->dfu_state = DFU_STATE_dfuERROR;
+               value = RET_STALL;
+               break;
+       }
+       return value;
+}
+
 static int state_dfu_upload_idle(struct f_dfu *f_dfu,
                                 const struct usb_ctrlrequest *ctrl,
                                 struct usb_gadget *gadget,
@@ -539,7 +575,7 @@ static dfu_state_fn dfu_state[] = {
        state_dfu_dnbusy,        /* DFU_STATE_dfuDNBUSY */
        state_dfu_dnload_idle,   /* DFU_STATE_dfuDNLOAD_IDLE */
        state_dfu_manifest_sync, /* DFU_STATE_dfuMANIFEST_SYNC */
-       NULL,                    /* DFU_STATE_dfuMANIFEST */
+       state_dfu_manifest,      /* DFU_STATE_dfuMANIFEST */
        NULL,                    /* DFU_STATE_dfuMANIFEST_WAIT_RST */
        state_dfu_upload_idle,   /* DFU_STATE_dfuUPLOAD_IDLE */
        state_dfu_error          /* DFU_STATE_dfuERROR */
index 04171bd..fa62cb6 100644 (file)
 
 #define CONFIG_TPM_TIS_SANDBOX
 
+#define CONFIG_CMD_LZMADEC
+
 #endif
index 98b6e72..721c4e6 100644 (file)
 #define CONFIG_DFU_NAND
 #define CONFIG_CMD_DFU
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE   (1 << 20)
+#define DFU_MANIFEST_POLL_TIMEOUT      25000
 
 #endif /* CONFIG_SPL_BUILD */
 
index f973426..6c71ecb 100644 (file)
@@ -80,6 +80,9 @@ static inline unsigned int get_mmc_blk_size(int dev)
 #ifndef DFU_DEFAULT_POLL_TIMEOUT
 #define DFU_DEFAULT_POLL_TIMEOUT 0
 #endif
+#ifndef DFU_MANIFEST_POLL_TIMEOUT
+#define DFU_MANIFEST_POLL_TIMEOUT      DFU_DEFAULT_POLL_TIMEOUT
+#endif
 
 struct dfu_entity {
        char                    name[DFU_NAME_SIZE];
@@ -138,6 +141,7 @@ unsigned long dfu_get_buf_size(void);
 
 int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
+int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 /* Device specific */
 #ifdef CONFIG_DFU_MMC
 extern int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s);
index 59f1776..b3aba13 100644 (file)
@@ -217,8 +217,10 @@ Series-changes: n
        to update the log there and then, knowing that the script will
        do the rest.
 
- Cc: Their Name <email>
-       This copies a single patch to another email address.
+Patch-cc: Their Name <email>
+       This copies a single patch to another email address. Note that the
+       Cc: used by git send-email is ignored by patman, but will be
+       interpreted by git send-email if you use it.
 
 Series-process-log: sort, uniq
        This tells patman to sort and/or uniq the change logs. It is
@@ -246,8 +248,9 @@ Where Patches Are Sent
 
 Once the patches are created, patman sends them using git send-email. The
 whole series is sent to the recipients in Series-to: and Series-cc.
-You can Cc individual patches to other people with the Cc: tag. Tags in the
-subject are also picked up to Cc patches. For example, a commit like this:
+You can Cc individual patches to other people with the Patch-cc: tag. Tags
+in the subject are also picked up to Cc patches. For example, a commit like
+this:
 
 >>>>
 commit 10212537b85ff9b6e09c82045127522c0f0db981
@@ -258,16 +261,16 @@ Date:     Mon Nov 7 23:18:44 2011 -0500
 
     This should make sending out e-mails to the right people easier.
 
-    Cc: sandbox, mikef, ag
-    Cc: afleming
+    Patch-cc: sandbox, mikef, ag
+    Patch-cc: afleming
 <<<<
 
 will create a patch which is copied to x86, arm, sandbox, mikef, ag and
 afleming.
 
-If you have a cover letter it will get sent to the union of the CC lists of
-all of the other patches. If you want to sent it to additional people you
-can add a tag:
+If you have a cover letter it will get sent to the union of the Patch-cc
+lists of all of the other patches. If you want to sent it to additional
+people you can add a tag:
 
 Cover-letter-cc: <list of addresses>
 
index 684204c..c4017e0 100644 (file)
@@ -36,7 +36,7 @@ re_series_tag = re.compile('^Series-([a-z-]*): *(.*)')
 re_commit_tag = re.compile('^Commit-([a-z-]*): *(.*)')
 
 # Commit tags that we want to collect and keep
-re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Cc): (.*)')
+re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Patch-cc): (.*)')
 
 # The start of a new commit in the git log
 re_commit = re.compile('^commit ([0-9a-f]*)$')
@@ -267,7 +267,7 @@ class PatchStream:
             if (tag_match.group(1) == 'Tested-by' and
                     tag_match.group(2).find(os.getenv('USER') + '@') != -1):
                 self.warn.append("Ignoring %s" % line)
-            elif tag_match.group(1) == 'Cc':
+            elif tag_match.group(1) == 'Patch-cc':
                 self.commit.AddCc(tag_match.group(2).split(','))
             else:
                 self.tags.append(line);