summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ehci-q.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/usb/host/ehci-q.c
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/usb/host/ehci-q.c')
-rw-r--r--drivers/usb/host/ehci-q.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index db05bd8..a7f776a 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -105,9 +105,9 @@ qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd)
is_out = qh->is_out;
epnum = (hc32_to_cpup(ehci, &hw->hw_info1) >> 8) & 0x0f;
- if (unlikely(!usb_gettoggle(qh->ps.udev, epnum, is_out))) {
+ if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) {
hw->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE);
- usb_settoggle(qh->ps.udev, epnum, is_out, 1);
+ usb_settoggle (qh->dev, epnum, is_out, 1);
}
}
@@ -247,6 +247,8 @@ static int qtd_copy_status (
static void
ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status)
+__releases(ehci->lock)
+__acquires(ehci->lock)
{
if (usb_pipetype(urb->pipe) == PIPE_INTERRUPT) {
/* ... update hc-wide periodic stats */
@@ -272,8 +274,11 @@ ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status)
urb->actual_length, urb->transfer_buffer_length);
#endif
+ /* complete() can reenter this HCD */
usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb);
+ spin_unlock (&ehci->lock);
usb_hcd_giveback_urb(ehci_to_hcd(ehci), urb, status);
+ spin_lock (&ehci->lock);
}
static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh);
@@ -797,35 +802,26 @@ qh_make (
* For control/bulk requests, the HC or TT handles these.
*/
if (type == PIPE_INTERRUPT) {
- unsigned tmp;
-
- qh->ps.usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
+ qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH,
is_input, 0,
hb_mult(maxp) * max_packet(maxp)));
- qh->ps.phase = NO_FRAME;
+ qh->start = NO_FRAME;
if (urb->dev->speed == USB_SPEED_HIGH) {
- qh->ps.c_usecs = 0;
+ qh->c_usecs = 0;
qh->gap_uf = 0;
- if (urb->interval > 1 && urb->interval < 8) {
+ qh->period = urb->interval >> 3;
+ if (qh->period == 0 && urb->interval != 1) {
/* NOTE interval 2 or 4 uframes could work.
* But interval 1 scheduling is simpler, and
* includes high bandwidth.
*/
urb->interval = 1;
- } else if (urb->interval > ehci->periodic_size << 3) {
- urb->interval = ehci->periodic_size << 3;
+ } else if (qh->period > ehci->periodic_size) {
+ qh->period = ehci->periodic_size;
+ urb->interval = qh->period << 3;
}
- qh->ps.period = urb->interval >> 3;
-
- /* period for bandwidth allocation */
- tmp = min_t(unsigned, EHCI_BANDWIDTH_SIZE,
- 1 << (urb->ep->desc.bInterval - 1));
-
- /* Allow urb->interval to override */
- qh->ps.bw_uperiod = min_t(unsigned, tmp, urb->interval);
- qh->ps.bw_period = qh->ps.bw_uperiod >> 3;
} else {
int think_time;
@@ -835,35 +831,27 @@ qh_make (
/* FIXME this just approximates SPLIT/CSPLIT times */
if (is_input) { // SPLIT, gap, CSPLIT+DATA
- qh->ps.c_usecs = qh->ps.usecs + HS_USECS(0);
- qh->ps.usecs = HS_USECS(1);
+ qh->c_usecs = qh->usecs + HS_USECS (0);
+ qh->usecs = HS_USECS (1);
} else { // SPLIT+DATA, gap, CSPLIT
- qh->ps.usecs += HS_USECS(1);
- qh->ps.c_usecs = HS_USECS(0);
+ qh->usecs += HS_USECS (1);
+ qh->c_usecs = HS_USECS (0);
}
think_time = tt ? tt->think_time : 0;
- qh->ps.tt_usecs = NS_TO_US(think_time +
+ qh->tt_usecs = NS_TO_US (think_time +
usb_calc_bus_time (urb->dev->speed,
is_input, 0, max_packet (maxp)));
- if (urb->interval > ehci->periodic_size)
- urb->interval = ehci->periodic_size;
- qh->ps.period = urb->interval;
-
- /* period for bandwidth allocation */
- tmp = min_t(unsigned, EHCI_BANDWIDTH_FRAMES,
- urb->ep->desc.bInterval);
- tmp = rounddown_pow_of_two(tmp);
-
- /* Allow urb->interval to override */
- qh->ps.bw_period = min_t(unsigned, tmp, urb->interval);
- qh->ps.bw_uperiod = qh->ps.bw_period << 3;
+ qh->period = urb->interval;
+ if (qh->period > ehci->periodic_size) {
+ qh->period = ehci->periodic_size;
+ urb->interval = qh->period;
+ }
}
}
/* support for tt scheduling, and access to toggles */
- qh->ps.udev = urb->dev;
- qh->ps.ep = urb->ep;
+ qh->dev = urb->dev;
/* using TT? */
switch (urb->dev->speed) {