summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-01-09 16:51:57 +0300
committerTom Rini <trini@konsulko.com>2020-01-09 16:51:57 +0300
commita74a2134b245d19a999c796d29285597a22954ed (patch)
tree0838cf4adc01fe969bbcf7dc53d41611546429a2 /common
parent7086de4948ba2bc46cdd3001f7d845535f05f7fe (diff)
parent3a117e721cc5b4a366dbd5fbbf8df0a80cbb0fa2 (diff)
downloadu-boot-a74a2134b245d19a999c796d29285597a22954ed.tar.xz
Merge branch 'master' of git://git.denx.de/u-boot-usb
- DFU updates
Diffstat (limited to 'common')
-rw-r--r--common/dfu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/dfu.c b/common/dfu.c
index 44d1484d3d..da6289b218 100644
--- a/common/dfu.c
+++ b/common/dfu.c
@@ -35,6 +35,10 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget)
return CMD_RET_FAILURE;
}
+#ifdef CONFIG_DFU_TIMEOUT
+ unsigned long start_time = get_timer(0);
+#endif
+
while (1) {
if (g_dnl_detach()) {
/*
@@ -79,6 +83,19 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget)
}
}
+#ifdef CONFIG_DFU_TIMEOUT
+ unsigned long wait_time = dfu_get_timeout();
+
+ if (wait_time) {
+ unsigned long current_time = get_timer(start_time);
+
+ if (current_time > wait_time) {
+ debug("Inactivity timeout, abort DFU\n");
+ goto exit;
+ }
+ }
+#endif
+
WATCHDOG_RESET();
usb_gadget_handle_interrupts(usbctrl_index);
}