]> Git Repo - J-u-boot.git/blame - common/cmd_dfu.c
nitrogen6x: add CONFIG_MV_UDC
[J-u-boot.git] / common / cmd_dfu.c
CommitLineData
a006a5de
ŁM
1/*
2 * cmd_dfu.c -- dfu command
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * authors: Andrzej Pietrasiewicz <[email protected]>
6 * Lukasz Majewski <[email protected]>
7 *
1a459660 8 * SPDX-License-Identifier: GPL-2.0+
a006a5de
ŁM
9 */
10
11#include <common.h>
a006a5de 12#include <dfu.h>
a006a5de
ŁM
13#include <g_dnl.h>
14
15static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
16{
b823fd9b 17 char *s = "dfu";
6bed7ce5 18 int ret, i = 0;
a006a5de
ŁM
19
20 if (argc < 3)
21 return CMD_RET_USAGE;
22
765c5ae5 23 ret = dfu_init_env_entities(argv[1], simple_strtoul(argv[2], NULL, 10));
a006a5de 24 if (ret)
765c5ae5 25 return ret;
a006a5de 26
df93cd9c 27 if (argc > 3 && strcmp(argv[3], "list") == 0) {
a006a5de
ŁM
28 dfu_show_entities();
29 goto done;
30 }
31
ea3e2122 32#ifdef CONFIG_TRATS
a006a5de 33 board_usb_init();
ea3e2122
PA
34#endif
35
a006a5de
ŁM
36 g_dnl_register(s);
37 while (1) {
6bed7ce5
ŁM
38 if (dfu_reset())
39 /*
40 * This extra number of usb_gadget_handle_interrupts()
41 * calls is necessary to assure correct transmission
42 * completion with dfu-util
43 */
44 if (++i == 10)
45 goto exit;
46
a006a5de
ŁM
47 if (ctrlc())
48 goto exit;
49
50 usb_gadget_handle_interrupts();
51 }
52exit:
53 g_dnl_unregister();
54done:
55 dfu_free_entities();
a006a5de 56
6bed7ce5
ŁM
57 if (dfu_reset())
58 run_command("reset", 0);
59
a006a5de
ŁM
60 return CMD_RET_SUCCESS;
61}
62
63U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
64 "Device Firmware Upgrade",
65 "<interface> <dev> [list]\n"
66 " - device firmware upgrade on a device <dev>\n"
67 " attached to interface <interface>\n"
68 " [list] - list available alt settings"
69);
This page took 0.097049 seconds and 4 git commands to generate.