diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
commit | ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff (patch) | |
tree | ae567980737beb24ca24e2ee8cfeaf6eb9e26e3f /cmd/thordown.c | |
parent | 4459ed60cb1e0562bc5b40405e2b4b9bbf766d57 (diff) | |
parent | e29b932aa07fa0226d325b35d96cd4eea0370129 (diff) | |
download | u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.zip u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.tar.gz u-boot-ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff.tar.bz2 |
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd/thordown.c')
-rw-r--r-- | cmd/thordown.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cmd/thordown.c b/cmd/thordown.c index 838764c..48e22b3 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -12,26 +12,29 @@ #include <dfu.h> #include <g_dnl.h> #include <usb.h> +#include <linux/printk.h> int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + char *interface, *devstring; + int controller_index; + struct udevice *udc; + int ret; + if (argc < 4) return CMD_RET_USAGE; - char *usb_controller = argv[1]; - char *interface = argv[2]; - char *devstring = argv[3]; - - int ret; - puts("TIZEN \"THOR\" Downloader\n"); + interface = argv[2]; + devstring = argv[3]; + ret = dfu_init_env_entities(interface, devstring); if (ret) goto done; - int controller_index = simple_strtoul(usb_controller, NULL, 0); - ret = usb_gadget_initialize(controller_index); + controller_index = simple_strtoul(argv[1], NULL, 0); + ret = udc_device_get_by_index(controller_index, &udc); if (ret) { pr_err("USB init failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -45,7 +48,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit; } - ret = thor_init(); + ret = thor_init(udc); if (ret) { pr_err("THOR DOWNLOAD failed: %d\n", ret); ret = CMD_RET_FAILURE; @@ -53,7 +56,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } do { - ret = thor_handle(); + ret = thor_handle(udc); if (ret == THOR_DFU_REINIT_NEEDED) { dfu_free_entities(); ret = dfu_init_env_entities(interface, devstring); @@ -66,7 +69,7 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } while (ret == 0); exit: g_dnl_unregister(); - usb_gadget_release(controller_index); + udc_device_put(udc); done: dfu_free_entities(); |