seems like a better use for the driver_data field. It also helps decoupling PCI from XHCI-specific ->setup function. Signed-off-by: Felipe Balbi <balbi@xxxxxx> --- drivers/usb/host/xhci-pci.c | 110 +++++++++++++++++++++++++++++-------------- 1 files changed, 74 insertions(+), 36 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 724f09f..e11900e 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -32,6 +32,11 @@ #define PCI_VENDOR_ID_ETRON 0x1b6f #define PCI_DEVICE_ID_ASROCK_P67 0x7023 +struct xhci_pci_data { + unsigned int limit_active_eps; + unsigned int quirks; +}; + static const char hcd_name[] = "xhci_hcd"; /* called after powerup, by probe or system-pm "wakeup" */ @@ -107,42 +112,6 @@ static int xhci_pci_setup(struct usb_hcd *hcd) xhci->hcc_params = xhci_readl(xhci, &xhci->cap_regs->hcc_params); xhci_print_registers(xhci); - /* Look for vendor-specific quirks */ - if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && - pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) { - if (pdev->revision == 0x0) { - xhci->quirks |= XHCI_RESET_EP_QUIRK; - xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" - " endpoint cmd after reset endpoint\n"); - } - /* Fresco Logic confirms: all revisions of this chip do not - * support MSI, even though some of them claim to in their PCI - * capabilities. - */ - xhci->quirks |= XHCI_BROKEN_MSI; - xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u " - "has broken MSI implementation\n", - pdev->revision); - } - - if (pdev->vendor == PCI_VENDOR_ID_NEC) - xhci->quirks |= XHCI_NEC_HOST; - - /* AMD PLL quirk */ - if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) - xhci->quirks |= XHCI_AMD_PLL_FIX; - if (pdev->vendor == PCI_VENDOR_ID_INTEL && - pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { - xhci->quirks |= XHCI_SPURIOUS_SUCCESS; - xhci->quirks |= XHCI_EP_LIMIT_QUIRK; - xhci->limit_active_eps = 64; - } - if (pdev->vendor == PCI_VENDOR_ID_ETRON && - pdev->device == PCI_DEVICE_ID_ASROCK_P67) { - xhci->quirks |= XHCI_RESET_ON_RESUME; - xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); - } - /* Make sure the HC is halted. */ retval = xhci_halt(xhci); if (retval) @@ -195,6 +164,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) struct xhci_hcd *xhci; const struct hc_driver *driver; struct usb_hcd *hcd; + struct xhci_pci_data *data = (struct xhci_pci_data *) id->driver_data; driver = &xhci_pci_hc_driver; @@ -212,6 +182,20 @@ 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); + + xhci->quirks = data->quirks; + xhci->limit_active_eps = data->limit_active_eps; + + /* 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) { + xhci->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 +335,62 @@ static const struct hc_driver xhci_pci_hc_driver = { /*-------------------------------------------------------------------------*/ +#define DEFINE_XHCI_PCI_DATA(name) \ +struct xhci_platform_data name##_driver_data __devinit + +static DEFINE_XHCI_PCI_DATA(fresco_logic) = { + .quirks = XHCI_BROKEN_MSI, +}; + +static DEFINE_XHCI_PCI_DATA(nec) = { + .quirks = XHCI_NEC_HOST, +}; + +static DEFINE_XHCI_PCI_DATA(amd) = { + .quirks = XHCI_AMD_PLL_FIX, +}; + +static DEFINE_XHCI_PCI_DATA(intel_pantherpoint) = { + .quirks = (XHCI_SPURIOUS_SUCCESS + | XHCI_EP_LIMIT_QUIRK), + .limit_active_eps = 64, +}; + +static DEFINE_XHCI_PCI_DATA(etron) = { + .quirks = XHCI_RESET_ON_RESUME, +}; + /* 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.6 -- 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