All of lore.kernel.org
 help / color / mirror / Atom feed
* RK3288 USB OTG controller in peripheral mode
@ 2017-02-23 18:11 ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-23 18:11 UTC (permalink / raw)
  To: linux-rockchip, linux-arm-kernel; +Cc: Heiko Stuebner

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RK3288 USB OTG controller in peripheral mode
@ 2017-02-23 18:11 ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-23 18:11 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues (was: RK3288 USB OTG controller in peripheral mode)
       [not found] ` <2b818d21-62a6-515e-8116-f243a2c07e08-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-23 19:27   ` Heiko Stuebner
  2017-02-27 17:57       ` Francesco Lavra
  2017-03-02  5:58       ` Randy Li
  0 siblings, 2 replies; 16+ messages in thread
From: Heiko Stuebner @ 2017-02-23 19:27 UTC (permalink / raw)
  To: Francesco Lavra
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	johnyoun-HKixBCOQz3hWk0Htik3J/w

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.


> 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?

In general the controller is a dwc2 and there was quite some activity on the 
driver recently. So maybe really try linux-next first and see if any of the 
changes included there improve the situation.

I've included some usb lists + people, maybe they know if anything recent may 
have changed things.


> 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)


Heiko
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-23 19:27   ` dwc2 gadget issues (was: RK3288 USB OTG controller in peripheral mode) Heiko Stuebner
@ 2017-02-27 17:57       ` Francesco Lavra
  2017-03-02  5:58       ` Randy Li
  1 sibling, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-27 17:57 UTC (permalink / raw)
  To: Heiko Stuebner; +Cc: johnyoun, linux-rockchip, linux-usb, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-02-27 17:57       ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-27 17:57 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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 at 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-27 17:57       ` Francesco Lavra
@ 2017-02-28  8:41         ` Vardan Mikayelyan
  -1 siblings, 0 replies; 16+ messages in thread
From: Vardan Mikayelyan @ 2017-02-28  8:41 UTC (permalink / raw)
  To: Francesco Lavra, Heiko Stuebner
  Cc: linux-rockchip, linux-usb, linux-arm-kernel, John.Youn

On 2/27/2017 11:55 PM, Francesco Lavra wrote:
> 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
> --

Hi Francesco,

Could you please provide full log (with debugs enabled) from DWC2 driver 
loading to issue point? Two logs are not giving us the full picture.

Thanks,
Vardan.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-02-28  8:41         ` Vardan Mikayelyan
  0 siblings, 0 replies; 16+ messages in thread
From: Vardan Mikayelyan @ 2017-02-28  8:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/27/2017 11:55 PM, Francesco Lavra wrote:
> 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 at 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 at 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
> --

Hi Francesco,

Could you please provide full log (with debugs enabled) from DWC2 driver 
loading to issue point? Two logs are not giving us the full picture.

Thanks,
Vardan.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-28  8:41         ` Vardan Mikayelyan
@ 2017-02-28 11:43           ` Francesco Lavra
  -1 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-28 11:43 UTC (permalink / raw)
  To: Vardan Mikayelyan, Heiko Stuebner
  Cc: linux-rockchip, linux-usb, linux-arm-kernel, John.Youn

Hi Vardan,

On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>> 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
>> --
>
> Hi Francesco,
>
> Could you please provide full log (with debugs enabled) from DWC2 driver
> loading to issue point? Two logs are not giving us the full picture.

The full log from the DWC2 driver is below:

