]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_dfu.c
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+
15 #include <asm/errno.h>
18 static int do_dfu(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
28 str_env
= getenv("dfu_alt_info");
29 if (str_env
== NULL
) {
30 printf("%s: \"dfu_alt_info\" env variable not defined!\n",
32 return CMD_RET_FAILURE
;
35 env_bkp
= strdup(str_env
);
36 ret
= dfu_config_entities(env_bkp
, argv
[1],
37 (int)simple_strtoul(argv
[2], NULL
, 10));
39 return CMD_RET_FAILURE
;
41 if (argc
> 3 && strcmp(argv
[3], "list") == 0) {
54 * This extra number of usb_gadget_handle_interrupts()
55 * calls is necessary to assure correct transmission
56 * completion with dfu-util
64 usb_gadget_handle_interrupts();
73 run_command("reset", 0);
75 return CMD_RET_SUCCESS
;
78 U_BOOT_CMD(dfu
, CONFIG_SYS_MAXARGS
, 1, do_dfu
,
79 "Device Firmware Upgrade",
80 "<interface> <dev> [list]\n"
81 " - device firmware upgrade on a device <dev>\n"
82 " attached to interface <interface>\n"
83 " [list] - list available alt settings"