2 * Copyright 2008 - 2009 Windriver, <www.windriver.com>
3 * Author: Tom Rix <Tom.Rix@windriver.com>
5 * (C) Copyright 2014 Linaro, Ltd.
6 * Rob Herring <robh@kernel.org>
8 * SPDX-License-Identifier: GPL-2.0+
16 static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
25 usb_controller = argv[1];
26 controller_index = simple_strtoul(usb_controller, NULL, 0);
28 ret = board_usb_init(controller_index, USB_INIT_DEVICE);
30 error("USB init failed: %d", ret);
31 return CMD_RET_FAILURE;
35 ret = g_dnl_register("usb_dnl_fastboot");
39 if (!g_dnl_board_usb_cable_connected()) {
40 puts("\rUSB cable not detected.\n" \
42 ret = CMD_RET_FAILURE;
51 usb_gadget_handle_interrupts(controller_index);
54 ret = CMD_RET_SUCCESS;
59 board_usb_cleanup(controller_index, USB_INIT_DEVICE);
65 fastboot, 2, 1, do_fastboot,
66 "use USB Fastboot protocol",
68 " - run as a fastboot usb device"