[    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found, 
using dummy regulator
[    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found, 
using dummy regulator
[    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes: 
Invalid parameter g-tx-fifo-size, setting to default average
[    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries 
in SPRAM
[    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002, 
DIEPMSK=00000000
[    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
[    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
[    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
[    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
[    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
[    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
[    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
[    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
[    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
[    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
[    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
[    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800, 
SIZ=0x00000000, DMA=0x379a4f2d
[    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000, 
SIZ=0x00000000, DMA=0xe3103c4f
[    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000, 
SIZ=0x00000000, DMA=0x5cf9a35d
[    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x9f637bc4
[    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000, 
SIZ=0x00000000, DMA=0xf03470c5
[    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xb6c8c271
[    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000, 
SIZ=0x00000000, DMA=0x84245611
[    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x0a6c1c90
[    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000, 
SIZ=0x00000000, DMA=0xaccb75ec
[    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800, 
SIZ=0x00000000, DMA=0x4625773c
[    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x437c9154
[    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000, 
SIZ=0x00000000, DMA=0x9cb1c89c
[    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x6ec79617
[    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
[    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
[    2.176105] dwc2 ff580000.usb: DWC OTG Controller
[    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus 
number 2
[    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
[    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2, 
SerialNumber=1
[    2.176470] usb usb2: Product: DWC OTG Controller
[    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
[    2.176485] usb usb2: SerialNumber: ff580000.usb
[ 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

> Thanks,
> Vardan.
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-02-28 11:43           ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-02-28 11:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Vardan,

On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>> 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 at 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 at 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
>> --
>
> Hi Francesco,
>
> Could you please provide full log (with debugs enabled) from DWC2 driver
> loading to issue point? Two logs are not giving us the full picture.

The full log from the DWC2 driver is below:

[    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found, 
using dummy regulator
[    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found, 
using dummy regulator
[    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes: 
Invalid parameter g-tx-fifo-size, setting to default average
[    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries 
in SPRAM
[    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002, 
DIEPMSK=00000000
[    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
[    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
[    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
[    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
[    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
[    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
[    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
[    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
[    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
[    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
[    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
[    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800, 
SIZ=0x00000000, DMA=0x379a4f2d
[    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000, 
SIZ=0x00000000, DMA=0xe3103c4f
[    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000, 
SIZ=0x00000000, DMA=0x5cf9a35d
[    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x9f637bc4
[    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000, 
SIZ=0x00000000, DMA=0xf03470c5
[    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xb6c8c271
[    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000, 
SIZ=0x00000000, DMA=0x84245611
[    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0xfef360cf
[    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x0a6c1c90
[    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000, 
SIZ=0x00000000, DMA=0xaccb75ec
[    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x8b00a168
[    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800, 
SIZ=0x00000000, DMA=0x4625773c
[    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x437c9154
[    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000, 
SIZ=0x00000000, DMA=0x9cb1c89c
[    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000, 
SIZ=0x00000000, DMA=0x6ec79617
[    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
[    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
[    2.176105] dwc2 ff580000.usb: DWC OTG Controller
[    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus 
number 2
[    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
[    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2, 
SerialNumber=1
[    2.176470] usb usb2: Product: DWC OTG Controller
[    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
[    2.176485] usb usb2: SerialNumber: ff580000.usb
[ 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 at 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 at 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

> Thanks,
> Vardan.
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-28 11:43           ` Francesco Lavra
@ 2017-02-28 13:44             ` Vardan Mikayelyan
  -1 siblings, 0 replies; 16+ messages in thread
From: Vardan Mikayelyan @ 2017-02-28 13:44 UTC (permalink / raw)
  To: Francesco Lavra, Vardan Mikayelyan, Heiko Stuebner
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	John.Youn-HKixBCOQz3hWk0Htik3J/w

On 2/28/2017 3:44 PM, Francesco Lavra wrote:
> Hi Vardan,
>
> On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
>> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>>> 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
>>> --
>>
>> Hi Francesco,
>>
>> Could you please provide full log (with debugs enabled) from DWC2 driver
>> loading to issue point? Two logs are not giving us the full picture.
>
> The full log from the DWC2 driver is below:
>
> [    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found,
> using dummy regulator
> [    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found,
> using dummy regulator
> [    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
> Invalid parameter g-tx-fifo-size, setting to default average
> [    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
> in SPRAM
> [    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002,
> DIEPMSK=00000000
> [    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
> [    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
> [    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
> [    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
> [    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
> [    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
> [    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
> [    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
> [    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
> [    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
> [    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
> [    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800,
> SIZ=0x00000000, DMA=0x379a4f2d
> [    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000,
> SIZ=0x00000000, DMA=0xe3103c4f
> [    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000,
> SIZ=0x00000000, DMA=0x5cf9a35d
> [    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x9f637bc4
> [    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000,
> SIZ=0x00000000, DMA=0xf03470c5
> [    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xb6c8c271
> [    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000,
> SIZ=0x00000000, DMA=0x84245611
> [    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x0a6c1c90
> [    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000,
> SIZ=0x00000000, DMA=0xaccb75ec
> [    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800,
> SIZ=0x00000000, DMA=0x4625773c
> [    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x437c9154
> [    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000,
> SIZ=0x00000000, DMA=0x9cb1c89c
> [    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x6ec79617
> [    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
> [    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
> [    2.176105] dwc2 ff580000.usb: DWC OTG Controller
> [    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus
> number 2
> [    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
> [    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
> [    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2,
> SerialNumber=1
> [    2.176470] usb usb2: Product: DWC OTG Controller
> [    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
> [    2.176485] usb usb2: SerialNumber: ff580000.usb
> [ 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
>
>> Thanks,
>> Vardan.
>>
>

Seems here we have fifo configuration issue. We will follow up it and 
provide feedback soon.

If it is possible, can you please provide to us register dump after 
driver loading.

Thanks,
Vardan.

Thanks,
Vardan.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-02-28 13:44             ` Vardan Mikayelyan
  0 siblings, 0 replies; 16+ messages in thread
From: Vardan Mikayelyan @ 2017-02-28 13:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/28/2017 3:44 PM, Francesco Lavra wrote:
> Hi Vardan,
>
> On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
>> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>>> 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 at 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 at 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
>>> --
>>
>> Hi Francesco,
>>
>> Could you please provide full log (with debugs enabled) from DWC2 driver
>> loading to issue point? Two logs are not giving us the full picture.
>
> The full log from the DWC2 driver is below:
>
> [    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found,
> using dummy regulator
> [    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found,
> using dummy regulator
> [    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
> Invalid parameter g-tx-fifo-size, setting to default average
> [    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
> in SPRAM
> [    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002,
> DIEPMSK=00000000
> [    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
> [    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
> [    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
> [    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
> [    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
> [    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
> [    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
> [    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
> [    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
> [    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
> [    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
> [    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800,
> SIZ=0x00000000, DMA=0x379a4f2d
> [    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000,
> SIZ=0x00000000, DMA=0xe3103c4f
> [    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000,
> SIZ=0x00000000, DMA=0x5cf9a35d
> [    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x9f637bc4
> [    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000,
> SIZ=0x00000000, DMA=0xf03470c5
> [    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xb6c8c271
> [    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000,
> SIZ=0x00000000, DMA=0x84245611
> [    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0xfef360cf
> [    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x0a6c1c90
> [    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000,
> SIZ=0x00000000, DMA=0xaccb75ec
> [    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x8b00a168
> [    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800,
> SIZ=0x00000000, DMA=0x4625773c
> [    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x437c9154
> [    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000,
> SIZ=0x00000000, DMA=0x9cb1c89c
> [    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000,
> SIZ=0x00000000, DMA=0x6ec79617
> [    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
> [    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
> [    2.176105] dwc2 ff580000.usb: DWC OTG Controller
> [    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus
> number 2
> [    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
> [    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
> [    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2,
> SerialNumber=1
> [    2.176470] usb usb2: Product: DWC OTG Controller
> [    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
> [    2.176485] usb usb2: SerialNumber: ff580000.usb
> [ 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 at 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 at 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
>
>> Thanks,
>> Vardan.
>>
>

Seems here we have fifo configuration issue. We will follow up it and 
provide feedback soon.

If it is possible, can you please provide to us register dump after 
driver loading.

Thanks,
Vardan.

Thanks,
Vardan.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-28 13:44             ` Vardan Mikayelyan
@ 2017-03-01  7:37               ` Francesco Lavra
  -1 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-03-01  7:37 UTC (permalink / raw)
  To: Vardan Mikayelyan, Heiko Stuebner
  Cc: linux-rockchip, linux-usb, linux-arm-kernel, John.Youn

On 02/28/2017 02:44 PM, Vardan Mikayelyan wrote:
> On 2/28/2017 3:44 PM, Francesco Lavra wrote:
>> Hi Vardan,
>>
>> On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
>>> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>>>> 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
>>>> --
>>>
>>> Hi Francesco,
>>>
>>> Could you please provide full log (with debugs enabled) from DWC2 driver
>>> loading to issue point? Two logs are not giving us the full picture.
>>
>> The full log from the DWC2 driver is below:
>>
>> [    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found,
>> using dummy regulator
>> [    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found,
>> using dummy regulator
>> [    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
>> Invalid parameter g-tx-fifo-size, setting to default average
>> [    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
>> in SPRAM
>> [    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002,
>> DIEPMSK=00000000
>> [    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
>> [    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
>> [    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
>> [    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
>> [    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
>> [    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
>> [    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
>> [    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
>> [    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
>> [    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
>> [    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
>> [    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800,
>> SIZ=0x00000000, DMA=0x379a4f2d
>> [    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000,
>> SIZ=0x00000000, DMA=0xe3103c4f
>> [    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000,
>> SIZ=0x00000000, DMA=0x5cf9a35d
>> [    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x9f637bc4
>> [    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000,
>> SIZ=0x00000000, DMA=0xf03470c5
>> [    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xb6c8c271
>> [    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000,
>> SIZ=0x00000000, DMA=0x84245611
>> [    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x0a6c1c90
>> [    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000,
>> SIZ=0x00000000, DMA=0xaccb75ec
>> [    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800,
>> SIZ=0x00000000, DMA=0x4625773c
>> [    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x437c9154
>> [    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000,
>> SIZ=0x00000000, DMA=0x9cb1c89c
>> [    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x6ec79617
>> [    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
>> [    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
>> [    2.176105] dwc2 ff580000.usb: DWC OTG Controller
>> [    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus
>> number 2
>> [    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
>> [    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
>> [    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=1
>> [    2.176470] usb usb2: Product: DWC OTG Controller
>> [    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
>> [    2.176485] usb usb2: SerialNumber: ff580000.usb
>> [ 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
>>
>>> Thanks,
>>> Vardan.
>>>
>>
>
> Seems here we have fifo configuration issue. We will follow up it and
> provide feedback soon.
>
> If it is possible, can you please provide to us register dump after
> driver loading.

Sure, here is the dump before loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x0000002f
GUSBCFG = 0x00001408
GRSTCTL = 0x80000000
GINTSTS = 0x04000030
GINTMSK = 0xd0000806
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000400
GNPTXFSIZ = 0x00100400
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x03cc0400
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x01000410
DPTXFSIZN(2) = 0x01000900
DPTXFSIZN(3) = 0x01000a00
DPTXFSIZN(4) = 0x01000b00
DPTXFSIZN(5) = 0x01000c00
DPTXFSIZN(6) = 0x01000d00
DPTXFSIZN(7) = 0x00000e00
DPTXFSIZN(8) = 0x00000f00
DPTXFSIZN(9) = 0x01000410
DPTXFSIZN(10) = 0x01000900
DPTXFSIZN(11) = 0x01000a00
DPTXFSIZN(12) = 0x01000b00
DPTXFSIZN(13) = 0x01000c00
DPTXFSIZN(14) = 0x01000d00
DPTXFSIZN(15) = 0x00000e00
DCFG = 0x08100000
DCTL = 0x00000002
DSTS = 0x0007ff02
DIEPMSK = 0x00000000
DOEPMSK = 0x00000000
DAINT = 0x00000000
DAINTMSK = 0x00000000
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008800
DIEPCTL(1) = 0x00001000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00002000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00003000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00004000
DIEPCTL(8) = 0x00004800
DIEPCTL(9) = 0x00005000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
DOEPCTL(0) = 0x00008000
DOEPCTL(1) = 0x00000000
DOEPCTL(2) = 0x00000000
DOEPCTL(3) = 0x00000000
DOEPCTL(4) = 0x00000000
DOEPCTL(5) = 0x00000000
DOEPCTL(6) = 0x00000000
DOEPCTL(7) = 0x00000000
DOEPCTL(8) = 0x00000000
DOEPCTL(9) = 0x00000000
DOEPCTL(10) = 0x00000000
DOEPCTL(11) = 0x00000000
DOEPCTL(12) = 0x00000000
DOEPCTL(13) = 0x00000000
DOEPCTL(14) = 0x00000000
DOEPCTL(15) = 0x00000000
DIEPINT(0) = 0x00000080
DIEPINT(1) = 0x00000080
DIEPINT(2) = 0x00000080
DIEPINT(3) = 0x00000080
DIEPINT(4) = 0x00000080
DIEPINT(5) = 0x00000080
DIEPINT(6) = 0x00000080
DIEPINT(7) = 0x00000080
DIEPINT(8) = 0x00000080
DIEPINT(9) = 0x00000080
DIEPINT(10) = 0x00000080
DIEPINT(11) = 0x00000080
DIEPINT(12) = 0x00000080
DIEPINT(13) = 0x00000080
DIEPINT(14) = 0x00000080
DIEPINT(15) = 0x00000080
DOEPINT(0) = 0x00000000
DOEPINT(1) = 0x00000000
DOEPINT(2) = 0x00000000
DOEPINT(3) = 0x00000000
DOEPINT(4) = 0x00000000
DOEPINT(5) = 0x00000000
DOEPINT(6) = 0x00000000
DOEPINT(7) = 0x00000000
DOEPINT(8) = 0x00000000
DOEPINT(9) = 0x00000000
DOEPINT(10) = 0x00000000
DOEPINT(11) = 0x00000000
DOEPINT(12) = 0x00000000
DOEPINT(13) = 0x00000000
DOEPINT(14) = 0x00000000
DOEPINT(15) = 0x00000000
DIEPTSIZ(0) = 0x00000000
DIEPTSIZ(1) = 0x00000000
DIEPTSIZ(2) = 0x00000000
DIEPTSIZ(3) = 0x00000000
DIEPTSIZ(4) = 0x00000000
DIEPTSIZ(5) = 0x00000000
DIEPTSIZ(6) = 0x00000000
DIEPTSIZ(7) = 0x00000000
DIEPTSIZ(8) = 0x00000000
DIEPTSIZ(9) = 0x00000000
DIEPTSIZ(10) = 0x00000000
DIEPTSIZ(11) = 0x00000000
DIEPTSIZ(12) = 0x00000000
DIEPTSIZ(13) = 0x00000000
DIEPTSIZ(14) = 0x00000000
DIEPTSIZ(15) = 0x00000000
DOEPTSIZ(0) = 0x00000000
DOEPTSIZ(1) = 0x00000000
DOEPTSIZ(2) = 0x00000000
DOEPTSIZ(3) = 0x00000000
DOEPTSIZ(4) = 0x00000000
DOEPTSIZ(5) = 0x00000000
DOEPTSIZ(6) = 0x00000000
DOEPTSIZ(7) = 0x00000000
DOEPTSIZ(8) = 0x00000000
DOEPTSIZ(9) = 0x00000000
DOEPTSIZ(10) = 0x00000000
DOEPTSIZ(11) = 0x00000000
DOEPTSIZ(12) = 0x00000000
DOEPTSIZ(13) = 0x00000000
DOEPTSIZ(14) = 0x00000000
DOEPTSIZ(15) = 0x00000000
DIEPDMA(0) = 0x379a4f6d
DIEPDMA(1) = 0x5cc9a35d
DIEPDMA(2) = 0xfef360cb
DIEPDMA(3) = 0xf83470c5
DIEPDMA(4) = 0xfef360cb
DIEPDMA(5) = 0xbc245623
DIEPDMA(6) = 0xfef360cb
DIEPDMA(7) = 0xbdcb75ec
DIEPDMA(8) = 0x46617f3e
DIEPDMA(9) = 0x9cb1ca9c
DIEPDMA(10) = 0xfef360cb
DIEPDMA(11) = 0xfef360cb
DIEPDMA(12) = 0xfef360cb
DIEPDMA(13) = 0xfef360cb
DIEPDMA(14) = 0xfef360cb
DIEPDMA(15) = 0xfef360cb
DOEPDMA(0) = 0xf3143c4f
DOEPDMA(1) = 0x8b10a1e8
DOEPDMA(2) = 0x9f637bc4
DOEPDMA(3) = 0x8b10a1e8
DOEPDMA(4) = 0xb6c84231
DOEPDMA(5) = 0x8b10a1e8
DOEPDMA(6) = 0x126c1490
DOEPDMA(7) = 0x8b10a1e8
DOEPDMA(8) = 0x437c9154
DOEPDMA(9) = 0x6ec79607
DOEPDMA(10) = 0x8b10a1e8
DOEPDMA(11) = 0x8b10a1e8
DOEPDMA(12) = 0x8b10a1e8
DOEPDMA(13) = 0x8b10a1e8
DOEPDMA(14) = 0x8b10a1e8
DOEPDMA(15) = 0x8b10a1e8
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00100000
HFIR = 0x00000b8f
HFNUM = 0x00003fff
HPTXSTS = 0x00080100
HAINT = 0x00000000
HAINTMSK = 0x00000000
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00001000
HCCHAR(1) = 0x00004800
HCCHAR(2) = 0x00000000
HCCHAR(3) = 0x00004800
HCCHAR(4) = 0x00000000
HCCHAR(5) = 0x00004800
HCCHAR(6) = 0x00000000
HCCHAR(7) = 0x00004800
HCCHAR(8) = 0x00000000
HCCHAR(9) = 0x00000000
HCCHAR(10) = 0x00004800
HCCHAR(11) = 0x00004800
HCCHAR(12) = 0x00004800
HCCHAR(13) = 0x00004800
HCCHAR(14) = 0x00004800
HCCHAR(15) = 0x00004800
HCSPLT(0) = 0x00000000
HCSPLT(1) = 0x00000000
HCSPLT(2) = 0x00000000
HCSPLT(3) = 0x00000000
HCSPLT(4) = 0x00000000
HCSPLT(5) = 0x00000000
HCSPLT(6) = 0x00000000
HCSPLT(7) = 0x00000000
HCSPLT(8) = 0x00000000
HCSPLT(9) = 0x00000000
HCSPLT(10) = 0x00000000
HCSPLT(11) = 0x00000000
HCSPLT(12) = 0x00000000
HCSPLT(13) = 0x00000000
HCSPLT(14) = 0x00000000
HCSPLT(15) = 0x00000000
HCINT(0) = 0x00000000
HCINT(1) = 0x00000000
HCINT(2) = 0x00000000
HCINT(3) = 0x00000000
HCINT(4) = 0x00000000
HCINT(5) = 0x00000000
HCINT(6) = 0x00000000
HCINT(7) = 0x00000000
HCINT(8) = 0x00000000
HCINT(9) = 0x00000000
HCINT(10) = 0x00000000
HCINT(11) = 0x00000000
HCINT(12) = 0x00000000
HCINT(13) = 0x00000000
HCINT(14) = 0x00000000
HCINT(15) = 0x00000000
HCINTMSK(0) = 0x00000000
HCINTMSK(1) = 0x00000000
HCINTMSK(2) = 0x00000000
HCINTMSK(3) = 0x00000000
HCINTMSK(4) = 0x00000000
HCINTMSK(5) = 0x00000000
HCINTMSK(6) = 0x00000000
HCINTMSK(7) = 0x00000000
HCINTMSK(8) = 0x00000000
HCINTMSK(9) = 0x00000000
HCINTMSK(10) = 0x00000000
HCINTMSK(11) = 0x00000000
HCINTMSK(12) = 0x00000000
HCINTMSK(13) = 0x00000000
HCINTMSK(14) = 0x00000000
HCINTMSK(15) = 0x00000000
HCTSIZ(0) = 0x00000000
HCTSIZ(1) = 0x00000000
HCTSIZ(2) = 0x00000000
HCTSIZ(3) = 0x00000000
HCTSIZ(4) = 0x00000000
HCTSIZ(5) = 0x00000000
HCTSIZ(6) = 0x00000000
HCTSIZ(7) = 0x00000000
HCTSIZ(8) = 0x00000000
HCTSIZ(9) = 0x00000000
HCTSIZ(10) = 0x00000000
HCTSIZ(11) = 0x00000000
HCTSIZ(12) = 0x00000000
HCTSIZ(13) = 0x00000000
HCTSIZ(14) = 0x00000000
HCTSIZ(15) = 0x00000000
HCDMA(0) = 0xf3143c4f
HCDMA(1) = 0x8b10a1e8
HCDMA(2) = 0x9f637bc4
HCDMA(3) = 0x8b10a1e8
HCDMA(4) = 0xb6c84231
HCDMA(5) = 0x8b10a1e8
HCDMA(6) = 0x126c1490
HCDMA(7) = 0x8b10a1e8
HCDMA(8) = 0x437c9154
HCDMA(9) = 0x6ec79607
HCDMA(10) = 0x8b10a1e8
HCDMA(11) = 0x8b10a1e8
HCDMA(12) = 0x8b10a1e8
HCDMA(13) = 0x8b10a1e8
HCDMA(14) = 0x8b10a1e8
HCDMA(15) = 0x8b10a1e8
HCDMAB(0) = 0x8b10a1e8
HCDMAB(1) = 0x8b10a1e8
HCDMAB(2) = 0x8b10a1e8
HCDMAB(3) = 0x8b10a1e8
HCDMAB(4) = 0x8b10a1e8
HCDMAB(5) = 0x8b10a1e8
HCDMAB(6) = 0x8b10a1e8
HCDMAB(7) = 0x8b10a1e8
HCDMAB(8) = 0x8b10a1e8
HCDMAB(9) = 0x8b10a1e8
HCDMAB(10) = 0x8b10a1e8
HCDMAB(11) = 0x8b10a1e8
HCDMAB(12) = 0x8b10a1e8
HCDMAB(13) = 0x8b10a1e8
HCDMAB(14) = 0x8b10a1e8
HCDMAB(15) = 0x8b10a1e8

and here is the dump after loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x00000027
GUSBCFG = 0x0000140f
GRSTCTL = 0x80000400
GINTSTS = 0x04008020
GINTMSK = 0xd08c3cc4
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000113
GNPTXFSIZ = 0x00100113
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x039303cc
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x00680123
DPTXFSIZN(2) = 0x0068018b
DPTXFSIZN(3) = 0x006801f3
DPTXFSIZN(4) = 0x0068025b
DPTXFSIZN(5) = 0x006802c3
DPTXFSIZN(6) = 0x0068032b
DPTXFSIZN(7) = 0x000003f3
DPTXFSIZN(8) = 0x0000037b
DPTXFSIZN(9) = 0x00680123
DPTXFSIZN(10) = 0x0068018b
DPTXFSIZN(11) = 0x006801f3
DPTXFSIZN(12) = 0x0068025b
DPTXFSIZN(13) = 0x006802c3
DPTXFSIZN(14) = 0x0068032b
DPTXFSIZN(15) = 0x000003f3
DCFG = 0x00840000
DCTL = 0x00000000
DSTS = 0x00000002
DIEPMSK = 0x0000000f
DOEPMSK = 0x0000022f
DAINT = 0x00000000
DAINTMSK = 0x00010001
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008000
DIEPCTL(1) = 0x00000000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00000000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00000000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00000000
DIEPCTL(8) = 0x00000000
DIEPCTL(9) = 0x00000000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
DOEPCTL(0) = 0x80008000
DOEPCTL(1) = 0x00000000
DOEPCTL(2) = 0x00000000
DOEPCTL(3) = 0x00000000
DOEPCTL(4) = 0x00000000
DOEPCTL(5) = 0x00000000
DOEPCTL(6) = 0x00000000
DOEPCTL(7) = 0x00000000
DOEPCTL(8) = 0x00000000
DOEPCTL(9) = 0x00000000
DOEPCTL(10) = 0x00000000
DOEPCTL(11) = 0x00000000
DOEPCTL(12) = 0x00000000
DOEPCTL(13) = 0x00000000
DOEPCTL(14) = 0x00000000
DOEPCTL(15) = 0x00000000
DIEPINT(0) = 0x00000080
DIEPINT(1) = 0x00000080
DIEPINT(2) = 0x00000080
DIEPINT(3) = 0x00000080
DIEPINT(4) = 0x00000080
DIEPINT(5) = 0x00000080
DIEPINT(6) = 0x00000080
DIEPINT(7) = 0x00000080
DIEPINT(8) = 0x00000080
DIEPINT(9) = 0x00000080
DIEPINT(10) = 0x00000080
DIEPINT(11) = 0x00000080
DIEPINT(12) = 0x00000080
DIEPINT(13) = 0x00000080
DIEPINT(14) = 0x00000080
DIEPINT(15) = 0x00000080
DOEPINT(0) = 0x00000000
DOEPINT(1) = 0x00000000
DOEPINT(2) = 0x00000000
DOEPINT(3) = 0x00000000
DOEPINT(4) = 0x00000000
DOEPINT(5) = 0x00000000
DOEPINT(6) = 0x00000000
DOEPINT(7) = 0x00000000
DOEPINT(8) = 0x00000000
DOEPINT(9) = 0x00000000
DOEPINT(10) = 0x00000000
DOEPINT(11) = 0x00000000
DOEPINT(12) = 0x00000000
DOEPINT(13) = 0x00000000
DOEPINT(14) = 0x00000000
DOEPINT(15) = 0x00000000
DIEPTSIZ(0) = 0x00000000
DIEPTSIZ(1) = 0x00000000
DIEPTSIZ(2) = 0x00000000
DIEPTSIZ(3) = 0x00000000
DIEPTSIZ(4) = 0x00000000
DIEPTSIZ(5) = 0x00000000
DIEPTSIZ(6) = 0x00000000
DIEPTSIZ(7) = 0x00000000
DIEPTSIZ(8) = 0x00000000
DIEPTSIZ(9) = 0x00000000
DIEPTSIZ(10) = 0x00000000
DIEPTSIZ(11) = 0x00000000
DIEPTSIZ(12) = 0x00000000
DIEPTSIZ(13) = 0x00000000
DIEPTSIZ(14) = 0x00000000
DIEPTSIZ(15) = 0x00000000
DOEPTSIZ(0) = 0x20080008
DOEPTSIZ(1) = 0x00000000
DOEPTSIZ(2) = 0x00000000
DOEPTSIZ(3) = 0x00000000
DOEPTSIZ(4) = 0x00000000
DOEPTSIZ(5) = 0x00000000
DOEPTSIZ(6) = 0x00000000
DOEPTSIZ(7) = 0x00000000
DOEPTSIZ(8) = 0x00000000
DOEPTSIZ(9) = 0x00000000
DOEPTSIZ(10) = 0x00000000
DOEPTSIZ(11) = 0x00000000
DOEPTSIZ(12) = 0x00000000
DOEPTSIZ(13) = 0x00000000
DOEPTSIZ(14) = 0x00000000
DOEPTSIZ(15) = 0x00000000
DIEPDMA(0) = 0xb616a434
DIEPDMA(1) = 0x1def4eb6
DIEPDMA(2) = 0xbdcb75ec
DIEPDMA(3) = 0xd55e9df3
DIEPDMA(4) = 0xbdcb75ec
DIEPDMA(5) = 0x026813f5
DIEPDMA(6) = 0xbdcb75ec
DIEPDMA(7) = 0xc10f8789
DIEPDMA(8) = 0xb0f82040
DIEPDMA(9) = 0xcbf8ce30
DIEPDMA(10) = 0xbdcb75ec
DIEPDMA(11) = 0xbdcb75ec
DIEPDMA(12) = 0xbdcb75ec
DIEPDMA(13) = 0xbdcb75ec
DIEPDMA(14) = 0xbdcb75ec
DIEPDMA(15) = 0xbdcb75ec
DOEPDMA(0) = 0xff43819d
DOEPDMA(1) = 0x5afb2109
DOEPDMA(2) = 0x074e8688
DOEPDMA(3) = 0x5afb2109
DOEPDMA(4) = 0xe7952f76
DOEPDMA(5) = 0x5afb2109
DOEPDMA(6) = 0x19c23309
DOEPDMA(7) = 0x5afb2109
DOEPDMA(8) = 0x1a1bb42e
DOEPDMA(9) = 0xcd2257a4
DOEPDMA(10) = 0x5afb2109
DOEPDMA(11) = 0x5afb2109
DOEPDMA(12) = 0x5afb2109
DOEPDMA(13) = 0x5afb2109
DOEPDMA(14) = 0x5afb2109
DOEPDMA(15) = 0x5afb2109
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00840000
HFIR = 0x00000b8f
HFNUM = 0x4ebd0000
HPTXSTS = 0x00080068
HAINT = 0x00000000
HAINTMSK = 0x00000001
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00000000
HCCHAR(1) = 0x00000000
HCCHAR(2) = 0x00000000
HCCHAR(3) = 0x00000000
HCCHAR(4) = 0x00000000
HCCHAR(5) = 0x00000000
HCCHAR(6) = 0x00000000
HCCHAR(7) = 0x00000000
HCCHAR(8) = 0x00000000
HCCHAR(9) = 0x00000000
HCCHAR(10) = 0x00000000
HCCHAR(11) = 0x00000000
HCCHAR(12) = 0x00000000
HCCHAR(13) = 0x00000000
HCCHAR(14) = 0x00000000
HCCHAR(15) = 0x00000000
HCSPLT(0) = 0x00000000
HCSPLT(1) = 0x00000000
HCSPLT(2) = 0x00000000
HCSPLT(3) = 0x00000000
HCSPLT(4) = 0x00000000
HCSPLT(5) = 0x00000000
HCSPLT(6) = 0x00000000
HCSPLT(7) = 0x00000000
HCSPLT(8) = 0x00000000
HCSPLT(9) = 0x00000000
HCSPLT(10) = 0x00000000
HCSPLT(11) = 0x00000000
HCSPLT(12) = 0x00000000
HCSPLT(13) = 0x00000000
HCSPLT(14) = 0x00000000
HCSPLT(15) = 0x00000000
HCINT(0) = 0x00000000
HCINT(1) = 0x00000000
HCINT(2) = 0x00000000
HCINT(3) = 0x00000000
HCINT(4) = 0x00000000
HCINT(5) = 0x00000000
HCINT(6) = 0x00000000
HCINT(7) = 0x00000000
HCINT(8) = 0x00000000
HCINT(9) = 0x00000000
HCINT(10) = 0x00000000
HCINT(11) = 0x00000000
HCINT(12) = 0x00000000
HCINT(13) = 0x00000000
HCINT(14) = 0x00000000
HCINT(15) = 0x00000000
HCINTMSK(0) = 0x0000000f
HCINTMSK(1) = 0x00000000
HCINTMSK(2) = 0x00000000
HCINTMSK(3) = 0x00000000
HCINTMSK(4) = 0x00000000
HCINTMSK(5) = 0x00000000
HCINTMSK(6) = 0x00000000
HCINTMSK(7) = 0x00000000
HCINTMSK(8) = 0x00000000
HCINTMSK(9) = 0x00000000
HCINTMSK(10) = 0x00000000
HCINTMSK(11) = 0x00000000
HCINTMSK(12) = 0x00000000
HCINTMSK(13) = 0x00000000
HCINTMSK(14) = 0x00000000
HCINTMSK(15) = 0x00000000
HCTSIZ(0) = 0x00000000
HCTSIZ(1) = 0x00000000
HCTSIZ(2) = 0x00000000
HCTSIZ(3) = 0x00000000
HCTSIZ(4) = 0x00000000
HCTSIZ(5) = 0x00000000
HCTSIZ(6) = 0x00000000
HCTSIZ(7) = 0x00000000
HCTSIZ(8) = 0x00000000
HCTSIZ(9) = 0x00000000
HCTSIZ(10) = 0x00000000
HCTSIZ(11) = 0x00000000
HCTSIZ(12) = 0x00000000
HCTSIZ(13) = 0x00000000
HCTSIZ(14) = 0x00000000
HCTSIZ(15) = 0x00000000
HCDMA(0) = 0xff43819d
HCDMA(1) = 0x5afb2109
HCDMA(2) = 0x074e8688
HCDMA(3) = 0x5afb2109
HCDMA(4) = 0xe7952f76
HCDMA(5) = 0x5afb2109
HCDMA(6) = 0x19c23309
HCDMA(7) = 0x5afb2109
HCDMA(8) = 0x1a1bb42e
HCDMA(9) = 0xcd2257a4
HCDMA(10) = 0x5afb2109
HCDMA(11) = 0x5afb2109
HCDMA(12) = 0x5afb2109
HCDMA(13) = 0x5afb2109
HCDMA(14) = 0x5afb2109
HCDMA(15) = 0x5afb2109
HCDMAB(0) = 0x4d39126c
HCDMAB(1) = 0xdd37f8a2
HCDMAB(2) = 0x14b9118c
HCDMAB(3) = 0xdd37f8a2
HCDMAB(4) = 0x5d5bff79
HCDMAB(5) = 0xdd37f8a2
HCDMAB(6) = 0x01144f4d
HCDMAB(7) = 0xdd37f8a2
HCDMAB(8) = 0x8b35ac87
HCDMAB(9) = 0x28a47b1b
HCDMAB(10) = 0xdd37f8a2
HCDMAB(11) = 0xdd37f8a2
HCDMAB(12) = 0xdd37f8a2
HCDMAB(13) = 0xdd37f8a2
HCDMAB(14) = 0xdd37f8a2
HCDMAB(15) = 0xdd37f8a2

When I plug a USB host into the OTG port, GINTSTS changes from 
0x04008020 to 0x04008022, while the other registers remain unchanged 
(except HFNUM).
It may be worth noting that when I request a register dump for the first 
time, I get two interrupts from the controller, both of which say:

[   23.081525] dwc2 ff580000.usb: gintsts=04000032  gintmsk=d0000806
[   23.081568] dwc2 ff580000.usb: Mode Mismatch Interrupt: currently in 
Device mode
[   23.089908] dwc2 ff580000.usb: dwc2_hsotg_irq: 04000030 00000000 
(d0000806) retry 8

Thanks,
Francesco

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-03-01  7:37               ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-03-01  7:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/28/2017 02:44 PM, Vardan Mikayelyan wrote:
> On 2/28/2017 3:44 PM, Francesco Lavra wrote:
>> Hi Vardan,
>>
>> On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
>>> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>>>> 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 at 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 at 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
>>>> --
>>>
>>> Hi Francesco,
>>>
>>> Could you please provide full log (with debugs enabled) from DWC2 driver
>>> loading to issue point? Two logs are not giving us the full picture.
>>
>> The full log from the DWC2 driver is below:
>>
>> [    1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found,
>> using dummy regulator
>> [    1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found,
>> using dummy regulator
>> [    1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
>> Invalid parameter g-tx-fifo-size, setting to default average
>> [    1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
>> in SPRAM
>> [    1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002,
>> DIEPMSK=00000000
>> [    1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
>> [    1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
>> [    1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
>> [    1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
>> [    1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
>> [    1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
>> [    1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
>> [    1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
>> [    1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
>> [    1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
>> [    1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
>> [    1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800,
>> SIZ=0x00000000, DMA=0x379a4f2d
>> [    1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000,
>> SIZ=0x00000000, DMA=0xe3103c4f
>> [    2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000,
>> SIZ=0x00000000, DMA=0x5cf9a35d
>> [    2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x9f637bc4
>> [    2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000,
>> SIZ=0x00000000, DMA=0xf03470c5
>> [    2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xb6c8c271
>> [    2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000,
>> SIZ=0x00000000, DMA=0x84245611
>> [    2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [    2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x0a6c1c90
>> [    2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000,
>> SIZ=0x00000000, DMA=0xaccb75ec
>> [    2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [    2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800,
>> SIZ=0x00000000, DMA=0x4625773c
>> [    2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x437c9154
>> [    2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000,
>> SIZ=0x00000000, DMA=0x9cb1c89c
>> [    2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x6ec79617
>> [    2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
>> [    2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
>> [    2.176105] dwc2 ff580000.usb: DWC OTG Controller
>> [    2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus
>> number 2
>> [    2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
>> [    2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
>> [    2.176462] usb usb2: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=1
>> [    2.176470] usb usb2: Product: DWC OTG Controller
>> [    2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
>> [    2.176485] usb usb2: SerialNumber: ff580000.usb
>> [ 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 at 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 at 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
>>
>>> Thanks,
>>> Vardan.
>>>
>>
>
> Seems here we have fifo configuration issue. We will follow up it and
> provide feedback soon.
>
> If it is possible, can you please provide to us register dump after
> driver loading.

Sure, here is the dump before loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x0000002f
GUSBCFG = 0x00001408
GRSTCTL = 0x80000000
GINTSTS = 0x04000030
GINTMSK = 0xd0000806
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000400
GNPTXFSIZ = 0x00100400
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x03cc0400
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x01000410
DPTXFSIZN(2) = 0x01000900
DPTXFSIZN(3) = 0x01000a00
DPTXFSIZN(4) = 0x01000b00
DPTXFSIZN(5) = 0x01000c00
DPTXFSIZN(6) = 0x01000d00
DPTXFSIZN(7) = 0x00000e00
DPTXFSIZN(8) = 0x00000f00
DPTXFSIZN(9) = 0x01000410
DPTXFSIZN(10) = 0x01000900
DPTXFSIZN(11) = 0x01000a00
DPTXFSIZN(12) = 0x01000b00
DPTXFSIZN(13) = 0x01000c00
DPTXFSIZN(14) = 0x01000d00
DPTXFSIZN(15) = 0x00000e00
DCFG = 0x08100000
DCTL = 0x00000002
DSTS = 0x0007ff02
DIEPMSK = 0x00000000
DOEPMSK = 0x00000000
DAINT = 0x00000000
DAINTMSK = 0x00000000
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008800
DIEPCTL(1) = 0x00001000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00002000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00003000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00004000
DIEPCTL(8) = 0x00004800
DIEPCTL(9) = 0x00005000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
DOEPCTL(0) = 0x00008000
DOEPCTL(1) = 0x00000000
DOEPCTL(2) = 0x00000000
DOEPCTL(3) = 0x00000000
DOEPCTL(4) = 0x00000000
DOEPCTL(5) = 0x00000000
DOEPCTL(6) = 0x00000000
DOEPCTL(7) = 0x00000000
DOEPCTL(8) = 0x00000000
DOEPCTL(9) = 0x00000000
DOEPCTL(10) = 0x00000000
DOEPCTL(11) = 0x00000000
DOEPCTL(12) = 0x00000000
DOEPCTL(13) = 0x00000000
DOEPCTL(14) = 0x00000000
DOEPCTL(15) = 0x00000000
DIEPINT(0) = 0x00000080
DIEPINT(1) = 0x00000080
DIEPINT(2) = 0x00000080
DIEPINT(3) = 0x00000080
DIEPINT(4) = 0x00000080
DIEPINT(5) = 0x00000080
DIEPINT(6) = 0x00000080
DIEPINT(7) = 0x00000080
DIEPINT(8) = 0x00000080
DIEPINT(9) = 0x00000080
DIEPINT(10) = 0x00000080
DIEPINT(11) = 0x00000080
DIEPINT(12) = 0x00000080
DIEPINT(13) = 0x00000080
DIEPINT(14) = 0x00000080
DIEPINT(15) = 0x00000080
DOEPINT(0) = 0x00000000
DOEPINT(1) = 0x00000000
DOEPINT(2) = 0x00000000
DOEPINT(3) = 0x00000000
DOEPINT(4) = 0x00000000
DOEPINT(5) = 0x00000000
DOEPINT(6) = 0x00000000
DOEPINT(7) = 0x00000000
DOEPINT(8) = 0x00000000
DOEPINT(9) = 0x00000000
DOEPINT(10) = 0x00000000
DOEPINT(11) = 0x00000000
DOEPINT(12) = 0x00000000
DOEPINT(13) = 0x00000000
DOEPINT(14) = 0x00000000
DOEPINT(15) = 0x00000000
DIEPTSIZ(0) = 0x00000000
DIEPTSIZ(1) = 0x00000000
DIEPTSIZ(2) = 0x00000000
DIEPTSIZ(3) = 0x00000000
DIEPTSIZ(4) = 0x00000000
DIEPTSIZ(5) = 0x00000000
DIEPTSIZ(6) = 0x00000000
DIEPTSIZ(7) = 0x00000000
DIEPTSIZ(8) = 0x00000000
DIEPTSIZ(9) = 0x00000000
DIEPTSIZ(10) = 0x00000000
DIEPTSIZ(11) = 0x00000000
DIEPTSIZ(12) = 0x00000000
DIEPTSIZ(13) = 0x00000000
DIEPTSIZ(14) = 0x00000000
DIEPTSIZ(15) = 0x00000000
DOEPTSIZ(0) = 0x00000000
DOEPTSIZ(1) = 0x00000000
DOEPTSIZ(2) = 0x00000000
DOEPTSIZ(3) = 0x00000000
DOEPTSIZ(4) = 0x00000000
DOEPTSIZ(5) = 0x00000000
DOEPTSIZ(6) = 0x00000000
DOEPTSIZ(7) = 0x00000000
DOEPTSIZ(8) = 0x00000000
DOEPTSIZ(9) = 0x00000000
DOEPTSIZ(10) = 0x00000000
DOEPTSIZ(11) = 0x00000000
DOEPTSIZ(12) = 0x00000000
DOEPTSIZ(13) = 0x00000000
DOEPTSIZ(14) = 0x00000000
DOEPTSIZ(15) = 0x00000000
DIEPDMA(0) = 0x379a4f6d
DIEPDMA(1) = 0x5cc9a35d
DIEPDMA(2) = 0xfef360cb
DIEPDMA(3) = 0xf83470c5
DIEPDMA(4) = 0xfef360cb
DIEPDMA(5) = 0xbc245623
DIEPDMA(6) = 0xfef360cb
DIEPDMA(7) = 0xbdcb75ec
DIEPDMA(8) = 0x46617f3e
DIEPDMA(9) = 0x9cb1ca9c
DIEPDMA(10) = 0xfef360cb
DIEPDMA(11) = 0xfef360cb
DIEPDMA(12) = 0xfef360cb
DIEPDMA(13) = 0xfef360cb
DIEPDMA(14) = 0xfef360cb
DIEPDMA(15) = 0xfef360cb
DOEPDMA(0) = 0xf3143c4f
DOEPDMA(1) = 0x8b10a1e8
DOEPDMA(2) = 0x9f637bc4
DOEPDMA(3) = 0x8b10a1e8
DOEPDMA(4) = 0xb6c84231
DOEPDMA(5) = 0x8b10a1e8
DOEPDMA(6) = 0x126c1490
DOEPDMA(7) = 0x8b10a1e8
DOEPDMA(8) = 0x437c9154
DOEPDMA(9) = 0x6ec79607
DOEPDMA(10) = 0x8b10a1e8
DOEPDMA(11) = 0x8b10a1e8
DOEPDMA(12) = 0x8b10a1e8
DOEPDMA(13) = 0x8b10a1e8
DOEPDMA(14) = 0x8b10a1e8
DOEPDMA(15) = 0x8b10a1e8
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00100000
HFIR = 0x00000b8f
HFNUM = 0x00003fff
HPTXSTS = 0x00080100
HAINT = 0x00000000
HAINTMSK = 0x00000000
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00001000
HCCHAR(1) = 0x00004800
HCCHAR(2) = 0x00000000
HCCHAR(3) = 0x00004800
HCCHAR(4) = 0x00000000
HCCHAR(5) = 0x00004800
HCCHAR(6) = 0x00000000
HCCHAR(7) = 0x00004800
HCCHAR(8) = 0x00000000
HCCHAR(9) = 0x00000000
HCCHAR(10) = 0x00004800
HCCHAR(11) = 0x00004800
HCCHAR(12) = 0x00004800
HCCHAR(13) = 0x00004800
HCCHAR(14) = 0x00004800
HCCHAR(15) = 0x00004800
HCSPLT(0) = 0x00000000
HCSPLT(1) = 0x00000000
HCSPLT(2) = 0x00000000
HCSPLT(3) = 0x00000000
HCSPLT(4) = 0x00000000
HCSPLT(5) = 0x00000000
HCSPLT(6) = 0x00000000
HCSPLT(7) = 0x00000000
HCSPLT(8) = 0x00000000
HCSPLT(9) = 0x00000000
HCSPLT(10) = 0x00000000
HCSPLT(11) = 0x00000000
HCSPLT(12) = 0x00000000
HCSPLT(13) = 0x00000000
HCSPLT(14) = 0x00000000
HCSPLT(15) = 0x00000000
HCINT(0) = 0x00000000
HCINT(1) = 0x00000000
HCINT(2) = 0x00000000
HCINT(3) = 0x00000000
HCINT(4) = 0x00000000
HCINT(5) = 0x00000000
HCINT(6) = 0x00000000
HCINT(7) = 0x00000000
HCINT(8) = 0x00000000
HCINT(9) = 0x00000000
HCINT(10) = 0x00000000
HCINT(11) = 0x00000000
HCINT(12) = 0x00000000
HCINT(13) = 0x00000000
HCINT(14) = 0x00000000
HCINT(15) = 0x00000000
HCINTMSK(0) = 0x00000000
HCINTMSK(1) = 0x00000000
HCINTMSK(2) = 0x00000000
HCINTMSK(3) = 0x00000000
HCINTMSK(4) = 0x00000000
HCINTMSK(5) = 0x00000000
HCINTMSK(6) = 0x00000000
HCINTMSK(7) = 0x00000000
HCINTMSK(8) = 0x00000000
HCINTMSK(9) = 0x00000000
HCINTMSK(10) = 0x00000000
HCINTMSK(11) = 0x00000000
HCINTMSK(12) = 0x00000000
HCINTMSK(13) = 0x00000000
HCINTMSK(14) = 0x00000000
HCINTMSK(15) = 0x00000000
HCTSIZ(0) = 0x00000000
HCTSIZ(1) = 0x00000000
HCTSIZ(2) = 0x00000000
HCTSIZ(3) = 0x00000000
HCTSIZ(4) = 0x00000000
HCTSIZ(5) = 0x00000000
HCTSIZ(6) = 0x00000000
HCTSIZ(7) = 0x00000000
HCTSIZ(8) = 0x00000000
HCTSIZ(9) = 0x00000000
HCTSIZ(10) = 0x00000000
HCTSIZ(11) = 0x00000000
HCTSIZ(12) = 0x00000000
HCTSIZ(13) = 0x00000000
HCTSIZ(14) = 0x00000000
HCTSIZ(15) = 0x00000000
HCDMA(0) = 0xf3143c4f
HCDMA(1) = 0x8b10a1e8
HCDMA(2) = 0x9f637bc4
HCDMA(3) = 0x8b10a1e8
HCDMA(4) = 0xb6c84231
HCDMA(5) = 0x8b10a1e8
HCDMA(6) = 0x126c1490
HCDMA(7) = 0x8b10a1e8
HCDMA(8) = 0x437c9154
HCDMA(9) = 0x6ec79607
HCDMA(10) = 0x8b10a1e8
HCDMA(11) = 0x8b10a1e8
HCDMA(12) = 0x8b10a1e8
HCDMA(13) = 0x8b10a1e8
HCDMA(14) = 0x8b10a1e8
HCDMA(15) = 0x8b10a1e8
HCDMAB(0) = 0x8b10a1e8
HCDMAB(1) = 0x8b10a1e8
HCDMAB(2) = 0x8b10a1e8
HCDMAB(3) = 0x8b10a1e8
HCDMAB(4) = 0x8b10a1e8
HCDMAB(5) = 0x8b10a1e8
HCDMAB(6) = 0x8b10a1e8
HCDMAB(7) = 0x8b10a1e8
HCDMAB(8) = 0x8b10a1e8
HCDMAB(9) = 0x8b10a1e8
HCDMAB(10) = 0x8b10a1e8
HCDMAB(11) = 0x8b10a1e8
HCDMAB(12) = 0x8b10a1e8
HCDMAB(13) = 0x8b10a1e8
HCDMAB(14) = 0x8b10a1e8
HCDMAB(15) = 0x8b10a1e8

and here is the dump after loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x00000027
GUSBCFG = 0x0000140f
GRSTCTL = 0x80000400
GINTSTS = 0x04008020
GINTMSK = 0xd08c3cc4
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000113
GNPTXFSIZ = 0x00100113
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x039303cc
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x00680123
DPTXFSIZN(2) = 0x0068018b
DPTXFSIZN(3) = 0x006801f3
DPTXFSIZN(4) = 0x0068025b
DPTXFSIZN(5) = 0x006802c3
DPTXFSIZN(6) = 0x0068032b
DPTXFSIZN(7) = 0x000003f3
DPTXFSIZN(8) = 0x0000037b
DPTXFSIZN(9) = 0x00680123
DPTXFSIZN(10) = 0x0068018b
DPTXFSIZN(11) = 0x006801f3
DPTXFSIZN(12) = 0x0068025b
DPTXFSIZN(13) = 0x006802c3
DPTXFSIZN(14) = 0x0068032b
DPTXFSIZN(15) = 0x000003f3
DCFG = 0x00840000
DCTL = 0x00000000
DSTS = 0x00000002
DIEPMSK = 0x0000000f
DOEPMSK = 0x0000022f
DAINT = 0x00000000
DAINTMSK = 0x00010001
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008000
DIEPCTL(1) = 0x00000000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00000000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00000000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00000000
DIEPCTL(8) = 0x00000000
DIEPCTL(9) = 0x00000000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
DOEPCTL(0) = 0x80008000
DOEPCTL(1) = 0x00000000
DOEPCTL(2) = 0x00000000
DOEPCTL(3) = 0x00000000
DOEPCTL(4) = 0x00000000
DOEPCTL(5) = 0x00000000
DOEPCTL(6) = 0x00000000
DOEPCTL(7) = 0x00000000
DOEPCTL(8) = 0x00000000
DOEPCTL(9) = 0x00000000
DOEPCTL(10) = 0x00000000
DOEPCTL(11) = 0x00000000
DOEPCTL(12) = 0x00000000
DOEPCTL(13) = 0x00000000
DOEPCTL(14) = 0x00000000
DOEPCTL(15) = 0x00000000
DIEPINT(0) = 0x00000080
DIEPINT(1) = 0x00000080
DIEPINT(2) = 0x00000080
DIEPINT(3) = 0x00000080
DIEPINT(4) = 0x00000080
DIEPINT(5) = 0x00000080
DIEPINT(6) = 0x00000080
DIEPINT(7) = 0x00000080
DIEPINT(8) = 0x00000080
DIEPINT(9) = 0x00000080
DIEPINT(10) = 0x00000080
DIEPINT(11) = 0x00000080
DIEPINT(12) = 0x00000080
DIEPINT(13) = 0x00000080
DIEPINT(14) = 0x00000080
DIEPINT(15) = 0x00000080
DOEPINT(0) = 0x00000000
DOEPINT(1) = 0x00000000
DOEPINT(2) = 0x00000000
DOEPINT(3) = 0x00000000
DOEPINT(4) = 0x00000000
DOEPINT(5) = 0x00000000
DOEPINT(6) = 0x00000000
DOEPINT(7) = 0x00000000
DOEPINT(8) = 0x00000000
DOEPINT(9) = 0x00000000
DOEPINT(10) = 0x00000000
DOEPINT(11) = 0x00000000
DOEPINT(12) = 0x00000000
DOEPINT(13) = 0x00000000
DOEPINT(14) = 0x00000000
DOEPINT(15) = 0x00000000
DIEPTSIZ(0) = 0x00000000
DIEPTSIZ(1) = 0x00000000
DIEPTSIZ(2) = 0x00000000
DIEPTSIZ(3) = 0x00000000
DIEPTSIZ(4) = 0x00000000
DIEPTSIZ(5) = 0x00000000
DIEPTSIZ(6) = 0x00000000
DIEPTSIZ(7) = 0x00000000
DIEPTSIZ(8) = 0x00000000
DIEPTSIZ(9) = 0x00000000
DIEPTSIZ(10) = 0x00000000
DIEPTSIZ(11) = 0x00000000
DIEPTSIZ(12) = 0x00000000
DIEPTSIZ(13) = 0x00000000
DIEPTSIZ(14) = 0x00000000
DIEPTSIZ(15) = 0x00000000
DOEPTSIZ(0) = 0x20080008
DOEPTSIZ(1) = 0x00000000
DOEPTSIZ(2) = 0x00000000
DOEPTSIZ(3) = 0x00000000
DOEPTSIZ(4) = 0x00000000
DOEPTSIZ(5) = 0x00000000
DOEPTSIZ(6) = 0x00000000
DOEPTSIZ(7) = 0x00000000
DOEPTSIZ(8) = 0x00000000
DOEPTSIZ(9) = 0x00000000
DOEPTSIZ(10) = 0x00000000
DOEPTSIZ(11) = 0x00000000
DOEPTSIZ(12) = 0x00000000
DOEPTSIZ(13) = 0x00000000
DOEPTSIZ(14) = 0x00000000
DOEPTSIZ(15) = 0x00000000
DIEPDMA(0) = 0xb616a434
DIEPDMA(1) = 0x1def4eb6
DIEPDMA(2) = 0xbdcb75ec
DIEPDMA(3) = 0xd55e9df3
DIEPDMA(4) = 0xbdcb75ec
DIEPDMA(5) = 0x026813f5
DIEPDMA(6) = 0xbdcb75ec
DIEPDMA(7) = 0xc10f8789
DIEPDMA(8) = 0xb0f82040
DIEPDMA(9) = 0xcbf8ce30
DIEPDMA(10) = 0xbdcb75ec
DIEPDMA(11) = 0xbdcb75ec
DIEPDMA(12) = 0xbdcb75ec
DIEPDMA(13) = 0xbdcb75ec
DIEPDMA(14) = 0xbdcb75ec
DIEPDMA(15) = 0xbdcb75ec
DOEPDMA(0) = 0xff43819d
DOEPDMA(1) = 0x5afb2109
DOEPDMA(2) = 0x074e8688
DOEPDMA(3) = 0x5afb2109
DOEPDMA(4) = 0xe7952f76
DOEPDMA(5) = 0x5afb2109
DOEPDMA(6) = 0x19c23309
DOEPDMA(7) = 0x5afb2109
DOEPDMA(8) = 0x1a1bb42e
DOEPDMA(9) = 0xcd2257a4
DOEPDMA(10) = 0x5afb2109
DOEPDMA(11) = 0x5afb2109
DOEPDMA(12) = 0x5afb2109
DOEPDMA(13) = 0x5afb2109
DOEPDMA(14) = 0x5afb2109
DOEPDMA(15) = 0x5afb2109
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00840000
HFIR = 0x00000b8f
HFNUM = 0x4ebd0000
HPTXSTS = 0x00080068
HAINT = 0x00000000
HAINTMSK = 0x00000001
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00000000
HCCHAR(1) = 0x00000000
HCCHAR(2) = 0x00000000
HCCHAR(3) = 0x00000000
HCCHAR(4) = 0x00000000
HCCHAR(5) = 0x00000000
HCCHAR(6) = 0x00000000
HCCHAR(7) = 0x00000000
HCCHAR(8) = 0x00000000
HCCHAR(9) = 0x00000000
HCCHAR(10) = 0x00000000
HCCHAR(11) = 0x00000000
HCCHAR(12) = 0x00000000
HCCHAR(13) = 0x00000000
HCCHAR(14) = 0x00000000
HCCHAR(15) = 0x00000000
HCSPLT(0) = 0x00000000
HCSPLT(1) = 0x00000000
HCSPLT(2) = 0x00000000
HCSPLT(3) = 0x00000000
HCSPLT(4) = 0x00000000
HCSPLT(5) = 0x00000000
HCSPLT(6) = 0x00000000
HCSPLT(7) = 0x00000000
HCSPLT(8) = 0x00000000
HCSPLT(9) = 0x00000000
HCSPLT(10) = 0x00000000
HCSPLT(11) = 0x00000000
HCSPLT(12) = 0x00000000
HCSPLT(13) = 0x00000000
HCSPLT(14) = 0x00000000
HCSPLT(15) = 0x00000000
HCINT(0) = 0x00000000
HCINT(1) = 0x00000000
HCINT(2) = 0x00000000
HCINT(3) = 0x00000000
HCINT(4) = 0x00000000
HCINT(5) = 0x00000000
HCINT(6) = 0x00000000
HCINT(7) = 0x00000000
HCINT(8) = 0x00000000
HCINT(9) = 0x00000000
HCINT(10) = 0x00000000
HCINT(11) = 0x00000000
HCINT(12) = 0x00000000
HCINT(13) = 0x00000000
HCINT(14) = 0x00000000
HCINT(15) = 0x00000000
HCINTMSK(0) = 0x0000000f
HCINTMSK(1) = 0x00000000
HCINTMSK(2) = 0x00000000
HCINTMSK(3) = 0x00000000
HCINTMSK(4) = 0x00000000
HCINTMSK(5) = 0x00000000
HCINTMSK(6) = 0x00000000
HCINTMSK(7) = 0x00000000
HCINTMSK(8) = 0x00000000
HCINTMSK(9) = 0x00000000
HCINTMSK(10) = 0x00000000
HCINTMSK(11) = 0x00000000
HCINTMSK(12) = 0x00000000
HCINTMSK(13) = 0x00000000
HCINTMSK(14) = 0x00000000
HCINTMSK(15) = 0x00000000
HCTSIZ(0) = 0x00000000
HCTSIZ(1) = 0x00000000
HCTSIZ(2) = 0x00000000
HCTSIZ(3) = 0x00000000
HCTSIZ(4) = 0x00000000
HCTSIZ(5) = 0x00000000
HCTSIZ(6) = 0x00000000
HCTSIZ(7) = 0x00000000
HCTSIZ(8) = 0x00000000
HCTSIZ(9) = 0x00000000
HCTSIZ(10) = 0x00000000
HCTSIZ(11) = 0x00000000
HCTSIZ(12) = 0x00000000
HCTSIZ(13) = 0x00000000
HCTSIZ(14) = 0x00000000
HCTSIZ(15) = 0x00000000
HCDMA(0) = 0xff43819d
HCDMA(1) = 0x5afb2109
HCDMA(2) = 0x074e8688
HCDMA(3) = 0x5afb2109
HCDMA(4) = 0xe7952f76
HCDMA(5) = 0x5afb2109
HCDMA(6) = 0x19c23309
HCDMA(7) = 0x5afb2109
HCDMA(8) = 0x1a1bb42e
HCDMA(9) = 0xcd2257a4
HCDMA(10) = 0x5afb2109
HCDMA(11) = 0x5afb2109
HCDMA(12) = 0x5afb2109
HCDMA(13) = 0x5afb2109
HCDMA(14) = 0x5afb2109
HCDMA(15) = 0x5afb2109
HCDMAB(0) = 0x4d39126c
HCDMAB(1) = 0xdd37f8a2
HCDMAB(2) = 0x14b9118c
HCDMAB(3) = 0xdd37f8a2
HCDMAB(4) = 0x5d5bff79
HCDMAB(5) = 0xdd37f8a2
HCDMAB(6) = 0x01144f4d
HCDMAB(7) = 0xdd37f8a2
HCDMAB(8) = 0x8b35ac87
HCDMAB(9) = 0x28a47b1b
HCDMAB(10) = 0xdd37f8a2
HCDMAB(11) = 0xdd37f8a2
HCDMAB(12) = 0xdd37f8a2
HCDMAB(13) = 0xdd37f8a2
HCDMAB(14) = 0xdd37f8a2
HCDMAB(15) = 0xdd37f8a2

When I plug a USB host into the OTG port, GINTSTS changes from 
0x04008020 to 0x04008022, while the other registers remain unchanged 
(except HFNUM).
It may be worth noting that when I request a register dump for the first 
time, I get two interrupts from the controller, both of which say:

[   23.081525] dwc2 ff580000.usb: gintsts=04000032  gintmsk=d0000806
[   23.081568] dwc2 ff580000.usb: Mode Mismatch Interrupt: currently in 
Device mode
[   23.089908] dwc2 ff580000.usb: dwc2_hsotg_irq: 04000030 00000000 
(d0000806) retry 8

Thanks,
Francesco

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
  2017-02-23 19:27   ` dwc2 gadget issues (was: RK3288 USB OTG controller in peripheral mode) Heiko Stuebner
@ 2017-03-02  5:58       ` Randy Li
  2017-03-02  5:58       ` Randy Li
  1 sibling, 0 replies; 16+ messages in thread
From: Randy Li @ 2017-03-02  5:58 UTC (permalink / raw)
  To: Francesco Lavra
  Cc: Heiko Stuebner, johnyoun-HKixBCOQz3hWk0Htik3J/w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

You don't need to send me a private mail, I would suggest you CC me next 
time.

On 02/24/2017 03:27 AM, 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.
>
>
>> Tried with different gadget drivers (g_audio, g_ether, g_mass_storage),
>> but it makes no difference.
I tried g_ether and g_serial, it looks fine for me.
>> 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?
>
> In general the controller is a dwc2 and there was quite some activity on the
> driver recently. So maybe really try linux-next first and see if any of the
> changes included there improve the situation.
>
> I've included some usb lists + people, maybe they know if anything recent may
> have changed things.
>
>
>> 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)
>
>
> Heiko
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>

-- 
Randy Li

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* dwc2 gadget issues
@ 2017-03-02  5:58       ` Randy Li
  0 siblings, 0 replies; 16+ messages in thread
From: Randy Li @ 2017-03-02  5:58 UTC (permalink / raw)
  To: linux-arm-kernel

You don't need to send me a private mail, I would suggest you CC me next 
time.

On 02/24/2017 03:27 AM, 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.
>
>
>> Tried with different gadget drivers (g_audio, g_ether, g_mass_storage),
>> but it makes no difference.
I tried g_ether and g_serial, it looks fine for me.
>> 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?
>
> In general the controller is a dwc2 and there was quite some activity on the
> driver recently. So maybe really try linux-next first and see if any of the
> changes included there improve the situation.
>
> I've included some usb lists + people, maybe they know if anything recent may
> have changed things.
>
>
>> 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)
>
>
> Heiko
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>

-- 
Randy Li

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: dwc2 gadget issues
       [not found]       ` <11c40609-d59a-8e8e-1c9b-3989cd98b5e7-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2017-03-03  7:43         ` Francesco Lavra
  0 siblings, 0 replies; 16+ messages in thread
From: Francesco Lavra @ 2017-03-03  7:43 UTC (permalink / raw)
  To: Randy Li
  Cc: johnyoun-HKixBCOQz3hWk0Htik3J/w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

Hi,

On Thu, Mar 2, 2017 at 6:58 AM, Randy Li <randy.li-TNX95d0MmH7DzftRWevZcw@public.gmane.org> wrote:
> You don't need to send me a private mail, I would suggest you CC me next
> time.
>
> On 02/24/2017 03:27 AM, 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.
>>
>>
>>> Tried with different gadget drivers (g_audio, g_ether, g_mass_storage),
>>> but it makes no difference.
>
> I tried g_ether and g_serial, it looks fine for me.

Thanks.
Would you mind sharing the config you used in your kernel, and what
kernel tree you are using?
I'm using the 4.10.0 mainline kernel, with the config in attachment.
Also, what RK3288 board did you try this with?

Regards,
Francesco

> Randy Li
>

[-- Attachment #2: 4.10.0.config --]
[-- Type: application/xml, Size: 122126 bytes --]

[-- Attachment #3: Type: text/plain, Size: 200 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-03-03  7:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 18:11 RK3288 USB OTG controller in peripheral mode Francesco Lavra
2017-02-23 18:11 ` Francesco Lavra
     [not found] ` <2b818d21-62a6-515e-8116-f243a2c07e08-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-23 19:27   ` dwc2 gadget issues (was: RK3288 USB OTG controller in peripheral mode) Heiko Stuebner
2017-02-27 17:57     ` dwc2 gadget issues Francesco Lavra
2017-02-27 17:57       ` Francesco Lavra
2017-02-28  8:41       ` Vardan Mikayelyan
2017-02-28  8:41         ` Vardan Mikayelyan
2017-02-28 11:43         ` Francesco Lavra
2017-02-28 11:43           ` Francesco Lavra
2017-02-28 13:44           ` Vardan Mikayelyan
2017-02-28 13:44             ` Vardan Mikayelyan
2017-03-01  7:37             ` Francesco Lavra
2017-03-01  7:37               ` Francesco Lavra
2017-03-02  5:58     ` Randy Li
2017-03-02  5:58       ` Randy Li
     [not found]       ` <11c40609-d59a-8e8e-1c9b-3989cd98b5e7-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-03-03  7:43         ` Francesco Lavra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.