1 // SPDX-License-Identifier: GPL-2.0+
3 * cmd_dfu.c -- dfu command
6 * Lukasz Majewski <l.majewski@majess.pl>
8 * Copyright (C) 2012 Samsung Electronics
9 * authors: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10 * Lukasz Majewski <l.majewski@samsung.com>
21 static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
27 #ifdef CONFIG_DFU_OVER_USB
28 char *usb_controller = argv[1];
30 char *interface = argv[2];
31 char *devstring = argv[3];
34 #ifdef CONFIG_DFU_OVER_TFTP
35 unsigned long addr = 0;
36 if (!strcmp(argv[1], "tftp")) {
38 addr = simple_strtoul(argv[4], NULL, 0);
40 return update_tftp(addr, interface, devstring);
43 #ifdef CONFIG_DFU_OVER_USB
44 ret = dfu_init_env_entities(interface, devstring);
48 ret = CMD_RET_SUCCESS;
49 if (argc > 4 && strcmp(argv[4], "list") == 0) {
54 int controller_index = simple_strtoul(usb_controller, NULL, 0);
56 run_usb_dnl_gadget(controller_index, "usb_dnl_dfu");
64 U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
65 "Device Firmware Upgrade",
66 #ifdef CONFIG_DFU_OVER_USB
67 "<USB_controller> <interface> <dev> [list]\n"
68 " - device firmware upgrade via <USB_controller>\n"
69 " on device <dev>, attached to interface\n"
71 " [list] - list available alt settings\n"
73 #ifdef CONFIG_DFU_OVER_TFTP
74 #ifdef CONFIG_DFU_OVER_USB
77 "tftp <interface> <dev> [<addr>]\n"
78 " - device firmware upgrade via TFTP\n"
79 " on device <dev>, attached to interface\n"
81 " [<addr>] - address where FIT image has been stored\n"