summaryrefslogtreecommitdiff
path: root/common/cmd_dfu.c
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2013-07-18 13:19:14 +0200
committerMarek Vasut <marex@denx.de>2013-07-29 23:01:33 +0200
commit6bed7ce569fc409843ff2537937ea1b5fd0f694d (patch)
treebb17efd44c3e2f69ae3dd0f0a0a6bd31a06a2204 /common/cmd_dfu.c
parent6dd30af0fa5c2f509f6f789789151268bdfcde0c (diff)
downloadu-boot-imx-6bed7ce569fc409843ff2537937ea1b5fd0f694d.zip
u-boot-imx-6bed7ce569fc409843ff2537937ea1b5fd0f694d.tar.gz
u-boot-imx-6bed7ce569fc409843ff2537937ea1b5fd0f694d.tar.bz2
dfu: Implementation of target reset after communication with dfu-util's -R switch
This patch extends dfu code to support transmission with -R switch specified at dfu-util. When -R is specified, the extra USB_REQ_DFU_DETACH request is sent after successful data transmission. Then dfu resources are released and reset command is issued. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'common/cmd_dfu.c')
-rw-r--r--common/cmd_dfu.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index db066ac..793c422 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -19,8 +19,8 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const char *str_env;
char *s = "dfu";
+ int ret, i = 0;
char *env_bkp;
- int ret;
if (argc < 3)
return CMD_RET_USAGE;
@@ -49,6 +49,15 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
g_dnl_register(s);
while (1) {
+ if (dfu_reset())
+ /*
+ * This extra number of usb_gadget_handle_interrupts()
+ * calls is necessary to assure correct transmission
+ * completion with dfu-util
+ */
+ if (++i == 10)
+ goto exit;
+
if (ctrlc())
goto exit;
@@ -60,6 +69,9 @@ done:
dfu_free_entities();
free(env_bkp);
+ if (dfu_reset())
+ run_command("reset", 0);
+
return CMD_RET_SUCCESS;
}