[PATCH v5 2/2] USB: try MSI before legacy irq on pci xhci HCD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch try to make sure that the USB core allows the xHCI driver to
enable MSI/MSIX before the legacy PCI IRQ. If the MSI/MSIX broken for
the HCD. It will still fall back to legacy PCI IRQ. This change can
avoid a unnecessary request/free legacy PCI IRQ when MSI is workable.

Signed-off-by: Alex Shi <alex.shi@xxxxxxxxx>
---
 drivers/usb/core/hcd.c      |    5 ++---
 drivers/usb/host/xhci-pci.c |   11 +++++------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 52566c6..b3a7920 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2447,9 +2447,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
 			&& device_can_wakeup(&hcd->self.root_hub->dev))
 		dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
 
-	/* enable irqs just before we start the controller. But Intel USB3
-	 * hcd can't do this here on some platform, they will do it in
-	 * following driver->start();
+	/* enable irqs just before we start the controller, except MSI
+	 * first try HCD. That will do it in following driver->start();
 	 */
 	if (usb_hcd_is_primary_hcd(hcd) &&
 			!(hcd->driver->flags & HCD_MSI_FIRST)) {
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index d453cb8..5185ab7 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -55,6 +55,8 @@ static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
 static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 {
 	struct pci_dev		*pdev = to_pci_dev(dev);
+	struct hc_driver	*hcp = (struct hc_driver *) xhci_to_hcd(xhci)
+						->driver;
 
 	/* Look for vendor-specific quirks */
 	if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
@@ -69,6 +71,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		 * capabilities.
 		 */
 		xhci->quirks |= XHCI_BROKEN_MSI;
+		hcp->flags &= ~HCD_MSI_FIRST;
 		xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
 				"has broken MSI implementation\n",
 				pdev->revision);
@@ -137,11 +140,6 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 	driver = (struct hc_driver *)id->driver_data;
 
-	/* stop line IRQ checking in xhci_hcd_pci_probe. */
-	if (dev->vendor == PCI_VENDOR_ID_INTEL &&
-			dev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI)
-		driver->flags |= HCD_MSI_FIRST;
-
 	/* Register the USB 2.0 roothub.
 	 * FIXME: USB core must know to register the USB 2.0 roothub first.
 	 * This is sort of silly, because we could just set the HCD driver flags
@@ -249,7 +247,8 @@ static const struct hc_driver xhci_pci_hc_driver = {
 	 * generic hardware linkage
 	 */
 	.irq =			xhci_irq,
-	.flags =		HCD_MEMORY | HCD_USB3 | HCD_SHARED,
+	.flags =		HCD_MEMORY | HCD_USB3 | HCD_SHARED |
+				HCD_MSI_FIRST,
 
 	/*
 	 * basic lifecycle operations
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux