]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
thor: add support for the dfu_alt_info reintialization from the flashed script
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 22 Dec 2020 10:32:24 +0000 (11:32 +0100)
committerMarek Vasut <marex@denx.de>
Sun, 31 Jan 2021 13:08:56 +0000 (14:08 +0100)
Reinitialize dfu_env_entities after flashing the 'SCRIPT' entity to
ensure that the potential changes to the 'dfu_alt_info' environment
variable are applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
cmd/thordown.c
drivers/usb/gadget/f_thor.c
include/thor.h

index ae20dddfddba1acffe28f3f84a40eb5d4b8b4511..838764ccef79b98ae9f9b029b90090c1cbe53695 100644 (file)
@@ -52,13 +52,18 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                goto exit;
        }
 
-       ret = thor_handle();
-       if (ret) {
-               pr_err("THOR failed: %d\n", ret);
-               ret = CMD_RET_FAILURE;
-               goto exit;
-       }
-
+       do {
+               ret = thor_handle();
+               if (ret == THOR_DFU_REINIT_NEEDED) {
+                       dfu_free_entities();
+                       ret = dfu_init_env_entities(interface, devstring);
+               }
+               if (ret) {
+                       pr_err("THOR failed: %d\n", ret);
+                       ret = CMD_RET_FAILURE;
+                       goto exit;
+               }
+       } while (ret == 0);
 exit:
        g_dnl_unregister();
        usb_gadget_release(controller_index);
index 559ffb759ed7c4b6b25d325a91f0328332464c6a..47ef55b2fd31347c3958cfc985bf72b17acd1917 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/usb/cdc.h>
 #include <g_dnl.h>
 #include <dfu.h>
+#include <thor.h>
 
 #include "f_thor.h"
 
@@ -735,6 +736,8 @@ int thor_handle(void)
                        printf("%s: No data received!\n", __func__);
                        break;
                }
+               if (dfu_reinit_needed)
+                       return THOR_DFU_REINIT_NEEDED;
        }
 
        return 0;
index 62501bda17c5ce4aa7e388a57c7210e04256a1c9..ee67ab0a2704ed6080d10f4348c44401633716d7 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <linux/usb/composite.h>
 
+#define THOR_DFU_REINIT_NEEDED 0xFFFFFFFE
+
 int thor_handle(void);
 int thor_init(void);
 int thor_add(struct usb_configuration *c);