summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2011-12-19 09:27:18 +0800
committerJason Liu <r64343@freescale.com>2012-01-09 21:12:13 +0800
commitfad8121594fdac7783ecf4dc03a6acb927bc31bb (patch)
tree6da7ad3fd40e7dba001ddb63ee73277c63afea5f /drivers/usb
parent6f787bce83e588be2c472c76224a1a6a2d041fc8 (diff)
ENGR00170530 usb-udc: Some tiny bug fixes
Most of them are from community - Using correct dequeue method - Fix the ISOC_XFER condition judgement - Need to wmb before prime - Fix some conditions of udc->max_ep judgement Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'drivers/usb')
-rwxr-xr-xdrivers/usb/gadget/arcotg_udc.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/usb/gadget/arcotg_udc.c b/drivers/usb/gadget/arcotg_udc.c
index 1d48dd57b80e..3e1bd8682a96 100755
--- a/drivers/usb/gadget/arcotg_udc.c
+++ b/drivers/usb/gadget/arcotg_udc.c
@@ -846,6 +846,9 @@ static void update_qh(struct fsl_req *req)
| EP_QUEUE_HEAD_STATUS_HALT));
dQH->size_ioc_int_sts &= temp;
+#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
+ wmb();
+#endif
/* Prime endpoint by writing 1 to ENDPTPRIME */
temp = ep_is_in(ep)
? (1 << (ep_index(ep) + 16))
@@ -1061,7 +1064,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
spin_unlock_irqrestore(&udc->lock, flags);
return -EINVAL;
}
- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
+ if (usb_endpoint_xfer_isoc(ep->desc)) {
if (req->req.length > ep->ep.maxpacket) {
spin_unlock_irqrestore(&udc->lock, flags);
return -EMSGSIZE;
@@ -1168,8 +1171,8 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
next_req = list_entry(req->queue.next, struct fsl_req,
queue);
- /* Point the QH to the first TD of next request */
- fsl_writel((u32) next_req->head, &qh->curr_dtd_ptr);
+ /* prime with dTD of next request */
+ update_qh(next_req);
}
/* The request hasn't been processed, patch up the TD chain */
@@ -1177,9 +1180,10 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
struct fsl_req *prev_req;
prev_req = list_entry(req->queue.prev, struct fsl_req, queue);
- fsl_writel(fsl_readl(&req->tail->next_td_ptr),
- &prev_req->tail->next_td_ptr);
-
+ prev_req->tail->next_td_ptr = req->tail->next_td_ptr;
+ #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
+ wmb();
+ #endif
}
done(ep, req, -ECONNRESET);
@@ -1224,7 +1228,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value)
goto out;
}
- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
+ if (usb_endpoint_xfer_isoc(ep->desc)) {
status = -EOPNOTSUPP;
goto out;
}
@@ -1619,7 +1623,7 @@ static void setup_received_irq(struct fsl_udc *udc,
int pipe = get_pipe_by_windex(wIndex);
struct fsl_ep *ep;
- if (wValue != 0 || wLength != 0 || pipe > udc->max_ep)
+ if (wValue != 0 || wLength != 0 || pipe >= (udc->max_ep / 2))
break;
ep = get_ep_by_pipe(udc, pipe);
@@ -1928,7 +1932,7 @@ static void dtd_complete_irq(struct fsl_udc *udc)
if (!bit_pos)
return;
- for (i = 0; i < udc->max_ep * 2; i++) {
+ for (i = 0; i < udc->max_ep; i++) {
ep_num = i >> 1;
direction = i % 2;