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+
15 static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
24 usb_controller = argv[1];
25 controller_index = simple_strtoul(usb_controller, NULL, 0);
27 ret = board_usb_init(controller_index, USB_INIT_DEVICE);
29 error("USB init failed: %d", ret);
30 return CMD_RET_FAILURE;
34 ret = g_dnl_register("usb_dnl_fastboot");
38 if (!g_dnl_board_usb_cable_connected()) {
39 puts("\rUSB cable not detected.\n" \
41 ret = CMD_RET_FAILURE;
50 usb_gadget_handle_interrupts(controller_index);
53 ret = CMD_RET_SUCCESS;
58 board_usb_cleanup(controller_index, USB_INIT_DEVICE);
64 fastboot, 2, 1, do_fastboot,
65 "use USB Fastboot protocol",
67 " - run as a fastboot usb device"