Hi Pratyush, > Hi Anton, > > On Wed, Dec 18, 2013 at 12:11:33PM +0800, Felipe Balbi wrote: > > Hi, > > > > On Tue, Dec 17, 2013 at 03:59:31PM +0900, Anton Tikhomirov wrote: > > > In accordance with specification, when sent data length is > > > > please mention section of specification. > > > > > an exact multiple of wMaxPacketSize for the pipe and less > > > than requested by host, the function shall return a zero-length > > > packet (ZLP) to indicate the end of the Data stage to a USB host. > > > > hmm... so in USB3 mode that would be host requesting 513 bytes and us > > sending only 512. > > Curious, what was the use case when you encountered above situation? Please read my reply to Felipe. > > Wouldn't something simple as follows be able to resolve it? > > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > index 95f7649..8b419aa 100644 > --- a/drivers/usb/dwc3/ep0.c > +++ b/drivers/usb/dwc3/ep0.c > @@ -924,6 +924,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 > *dwc, > > ret = dwc3_ep0_start_trans(dwc, dep->number, req- > >request.dma, > req->request.length, DWC3_TRBCTL_CONTROL_DATA); > + if (req->zero && !ret) > + ret = dwc3_ep0_start_trans(dwc, dep->number, > + dwc->ctrl_req_addr, 0, > + DWC3_TRBCTL_CONTROL_DATA); No. Second call to dwc3_ep0_start_trans() modifies EP0 TRB which is already owned by the core. More correct solution here is to use second zero-length TRB for ZLP. > } > > WARN_ON(ret < 0); > > Regards > Pratyush By the way, chaining additional (auxiliary) TRB would allow complying with Buffer Size Rule on _UDC_driver_level_ for any type of OUT endpoints, when total size of a Buffer Descriptor must be a multiple of MaxPacketSize: rem = request_length % MaxPacketSize general TRB size = request_length (CHN = 1) aux TRB size = MaxPacketSize - rem (CHN = 0) Buffer for aux TRBs can be allocated at initialization time and used when necessary. Thank you -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html