]>
Commit | Line | Data |
---|---|---|
3aab70af SS |
1 | /* |
2 | * Copyright 2008 - 2009 Windriver, <www.windriver.com> | |
3 | * Author: Tom Rix <[email protected]> | |
4 | * | |
5 | * (C) Copyright 2014 Linaro, Ltd. | |
6 | * Rob Herring <[email protected]> | |
7 | * | |
8 | * SPDX-License-Identifier: GPL-2.0+ | |
9 | */ | |
10 | #include <common.h> | |
11 | #include <command.h> | |
12 | #include <g_dnl.h> | |
13 | ||
14 | static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) | |
15 | { | |
16 | int ret; | |
17 | ||
267abc62 | 18 | g_dnl_clear_detach(); |
3aab70af SS |
19 | ret = g_dnl_register("usb_dnl_fastboot"); |
20 | if (ret) | |
21 | return ret; | |
22 | ||
7c23bcb9 RH |
23 | if (!g_dnl_board_usb_cable_connected()) { |
24 | puts("\rUSB cable not detected.\n" \ | |
25 | "Command exit.\n"); | |
a32d2791 PK |
26 | g_dnl_unregister(); |
27 | g_dnl_clear_detach(); | |
7c23bcb9 RH |
28 | return CMD_RET_FAILURE; |
29 | } | |
30 | ||
3aab70af | 31 | while (1) { |
267abc62 RH |
32 | if (g_dnl_detach()) |
33 | break; | |
3aab70af SS |
34 | if (ctrlc()) |
35 | break; | |
2d48aa69 | 36 | usb_gadget_handle_interrupts(0); |
3aab70af SS |
37 | } |
38 | ||
39 | g_dnl_unregister(); | |
267abc62 | 40 | g_dnl_clear_detach(); |
3aab70af SS |
41 | return CMD_RET_SUCCESS; |
42 | } | |
43 | ||
44 | U_BOOT_CMD( | |
593cbd93 SR |
45 | fastboot, 1, 0, do_fastboot, |
46 | "use USB Fastboot protocol", | |
47 | "\n" | |
48 | " - run as a fastboot usb device" | |
3aab70af | 49 | ); |