On Tue, May 01, 2012 at 12:18:25PM +0530, Pratyush Anand wrote: > If transfer not ready is received before ep queue is called for control > out transfer then pending flag is set. Handling of this case was not > correct. > TRB size must be max packet for all control out transfer. > dma sync function should also be called before start transfer. > > Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx> > --- > drivers/usb/dwc3/ep0.c | 26 +++++++++++++++++++++++--- > 1 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > index c6c9b8a..ad4062a 100644 > --- a/drivers/usb/dwc3/ep0.c > +++ b/drivers/usb/dwc3/ep0.c > @@ -150,9 +150,29 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, > return 0; > } > > - ret = dwc3_ep0_start_trans(dwc, direction, > - req->request.dma, req->request.length, > - DWC3_TRBCTL_CONTROL_DATA); > + dwc3_map_buffer_to_dma(req); > + > + if (direction) > + ret = dwc3_ep0_start_trans(dwc, direction, > + req->request.dma, req->request.length, > + DWC3_TRBCTL_CONTROL_DATA); > + else { > + WARN_ON(req->request.length > dep->endpoint.maxpacket); > + > + dwc->ep0_bounced = true; this introduces a bug. Not all cases will need bouncing, only wen request.length isn't aligned to wMaxPacketSize. Also, instead of adding all this huge amount of code just to change one simple parameter, you could have something like: unsigned transfer_size = req->request.length; if (transfer_size % dep->endpoint.maxpacket) transfer_size += transfer_size % dep->endpoint.maxpacket; ret = dwc3_ep0_start_trans(dwc, direction, req->request.dma, direction ? req->request.length : transfer_size, DWC3_TRBCTL_CONTROL_DATA); you would be adding much less code. also, you missed braces on the if () branch. -- balbi
Attachment:
signature.asc
Description: Digital signature