Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299409
b: refs/heads/master
c: f79a60b
h: refs/heads/master
i:
  299407: 976f21e
v: v3
  • Loading branch information
Peter Chen authored and Felipe Balbi committed Apr 10, 2012
1 parent c565ccf commit ee2dbe8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 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: c04352a590538123f8c93bd87ef1d4bb9e3a64c7
refs/heads/master: f79a60b8785409f5a77767780315ce6d3ea04a44
25 changes: 16 additions & 9 deletions trunk/drivers/usb/gadget/fsl_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
: (1 << (ep_index(ep)));

/* check if the pipe is empty */
if (!(list_empty(&ep->queue))) {
if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) {
/* Add td to the end */
struct fsl_req *lastreq;
lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
Expand Down Expand Up @@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
return -ENOMEM;
}

/* Update ep0 state */
if ((ep_index(ep) == 0))
udc->ep0_state = DATA_STATE_XMIT;

/* irq handler advances the queue */
if (req != NULL)
list_add_tail(&req->queue, &ep->queue);
Expand Down Expand Up @@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
udc->ep0_dir = USB_DIR_OUT;

ep = &udc->eps[0];
udc->ep0_state = WAIT_FOR_OUT_STATUS;
if (udc->ep0_state != DATA_STATE_XMIT)
udc->ep0_state = WAIT_FOR_OUT_STATUS;

req->ep = ep;
req->req.length = 0;
Expand Down Expand Up @@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,

list_add_tail(&req->queue, &ep->queue);
udc->ep0_state = DATA_STATE_XMIT;
if (ep0_prime_status(udc, EP_DIR_OUT))
ep0stall(udc);

return;
stall:
ep0stall(udc);
Expand Down Expand Up @@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc,
spin_lock(&udc->lock);
udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
? DATA_STATE_XMIT : DATA_STATE_RECV;
/*
* If the data stage is IN, send status prime immediately.
* See 2.0 Spec chapter 8.5.3.3 for detail.
*/
if (udc->ep0_state == DATA_STATE_XMIT)
if (ep0_prime_status(udc, EP_DIR_OUT))
ep0stall(udc);

} else {
/* No data phase, IN status from gadget */
udc->ep0_dir = USB_DIR_IN;
Expand Down Expand Up @@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0,

switch (udc->ep0_state) {
case DATA_STATE_XMIT:
/* receive status phase */
if (ep0_prime_status(udc, EP_DIR_OUT))
ep0stall(udc);
/* already primed at setup_received_irq */
udc->ep0_state = WAIT_FOR_OUT_STATUS;
break;
case DATA_STATE_RECV:
/* send status phase */
Expand Down

0 comments on commit ee2dbe8

Please sign in to comment.