Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364569
b: refs/heads/master
c: 5f6da77
h: refs/heads/master
i:
  364567: cf78982
v: v3
  • Loading branch information
Felipe Balbi committed Mar 18, 2013
1 parent 7005a03 commit 2f6d030
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1bda9df8dd6d39ac369020594c82d3f70f3a4721
refs/heads/master: 5f6da778578de6b7c43b943cf9cfba12289e9ff3
51 changes: 13 additions & 38 deletions trunk/drivers/usb/gadget/fsl_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,7 @@ static void done(struct fsl_ep *ep, struct fsl_req *req, int status)
dma_pool_free(udc->td_pool, curr_td, curr_td->td_dma);
}

if (req->mapped) {
dma_unmap_single(ep->udc->gadget.dev.parent,
req->req.dma, req->req.length,
ep_is_in(ep)
? DMA_TO_DEVICE
: DMA_FROM_DEVICE);
req->req.dma = DMA_ADDR_INVALID;
req->mapped = 0;
} else
dma_sync_single_for_cpu(ep->udc->gadget.dev.parent,
req->req.dma, req->req.length,
ep_is_in(ep)
? DMA_TO_DEVICE
: DMA_FROM_DEVICE);
usb_gadget_unmap_request(&ep->udc->gadget, &req->req, ep_is_in(ep));

if (status && (status != -ESHUTDOWN))
VDBG("complete %s req %p stat %d len %u/%u",
Expand Down Expand Up @@ -888,6 +875,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
struct fsl_req *req = container_of(_req, struct fsl_req, req);
struct fsl_udc *udc;
unsigned long flags;
int ret;

/* catch various bogus parameters */
if (!_req || !req->req.complete || !req->req.buf
Expand All @@ -910,22 +898,9 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)

req->ep = ep;

/* map virtual address to hardware */
if (req->req.dma == DMA_ADDR_INVALID) {
req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
req->req.buf,
req->req.length, ep_is_in(ep)
? DMA_TO_DEVICE
: DMA_FROM_DEVICE);
req->mapped = 1;
} else {
dma_sync_single_for_device(ep->udc->gadget.dev.parent,
req->req.dma, req->req.length,
ep_is_in(ep)
? DMA_TO_DEVICE
: DMA_FROM_DEVICE);
req->mapped = 0;
}
ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
if (ret)
return ret;

req->req.status = -EINPROGRESS;
req->req.actual = 0;
Expand Down Expand Up @@ -1290,6 +1265,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
{
struct fsl_req *req = udc->status_req;
struct fsl_ep *ep;
int ret;

if (direction == EP_DIR_IN)
udc->ep0_dir = USB_DIR_IN;
Expand All @@ -1307,10 +1283,9 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
req->req.complete = NULL;
req->dtd_count = 0;

req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
req->req.buf, req->req.length,
ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 1;
ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
if (ret)
return ret;

if (fsl_req_to_dtd(req, GFP_ATOMIC) == 0)
fsl_queue_td(ep, req);
Expand Down Expand Up @@ -1353,6 +1328,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
u16 tmp = 0; /* Status, cpu endian */
struct fsl_req *req;
struct fsl_ep *ep;
int ret;

ep = &udc->eps[0];

Expand Down Expand Up @@ -1390,10 +1366,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
req->req.complete = NULL;
req->dtd_count = 0;

req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
req->req.buf, req->req.length,
ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 1;
ret = usb_gadget_map_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
if (ret)
goto stall;

/* prime the data phase */
if ((fsl_req_to_dtd(req, GFP_ATOMIC) == 0))
Expand Down

0 comments on commit 2f6d030

Please sign in to comment.