]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_usb_mass_storage.c
2 * Copyright (C) 2011 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <usb_mass_storage.h>
14 int do_usb_mass_storage(cmd_tbl_t
*cmdtp
, int flag
,
15 int argc
, char * const argv
[])
20 const char *usb_controller
= argv
[1];
21 const char *mmc_devstring
= argv
[2];
23 unsigned int dev_num
= (unsigned int)(simple_strtoul(mmc_devstring
,
26 error("Set eMMC device to 0! - e.g. ums 0");
30 unsigned int controller_index
= (unsigned int)(simple_strtoul(
31 usb_controller
, NULL
, 0));
32 if (board_usb_init(controller_index
, USB_INIT_DEVICE
)) {
33 error("Couldn't init USB controller.");
37 struct ums_board_info
*ums_info
= board_ums_init(dev_num
, 0, 0);
39 error("MMC: %d -> NOT available", dev_num
);
43 int rc
= fsg_init(ums_info
);
45 error("fsg_init failed");
49 g_dnl_register("ums");
52 /* Handle control-c and timeouts */
54 error("The remote end did not respond in time.");
58 usb_gadget_handle_interrupts();
59 /* Check if USB cable has been detached */
60 if (fsg_main_thread(NULL
) == EIO
)
71 U_BOOT_CMD(ums
, CONFIG_SYS_MAXARGS
, 1, do_usb_mass_storage
,
72 "Use the UMS [User Mass Storage]",
73 "<USB_controller> <mmc_dev>"