[U-Boot] [PATCH] usb: gadget: ci_udc: fix suspend/resume of USB Mass Storage

Marek Vasut marex at denx.de
Wed Aug 24 02:18:19 CEST 2016


On 08/24/2016 12:49 AM, Fabio Estevam wrote:
> Adding Marek on Cc

Thanks

> On Mon, Aug 22, 2016 at 4:38 PM, John Tobias <john.tobias.ph at gmail.com> wrote:
>> When the host machine went to suspend mode and then wake it up, it send
>> a USB_REQ_GET_STATUS.

Can you expand on this ? It is not clear what the conditions to
replicate this are. Please do so in detail.

>> The existing case condition below, never
>> become true and it causes the host machine to reset the connection. Once,
>> it reset you will see an error "Disk Not Ejected Properly".
>>
>> case SETUP(USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_STATUS):
>>
>> By applying this patch, the device could respond to the USB_REQ_GET_STATUS
>> command correctly.
>> ---
>>  drivers/usb/gadget/ci_udc.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
>> index d36bcf6..fdec613 100644
>> --- a/drivers/usb/gadget/ci_udc.c
>> +++ b/drivers/usb/gadget/ci_udc.c
>> @@ -703,8 +703,8 @@ static void handle_setup(void)
>>         list_del_init(&ci_req->queue);
>>         ci_ep->req_primed = false;
>>
>> -       switch (SETUP(r.bRequestType, r.bRequest)) {
>> -       case SETUP(USB_RECIP_ENDPOINT, USB_REQ_CLEAR_FEATURE):
>> +       switch (r.bRequest) {
>> +       case USB_REQ_CLEAR_FEATURE:
>>                 _num = r.wIndex & 15;
>>                 _in = !!(r.wIndex & 0x80);
>>
>> @@ -729,7 +729,7 @@ static void handle_setup(void)
>>                 }
>>                 return;
>>
>> -       case SETUP(USB_RECIP_DEVICE, USB_REQ_SET_ADDRESS):
>> +       case USB_REQ_SET_ADDRESS:
>>                 /*
>>                  * write address delayed (will take effect
>>                  * after the next IN txn)
>> @@ -739,7 +739,7 @@ static void handle_setup(void)
>>                 usb_ep_queue(controller.gadget.ep0, req, 0);
>>                 return;
>>
>> -       case SETUP(USB_DIR_IN | USB_RECIP_DEVICE, USB_REQ_GET_STATUS):
>> +       case USB_REQ_GET_STATUS:
>>                 req->length = 2;
>>                 buf = (char *)req->buf;
>>                 buf[0] = 1 << USB_DEVICE_SELF_POWERED;
>> --
>> 2.9.3
>>


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list