USB

USB Host Hardware (sun4i, sun7i)
USB Host 1 --> USB PORT ---                                  VBUS_POWER1--^ CLK2 ---> | EHCI | OHCI | < CLK1 ---                |     PHY1    | <| ---                     |                        ^-RESET1                  | |CLK5 USB Host 2---+-> USB PORT ---                     |            VBUS_POWER2--^ CLK4 ---> | EHCI | OHCI | <--- CLK3           | ---                     |                 |     PHY2    | <| -                       ^-RESET2

USB Host Status in Mainline Kernel / U-Boot
Currently only EHCI support is added. It is trivial to add OHCI support. It will be added once all the EHCI bugs are squashed. If you want OHCI support now, please submit patches.

Patches

 * Up to date patches against sunxi-next with some other cherry-picked commits from all over the world can be found here https://github.com/arokux/linux/tree/sunxi-next-usb

Supported SoCs

 * A10
 * A20
 * A13
 * (A31 very preliminary work has been posted to the ML by bamvor)

USB devices known to work

 * USB Keyboard
 * USB 2 Ethernet adapter
 * USB Stick/HDD (This allows you to have your rootfs on a USB stick/HDD. Add root=/dev/sda1 rootwait to your cmdline.)
 * On-board WiFi module (idVendor=0bda, idProduct=8176) is identified and causes "detected XactErr len 0/0 retry" but still works, see dmesg.

USB to Ethernet Adapters known to work with U-Boot

 * Level One USB-0301

Known issues

 * U-Boot output weired error messages if a USB sound card or USB midi device is plugged in on boot, both are full speed devices
 * On Hackberry A10 current stage/sunxi-3.4 (a7350cb6a9ec) has a regression which lefts USB ports without power supply. The issue can be workaround by using a powered USB hub.

Reporting USB problem
If reporting USB Host related problems please turn on the following options in the menuconfig
 * Device Drivers > USB support > USB verbose debug messages
 * Device Drivers > USB support > USB announce new devices
 * Change 0 to 1 at the line #37 of the drivers/usb/host/sw_hci_sunxi.h

Afterwards rebuild and boot a new kernel and submit the following information
 * The exact tag or hash of the Linux kernel you are using
 * Your .config
 * Output of dmesg
 * Output of cat /proc/ccmu
 * Output of the following
 * devmem2 0x01c14800
 * devmem2 0x01c1c800
 * devmem2 0x01c200cc
 * devmem2 0x01c20060

Tip: You can use sprunge.us paste service easily from the command line, for example cat .config | curl -F 'sprunge=<-' http://sprunge.us