lkml.org 
[lkml]   [2022]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] usb: dwc3: Fix ep0 handling when getting reset while doing control transfer
Date
Thinh Nguyen wrote:

> Mayank Rana wrote:
>> @@ -3766,6 +3768,27 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
>> }
>>
>> dwc3_reset_gadget(dwc);
>> +
>> + /*
>> + * From SNPS databook section 8.1.2, the EP0 should be in setup
>> + * phase. So ensure that EP0 is in setup phase by issuing a stall
>> + * and restart if EP0 is not in setup phase.
>> + */
>
> We should not issue End Transfer to control endpoint unless it's error
> case such as invalid direction. The databook also specify under section
> USB reset initialization to not send End Transfer to control endpoint.
>
>> + if (dwc->ep0state != EP0_SETUP_PHASE) {
>> + unsigned int dir;
>> +
>> + dir = !!dwc->ep0_expect_in;
>> + if (dwc->ep0state == EP0_DATA_PHASE)
>> + dwc3_ep0_end_control_data(dwc, dwc->eps[dir]);
>> + else
>> + dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]);

On second thought, it seems cleaner to do this though the behavior is
undefined.

Do you have the driver tracepoint log capture of this scenario? It'd be
great if I can also review it.

Thanks!
Thinh
\
 
 \ /
  Last update: 2022-05-25 05:53    [W:0.057 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site