Commit 1bda9df8 authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: atmel_usba_udc: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 3be49f38
...@@ -489,13 +489,8 @@ request_complete(struct usba_ep *ep, struct usba_request *req, int status) ...@@ -489,13 +489,8 @@ request_complete(struct usba_ep *ep, struct usba_request *req, int status)
if (req->req.status == -EINPROGRESS) if (req->req.status == -EINPROGRESS)
req->req.status = status; req->req.status = status;
if (req->mapped) { if (req->using_dma)
dma_unmap_single( usb_gadget_unmap_request(&udc->gadget, &req->req, ep->is_in);
&udc->pdev->dev, req->req.dma, req->req.length,
ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->req.dma = DMA_ADDR_INVALID;
req->mapped = 0;
}
DBG(DBG_GADGET | DBG_REQ, DBG(DBG_GADGET | DBG_REQ,
"%s: req %p complete: status %d, actual %u\n", "%s: req %p complete: status %d, actual %u\n",
...@@ -684,7 +679,6 @@ usba_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags) ...@@ -684,7 +679,6 @@ usba_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
return NULL; return NULL;
INIT_LIST_HEAD(&req->queue); INIT_LIST_HEAD(&req->queue);
req->req.dma = DMA_ADDR_INVALID;
return &req->req; return &req->req;
} }
...@@ -717,20 +711,11 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep, ...@@ -717,20 +711,11 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep,
return -EINVAL; return -EINVAL;
} }
req->using_dma = 1; ret = usb_gadget_map_request(&udc->gadget, &req->req, ep->is_in);
if (ret)
if (req->req.dma == DMA_ADDR_INVALID) { return ret;
req->req.dma = dma_map_single(
&udc->pdev->dev, req->req.buf, req->req.length,
ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 1;
} else {
dma_sync_single_for_device(
&udc->pdev->dev, req->req.dma, req->req.length,
ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 0;
}
req->using_dma = 1;
req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length)
| USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
| USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment