On Fri, May 04, 2012 at 04:06:22PM +0530, Pratyush Anand wrote: > On 5/4/2012 3:15 PM, Felipe Balbi wrote: > >On Thu, May 03, 2012 at 07:05:05PM +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 multiple of maxpacket for all control out transfer. > >>dma sync function should also be called before start transfer. > >> > >>A routine to delegate transfer for control data has been extracted out > >>from dwc3_ep0_do_control_data. Same routine has been called from > >>ep_queue too in case of pending flag is set. > >> > >>Signed-off-by: Pratyush Anand<pratyush.anand@xxxxxx> > >>Signed-off-by: Felipe Balbi<balbi@xxxxxx> > >>--- > >> drivers/usb/dwc3/ep0.c | 90 +++++++++++++++++++++++++---------------------- > >> 1 files changed, 48 insertions(+), 42 deletions(-) > >> > >>diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > >>index 1f917d9..f0c5f85 100644 > >>--- a/drivers/usb/dwc3/ep0.c > >>+++ b/drivers/usb/dwc3/ep0.c > >>@@ -119,6 +119,49 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, > >> return 0; > >> } > >> > >>+static int dwc3_ep0_start_data_trans(struct dwc3 *dwc, > >>+ struct dwc3_request *req) > >>+{ > >>+ u32 transfer_size = req->request.length; > >>+ struct dwc3_ep *dep = dwc->eps[0]; > > > >you can't hardcode this to ep0. Physical endpoint 0 is *ONLY* for OUT > >direction. physical endpoint 1 is *ONLY* for in direction. > > But , If I see original dwc3_ep0_do_control_data, then it does hard > code to ep0. no, it does not. It starts the transfer with event->endpoint_number, which contains the physical number. dep is hardcoded to ep0, but solely because we only queue request on ep0 list. BTW, assuming req->direction contains the endpoint number isn't the best way to go. It will work for ep0/1, of course, but only as long as we don't change that flag to anything else. It's best to use event->endpoint_number or dep->number, as I did on the version I just sent. -- balbi
Attachment:
signature.asc
Description: Digital signature