aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-platform.c4
-rw-r--r--drivers/usb/host/r8a66597-hcd.c6
-rw-r--r--drivers/usb/host/xhci-hub.c2
-rw-r--r--drivers/usb/host/xhci-mem.c11
-rw-r--r--drivers/usb/host/xhci-pci.c7
-rw-r--r--drivers/usb/host/xhci-plat.c2
-rw-r--r--drivers/usb/host/xhci-ring.c20
-rw-r--r--drivers/usb/host/xhci.c13
8 files changed, 36 insertions, 29 deletions
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index bc7b9be12f54..f1908ea9fbd8 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -384,8 +384,10 @@ static int ehci_platform_resume(struct device *dev)
384 } 384 }
385 385
386 companion_dev = usb_of_get_companion_dev(hcd->self.controller); 386 companion_dev = usb_of_get_companion_dev(hcd->self.controller);
387 if (companion_dev) 387 if (companion_dev) {
388 device_pm_wait_for_dev(hcd->self.controller, companion_dev); 388 device_pm_wait_for_dev(hcd->self.controller, companion_dev);
389 put_device(companion_dev);
390 }
389 391
390 ehci_resume(hcd, priv->reset_on_resume); 392 ehci_resume(hcd, priv->reset_on_resume);
391 return 0; 393 return 0;
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index bfa7fa3d2eea..7bf78be1fd32 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -1269,7 +1269,7 @@ static void set_td_timer(struct r8a66597 *r8a66597, struct r8a66597_td *td)
1269 time = 30; 1269 time = 30;
1270 break; 1270 break;
1271 default: 1271 default:
1272 time = 300; 1272 time = 50;
1273 break; 1273 break;
1274 } 1274 }
1275 1275
@@ -1785,6 +1785,7 @@ static void r8a66597_td_timer(unsigned long _r8a66597)
1785 pipe = td->pipe; 1785 pipe = td->pipe;
1786 pipe_stop(r8a66597, pipe); 1786 pipe_stop(r8a66597, pipe);
1787 1787
1788 /* Select a different address or endpoint */
1788 new_td = td; 1789 new_td = td;
1789 do { 1790 do {
1790 list_move_tail(&new_td->queue, 1791 list_move_tail(&new_td->queue,
@@ -1794,7 +1795,8 @@ static void r8a66597_td_timer(unsigned long _r8a66597)
1794 new_td = td; 1795 new_td = td;
1795 break; 1796 break;
1796 } 1797 }
1797 } while (td != new_td && td->address == new_td->address); 1798 } while (td != new_td && td->address == new_td->address &&
1799 td->pipe->info.epnum == new_td->pipe->info.epnum);
1798 1800
1799 start_transfer(r8a66597, new_td); 1801 start_transfer(r8a66597, new_td);
1800 1802
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 5e3e9d4c6956..0dde49c35dd2 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -419,7 +419,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
419 wait_for_completion(cmd->completion); 419 wait_for_completion(cmd->completion);
420 420
421 if (cmd->status == COMP_COMMAND_ABORTED || 421 if (cmd->status == COMP_COMMAND_ABORTED ||
422 cmd->status == COMP_STOPPED) { 422 cmd->status == COMP_COMMAND_RING_STOPPED) {
423 xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); 423 xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");
424 ret = -ETIME; 424 ret = -ETIME;
425 } 425 }
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index bbe22bcc550a..1f1687e888d6 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -56,7 +56,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci,
56 } 56 }
57 57
58 if (max_packet) { 58 if (max_packet) {
59 seg->bounce_buf = kzalloc(max_packet, flags | GFP_DMA); 59 seg->bounce_buf = kzalloc(max_packet, flags);
60 if (!seg->bounce_buf) { 60 if (!seg->bounce_buf) {
61 dma_pool_free(xhci->segment_pool, seg->trbs, dma); 61 dma_pool_free(xhci->segment_pool, seg->trbs, dma);
62 kfree(seg); 62 kfree(seg);
@@ -1724,7 +1724,7 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
1724 xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); 1724 xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma);
1725 for (i = 0; i < num_sp; i++) { 1725 for (i = 0; i < num_sp; i++) {
1726 dma_addr_t dma; 1726 dma_addr_t dma;
1727 void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, 1727 void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma,
1728 flags); 1728 flags);
1729 if (!buf) 1729 if (!buf)
1730 goto fail_sp4; 1730 goto fail_sp4;
@@ -2307,10 +2307,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
2307 /* Place limits on the number of roothub ports so that the hub 2307 /* Place limits on the number of roothub ports so that the hub
2308 * descriptors aren't longer than the USB core will allocate. 2308 * descriptors aren't longer than the USB core will allocate.
2309 */ 2309 */
2310 if (xhci->num_usb3_ports > 15) { 2310 if (xhci->num_usb3_ports > USB_SS_MAXPORTS) {
2311 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 2311 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
2312 "Limiting USB 3.0 roothub ports to 15."); 2312 "Limiting USB 3.0 roothub ports to %u.",
2313 xhci->num_usb3_ports = 15; 2313 USB_SS_MAXPORTS);
2314 xhci->num_usb3_ports = USB_SS_MAXPORTS;
2314 } 2315 }
2315 if (xhci->num_usb2_ports > USB_MAXCHILDREN) { 2316 if (xhci->num_usb2_ports > USB_MAXCHILDREN) {
2316 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 2317 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7b86508ac8cf..fcf1f3f63e7a 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -52,6 +52,7 @@
52#define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 52#define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8
53#define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 53#define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8
54#define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 54#define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8
55#define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0
55 56
56static const char hcd_name[] = "xhci_hcd"; 57static const char hcd_name[] = "xhci_hcd";
57 58
@@ -166,7 +167,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
166 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 167 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
167 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || 168 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI ||
168 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || 169 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI ||
169 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) { 170 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI ||
171 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) {
170 xhci->quirks |= XHCI_PME_STUCK_QUIRK; 172 xhci->quirks |= XHCI_PME_STUCK_QUIRK;
171 } 173 }
172 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 174 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
@@ -175,7 +177,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
175 } 177 }
176 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 178 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
177 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 179 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
178 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) 180 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI ||
181 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
179 xhci->quirks |= XHCI_MISSING_CAS; 182 xhci->quirks |= XHCI_MISSING_CAS;
180 183
181 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 184 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 7c2a9e7c8e0f..c04144b25a67 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -177,7 +177,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
177 177
178 irq = platform_get_irq(pdev, 0); 178 irq = platform_get_irq(pdev, 0);
179 if (irq < 0) 179 if (irq < 0)
180 return -ENODEV; 180 return irq;
181 181
182 /* 182 /*
183 * sysdev must point to a device that is known to the system firmware 183 * sysdev must point to a device that is known to the system firmware
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 74bf5c60a260..03f63f50afb6 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -323,7 +323,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
323 if (i_cmd->status != COMP_COMMAND_ABORTED) 323 if (i_cmd->status != COMP_COMMAND_ABORTED)
324 continue; 324 continue;
325 325
326 i_cmd->status = COMP_STOPPED; 326 i_cmd->status = COMP_COMMAND_RING_STOPPED;
327 327
328 xhci_dbg(xhci, "Turn aborted command %p to no-op\n", 328 xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
329 i_cmd->command_trb); 329 i_cmd->command_trb);
@@ -641,8 +641,8 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
641 xhci_urb_free_priv(urb_priv); 641 xhci_urb_free_priv(urb_priv);
642 usb_hcd_unlink_urb_from_ep(hcd, urb); 642 usb_hcd_unlink_urb_from_ep(hcd, urb);
643 spin_unlock(&xhci->lock); 643 spin_unlock(&xhci->lock);
644 usb_hcd_giveback_urb(hcd, urb, status);
645 trace_xhci_urb_giveback(urb); 644 trace_xhci_urb_giveback(urb);
645 usb_hcd_giveback_urb(hcd, urb, status);
646 spin_lock(&xhci->lock); 646 spin_lock(&xhci->lock);
647} 647}
648 648
@@ -1380,7 +1380,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1380 cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); 1380 cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status));
1381 1381
1382 /* If CMD ring stopped we own the trbs between enqueue and dequeue */ 1382 /* If CMD ring stopped we own the trbs between enqueue and dequeue */
1383 if (cmd_comp_code == COMP_STOPPED) { 1383 if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) {
1384 complete_all(&xhci->cmd_ring_stop_completion); 1384 complete_all(&xhci->cmd_ring_stop_completion);
1385 return; 1385 return;
1386 } 1386 }
@@ -1436,8 +1436,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1436 break; 1436 break;
1437 case TRB_CMD_NOOP: 1437 case TRB_CMD_NOOP:
1438 /* Is this an aborted command turned to NO-OP? */ 1438 /* Is this an aborted command turned to NO-OP? */
1439 if (cmd->status == COMP_STOPPED) 1439 if (cmd->status == COMP_COMMAND_RING_STOPPED)
1440 cmd_comp_code = COMP_STOPPED; 1440 cmd_comp_code = COMP_COMMAND_RING_STOPPED;
1441 break; 1441 break;
1442 case TRB_RESET_EP: 1442 case TRB_RESET_EP:
1443 WARN_ON(slot_id != TRB_TO_SLOT_ID( 1443 WARN_ON(slot_id != TRB_TO_SLOT_ID(
@@ -2677,11 +2677,12 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
2677 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 2677 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
2678 union xhci_trb *event_ring_deq; 2678 union xhci_trb *event_ring_deq;
2679 irqreturn_t ret = IRQ_NONE; 2679 irqreturn_t ret = IRQ_NONE;
2680 unsigned long flags;
2680 dma_addr_t deq; 2681 dma_addr_t deq;
2681 u64 temp_64; 2682 u64 temp_64;
2682 u32 status; 2683 u32 status;
2683 2684
2684 spin_lock(&xhci->lock); 2685 spin_lock_irqsave(&xhci->lock, flags);
2685 /* Check if the xHC generated the interrupt, or the irq is shared */ 2686 /* Check if the xHC generated the interrupt, or the irq is shared */
2686 status = readl(&xhci->op_regs->status); 2687 status = readl(&xhci->op_regs->status);
2687 if (status == ~(u32)0) { 2688 if (status == ~(u32)0) {
@@ -2707,12 +2708,9 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
2707 */ 2708 */
2708 status |= STS_EINT; 2709 status |= STS_EINT;
2709 writel(status, &xhci->op_regs->status); 2710 writel(status, &xhci->op_regs->status);
2710 /* FIXME when MSI-X is supported and there are multiple vectors */
2711 /* Clear the MSI-X event interrupt status */
2712 2711
2713 if (hcd->irq) { 2712 if (!hcd->msi_enabled) {
2714 u32 irq_pending; 2713 u32 irq_pending;
2715 /* Acknowledge the PCI interrupt */
2716 irq_pending = readl(&xhci->ir_set->irq_pending); 2714 irq_pending = readl(&xhci->ir_set->irq_pending);
2717 irq_pending |= IMAN_IP; 2715 irq_pending |= IMAN_IP;
2718 writel(irq_pending, &xhci->ir_set->irq_pending); 2716 writel(irq_pending, &xhci->ir_set->irq_pending);
@@ -2757,7 +2755,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
2757 ret = IRQ_HANDLED; 2755 ret = IRQ_HANDLED;
2758 2756
2759out: 2757out:
2760 spin_unlock(&xhci->lock); 2758 spin_unlock_irqrestore(&xhci->lock, flags);
2761 2759
2762 return ret; 2760 return ret;
2763} 2761}
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 2d1310220832..30f47d92a610 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -359,9 +359,10 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
359 /* fall back to msi*/ 359 /* fall back to msi*/
360 ret = xhci_setup_msi(xhci); 360 ret = xhci_setup_msi(xhci);
361 361
362 if (!ret) 362 if (!ret) {
363 /* hcd->irq is 0, we have MSI */ 363 hcd->msi_enabled = 1;
364 return 0; 364 return 0;
365 }
365 366
366 if (!pdev->irq) { 367 if (!pdev->irq) {
367 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); 368 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");
@@ -1763,7 +1764,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
1763 1764
1764 switch (*cmd_status) { 1765 switch (*cmd_status) {
1765 case COMP_COMMAND_ABORTED: 1766 case COMP_COMMAND_ABORTED:
1766 case COMP_STOPPED: 1767 case COMP_COMMAND_RING_STOPPED:
1767 xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); 1768 xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n");
1768 ret = -ETIME; 1769 ret = -ETIME;
1769 break; 1770 break;
@@ -1813,7 +1814,7 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
1813 1814
1814 switch (*cmd_status) { 1815 switch (*cmd_status) {
1815 case COMP_COMMAND_ABORTED: 1816 case COMP_COMMAND_ABORTED:
1816 case COMP_STOPPED: 1817 case COMP_COMMAND_RING_STOPPED:
1817 xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); 1818 xhci_warn(xhci, "Timeout while waiting for evaluate context command\n");
1818 ret = -ETIME; 1819 ret = -ETIME;
1819 break; 1820 break;
@@ -3432,7 +3433,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd,
3432 ret = reset_device_cmd->status; 3433 ret = reset_device_cmd->status;
3433 switch (ret) { 3434 switch (ret) {
3434 case COMP_COMMAND_ABORTED: 3435 case COMP_COMMAND_ABORTED:
3435 case COMP_STOPPED: 3436 case COMP_COMMAND_RING_STOPPED:
3436 xhci_warn(xhci, "Timeout waiting for reset device command\n"); 3437 xhci_warn(xhci, "Timeout waiting for reset device command\n");
3437 ret = -ETIME; 3438 ret = -ETIME;
3438 goto command_cleanup; 3439 goto command_cleanup;
@@ -3817,7 +3818,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3817 */ 3818 */
3818 switch (command->status) { 3819 switch (command->status) {
3819 case COMP_COMMAND_ABORTED: 3820 case COMP_COMMAND_ABORTED:
3820 case COMP_STOPPED: 3821 case COMP_COMMAND_RING_STOPPED:
3821 xhci_warn(xhci, "Timeout while waiting for setup device command\n"); 3822 xhci_warn(xhci, "Timeout while waiting for setup device command\n");
3822 ret = -ETIME; 3823 ret = -ETIME;
3823 break; 3824 break;