Re: dwc2 gadget issues

Francesco Lavra
2017-02-27T17:57:10Z

Hi,

On 02/23/2017 08:27 PM, Heiko Stuebner wrote:
> Hi Francesco,
>
> Am Donnerstag, 23. Februar 2017, 19:11:37 CET schrieb Francesco Lavra:
>> 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.
>
> you shouldn't use my tree as base for any real work :-) . Best to use the
> regular mainline kernel or alternatively try linux-next to get all recent usb
> changes schedules for the next release.

Thanks for your inputs.

I was actually using the mainline kernel (4.8.1), in which the dwc2
driver wasn't working, that's why I went to your tree to pick up any
fixes or new features that might have been done. I also went to the
linux-usb tree for the same reason.

Anyway, today I tried with the latest mainline release 4.10.0, and also
with linux-next. Unfortunately, still no luck: I can load a gadget
driver, which gets correctly bound to the OTG controller, but then
nothing happens if a USB host is connected to the OTG port.
I'm pasting below the dmesg contents (obtained with 4.10.0, with verbose
debugging enabled for the dwc2 driver) when a gadget driver is loaded,
in case you might spot something suspicious:

[ 1147.035367] dwc2 ff580000.usb: bound driver g_audio
[ 1147.041203] dwc2 ff580000.usb: dwc2_hsotg_pullup: is_on: 1 op_state: 3
[ 1147.041250] dwc2 ff580000.usb: dwc2_core_reset()
[ 1147.041345] dwc2 ff580000.usb: FIFOs reset, timeout at 100
[ 1147.041405] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
DOEPCTL0=0x00008000
[ 1147.041447] dwc2 ff580000.usb: gsintmsk now 0xd08c3cc4
[ 1147.041554] dwc2 ff580000.usb: DCTL=0x00000002
[ 1147.041631] dwc2 ff580000.usb: dwc2_hsotg_enqueue_setup: queueing
setup request
[ 1147.041692] dwc2 ff580000.usb: ep0: req ee241680: 8@ee241198, noi=0,
zero=0, snok=0
[ 1147.041757] dwc2 ff580000.usb: dwc2_hsotg_start_req:
DxEPCTL=0x80008000, ep 0, dir out
[ 1147.041799] dwc2 ff580000.usb: ureq->length:8 ureq->actual:0
[ 1147.041896] dwc2 ff580000.usb: dwc2_hsotg_start_req: 1@8/8,
0x00080008 => 0x00000b10
[ 1147.041975] dwc2 ff580000.usb: dwc2_hsotg_start_req: 2e243000 pad =>
0x00000b14
[ 1147.042014] dwc2 ff580000.usb: ep0 state:0
[ 1147.042055] dwc2 ff580000.usb: dwc2_hsotg_start_req: DxEPCTL=0x80008000
[ 1147.042097] dwc2 ff580000.usb: dwc2_hsotg_start_req: DXEPCTL=0x80008000
[ 1147.042169] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
DOEPCTL0=0x80008000

Thanks,
Francesco