U-Boot/USB Mass Storage

From linux-sunxi.org
Jump to navigation Jump to search

USB Mass Storage (UMS) Gadget

For few years now, starting from v2014.07, U-Boot has contained UMS gadget that allows for easier access to onboard eMMC/SD storage by emulating a simple block device over OTG to the host. Similar to the Linux kernel Mass Storage Gadget.

U-Boot UMS Gadget also provides a simpler alternative to Fastboot based device setup and recovery.

Prerequisites

  • USB_MUSB_GADGET=y
  • CONFIG_CMD_USB_MASS_STORAGE=y
  • Sunxi device connected to a host over USB OTG port.

On my NanoPi NEO Core I also had to enable

  • USB_MUSB_PIO_ONLY=y
  • USB_ETHER=y

Using it

In U-Boot prompt you can use the ums command.

=> ums
ums - Use the UMS [USB Mass Storage]

Usage:
ums <USB_controller> [<devtype>] <dev[:part]>  e.g. ums 0 mmc 0
    devtype defaults to mmc


To export internal eMMC storage, just type

=> ums 0 mmc 1

Press Ctrl+C to stop UMS gadget.

Benchmarks

On my NanoPi NEO Core internal eMMC I got around 13MB/s read and 9MB/s write.

U-boot ums gadget benchmark.png

See also