]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - cmd/rockusb.c
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Eddie Cai <eddie.cai.linux@gmail.com>
11 #include <asm/arch-rockchip/f_rockusb.h>
13 static int do_rockusb(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
16 int controller_index
, dev_index
;
26 usb_controller
= argv
[1];
27 controller_index
= simple_strtoul(usb_controller
, NULL
, 0);
35 dev_index
= simple_strtoul(devnum
, NULL
, 0);
36 rockusb_dev_init(devtype
, dev_index
);
38 ret
= udc_device_get_by_index(controller_index
, &udc
);
40 printf("USB init failed: %d\n", ret
);
41 return CMD_RET_FAILURE
;
45 ret
= g_dnl_register("usb_dnl_rockusb");
47 return CMD_RET_FAILURE
;
49 if (!g_dnl_board_usb_cable_connected()) {
50 puts("\rUSB cable not detected, Command exit.\n");
51 ret
= CMD_RET_FAILURE
;
60 dm_usb_gadget_handle_interrupts(udc
);
62 ret
= CMD_RET_SUCCESS
;
72 U_BOOT_CMD(rockusb
, 4, 1, do_rockusb
,
73 "use the rockusb protocol",
74 "<USB_controller> <devtype> <dev[:part]> e.g. rockusb 0 mmc 0\n"