On 31/10/17 12:05, Felipe Balbi wrote:
> 
> Hi,
> 
> "Howey, Dylan" <dylan.ho...@tennantco.com> writes:
>> Felipe,
>>
>> On 10/30/2017 15:28, Felipe Balbi wrote:
>>>
>>> Hi,
>>>
>>> "Howey, Dylan" <dylan.ho...@tennantco.com> writes:
>>>> Felipe,
>>>>
>>>> It's also happening in v4.14-rc7.
>>>
>>> Please make sure to also Cc: linux-usb@vger.kernel.org and send
>>> plain-text emails, also avoid top-posting :-)
>>>
>>>> [   59.716702] ------------[ cut here ]------------
>>>> [   59.721365] WARNING: CPU: 0 PID: 966 at drivers/usb/dwc3/gadget.c:2610 
>>>> dwc3_stop_active_transfer.constprop.4+0xe8/0xec
>>>> [   59.732038] Modules linked in: matrix_keypad
>>>> [   59.736311] CPU: 0 PID: 966 Comm: irq/90-dwc3 Tainted: G        W       
>>>> 4.14.0-rc7 #3
>>>> [   59.744124] Hardware name: Generic AM43 (Flattened Device Tree)
>>>> [   59.750029] Backtrace:
>>>> [   59.752494] [<c010b7e0>] (dump_backtrace) from [<c010bab4>] 
>>>> (show_stack+0x18/0x1c)
>>>> [   59.760051]  r7:00000009 r6:00000000 r5:c0889bd0 r4:00000000
>>>> [   59.765707] [<c010ba9c>] (show_stack) from [<c06a1e14>] 
>>>> (dump_stack+0x24/0x28)
>>>> [   59.772926] [<c06a1df0>] (dump_stack) from [<c0128290>] 
>>>> (__warn+0xe8/0x100)
>>>> [   59.779877] [<c01281a8>] (__warn) from [<c0128360>] 
>>>> (warn_slowpath_null+0x28/0x30)
>>>> [   59.787433]  r9:00000000 r8:a00e0093 r7:00000002 r6:00000003 
>>>> r5:ee8b7810 r4:ee8bbf00
>>>> [   59.795166] [<c0128338>] (warn_slowpath_null) from [<c04c1c24>] 
>>>> (dwc3_stop_active_transfer.constprop.4+0xe8/0xec)
>>>> [   59.805413] [<c04c1b3c>] (dwc3_stop_active_transfer.constprop.4) from 
>>>> [<c04c3264>] (__dwc3_gadget_ep_disable+0x24/0x110)
>>>> [   59.816259]  r6:ee8b7810 r5:ee8bbf34 r4:ee8bbf00
>>>> [   59.820871] [<c04c3240>] (__dwc3_gadget_ep_disable) from [<c04c371c>] 
>>>> (dwc3_gadget_ep_disable+0x30/0xac)
>>>> [   59.830332]  r7:00000002 r6:ee987638 r5:00000001 r4:200e0093
>>>> [   59.835993] [<c04c36ec>] (dwc3_gadget_ep_disable) from [<c04e3800>] 
>>>> (usb_ep_disable+0x30/0x3c)
>>>> [   59.844585]  r5:00000001 r4:ee8bbf00
>>>> [   59.848158] [<c04e37d0>] (usb_ep_disable) from [<c04eaa84>] 
>>>> (ffs_func_eps_disable+0x50/0x78)
>>>> [   59.856576]  r5:00000001 r4:ef0cfc80
>>>> [   59.860145] [<c04eaa34>] (ffs_func_eps_disable) from [<c04eab84>] 
>>>> (ffs_func_set_alt+0x90/0x290)
>>>> [   59.868827]  r9:5533194a r8:55332309 r7:ee98b254 r6:ffffffff 
>>>> r5:200e0093 r4:ee1f5e64
>>>> [   59.876556] [<c04eaaf4>] (ffs_func_set_alt) from [<c04ead9c>] 
>>>> (ffs_func_disable+0x18/0x1c)
>>>> [   59.884805]  r10:ee9f3d14 r9:5533194a r8:55332309 r7:ee98b254 
>>>> r6:00000000 r5:200e0093
>>>> [   59.892615]  r4:ee1f5e64
>>>> [   59.895145] [<c04ead84>] (ffs_func_disable) from [<c04dd44c>] 
>>>> (composite_disconnect+0x4c/0x94)
>>>
>>> okay, so you're using ffs. I see you're implementing your own HID gadget
>>> on top of FFS. Could it be you have a bug there? Why not use the in-tree
>>> HID function? Can you capture dwc3 logs? More details here:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/driver-api/usb/dwc3.rst#n113
>>>
>>
>> This implementation works on an AM335x platform.
> 
> that really doesn't mean much :-) Different controller will behave
> completely differently when it comes to transfer cancellation.
> 
>> I should add that the host is Linux v4.4.0 on x86_64. I have not tried any
>> other host yet.
> 
> okay.
> 
> 
>> Attached the dwc3 logs as instructed.
> 
> Thank you.
> 
> (in below logs, I've removed register access traces to make it easier to read)
> 
> Roger, your PHY is toast :-(
> 
>      irq/90-dwc3-969   [000] d...    52.323145: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    52.560646: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    52.798144: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    53.035646: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    53.273143: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    53.510657: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    53.748142: dwc3_event: event (00000901): 
> Erratic Error [U0]
>      irq/90-dwc3-969   [000] d...    53.985640: dwc3_event: event (00000901): 
> Erratic Error [U0]
> 

This is known issue due to operating a HighSpeed PHY in SuperSpeed mode.

from dwc3/gadget.c:2015

        /*
         * WORKAROUND: DWC3 revision < 2.20a have an issue
         * which would cause metastability state on Run/Stop
         * bit if we try to force the IP to USB2-only mode.
         *
         * Because of that, we cannot configure the IP to any
         * speed other than the SuperSpeed
         *
         * Refers to:
         *
         * STAR#9000525659: Clock Domain Crossing on DCTL in
         * USB 2.0 Mode
         */
        if (dwc->revision < DWC3_REVISION_220A) {
                reg |= DWC3_DCFG_SUPERSPEED;
        } else {

If we undo this workaround, the Erratic Error messages should go away.

> Seems like your FFS HID is missing Data phase for this clear feature
> request. Either that, or should stall this unknown interface feature
> 
> (and seems like I need to figure out a way to add the raw value to the
> trace)
> 
>      irq/90-dwc3-969   [000] d...    54.372175: dwc3_ctrl_req: Clear 
> Interface Feature(UNKNOWN)
>      irq/90-dwc3-969   [000] d...    54.372186: dwc3_event: event (000010c2): 
> ep0in: Transfer Not Ready (Not Active) [Data Phase]
>   UI_Touchscreen-963   [000] d...    54.372437: dwc3_ep_queue: ep1in: req 
> ee268c00 length 0/64 zsI ==> -115
>   UI_Touchscreen-963   [000] d...    54.372451: dwc3_prepare_trb: ep1in: 1/1 
> trb f0a27000 buf 00000000a9409580 size 64 ctrl 00000811 (Hlcs:sC:normal)
>   UI_Touchscreen-963   [000] d...    54.372468: dwc3_gadget_ep_cmd: ep1in: 
> cmd 'Start Transfer' [1030] params 00000000 be844000 00000000 --> status: 
> Successful
>   UI_Touchscreen-965   [000] d...    54.393628: dwc3_ep_queue: ep1out: req 
> ee268000 length 0/64 zsI ==> -115
>   UI_Touchscreen-965   [000] d...    54.393646: dwc3_prepare_trb: ep1out: 1/1 
> trb f0a25000 buf 00000000a94095c0 size 64 ctrl 00000819 (HlcS:sC:normal)
>   UI_Touchscreen-965   [000] d...    54.393663: dwc3_gadget_ep_cmd: ep1out: 
> cmd 'Start Transfer' [1030] params 00000000 be843000 00000000 --> status: 
> Successful
>      irq/90-dwc3-969   [000] d...    68.205509: dwc3_event: event (00050301): 
> Link Change [RX.Detect]
>      irq/90-dwc3-969   [000] d...    68.208516: dwc3_event: event (00030301): 
> Link Change [U3]
>      irq/90-dwc3-969   [000] d...    73.922019: dwc3_gadget_ep_disable: 
> ep1in: mps 1024/1024 streams 15 burst 0 ring 1/0 flags E:swBpm:e:<
>      irq/90-dwc3-969   [000] d...    73.922879: dwc3_gadget_ep_cmd: ep1in: 
> cmd 'End Transfer' [199944] params 00000000 00000000 00000000 --> status: 
> Timed Out
>      irq/90-dwc3-969   [000] d...    74.229721: dwc3_gadget_giveback: ep1in: 
> req ee268c00 length 0/64 zsI ==> -108
> 
> You need to fix something in your gadget, apparently.
> 

-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to