Merge tag 'efi-2020-07-rc6' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / drivers / dfu / dfu.c
index 38aecd3a0586f42bb9c132398efecc8897d63255..a298c2c43999bd0970ba3e7ac55bbb554a97a890 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <fat.h>
@@ -21,6 +22,9 @@ static LIST_HEAD(dfu_list);
 static int dfu_alt_num;
 static int alt_num_cnt;
 static struct hash_algo *dfu_hash_algo;
+#ifdef CONFIG_DFU_TIMEOUT
+static unsigned long dfu_timeout = 0;
+#endif
 
 /*
  * The purpose of the dfu_flush_callback() function is to
@@ -58,6 +62,18 @@ __weak bool dfu_usb_get_reset(void)
 #endif
 }
 
+#ifdef CONFIG_DFU_TIMEOUT
+void dfu_set_timeout(unsigned long timeout)
+{
+       dfu_timeout = timeout;
+}
+
+unsigned long dfu_get_timeout(void)
+{
+       return dfu_timeout;
+}
+#endif
+
 static int dfu_find_alt_num(const char *s)
 {
        int i = 0;