aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/atmel_usba_udc.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-01-28 09:57:02 -0500
committerFelipe Balbi <balbi@ti.com>2013-03-18 05:16:57 -0400
commit1bda9df8dd6d39ac369020594c82d3f70f3a4721 (patch)
treeab3e5d151270007ec36b4195ad1e0ade2c54124b /drivers/usb/gadget/atmel_usba_udc.c
parent3be49f38d38a1a2c1cffc61579290c9ba6404446 (diff)
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: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 41518e612808..94aeba84b21e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -489,13 +489,8 @@ request_complete(struct usba_ep *ep, struct usba_request *req, int status)
489 if (req->req.status == -EINPROGRESS) 489 if (req->req.status == -EINPROGRESS)
490 req->req.status = status; 490 req->req.status = status;
491 491
492 if (req->mapped) { 492 if (req->using_dma)
493 dma_unmap_single( 493 usb_gadget_unmap_request(&udc->gadget, &req->req, ep->is_in);
494 &udc->pdev->dev, req->req.dma, req->req.length,
495 ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
496 req->req.dma = DMA_ADDR_INVALID;
497 req->mapped = 0;
498 }
499 494
500 DBG(DBG_GADGET | DBG_REQ, 495 DBG(DBG_GADGET | DBG_REQ,
501 "%s: req %p complete: status %d, actual %u\n", 496 "%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 return NULL; 679 return NULL;
685 680
686 INIT_LIST_HEAD(&req->queue); 681 INIT_LIST_HEAD(&req->queue);
687 req->req.dma = DMA_ADDR_INVALID;
688 682
689 return &req->req; 683 return &req->req;
690} 684}
@@ -717,20 +711,11 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep,
717 return -EINVAL; 711 return -EINVAL;
718 } 712 }
719 713
720 req->using_dma = 1; 714 ret = usb_gadget_map_request(&udc->gadget, &req->req, ep->is_in);
721 715 if (ret)
722 if (req->req.dma == DMA_ADDR_INVALID) { 716 return ret;
723 req->req.dma = dma_map_single(
724 &udc->pdev->dev, req->req.buf, req->req.length,
725 ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
726 req->mapped = 1;
727 } else {
728 dma_sync_single_for_device(
729 &udc->pdev->dev, req->req.dma, req->req.length,
730 ep->is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
731 req->mapped = 0;
732 }
733 717
718 req->using_dma = 1;
734 req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) 719 req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length)
735 | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE 720 | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
736 | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; 721 | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;