| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2017 Eddie Cai <eddie.cai.linux@gmail.com> |
| #include <asm/arch-rockchip/f_rockusb.h> |
| static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc, |
| int controller_index, dev_index; |
| usb_controller = argv[1]; |
| controller_index = simple_strtoul(usb_controller, NULL, 0); |
| dev_index = simple_strtoul(devnum, NULL, 0); |
| rockusb_dev_init(devtype, dev_index); |
| ret = usb_gadget_initialize(controller_index); |
| printf("USB init failed: %d\n", ret); |
| ret = g_dnl_register("usb_dnl_rockusb"); |
| if (!g_dnl_board_usb_cable_connected()) { |
| puts("\rUSB cable not detected, Command exit.\n"); |
| usb_gadget_handle_interrupts(controller_index); |
| usb_gadget_release(controller_index); |
| U_BOOT_CMD(rockusb, 4, 1, do_rockusb, |
| "use the rockusb protocol", |
| "<USB_controller> <devtype> <dev[:part]> e.g. rockusb 0 mmc 0\n" |