Skip to content

Commit 158d412

Browse files
author
Feng Mingli
committed
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 <[email protected]>
1 parent 0616f26 commit 158d412

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/usb/dwc_otg_310/dwc_otg_pcd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,11 +2259,14 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t *pcd, void *ep_handle,
22592259
req->sent_zlp = zero;
22602260
req->priv = req_handle;
22612261
req->dw_align_buf = NULL;
2262-
if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable
2263-
&& !GET_CORE_IF(pcd)->dma_desc_enable)
2262+
if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable &&
2263+
!GET_CORE_IF(pcd)->dma_desc_enable) {
22642264
req->dw_align_buf = DWC_DEV_DMA_ALLOC_ATOMIC(buflen,
22652265
&req->
22662266
dw_align_buf_dma);
2267+
if (req->dw_align_buf && ep->dwc_ep.is_in)
2268+
dwc_memcpy(req->dw_align_buf, buf, buflen);
2269+
}
22672270
DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags);
22682271

22692272
/*
@@ -2374,9 +2377,6 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t *pcd, void *ep_handle,
23742377

23752378
/* Setup and start the Transfer */
23762379
if (req->dw_align_buf) {
2377-
if (ep->dwc_ep.is_in)
2378-
dwc_memcpy(req->dw_align_buf,
2379-
buf, buflen);
23802380
ep->dwc_ep.dma_addr =
23812381
req->dw_align_buf_dma;
23822382
ep->dwc_ep.start_xfer_buff =

0 commit comments

Comments
 (0)