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

Lukasz Majewski l.majewski at samsung.com
Wed Aug 20 09:23:04 CEST 2014


Hi Kishon,

> 
> 
> On Monday 18 August 2014 08:26 PM, Lukasz Majewski wrote:
> > Hi Kishon,
> > 
> >>> 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.
> > 
> > It seems like this patch slipped without my attention ...
> > 
> > Hence, I'd like to ask why you must hardcode the packet size here?
> 
> http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section
> 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can
> be  8,16,32,64. And the value we get from gadget is 512. So hard
> coded it.

As fair as I know ep0 MaxPacket for USB 2.0 is up to 64 bytes. This
value here is set in a following way:

./drivers/usb/gadget/composite.c:990:   cdev->desc.bMaxPacketSize0 =
gadget->ep0->maxpacket;

And in my UDC driver .maxpacket = EP0_FIFO_SIZE, for ep0 the max packet
is set to 64B:
s3c_udc_otg.c:782 .maxpacket = EP0_FIFO_SIZE,

So you don't need to hardcode it.

Another issue is how DFU works. It uses ONLY ep0 for transmission (as
it was the requirement for very tiny microcontrollers). 

According to USB 2.0 spec the ep0 MaxPacket size is up to 64B.

Considering above, DFU shall work with USB 3.0 using compliance mode
with USB 2.0. 
For other gadgets - like USB Mass Storage - which use other EPs you
should notice benefit from using USB 3.0.

> 
> Thanks
> Kishon



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list