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 #if defined(CONFIG_DFU_OVER_USB) || defined(CONFIG_DFU_OVER_TFTP)
31 char *interface = argv[2];
32 char *devstring = argv[3];
36 #ifdef CONFIG_DFU_OVER_TFTP
37 unsigned long addr = 0;
38 if (!strcmp(argv[1], "tftp")) {
40 addr = simple_strtoul(argv[4], NULL, 0);
42 return update_tftp(addr, interface, devstring);
45 #ifdef CONFIG_DFU_OVER_USB
46 ret = dfu_init_env_entities(interface, devstring);
50 ret = CMD_RET_SUCCESS;
51 if (argc > 4 && strcmp(argv[4], "list") == 0) {
56 int controller_index = simple_strtoul(usb_controller, NULL, 0);
58 run_usb_dnl_gadget(controller_index, "usb_dnl_dfu");
66 U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
67 "Device Firmware Upgrade",
69 #ifdef CONFIG_DFU_OVER_USB
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"
76 #ifdef CONFIG_DFU_OVER_TFTP
77 #ifdef CONFIG_DFU_OVER_USB
80 "tftp <interface> <dev> [<addr>]\n"
81 " - device firmware upgrade via TFTP\n"
82 " on device <dev>, attached to interface\n"
84 " [<addr>] - address where FIT image has been stored\n"