summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-02-24 14:26:20 -0500
committerTom Rini <trini@konsulko.com>2016-02-24 18:44:17 -0500
commitfec26e7270ad31e4179d1bd189e5cd8ab93ccba3 (patch)
tree6a24a5af8d3c40956db407177e945493fd6a1ce3 /cmd
parente1417c7b66f4e0051a3aa242f655e85c1c96eef2 (diff)
parentd7d8c00575c8ae766d387c763395470410427b69 (diff)
downloadu-boot-imx-fec26e7270ad31e4179d1bd189e5cd8ab93ccba3.zip
u-boot-imx-fec26e7270ad31e4179d1bd189e5cd8ab93ccba3.tar.gz
u-boot-imx-fec26e7270ad31e4179d1bd189e5cd8ab93ccba3.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-usb
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dfu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/dfu.c b/cmd/dfu.c
index 6d95ce9..d8aae26 100644
--- a/cmd/dfu.c
+++ b/cmd/dfu.c
@@ -79,6 +79,26 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (ctrlc())
goto exit;
+ if (dfu_get_defer_flush()) {
+ /*
+ * Call to usb_gadget_handle_interrupts() is necessary
+ * to act on ZLP OUT transaction from HOST PC after
+ * transmitting the whole file.
+ *
+ * If this ZLP OUT packet is NAK'ed, the HOST libusb
+ * function fails after timeout (by default it is set to
+ * 5 seconds). In such situation the dfu-util program
+ * exits with error message.
+ */
+ usb_gadget_handle_interrupts(controller_index);
+ ret = dfu_flush(dfu_get_defer_flush(), NULL, 0, 0);
+ dfu_set_defer_flush(NULL);
+ if (ret) {
+ error("Deferred dfu_flush() failed!");
+ goto exit;
+ }
+ }
+
WATCHDOG_RESET();
usb_gadget_handle_interrupts(controller_index);
}