[PATCH] RFC: Allow to blacklist xhci_hcd module and use ports with EHCI

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

 



From: Holger Hans Peter Freyther <holger@xxxxxxxxxxxxxxxx>

xhci_hcd does not work with the Canon Lide scanners and has issues
with the suspend/resume handling. My Acer Aspire S5 notebook only
exposes USB3.0 ports and the distribution kernels generally have
xhci_hcd enabled and I don't have any USB3.0 hardware either.

I would like be able to add the blacklist rule for xhci_hcd into the
/etc/modprobe.d/usb-blacklist.conf file when using the distribution
kernel and switching back the ports into EHCI mode when unloading the
module. This would allow me to unload the module when needing to
scan some documents.

I have boot tested this on my laptop and the XHCI ports have enumerated
before they were seen by EHCI. So the comment I highlighted might not
apply anymore or could be solved by adding depedencies between XHCI
and EHCI?

usb_enable_intel_xhci_ports is now only called from the xhci_hcd
module so I removed the IS_ENABLED check.
---
 drivers/usb/host/pci-quirks.c | 19 ++++---------------
 drivers/usb/host/xhci-pci.c   |  7 +++++++
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 08ef282..740dd3f 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -747,6 +747,8 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,
  * failed boot when the root file system is on a USB mass storage device and is
  * enumerated under EHCI first.
  *
+ * ^^^ *sigh* anything one can do to have both?
+ *
  * We write into the xHC's PCI configuration space in some Intel-specific
  * registers to switch the ports over.  The USB 3.0 terminations and the USB
  * 2.0 data wires are switched separately.  We want to enable the SuperSpeed
@@ -771,20 +773,6 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev)
 	if (!ehci_found)
 		return;
 
-	/* Don't switchover the ports if the user hasn't compiled the xHCI
-	 * driver.  Otherwise they will see "dead" USB ports that don't power
-	 * the devices.
-	 */
-	if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) {
-		dev_warn(&xhci_pdev->dev,
-				"CONFIG_USB_XHCI_HCD is turned off, "
-				"defaulting to EHCI.\n");
-		dev_warn(&xhci_pdev->dev,
-				"USB 3.0 devices will work at USB 2.0 speeds.\n");
-		usb_disable_xhci_ports(xhci_pdev);
-		return;
-	}
-
 	/* Read USB3PRM, the USB 3.0 Port Routing Mask Register
 	 * Indicate the ports that can be changed from OS.
 	 */
@@ -909,8 +897,9 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
 	writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
 
 hc_init:
+	/* Start with the EHCI mode to allow to blacklist xhci_hcd */
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL)
-		usb_enable_intel_xhci_ports(pdev);
+		usb_disable_xhci_ports(pdev);
 
 	op_reg_base = base + XHCI_HC_LENGTH(readl(base));
 
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index b8dffd5..b4d6729 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -179,6 +179,9 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	struct hc_driver *driver;
 	struct usb_hcd *hcd;
 
+	if (dev->vendor == PCI_VENDOR_ID_INTEL)
+		usb_enable_intel_xhci_ports(dev);
+
 	driver = (struct hc_driver *)id->driver_data;
 	/* Register the USB 2.0 roothub.
 	 * FIXME: USB core must know to register the USB 2.0 roothub first.
@@ -242,6 +245,10 @@ static void xhci_pci_remove(struct pci_dev *dev)
 	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
 		pci_set_power_state(dev, PCI_D3hot);
 
+	/* Move the port back-into the EHCI mode */
+	if (dev->vendor == PCI_VENDOR_ID_INTEL)
+		usb_disable_xhci_ports(dev);
+
 	kfree(xhci);
 }
 
-- 
1.8.5.1

--
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