diff options
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hub.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/ehci-q.c | 50 | ||||
-rw-r--r-- | drivers/usb/host/ehci-sched.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/ehci-timer.c | 29 | ||||
-rw-r--r-- | drivers/usb/host/pci-quirks.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hub.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 13 |
8 files changed, 73 insertions, 42 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 09537b2f1002..b416a3fc9959 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -797,6 +797,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
797 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 797 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
798 | set_bit(i, &ehci->resuming_ports); | 798 | set_bit(i, &ehci->resuming_ports); |
799 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 799 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
800 | usb_hcd_start_port_resume(&hcd->self, i); | ||
800 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 801 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
801 | } | 802 | } |
802 | } | 803 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4ccb97c0678f..4d3b294f203e 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -649,7 +649,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
649 | status = STS_PCD; | 649 | status = STS_PCD; |
650 | } | 650 | } |
651 | } | 651 | } |
652 | /* FIXME autosuspend idle root hubs */ | 652 | |
653 | /* If a resume is in progress, make sure it can finish */ | ||
654 | if (ehci->resuming_ports) | ||
655 | mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); | ||
656 | |||
653 | spin_unlock_irqrestore (&ehci->lock, flags); | 657 | spin_unlock_irqrestore (&ehci->lock, flags); |
654 | return status ? retval : 0; | 658 | return status ? retval : 0; |
655 | } | 659 | } |
@@ -851,6 +855,7 @@ static int ehci_hub_control ( | |||
851 | /* resume signaling for 20 msec */ | 855 | /* resume signaling for 20 msec */ |
852 | ehci->reset_done[wIndex] = jiffies | 856 | ehci->reset_done[wIndex] = jiffies |
853 | + msecs_to_jiffies(20); | 857 | + msecs_to_jiffies(20); |
858 | usb_hcd_start_port_resume(&hcd->self, wIndex); | ||
854 | /* check the port again */ | 859 | /* check the port again */ |
855 | mod_timer(&ehci_to_hcd(ehci)->rh_timer, | 860 | mod_timer(&ehci_to_hcd(ehci)->rh_timer, |
856 | ehci->reset_done[wIndex]); | 861 | ehci->reset_done[wIndex]); |
@@ -862,6 +867,7 @@ static int ehci_hub_control ( | |||
862 | clear_bit(wIndex, &ehci->suspended_ports); | 867 | clear_bit(wIndex, &ehci->suspended_ports); |
863 | set_bit(wIndex, &ehci->port_c_suspend); | 868 | set_bit(wIndex, &ehci->port_c_suspend); |
864 | ehci->reset_done[wIndex] = 0; | 869 | ehci->reset_done[wIndex] = 0; |
870 | usb_hcd_end_port_resume(&hcd->self, wIndex); | ||
865 | 871 | ||
866 | /* stop resume signaling */ | 872 | /* stop resume signaling */ |
867 | temp = ehci_readl(ehci, status_reg); | 873 | temp = ehci_readl(ehci, status_reg); |
@@ -950,6 +956,7 @@ static int ehci_hub_control ( | |||
950 | ehci->reset_done[wIndex] = 0; | 956 | ehci->reset_done[wIndex] = 0; |
951 | if (temp & PORT_PE) | 957 | if (temp & PORT_PE) |
952 | set_bit(wIndex, &ehci->port_c_suspend); | 958 | set_bit(wIndex, &ehci->port_c_suspend); |
959 | usb_hcd_end_port_resume(&hcd->self, wIndex); | ||
953 | } | 960 | } |
954 | 961 | ||
955 | if (temp & PORT_OC) | 962 | if (temp & PORT_OC) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 3d989028c836..fd252f0cfb3a 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -1197,17 +1197,26 @@ static void start_iaa_cycle(struct ehci_hcd *ehci, bool nested) | |||
1197 | if (ehci->async_iaa || ehci->async_unlinking) | 1197 | if (ehci->async_iaa || ehci->async_unlinking) |
1198 | return; | 1198 | return; |
1199 | 1199 | ||
1200 | /* Do all the waiting QHs at once */ | ||
1201 | ehci->async_iaa = ehci->async_unlink; | ||
1202 | ehci->async_unlink = NULL; | ||
1203 | |||
1204 | /* If the controller isn't running, we don't have to wait for it */ | 1200 | /* If the controller isn't running, we don't have to wait for it */ |
1205 | if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) { | 1201 | if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) { |
1202 | |||
1203 | /* Do all the waiting QHs */ | ||
1204 | ehci->async_iaa = ehci->async_unlink; | ||
1205 | ehci->async_unlink = NULL; | ||
1206 | |||
1206 | if (!nested) /* Avoid recursion */ | 1207 | if (!nested) /* Avoid recursion */ |
1207 | end_unlink_async(ehci); | 1208 | end_unlink_async(ehci); |
1208 | 1209 | ||
1209 | /* Otherwise start a new IAA cycle */ | 1210 | /* Otherwise start a new IAA cycle */ |
1210 | } else if (likely(ehci->rh_state == EHCI_RH_RUNNING)) { | 1211 | } else if (likely(ehci->rh_state == EHCI_RH_RUNNING)) { |
1212 | struct ehci_qh *qh; | ||
1213 | |||
1214 | /* Do only the first waiting QH (nVidia bug?) */ | ||
1215 | qh = ehci->async_unlink; | ||
1216 | ehci->async_iaa = qh; | ||
1217 | ehci->async_unlink = qh->unlink_next; | ||
1218 | qh->unlink_next = NULL; | ||
1219 | |||
1211 | /* Make sure the unlinks are all visible to the hardware */ | 1220 | /* Make sure the unlinks are all visible to the hardware */ |
1212 | wmb(); | 1221 | wmb(); |
1213 | 1222 | ||
@@ -1255,34 +1264,35 @@ static void end_unlink_async(struct ehci_hcd *ehci) | |||
1255 | } | 1264 | } |
1256 | } | 1265 | } |
1257 | 1266 | ||
1267 | static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh); | ||
1268 | |||
1258 | static void unlink_empty_async(struct ehci_hcd *ehci) | 1269 | static void unlink_empty_async(struct ehci_hcd *ehci) |
1259 | { | 1270 | { |
1260 | struct ehci_qh *qh, *next; | 1271 | struct ehci_qh *qh; |
1261 | bool stopped = (ehci->rh_state < EHCI_RH_RUNNING); | 1272 | struct ehci_qh *qh_to_unlink = NULL; |
1262 | bool check_unlinks_later = false; | 1273 | bool check_unlinks_later = false; |
1274 | int count = 0; | ||
1263 | 1275 | ||
1264 | /* Unlink all the async QHs that have been empty for a timer cycle */ | 1276 | /* Find the last async QH which has been empty for a timer cycle */ |
1265 | next = ehci->async->qh_next.qh; | 1277 | for (qh = ehci->async->qh_next.qh; qh; qh = qh->qh_next.qh) { |
1266 | while (next) { | ||
1267 | qh = next; | ||
1268 | next = qh->qh_next.qh; | ||
1269 | |||
1270 | if (list_empty(&qh->qtd_list) && | 1278 | if (list_empty(&qh->qtd_list) && |
1271 | qh->qh_state == QH_STATE_LINKED) { | 1279 | qh->qh_state == QH_STATE_LINKED) { |
1272 | if (!stopped && qh->unlink_cycle == | 1280 | ++count; |
1273 | ehci->async_unlink_cycle) | 1281 | if (qh->unlink_cycle == ehci->async_unlink_cycle) |
1274 | check_unlinks_later = true; | 1282 | check_unlinks_later = true; |
1275 | else | 1283 | else |
1276 | single_unlink_async(ehci, qh); | 1284 | qh_to_unlink = qh; |
1277 | } | 1285 | } |
1278 | } | 1286 | } |
1279 | 1287 | ||
1280 | /* Start a new IAA cycle if any QHs are waiting for it */ | 1288 | /* If nothing else is being unlinked, unlink the last empty QH */ |
1281 | if (ehci->async_unlink) | 1289 | if (!ehci->async_iaa && !ehci->async_unlink && qh_to_unlink) { |
1282 | start_iaa_cycle(ehci, false); | 1290 | start_unlink_async(ehci, qh_to_unlink); |
1291 | --count; | ||
1292 | } | ||
1283 | 1293 | ||
1284 | /* QHs that haven't been empty for long enough will be handled later */ | 1294 | /* Other QHs will be handled later */ |
1285 | if (check_unlinks_later) { | 1295 | if (count > 0) { |
1286 | ehci_enable_event(ehci, EHCI_HRTIMER_ASYNC_UNLINKS, true); | 1296 | ehci_enable_event(ehci, EHCI_HRTIMER_ASYNC_UNLINKS, true); |
1287 | ++ehci->async_unlink_cycle; | 1297 | ++ehci->async_unlink_cycle; |
1288 | } | 1298 | } |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 69ebee73c0c1..b476daf49f6f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -213,7 +213,7 @@ static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | static const unsigned char | 215 | static const unsigned char |
216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 }; | 216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 }; |
217 | 217 | ||
218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ | 218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ |
219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) | 219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) |
@@ -2212,11 +2212,11 @@ static void scan_isoc(struct ehci_hcd *ehci) | |||
2212 | } | 2212 | } |
2213 | ehci->now_frame = now_frame; | 2213 | ehci->now_frame = now_frame; |
2214 | 2214 | ||
2215 | frame = ehci->last_iso_frame; | ||
2215 | for (;;) { | 2216 | for (;;) { |
2216 | union ehci_shadow q, *q_p; | 2217 | union ehci_shadow q, *q_p; |
2217 | __hc32 type, *hw_p; | 2218 | __hc32 type, *hw_p; |
2218 | 2219 | ||
2219 | frame = ehci->last_iso_frame; | ||
2220 | restart: | 2220 | restart: |
2221 | /* scan each element in frame's queue for completions */ | 2221 | /* scan each element in frame's queue for completions */ |
2222 | q_p = &ehci->pshadow [frame]; | 2222 | q_p = &ehci->pshadow [frame]; |
@@ -2321,6 +2321,9 @@ restart: | |||
2321 | /* Stop when we have reached the current frame */ | 2321 | /* Stop when we have reached the current frame */ |
2322 | if (frame == now_frame) | 2322 | if (frame == now_frame) |
2323 | break; | 2323 | break; |
2324 | ehci->last_iso_frame = (frame + 1) & fmask; | 2324 | |
2325 | /* The last frame may still have active siTDs */ | ||
2326 | ehci->last_iso_frame = frame; | ||
2327 | frame = (frame + 1) & fmask; | ||
2325 | } | 2328 | } |
2326 | } | 2329 | } |
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..f904071d70df 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
@@ -113,14 +113,15 @@ static void ehci_poll_ASS(struct ehci_hcd *ehci) | |||
113 | 113 | ||
114 | if (want != actual) { | 114 | if (want != actual) { |
115 | 115 | ||
116 | /* Poll again later, but give up after about 20 ms */ | 116 | /* Poll again later */ |
117 | if (ehci->ASS_poll_count++ < 20) { | 117 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); |
118 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); | 118 | ++ehci->ASS_poll_count; |
119 | return; | 119 | return; |
120 | } | ||
121 | ehci_dbg(ehci, "Waited too long for the async schedule status (%x/%x), giving up\n", | ||
122 | want, actual); | ||
123 | } | 120 | } |
121 | |||
122 | if (ehci->ASS_poll_count > 20) | ||
123 | ehci_dbg(ehci, "ASS poll count reached %d\n", | ||
124 | ehci->ASS_poll_count); | ||
124 | ehci->ASS_poll_count = 0; | 125 | ehci->ASS_poll_count = 0; |
125 | 126 | ||
126 | /* The status is up-to-date; restart or stop the schedule as needed */ | 127 | /* The status is up-to-date; restart or stop the schedule as needed */ |
@@ -159,14 +160,14 @@ static void ehci_poll_PSS(struct ehci_hcd *ehci) | |||
159 | 160 | ||
160 | if (want != actual) { | 161 | if (want != actual) { |
161 | 162 | ||
162 | /* Poll again later, but give up after about 20 ms */ | 163 | /* Poll again later */ |
163 | if (ehci->PSS_poll_count++ < 20) { | 164 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); |
164 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); | 165 | return; |
165 | return; | ||
166 | } | ||
167 | ehci_dbg(ehci, "Waited too long for the periodic schedule status (%x/%x), giving up\n", | ||
168 | want, actual); | ||
169 | } | 166 | } |
167 | |||
168 | if (ehci->PSS_poll_count > 20) | ||
169 | ehci_dbg(ehci, "PSS poll count reached %d\n", | ||
170 | ehci->PSS_poll_count); | ||
170 | ehci->PSS_poll_count = 0; | 171 | ehci->PSS_poll_count = 0; |
171 | 172 | ||
172 | /* The status is up-to-date; restart or stop the schedule as needed */ | 173 | /* The status is up-to-date; restart or stop the schedule as needed */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index a3b6d7104ae2..4c338ec03a07 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -780,6 +780,7 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev) | |||
780 | "defaulting to EHCI.\n"); | 780 | "defaulting to EHCI.\n"); |
781 | dev_warn(&xhci_pdev->dev, | 781 | dev_warn(&xhci_pdev->dev, |
782 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); | 782 | "USB 3.0 devices will work at USB 2.0 speeds.\n"); |
783 | usb_disable_xhci_ports(xhci_pdev); | ||
783 | return; | 784 | return; |
784 | } | 785 | } |
785 | 786 | ||
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 768d54295a20..15d13229ddbb 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -116,6 +116,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | clear_bit(port, &uhci->resuming_ports); | 118 | clear_bit(port, &uhci->resuming_ports); |
119 | usb_hcd_end_port_resume(&uhci_to_hcd(uhci)->self, port); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | /* Wait for the UHCI controller in HP's iLO2 server management chip. | 122 | /* Wait for the UHCI controller in HP's iLO2 server management chip. |
@@ -167,6 +168,8 @@ static void uhci_check_ports(struct uhci_hcd *uhci) | |||
167 | set_bit(port, &uhci->resuming_ports); | 168 | set_bit(port, &uhci->resuming_ports); |
168 | uhci->ports_timeout = jiffies + | 169 | uhci->ports_timeout = jiffies + |
169 | msecs_to_jiffies(25); | 170 | msecs_to_jiffies(25); |
171 | usb_hcd_start_port_resume( | ||
172 | &uhci_to_hcd(uhci)->self, port); | ||
170 | 173 | ||
171 | /* Make sure we see the port again | 174 | /* Make sure we see the port again |
172 | * after the resuming period is over. */ | 175 | * after the resuming period is over. */ |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 59fb5c677dbe..7f76a49e90d3 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1698,7 +1698,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1698 | faked_port_index + 1); | 1698 | faked_port_index + 1); |
1699 | if (slot_id && xhci->devs[slot_id]) | 1699 | if (slot_id && xhci->devs[slot_id]) |
1700 | xhci_ring_device(xhci, slot_id); | 1700 | xhci_ring_device(xhci, slot_id); |
1701 | if (bus_state->port_remote_wakeup && (1 << faked_port_index)) { | 1701 | if (bus_state->port_remote_wakeup & (1 << faked_port_index)) { |
1702 | bus_state->port_remote_wakeup &= | 1702 | bus_state->port_remote_wakeup &= |
1703 | ~(1 << faked_port_index); | 1703 | ~(1 << faked_port_index); |
1704 | xhci_test_and_clear_bit(xhci, port_array, | 1704 | xhci_test_and_clear_bit(xhci, port_array, |
@@ -2589,6 +2589,8 @@ cleanup: | |||
2589 | (trb_comp_code != COMP_STALL && | 2589 | (trb_comp_code != COMP_STALL && |
2590 | trb_comp_code != COMP_BABBLE)) | 2590 | trb_comp_code != COMP_BABBLE)) |
2591 | xhci_urb_free_priv(xhci, urb_priv); | 2591 | xhci_urb_free_priv(xhci, urb_priv); |
2592 | else | ||
2593 | kfree(urb_priv); | ||
2592 | 2594 | ||
2593 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2595 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
2594 | if ((urb->actual_length != urb->transfer_buffer_length && | 2596 | if ((urb->actual_length != urb->transfer_buffer_length && |
@@ -3108,7 +3110,7 @@ static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, | |||
3108 | * running_total. | 3110 | * running_total. |
3109 | */ | 3111 | */ |
3110 | packets_transferred = (running_total + trb_buff_len) / | 3112 | packets_transferred = (running_total + trb_buff_len) / |
3111 | usb_endpoint_maxp(&urb->ep->desc); | 3113 | GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); |
3112 | 3114 | ||
3113 | if ((total_packet_count - packets_transferred) > 31) | 3115 | if ((total_packet_count - packets_transferred) > 31) |
3114 | return 31 << 17; | 3116 | return 31 << 17; |
@@ -3642,7 +3644,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3642 | td_len = urb->iso_frame_desc[i].length; | 3644 | td_len = urb->iso_frame_desc[i].length; |
3643 | td_remain_len = td_len; | 3645 | td_remain_len = td_len; |
3644 | total_packet_count = DIV_ROUND_UP(td_len, | 3646 | total_packet_count = DIV_ROUND_UP(td_len, |
3645 | usb_endpoint_maxp(&urb->ep->desc)); | 3647 | GET_MAX_PACKET( |
3648 | usb_endpoint_maxp(&urb->ep->desc))); | ||
3646 | /* A zero-length transfer still involves at least one packet. */ | 3649 | /* A zero-length transfer still involves at least one packet. */ |
3647 | if (total_packet_count == 0) | 3650 | if (total_packet_count == 0) |
3648 | total_packet_count++; | 3651 | total_packet_count++; |
@@ -3664,9 +3667,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3664 | td = urb_priv->td[i]; | 3667 | td = urb_priv->td[i]; |
3665 | for (j = 0; j < trbs_per_td; j++) { | 3668 | for (j = 0; j < trbs_per_td; j++) { |
3666 | u32 remainder = 0; | 3669 | u32 remainder = 0; |
3667 | field = TRB_TBC(burst_count) | TRB_TLBPC(residue); | 3670 | field = 0; |
3668 | 3671 | ||
3669 | if (first_trb) { | 3672 | if (first_trb) { |
3673 | field = TRB_TBC(burst_count) | | ||
3674 | TRB_TLBPC(residue); | ||
3670 | /* Queue the isoc TRB */ | 3675 | /* Queue the isoc TRB */ |
3671 | field |= TRB_TYPE(TRB_ISOC); | 3676 | field |= TRB_TYPE(TRB_ISOC); |
3672 | /* Assume URB_ISO_ASAP is set */ | 3677 | /* Assume URB_ISO_ASAP is set */ |