aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ohci-pxa27x.c7
-rw-r--r--drivers/usb/host/xhci-dbg.c8
-rw-r--r--drivers/usb/host/xhci-mem.c14
-rw-r--r--drivers/usb/host/xhci-pci.c14
-rw-r--r--drivers/usb/host/xhci-ring.c2
-rw-r--r--drivers/usb/host/xhci.c18
-rw-r--r--drivers/usb/host/xhci.h6
7 files changed, 56 insertions, 13 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index afef7b0a4195..80be5472783a 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -312,8 +312,10 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
312 return PTR_ERR(usb_clk); 312 return PTR_ERR(usb_clk);
313 313
314 hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); 314 hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");
315 if (!hcd) 315 if (!hcd) {
316 return -ENOMEM; 316 retval = -ENOMEM;
317 goto err0;
318 }
317 319
318 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 320 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
319 if (!r) { 321 if (!r) {
@@ -368,6 +370,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
368 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 370 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
369 err1: 371 err1:
370 usb_put_hcd(hcd); 372 usb_put_hcd(hcd);
373 err0:
371 clk_put(usb_clk); 374 clk_put(usb_clk);
372 return retval; 375 return retval;
373} 376}
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index 17d3e359ca62..e9b0f043455d 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -438,13 +438,13 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci,
438 struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx); 438 struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
439 439
440 switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) { 440 switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) {
441 case 0: 441 case SLOT_STATE_ENABLED:
442 return "enabled/disabled"; 442 return "enabled/disabled";
443 case 1: 443 case SLOT_STATE_DEFAULT:
444 return "default"; 444 return "default";
445 case 2: 445 case SLOT_STATE_ADDRESSED:
446 return "addressed"; 446 return "addressed";
447 case 3: 447 case SLOT_STATE_CONFIGURED:
448 return "configured"; 448 return "configured";
449 default: 449 default:
450 return "reserved"; 450 return "reserved";
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 596d8fbb9e18..1370db808fc6 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -985,9 +985,19 @@ static unsigned int xhci_parse_exponent_interval(struct usb_device *udev,
985 interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; 985 interval = clamp_val(ep->desc.bInterval, 1, 16) - 1;
986 if (interval != ep->desc.bInterval - 1) 986 if (interval != ep->desc.bInterval - 1)
987 dev_warn(&udev->dev, 987 dev_warn(&udev->dev,
988 "ep %#x - rounding interval to %d microframes\n", 988 "ep %#x - rounding interval to %d %sframes\n",
989 ep->desc.bEndpointAddress, 989 ep->desc.bEndpointAddress,
990 1 << interval); 990 1 << interval,
991 udev->speed == USB_SPEED_FULL ? "" : "micro");
992
993 if (udev->speed == USB_SPEED_FULL) {
994 /*
995 * Full speed isoc endpoints specify interval in frames,
996 * not microframes. We are using microframes everywhere,
997 * so adjust accordingly.
998 */
999 interval += 3; /* 1 frame = 2^3 uframes */
1000 }
991 1001
992 return interval; 1002 return interval;
993} 1003}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c408e9f6a707..17541d09eabb 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -106,12 +106,22 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
106 106
107 /* Look for vendor-specific quirks */ 107 /* Look for vendor-specific quirks */
108 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && 108 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
109 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && 109 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) {
110 pdev->revision == 0x0) { 110 if (pdev->revision == 0x0) {
111 xhci->quirks |= XHCI_RESET_EP_QUIRK; 111 xhci->quirks |= XHCI_RESET_EP_QUIRK;
112 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" 112 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
113 " endpoint cmd after reset endpoint\n"); 113 " endpoint cmd after reset endpoint\n");
114 }
115 /* Fresco Logic confirms: all revisions of this chip do not
116 * support MSI, even though some of them claim to in their PCI
117 * capabilities.
118 */
119 xhci->quirks |= XHCI_BROKEN_MSI;
120 xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
121 "has broken MSI implementation\n",
122 pdev->revision);
114 } 123 }
124
115 if (pdev->vendor == PCI_VENDOR_ID_NEC) 125 if (pdev->vendor == PCI_VENDOR_ID_NEC)
116 xhci->quirks |= XHCI_NEC_HOST; 126 xhci->quirks |= XHCI_NEC_HOST;
117 127
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 4b40e4c95f94..e5530181baa3 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1778,7 +1778,7 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1778 struct usb_iso_packet_descriptor *frame; 1778 struct usb_iso_packet_descriptor *frame;
1779 int idx; 1779 int idx;
1780 1780
1781 ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); 1781 ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
1782 urb_priv = td->urb->hcpriv; 1782 urb_priv = td->urb->hcpriv;
1783 idx = urb_priv->td_cnt; 1783 idx = urb_priv->td_cnt;
1784 frame = &td->urb->iso_frame_desc[idx]; 1784 frame = &td->urb->iso_frame_desc[idx];
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 743cf80debb1..d0a65401670b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -430,12 +430,19 @@ int xhci_run(struct usb_hcd *hcd)
430 free_irq(hcd->irq, hcd); 430 free_irq(hcd->irq, hcd);
431 hcd->irq = -1; 431 hcd->irq = -1;
432 432
433 /* Some Fresco Logic host controllers advertise MSI, but fail to
434 * generate interrupts. Don't even try to enable MSI.
435 */
436 if (xhci->quirks & XHCI_BROKEN_MSI)
437 goto legacy_irq;
438
433 ret = xhci_setup_msix(xhci); 439 ret = xhci_setup_msix(xhci);
434 if (ret) 440 if (ret)
435 /* fall back to msi*/ 441 /* fall back to msi*/
436 ret = xhci_setup_msi(xhci); 442 ret = xhci_setup_msi(xhci);
437 443
438 if (ret) { 444 if (ret) {
445legacy_irq:
439 /* fall back to legacy interrupt*/ 446 /* fall back to legacy interrupt*/
440 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, 447 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
441 hcd->irq_descr, hcd); 448 hcd->irq_descr, hcd);
@@ -1848,8 +1855,8 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
1848 1855
1849 /* Free any rings that were dropped, but not changed. */ 1856 /* Free any rings that were dropped, but not changed. */
1850 for (i = 1; i < 31; ++i) { 1857 for (i = 1; i < 31; ++i) {
1851 if ((ctrl_ctx->drop_flags & (1 << (i + 1))) && 1858 if ((le32_to_cpu(ctrl_ctx->drop_flags) & (1 << (i + 1))) &&
1852 !(ctrl_ctx->add_flags & (1 << (i + 1)))) 1859 !(le32_to_cpu(ctrl_ctx->add_flags) & (1 << (i + 1))))
1853 xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); 1860 xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i);
1854 } 1861 }
1855 xhci_zero_in_ctx(xhci, virt_dev); 1862 xhci_zero_in_ctx(xhci, virt_dev);
@@ -2466,6 +2473,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2466 struct xhci_command *reset_device_cmd; 2473 struct xhci_command *reset_device_cmd;
2467 int timeleft; 2474 int timeleft;
2468 int last_freed_endpoint; 2475 int last_freed_endpoint;
2476 struct xhci_slot_ctx *slot_ctx;
2469 2477
2470 ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__); 2478 ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__);
2471 if (ret <= 0) 2479 if (ret <= 0)
@@ -2498,6 +2506,12 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2498 return -EINVAL; 2506 return -EINVAL;
2499 } 2507 }
2500 2508
2509 /* If device is not setup, there is no point in resetting it */
2510 slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx);
2511 if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) ==
2512 SLOT_STATE_DISABLED)
2513 return 0;
2514
2501 xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id); 2515 xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id);
2502 /* Allocate the command structure that holds the struct completion. 2516 /* Allocate the command structure that holds the struct completion.
2503 * Assume we're in process context, since the normal device reset 2517 * Assume we're in process context, since the normal device reset
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index f9098a24d38b..a2cc76741695 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -560,6 +560,11 @@ struct xhci_slot_ctx {
560#define SLOT_STATE (0x1f << 27) 560#define SLOT_STATE (0x1f << 27)
561#define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27) 561#define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27)
562 562
563#define SLOT_STATE_DISABLED 0
564#define SLOT_STATE_ENABLED SLOT_STATE_DISABLED
565#define SLOT_STATE_DEFAULT 1
566#define SLOT_STATE_ADDRESSED 2
567#define SLOT_STATE_CONFIGURED 3
563 568
564/** 569/**
565 * struct xhci_ep_ctx 570 * struct xhci_ep_ctx
@@ -1309,6 +1314,7 @@ struct xhci_hcd {
1309 * commands. 1314 * commands.
1310 */ 1315 */
1311#define XHCI_EP_LIMIT_QUIRK (1 << 5) 1316#define XHCI_EP_LIMIT_QUIRK (1 << 5)
1317#define XHCI_BROKEN_MSI (1 << 6)
1312 unsigned int num_active_eps; 1318 unsigned int num_active_eps;
1313 unsigned int limit_active_eps; 1319 unsigned int limit_active_eps;
1314 /* There are two roothubs to keep track of bus suspend info for */ 1320 /* There are two roothubs to keep track of bus suspend info for */