Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118966
b: refs/heads/master
c: 23d15e0
h: refs/heads/master
v: v3
  • Loading branch information
Ajay Kumar Gupta authored and Greg Kroah-Hartman committed Nov 13, 2008
1 parent bcb5429 commit f5bea8f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 38 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: b60c72abdbd44ed2a63fa80455d0b7f18ce76d2b
refs/heads/master: 23d15e070c2fe5d341ca04275f6ea1b5a5fcb26f
82 changes: 45 additions & 37 deletions trunk/drivers/usb/musb/musb_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,19 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)

switch (qh->type) {

case USB_ENDPOINT_XFER_CONTROL:
case USB_ENDPOINT_XFER_BULK:
/* fifo policy for these lists, except that NAKing
* should rotate a qh to the end (for fairness).
*/
if (qh->mux == 1) {
head = qh->ring.prev;
list_del(&qh->ring);
kfree(qh);
qh = first_qh(head);
break;
}

case USB_ENDPOINT_XFER_ISOC:
case USB_ENDPOINT_XFER_INT:
/* this is where periodic bandwidth should be
Expand All @@ -388,17 +401,6 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
kfree(qh);
qh = NULL;
break;

case USB_ENDPOINT_XFER_CONTROL:
case USB_ENDPOINT_XFER_BULK:
/* fifo policy for these lists, except that NAKing
* should rotate a qh to the end (for fairness).
*/
head = qh->ring.prev;
list_del(&qh->ring);
kfree(qh);
qh = first_qh(head);
break;
}
}
return qh;
Expand Down Expand Up @@ -1708,22 +1710,9 @@ static int musb_schedule(
struct list_head *head = NULL;

/* use fixed hardware for control and bulk */
switch (qh->type) {
case USB_ENDPOINT_XFER_CONTROL:
if (qh->type == USB_ENDPOINT_XFER_CONTROL) {
head = &musb->control;
hw_ep = musb->control_ep;
break;
case USB_ENDPOINT_XFER_BULK:
hw_ep = musb->bulk_ep;
if (is_in)
head = &musb->in_bulk;
else
head = &musb->out_bulk;
break;
}
if (head) {
idle = list_empty(head);
list_add_tail(&qh->ring, head);
goto success;
}

Expand Down Expand Up @@ -1762,19 +1751,34 @@ static int musb_schedule(
else
diff = hw_ep->max_packet_sz_tx - qh->maxpacket;

if (diff > 0 && best_diff > diff) {
if (diff >= 0 && best_diff > diff) {
best_diff = diff;
best_end = epnum;
}
}
if (best_end < 0)
/* use bulk reserved ep1 if no other ep is free */
if (best_end > 0 && qh->type == USB_ENDPOINT_XFER_BULK) {
hw_ep = musb->bulk_ep;
if (is_in)
head = &musb->in_bulk;
else
head = &musb->out_bulk;
goto success;
} else if (best_end < 0) {
return -ENOSPC;
}

idle = 1;
qh->mux = 0;
hw_ep = musb->endpoints + best_end;
musb->periodic[best_end] = qh;
DBG(4, "qh %p periodic slot %d\n", qh, best_end);
success:
if (head) {
idle = list_empty(head);
list_add_tail(&qh->ring, head);
qh->mux = 1;
}
qh->hw_ep = hw_ep;
qh->hep->hcpriv = qh;
if (idle)
Expand Down Expand Up @@ -2052,11 +2056,13 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
sched = &musb->control;
break;
case USB_ENDPOINT_XFER_BULK:
if (usb_pipein(urb->pipe))
sched = &musb->in_bulk;
else
sched = &musb->out_bulk;
break;
if (qh->mux == 1) {
if (usb_pipein(urb->pipe))
sched = &musb->in_bulk;
else
sched = &musb->out_bulk;
break;
}
default:
/* REVISIT when we get a schedule tree, periodic
* transfers won't always be at the head of a
Expand Down Expand Up @@ -2104,11 +2110,13 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
sched = &musb->control;
break;
case USB_ENDPOINT_XFER_BULK:
if (is_in)
sched = &musb->in_bulk;
else
sched = &musb->out_bulk;
break;
if (qh->mux == 1) {
if (is_in)
sched = &musb->in_bulk;
else
sched = &musb->out_bulk;
break;
}
default:
/* REVISIT when we get a schedule tree, periodic transfers
* won't always be at the head of a singleton queue...
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/usb/musb/musb_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct musb_qh {

struct list_head ring; /* of musb_qh */
/* struct musb_qh *next; */ /* for periodic tree */
u8 mux; /* qh multiplexed to hw_ep */

unsigned offset; /* in urb->transfer_buffer */
unsigned segsize; /* current xfer fragment */
Expand Down

0 comments on commit f5bea8f

Please sign in to comment.