From 158d412110dbbd1dd102cab95f9314ab0be2059d Mon Sep 17 00:00:00 2001 From: Feng Mingli Date: Tue, 3 Apr 2018 11:33:53 +0800 Subject: [PATCH] usb: dwc_otg_310: pcd: in ep do memory copy after alloc aligned buffer If more than two consecutive requests queue into in ep, maybe some requests need alloc temporary aligned buffer, only the first request will do memory copy to the aligned buffer, but start_next_request() function missing memory copy, then the transmission of data will be wrong, so do memory copy after alloc aligned buffer right away. TEST=rk3288 use rndis gadget function, Linux PC use this command can't ping: ping IP -s 1473 Change-Id: I1c5339dbb089d8a94d8093baa2a801f54e450267 Signed-off-by: Feng Mingli --- drivers/usb/dwc_otg_310/dwc_otg_pcd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc_otg_310/dwc_otg_pcd.c b/drivers/usb/dwc_otg_310/dwc_otg_pcd.c index 378e29ccfb99..68e97eb9a949 100644 --- a/drivers/usb/dwc_otg_310/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_pcd.c @@ -2259,11 +2259,14 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t *pcd, void *ep_handle, req->sent_zlp = zero; req->priv = req_handle; req->dw_align_buf = NULL; - if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable - && !GET_CORE_IF(pcd)->dma_desc_enable) + if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable && + !GET_CORE_IF(pcd)->dma_desc_enable) { req->dw_align_buf = DWC_DEV_DMA_ALLOC_ATOMIC(buflen, &req-> dw_align_buf_dma); + if (req->dw_align_buf && ep->dwc_ep.is_in) + dwc_memcpy(req->dw_align_buf, buf, buflen); + } DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); /* @@ -2374,9 +2377,6 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t *pcd, void *ep_handle, /* Setup and start the Transfer */ if (req->dw_align_buf) { - if (ep->dwc_ep.is_in) - dwc_memcpy(req->dw_align_buf, - buf, buflen); ep->dwc_ep.dma_addr = req->dw_align_buf_dma; ep->dwc_ep.start_xfer_buff =