RK3288 USB OTG controller in peripheral mode

Francesco Lavra
2017-02-23T18:11:37Z

I'm having trouble getting the RK3288 OTG controller (the one at
ff580000) to work in peripheral mode. I'm using a Firefly Reload board,
and I know the hardware is fine because I can successfully use the port
in device mode with U-Boot's mass storage gadget driver.
Under Linux, the OTG port works fine when used in host mode, but fails
to work in device mode: nothing happens when the a USB host is plugged
into the OTG port, not even a single interrupt is generated by the
controller. I'm using the latest device tree definitions from
git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git.
Tried with different gadget drivers (g_audio, g_ether, g_mass_storage),
but it makes no difference.
Tried also forcing peripheral mode in the device tree, with dr_mode =
"peripheral", to no avail.

Are there any known problems with the RK3288 OTG controller?

Here is the relevant log when the dwc2 driver is loaded at boot:

[ 1.376935] ff580000.usb supply vusb_d not found, using dummy regulator
[ 1.383683] ff580000.usb supply vusb_a not found, using dummy regulator
[ 1.390627] dwc2 ff580000.usb: dwc2_core_reset() HANG! Soft Reset
GRSTCTL=80000001
[ 1.509048] dwc2 ff580000.usb: dwc2_wait_for_mode: Couldn't set
device mode
[ 1.750626] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g-tx-fifo-size, setting to default average
[ 1.761828] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[1]=104
[ 1.771192] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[2]=104
[ 1.780529] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[3]=104
[ 1.789888] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[4]=104
[ 1.799245] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[5]=104
[ 1.808614] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[6]=104
[ 1.817993] usb 1-1: new high-speed USB device number 2 using dwc2
[ 1.824390] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
in SPRAM
[ 1.832098] dwc2 ff580000.usb: DWC OTG Controller
[ 1.836924] dwc2 ff580000.usb: new USB bus registered, assigned bus
number 2
[ 1.844125] dwc2 ff580000.usb: irq 41, io mem 0xff580000
[ 1.849747] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.856598] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 1.863875] usb usb2: Product: DWC OTG Controller
[ 1.868601] usb usb2: Manufacturer: Linux 4.8.1+ dwc2_hsotg
[ 1.874215] usb usb2: SerialNumber: ff580000.usb

and this is what I get when I load a gadget driver (in this case, g_audio):

[ 19.848590] dwc2 ff580000.usb: bound driver g_audio
[ 19.853816] dwc2 ff580000.usb: dwc2_hsotg_enqueue_setup: failed queue
(-11)

Thank you,
Francesco Lavra