2 * cmd_dfu.c -- dfu command
4 * Copyright (C) 2012 Samsung Electronics
5 * authors: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
6 * Lukasz Majewski <l.majewski@samsung.com>
8 * SPDX-License-Identifier: GPL-2.0+
16 static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
21 char *usb_controller = argv[1];
22 char *interface = argv[2];
23 char *devstring = argv[3];
28 ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
33 if (argc > 4 && strcmp(argv[4], "list") == 0) {
38 int controller_index = simple_strtoul(usb_controller, NULL, 0);
39 board_usb_init(controller_index, USB_INIT_DEVICE);
45 * This extra number of usb_gadget_handle_interrupts()
46 * calls is necessary to assure correct transmission
47 * completion with dfu-util
55 usb_gadget_handle_interrupts();
63 run_command("reset", 0);
65 return CMD_RET_SUCCESS;
68 U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
69 "Device Firmware Upgrade",
70 "<USB_controller> <interface> <dev> [list]\n"
71 " - device firmware upgrade via <USB_controller>\n"
72 " on device <dev>, attached to interface\n"
74 " [list] - list available alt settings\n"