From 4e6a1ee72b74ce013f0b31063915a58ba7db2f88 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2013 12:42:48 +0100 Subject: xhci: Add quirks module option It makes easier for debugging some hardware specific issues. Note that this option won't override the value to be set. That is, you can turn quirks on by this option but cannot turn them off if set by the driver. Signed-off-by: Takashi Iwai Signed-off-by: Sarah Sharp --- drivers/usb/host/xhci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d68ec1aa473d..6bc966cfb60e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -40,6 +40,10 @@ static int link_quirk; module_param(link_quirk, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB"); +static unsigned int quirks; +module_param(quirks, uint, S_IRUGO); +MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); + /* TODO: copied from ehci-hcd.c - can this be refactored? */ /* * xhci_handshake - spin reading hc until handshake completes or fails @@ -4770,6 +4774,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci->hcc_params = readl(&xhci->cap_regs->hcc_params); xhci_print_registers(xhci); + xhci->quirks = quirks; + get_quirks(dev, xhci); /* In xhci controllers which follow xhci 1.0 spec gives a spurious -- cgit v1.2.3 From 8cf4328569acc37ac5c5b4eb27ae86c3758f627b Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Fri, 13 Dec 2013 13:44:17 -0800 Subject: usbtest: Fix BOS control test for USB 2.01 devices. Commit c952a8ba7136505cd1ca01735cc748ddc08c7d2f "usb: usbtest: add a test case to support bos for queue control" will cause USB 2.01 and USB 2.10 devices with a BOS descriptor to fail case 15 of the control test. The Link PM errata (released in 2007, updated in 2011) says: "The value of the bcdUSB field in the standard USB 2.0 Device Descriptor is used to indicate that the device supports the request to read the BOS Descriptor (i.e. GetDescriptor(BOS)). Devices that support the BOS descriptor must have a bcdUSB value of 0201H or larger." The current code says that non-SuperSpeed devices *must* return -EPIPE, as this comment shows: /* sign of this variable means: * -: tested code must return this (negative) error code * +: tested code may return this (negative too) error code */ int expected = 0; This means the test will fail with USB 2.01 and USB 2.10 devices that provide a BOS descriptor. Change it to only require a stall response if the USB device bcdUSB is less than 2.01. Signed-off-by: Sarah Sharp Acked-by: Huang Rui --- drivers/usb/misc/usbtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index bff058ea222e..446ff55e3c58 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1224,7 +1224,7 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param) len = le16_to_cpu(udev->bos->desc->wTotalLength); else len = sizeof(struct usb_bos_descriptor); - if (udev->speed != USB_SPEED_SUPER) + if (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0201) expected = -EPIPE; break; default: -- cgit v1.2.3 From 599459d8230bd6af9c354e00ad6608c43b6f7426 Mon Sep 17 00:00:00 2001 From: Lin Wang Date: Tue, 17 Dec 2013 17:59:54 +0000 Subject: xhci: Remove unused variable 'addr' in inc_deq() and inc_enq(). This patch remove unused variable 'addr' in inc_deq() and inc_enq(). Signed-off-by: Lin Wang Signed-off-by: Sarah Sharp --- drivers/usb/host/xhci-ring.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d26cd9474aa6..afa28ce8e591 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -156,8 +156,6 @@ static void next_trb(struct xhci_hcd *xhci, */ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) { - unsigned long long addr; - ring->deq_updates++; /* @@ -186,8 +184,6 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) ring->dequeue++; } } while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)); - - addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); } /* @@ -212,7 +208,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, { u32 chain; union xhci_trb *next; - unsigned long long addr; chain = le32_to_cpu(ring->enqueue->generic.field[3]) & TRB_CHAIN; /* If this is not event ring, there is one less usable TRB */ @@ -264,7 +259,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, ring->enqueue = ring->enq_seg->trbs; next = ring->enqueue; } - addr = (unsigned long long) xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue); } /* -- cgit v1.2.3 From 9005355af23856c55a5538c9024355785424821b Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Fri, 15 Nov 2013 14:53:14 -0800 Subject: usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix() If CONFIG_PCI is enabled, make sure xhci_cleanup_msix() doesn't try to free a bogus PCI IRQ or dereference an invalid pci_dev when the xHCI device is actually a platform_device. This patch should be backported to kernels as old as 3.9, that contain the commit 52fb61250a7a132b0cfb9f4a1060a1f3c49e5a25 "xhci-plat: Don't enable legacy PCI interrupts." Signed-off-by: Jack Pham Signed-off-by: Sarah Sharp Cc: stable@vger.kernel.org --- drivers/usb/host/xhci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6bc966cfb60e..f8ffc512faf1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -325,6 +325,9 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) struct usb_hcd *hcd = xhci_to_hcd(xhci); struct pci_dev *pdev = to_pci_dev(hcd->self.controller); + if (xhci->quirks & XHCI_PLAT) + return; + xhci_free_irq(xhci); if (xhci->msix_entries) { -- cgit v1.2.3