Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265120
b: refs/heads/master
c: 27cec2b
h: refs/heads/master
v: v3
  • Loading branch information
Neil Zhang authored and Felipe Balbi committed Oct 13, 2011
1 parent 26a4cff commit 746d2fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 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: 96c2bbb09d0742148a305d7afbdf7c5803fd78c1
refs/heads/master: 27cec2b2f7a4d2394af63a3dc7928975f4c072f4
16 changes: 13 additions & 3 deletions trunk/drivers/usb/gadget/mv_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ static int mv_ep_enable(struct usb_ep *_ep,
u16 max = 0;
u32 bit_pos, epctrlx, direction;
unsigned char zlt = 0, ios = 0, mult = 0;
unsigned long flags;

ep = container_of(_ep, struct mv_ep, ep);
udc = ep->udc;
Expand All @@ -517,9 +518,6 @@ static int mv_ep_enable(struct usb_ep *_ep,
*/
zlt = 1;

/* Get the endpoint queue head address */
dqh = (struct mv_dqh *)ep->dqh;

bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);

/* Check if the Endpoint is Primed */
Expand Down Expand Up @@ -556,6 +554,10 @@ static int mv_ep_enable(struct usb_ep *_ep,
default:
goto en_done;
}

spin_lock_irqsave(&udc->lock, flags);
/* Get the endpoint queue head address */
dqh = ep->dqh;
dqh->max_packet_length = (max << EP_QUEUE_HEAD_MAX_PKT_LEN_POS)
| (mult << EP_QUEUE_HEAD_MULT_POS)
| (zlt ? EP_QUEUE_HEAD_ZLT_SEL : 0)
Expand Down Expand Up @@ -600,6 +602,8 @@ static int mv_ep_enable(struct usb_ep *_ep,
writel(epctrlx, &udc->op_regs->epctrlx[ep->ep_num]);
}

spin_unlock_irqrestore(&udc->lock, flags);

return 0;
en_done:
return -EINVAL;
Expand All @@ -611,6 +615,7 @@ static int mv_ep_disable(struct usb_ep *_ep)
struct mv_ep *ep;
struct mv_dqh *dqh;
u32 bit_pos, epctrlx, direction;
unsigned long flags;

ep = container_of(_ep, struct mv_ep, ep);
if ((_ep == NULL) || !ep->desc)
Expand All @@ -621,6 +626,8 @@ static int mv_ep_disable(struct usb_ep *_ep)
/* Get the endpoint queue head address */
dqh = ep->dqh;

spin_lock_irqsave(&udc->lock, flags);

direction = ep_dir(ep);
bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);

Expand All @@ -639,6 +646,9 @@ static int mv_ep_disable(struct usb_ep *_ep)

ep->desc = NULL;
ep->stopped = 1;

spin_unlock_irqrestore(&udc->lock, flags);

return 0;
}

Expand Down

0 comments on commit 746d2fa

Please sign in to comment.