lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1449134991-39095-3-git-send-email-heikki.krogerus@linux.intel.com>
Date:	Thu,  3 Dec 2015 11:29:51 +0200
From:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:	Chanwoo Choi <cw00.choi@...sung.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	MyungJoo Ham <myungjoo.ham@...sung.com>,
	David Cohen <david.a.cohen@...ux.intel.com>,
	Lu Baolu <baolu.lu@...ux.intel.com>,
	Mathias Nyman <mathias.nyman@...ux.intel.com>,
	Felipe Balbi <balbi@...com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCHv2 2/2] usb: pci-quirks: register USB mux found on Cherrytrail SOC

Intel Braswell/Cherrytrail has an internal mux that shares
one USB port between USB Device Controller and xHCI. The
same mux is found on several SOCs from Intel, but only on
a few Cherrytrail based platforms the OS is expected to
configure it. Normally BIOS takes care of it.

The driver for the mux is an "extcon" driver. With this we
only register the mux if it's detected.

Suggested-by: Lu Baolu <baolu.lu@...ux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
---
 drivers/usb/host/pci-quirks.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 26cb8c8..ee875e1 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -16,6 +16,7 @@
 #include <linux/export.h>
 #include <linux/acpi.h>
 #include <linux/dmi.h>
+#include <linux/extcon/intel_usb_mux.h>
 #include "pci-quirks.h"
 #include "xhci-ext-caps.h"
 
@@ -1022,9 +1023,32 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
 	writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
 
 hc_init:
-	if (pdev->vendor == PCI_VENDOR_ID_INTEL)
+	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		usb_enable_intel_xhci_ports(pdev);
 
+		/*
+		 * Initialize the internal mux that shares a port between USB
+		 * Device Controller and xHCI on platforms that have it.
+		 */
+#define XHCI_INTEL_VENDOR_CAPS 192
+#define XHCI_INTEL_USB_MUX_OFFSET 0x80d8
+		if (xhci_find_next_ext_cap(base, 0, XHCI_INTEL_VENDOR_CAPS)) {
+			struct intel_usb_mux *mux;
+			struct resource r;
+
+			r.start = pci_resource_start(pdev, 0) +
+					XHCI_INTEL_USB_MUX_OFFSET;
+			r.end   = r.start + 8;
+			r.flags = IORESOURCE_MEM;
+
+			mux = intel_usb_mux_register(&pdev->dev, &r);
+			if (IS_ERR(mux) && PTR_ERR(mux) == -ENOTSUPP)
+				dev_dbg(&pdev->dev, "USB mux not supported\n");
+			else if (IS_ERR(mux))
+				dev_err(&pdev->dev, "failed to register mux\n");
+		}
+	}
+
 	op_reg_base = base + XHCI_HC_LENGTH(readl(base));
 
 	/* Wait for the host controller to be ready before writing any
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