1 // SPDX-License-Identifier: GPL-2.0+
3 * cmd_thordown.c -- USB TIZEN "THOR" Downloader gadget
5 * Copyright (C) 2013 Lukasz Majewski <l.majewski@samsung.com>
16 int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
21 char *usb_controller = argv[1];
22 char *interface = argv[2];
23 char *devstring = argv[3];
27 puts("TIZEN \"THOR\" Downloader\n");
29 ret = dfu_init_env_entities(interface, devstring);
33 int controller_index = simple_strtoul(usb_controller, NULL, 0);
34 ret = usb_gadget_initialize(controller_index);
36 pr_err("USB init failed: %d\n", ret);
37 ret = CMD_RET_FAILURE;
41 ret = g_dnl_register("usb_dnl_thor");
43 pr_err("g_dnl_register failed %d\n", ret);
44 ret = CMD_RET_FAILURE;
50 pr_err("THOR DOWNLOAD failed: %d\n", ret);
51 ret = CMD_RET_FAILURE;
57 if (ret == THOR_DFU_REINIT_NEEDED) {
59 ret = dfu_init_env_entities(interface, devstring);
62 pr_err("THOR failed: %d\n", ret);
63 ret = CMD_RET_FAILURE;
69 usb_gadget_release(controller_index);
76 U_BOOT_CMD(thordown, CONFIG_SYS_MAXARGS, 1, do_thor_down,
77 "TIZEN \"THOR\" downloader",
78 "<USB_controller> <interface> <dev>\n"
79 " - device software upgrade via LTHOR TIZEN download\n"
80 " program via <USB_controller> on device <dev>,\n"
81 " attached to interface <interface>\n"