[U-Boot] [UBOOT RFC PATCH 07/13] usb: gadget: g_dnl: Explicitly set the max packet size in descriptor

Kishon Vijay Abraham I kishon at ti.com
Tue Aug 19 17:42:29 CEST 2014



On Tuesday 19 August 2014 09:09 PM, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Aug 19, 2014 at 09:04:06PM +0530, Kishon Vijay Abraham I wrote:
>> On Monday 18 August 2014 08:08 PM, Felipe Balbi wrote:
>>> On Mon, Aug 18, 2014 at 07:58:29PM +0530, Kishon Vijay Abraham I wrote:
>>>> Explicity set the max packet size in the device descriptor to 0x40
>>>> as specified in the device class specification for device firmware upgrade.
>>>> Also changed debug to printf to explicitly notify the user if the
>>>> device has been enumerated.
>>>>
>>>> Signed-off-by: Kishon Vijay Abraham I <kishon at ti.com>
>>>> ---
>>>>  drivers/usb/gadget/composite.c | 3 +--
>>>>  drivers/usb/gadget/g_dnl.c     | 1 +
>>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>>>> index 7bd2562..60ca9a5 100644
>>>> --- a/drivers/usb/gadget/composite.c
>>>> +++ b/drivers/usb/gadget/composite.c
>>>> @@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev,
>>>>  	} else
>>>>  		result = 0;
>>>>  
>>>> -	debug("%s: %s speed config #%d: %s\n", __func__,
>>>> +	printf("%s: %s speed config #%d: %s\n", __func__,
>>>
>>> this looks like it's only needed for debugging. No strong feelings
>>> though
>>
>> yeah.. it helps to know if the device has been enumerated.
>>>
>>>> @@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)
>>>>  
>>>>  	memcpy(&cdev->desc, composite->dev,
>>>>  	       sizeof(struct usb_device_descriptor));
>>>> -	cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
>>>
>>> why are you dropping this line ?
>>
>> Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size
>> to 512 and if the device is operating at hight speed, the
>> bMaxPacketSize0 field should be 64?
> 
> right, but that's changed on connection done IRQ.
> 
>> If the maxpacket size is set to 512, the host reports Invalid EP0
>> Maxpacket.
> 
> huh ? who broke dwc3 ? connection done happens before we receive the
> first setup packet, how can host complain about anything ?
> 
composite_bind() (where maxpacket is being set) happens much before connection
done interrupt. So it's not dwc3's fault.

Thanks
Kishon


More information about the U-Boot mailing list