From: Felipe Balbi <balbi@xxxxxx> seems like a better use for the driver_data field. It also helps decoupling PCI from XHCI-specific ->setup function. [bigeasy@linutronix: keep the quirks for now, they will vanish later] Signed-off-by: Felipe Balbi <balbi@xxxxxx> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- drivers/usb/host/xhci-pci.c | 77 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 70 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 724f09f..7006600 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -183,20 +183,16 @@ error: return retval; } -static const struct hc_driver xhci_pci_hc_driver; - -/* - * We need to register our own PCI probe function (instead of the USB core's - * function) in order to create a second roothub under xHCI. - */ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { int retval; struct xhci_hcd *xhci; const struct hc_driver *driver; struct usb_hcd *hcd; + struct xhci_platform_data *data; - driver = &xhci_pci_hc_driver; + data = (struct xhci_platform_data *) id->driver_data; + driver = data->driver; /* Register the USB 2.0 roothub. * FIXME: USB core must know to register the USB 2.0 roothub first. @@ -212,6 +208,17 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* USB 2.0 roothub is stored in the PCI device now. */ hcd = dev_get_drvdata(&dev->dev); xhci = hcd_to_xhci(hcd); + + /* Quirk on revision 0 of Fresco Logic's PDK */ + if (dev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && + dev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) { + if (dev->revision == 0x0) { + data->quirks |= XHCI_RESET_EP_QUIRK; + xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" + " endpoint cmd after reset endpoint\n"); + } + } + xhci->shared_hcd = usb_create_shared_hcd(driver, &dev->dev, pci_name(dev), hcd); if (!xhci->shared_hcd) { @@ -351,8 +358,64 @@ static const struct hc_driver xhci_pci_hc_driver = { /*-------------------------------------------------------------------------*/ +static DEFINE_XHCI_DATA(fresco_logic) = { + .quirks = XHCI_BROKEN_MSI, + .driver = &xhci_pci_hc_driver, +}; + +static DEFINE_XHCI_DATA(nec) = { + .quirks = XHCI_NEC_HOST, + .driver = &xhci_pci_hc_driver, +}; + +static DEFINE_XHCI_DATA(amd) = { + .quirks = XHCI_AMD_PLL_FIX, + .driver = &xhci_pci_hc_driver, +}; + +static DEFINE_XHCI_DATA(intel_pantherpoint) = { + .quirks = (XHCI_SPURIOUS_SUCCESS + | XHCI_EP_LIMIT_QUIRK), + .limit_active_eps = 64, + .driver = &xhci_pci_hc_driver, +}; + +static DEFINE_XHCI_DATA(etron) = { + .quirks = XHCI_RESET_ON_RESUME, + .driver = &xhci_pci_hc_driver, +}; + /* PCI driver selection metadata; PCI hotplugging uses this */ static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { + /* handle quirky devices here */ + { + PCI_DEVICE(PCI_VENDOR_ID_FRESCO_LOGIC, + PCI_DEVICE_ID_FRESCO_LOGIC_PDK), + .driver_data = (kernel_ulong_t) &fresco_logic_driver_data, + }, + { + PCI_DEVICE(PCI_VENDOR_ID_NEC, PCI_ANY_ID), + .driver_data = (kernel_ulong_t) &nec_driver_data, + }, + { + PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x9600), + .driver_data = (kernel_ulong_t) &amd_driver_data, + }, + { + PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x9601), + .driver_data = (kernel_ulong_t) &amd_driver_data, + }, + { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI), + .driver_data = (kernel_ulong_t) &intel_pantherpoint_driver_data, + }, + { + PCI_DEVICE(PCI_VENDOR_ID_ETRON, + PCI_DEVICE_ID_ASROCK_P67), + .driver_data = (kernel_ulong_t) &etron_driver_data, + }, + /* handle any USB 3.0 xHCI controller */ { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_XHCI, ~0), -- 1.7.4.4 -- 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