• Home
  • Raw
  • Download

Lines Matching full:xhci

3  * xHCI host controller driver PCI Bus Glue.
18 #include "xhci.h"
19 #include "xhci-trace.h"
20 #include "xhci-pci.h"
109 static void xhci_msix_sync_irqs(struct xhci_hcd *xhci) in xhci_msix_sync_irqs() argument
111 struct usb_hcd *hcd = xhci_to_hcd(xhci); in xhci_msix_sync_irqs()
117 for (i = 0; i < xhci->msix_count; i++) in xhci_msix_sync_irqs()
123 static void xhci_cleanup_msix(struct xhci_hcd *xhci) in xhci_cleanup_msix() argument
125 struct usb_hcd *hcd = xhci_to_hcd(xhci); in xhci_cleanup_msix()
135 for (i = 0; i < xhci->msix_count; i++) in xhci_cleanup_msix()
136 free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci)); in xhci_cleanup_msix()
138 free_irq(pci_irq_vector(pdev, 0), xhci_to_hcd(xhci)); in xhci_cleanup_msix()
148 static int xhci_setup_msi(struct xhci_hcd *xhci) in xhci_setup_msi() argument
154 struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); in xhci_setup_msi()
158 xhci_dbg_trace(xhci, trace_xhci_dbg_init, in xhci_setup_msi()
164 0, "xhci_hcd", xhci_to_hcd(xhci)); in xhci_setup_msi()
166 xhci_dbg_trace(xhci, trace_xhci_dbg_init, in xhci_setup_msi()
177 static int xhci_setup_msix(struct xhci_hcd *xhci) in xhci_setup_msix() argument
180 struct usb_hcd *hcd = xhci_to_hcd(xhci); in xhci_setup_msix()
186 * with max number of interrupters based on the xhci HCSPARAMS1. in xhci_setup_msix()
190 xhci->msix_count = min(num_online_cpus() + 1, in xhci_setup_msix()
191 HCS_MAX_INTRS(xhci->hcs_params1)); in xhci_setup_msix()
193 ret = pci_alloc_irq_vectors(pdev, xhci->msix_count, xhci->msix_count, in xhci_setup_msix()
196 xhci_dbg_trace(xhci, trace_xhci_dbg_init, in xhci_setup_msix()
201 for (i = 0; i < xhci->msix_count; i++) { in xhci_setup_msix()
203 "xhci_hcd", xhci_to_hcd(xhci)); in xhci_setup_msix()
212 xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt"); in xhci_setup_msix()
214 free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci)); in xhci_setup_msix()
221 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_try_enable_msi() local
225 pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); in xhci_try_enable_msi()
230 if (xhci->quirks & XHCI_BROKEN_MSI) in xhci_try_enable_msi()
238 ret = xhci_setup_msix(xhci); in xhci_try_enable_msi()
241 ret = xhci_setup_msi(xhci); in xhci_try_enable_msi()
249 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); in xhci_try_enable_msi()
262 xhci_err(xhci, "request interrupt %d failed\n", in xhci_try_enable_msi()
285 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pci_stop() local
290 xhci_cleanup_msix(xhci); in xhci_pci_stop()
294 static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev) in xhci_pci_reinit() argument
304 xhci_dbg(xhci, "MWI active\n"); in xhci_pci_reinit()
306 xhci_dbg(xhci, "Finished xhci_pci_reinit\n"); in xhci_pci_reinit()
310 static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) in xhci_pci_quirks() argument
320 xhci->quirks |= driver_data->quirks; in xhci_pci_quirks()
329 xhci->quirks |= XHCI_RESET_EP_QUIRK; in xhci_pci_quirks()
330 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, in xhci_pci_quirks()
335 xhci->quirks |= XHCI_SLOW_SUSPEND; in xhci_pci_quirks()
336 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, in xhci_pci_quirks()
342 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
347 xhci->quirks |= XHCI_BROKEN_MSI; in xhci_pci_quirks()
348 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, in xhci_pci_quirks()
356 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
359 xhci->quirks |= XHCI_NEC_HOST; in xhci_pci_quirks()
370 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_9; in xhci_pci_quirks()
374 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_9; in xhci_pci_quirks()
376 if (pdev->vendor == PCI_VENDOR_ID_AMD && xhci->hci_version == 0x96) in xhci_pci_quirks()
377 xhci->quirks |= XHCI_AMD_0x96_HOST; in xhci_pci_quirks()
381 xhci->quirks |= XHCI_AMD_PLL_FIX; in xhci_pci_quirks()
388 xhci->quirks |= XHCI_SUSPEND_DELAY; in xhci_pci_quirks()
392 xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; in xhci_pci_quirks()
395 xhci->quirks |= XHCI_DISABLE_SPARSE; in xhci_pci_quirks()
396 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
400 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
407 xhci->quirks |= XHCI_U2_DISABLE_WAKE; in xhci_pci_quirks()
411 xhci->quirks |= XHCI_BROKEN_D3COLD_S2I; in xhci_pci_quirks()
414 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
415 xhci->quirks |= XHCI_INTEL_HOST; in xhci_pci_quirks()
416 xhci->quirks |= XHCI_AVOID_BEI; in xhci_pci_quirks()
420 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; in xhci_pci_quirks()
421 xhci->limit_active_eps = 64; in xhci_pci_quirks()
422 xhci->quirks |= XHCI_SW_BW_CHECKING; in xhci_pci_quirks()
426 * switch the ports from xHCI to EHCI on shutdown. We can't use in xhci_pci_quirks()
431 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
436 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
437 xhci->quirks |= XHCI_SPURIOUS_WAKEUP; in xhci_pci_quirks()
448 xhci->quirks |= XHCI_PME_STUCK_QUIRK; in xhci_pci_quirks()
452 xhci->quirks |= XHCI_SSIC_PORT_UNUSED; in xhci_pci_quirks()
457 xhci->quirks |= XHCI_INTEL_USB_ROLE_SW; in xhci_pci_quirks()
464 xhci->quirks |= XHCI_MISSING_CAS; in xhci_pci_quirks()
469 xhci->quirks |= XHCI_RESET_TO_DEFAULT; in xhci_pci_quirks()
483 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
488 xhci->quirks |= XHCI_ETRON_HOST; in xhci_pci_quirks()
489 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
490 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
495 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
499 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
500 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
503 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
508 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
511 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
512 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
521 xhci->quirks |= XHCI_SPURIOUS_SUCCESS; in xhci_pci_quirks()
522 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
526 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
532 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
536 xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; in xhci_pci_quirks()
540 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
543 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; in xhci_pci_quirks()
548 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; in xhci_pci_quirks()
553 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
556 xhci->quirks |= XHCI_ZHAOXIN_HOST; in xhci_pci_quirks()
557 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
560 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
561 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
565 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
570 xhci->quirks |= XHCI_CDNS_SCTX_QUIRK; in xhci_pci_quirks()
573 if (xhci->hci_version >= 0x120) in xhci_pci_quirks()
574 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
576 if (xhci->quirks & XHCI_RESET_ON_RESUME) in xhci_pci_quirks()
577 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, in xhci_pci_quirks()
596 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_find_lpm_incapable_ports() local
597 struct xhci_hub *rhub = &xhci->usb3_rhub; in xhci_find_lpm_incapable_ports()
630 struct xhci_hcd *xhci; in xhci_pci_setup() local
634 xhci = hcd_to_xhci(hcd); in xhci_pci_setup()
635 if (!xhci->sbrn) in xhci_pci_setup()
636 pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, &xhci->sbrn); in xhci_pci_setup()
639 xhci->imod_interval = 40000; in xhci_pci_setup()
648 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_setup()
651 xhci_dbg(xhci, "Got SBRN %u\n", (unsigned int) xhci->sbrn); in xhci_pci_setup()
654 return xhci_pci_reinit(xhci, pdev); in xhci_pci_setup()
669 * function) in order to create a second roothub under xHCI.
674 struct xhci_hcd *xhci; in xhci_pci_probe() local
707 xhci = hcd_to_xhci(hcd); in xhci_pci_probe()
708 xhci->reset = reset; in xhci_pci_probe()
709 xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev, in xhci_pci_probe()
711 if (!xhci->shared_hcd) { in xhci_pci_probe()
716 retval = xhci_ext_cap_init(xhci); in xhci_pci_probe()
720 retval = usb_add_hcd(xhci->shared_hcd, dev->irq, in xhci_pci_probe()
726 if (!(xhci->quirks & XHCI_BROKEN_STREAMS) && in xhci_pci_probe()
727 HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_pci_probe()
728 xhci->shared_hcd->can_do_streams = 1; in xhci_pci_probe()
735 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_probe()
743 usb_put_hcd(xhci->shared_hcd); in xhci_pci_probe()
753 struct xhci_hcd *xhci; in xhci_pci_remove() local
756 xhci = hcd_to_xhci(pci_get_drvdata(dev)); in xhci_pci_remove()
757 set_power_d3 = xhci->quirks & XHCI_SPURIOUS_WAKEUP; in xhci_pci_remove()
759 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_pci_remove()
763 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_remove()
766 if (xhci->shared_hcd) { in xhci_pci_remove()
767 usb_remove_hcd(xhci->shared_hcd); in xhci_pci_remove()
768 usb_put_hcd(xhci->shared_hcd); in xhci_pci_remove()
769 xhci->shared_hcd = NULL; in xhci_pci_remove()
780 * In some Intel xHCI controllers, in order to get D3 working,
782 * SSIC PORT need to be marked as "unused" before putting xHCI
784 * Without this change, xHCI might not enter D3 state.
788 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_ssic_port_unused_quirk() local
794 reg = (void __iomem *) xhci->cap_regs + in xhci_ssic_port_unused_quirk()
818 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
823 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pme_quirk() local
827 reg = (void __iomem *) xhci->cap_regs + 0x80a4; in xhci_pme_quirk()
844 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pci_suspend() local
852 if (xhci->quirks & XHCI_COMP_MODE_QUIRK) in xhci_pci_suspend()
858 xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)) in xhci_pci_suspend()
862 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_suspend()
865 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_suspend()
868 if (xhci->quirks & XHCI_DISABLE_SPARSE) in xhci_pci_suspend()
871 ret = xhci_suspend(xhci, do_wakeup); in xhci_pci_suspend()
874 xhci_msix_sync_irqs(xhci); in xhci_pci_suspend()
876 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED)) in xhci_pci_suspend()
884 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pci_resume() local
888 reset_control_reset(xhci->reset); in xhci_pci_resume()
891 * not support xHCI natively. That means that during system resume, it in xhci_pci_resume()
895 * The BIOS is supposed to remember whether the OS had xHCI ports in xhci_pci_resume()
896 * enabled before resume, and switch the ports back to xHCI when the in xhci_pci_resume()
900 * Unconditionally switch the ports back to xHCI after a system resume. in xhci_pci_resume()
901 * It should not matter whether the EHCI or xHCI controller is in xhci_pci_resume()
902 * resumed first. It's enough to do the switchover in xHCI because in xhci_pci_resume()
905 * xHCI host controllers) have been resumed. in xhci_pci_resume()
911 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_resume()
914 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_resume()
917 retval = xhci_resume(xhci, msg); in xhci_pci_resume()
923 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pci_poweroff_late() local
939 if (!(xhci->quirks & XHCI_RESET_TO_DEFAULT)) in xhci_pci_poweroff_late()
942 for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { in xhci_pci_poweroff_late()
943 port = &xhci->hw_ports[i]; in xhci_pci_poweroff_late()
949 slot_id = xhci_find_slot_id_by_port(port->rhub->hcd, xhci, in xhci_pci_poweroff_late()
951 if (!slot_id || !xhci->devs[slot_id]) { in xhci_pci_poweroff_late()
952 xhci_err(xhci, "No dev for slot_id %d for port %d-%d in U3\n", in xhci_pci_poweroff_late()
957 udev = xhci->devs[slot_id]->udev; in xhci_pci_poweroff_late()
963 xhci_dbg(xhci, "port %d-%d in U3 without wakeup, disable it\n", in xhci_pci_poweroff_late()
974 struct xhci_hcd *xhci = hcd_to_xhci(hcd); in xhci_pci_shutdown() local
978 xhci_cleanup_msix(xhci); in xhci_pci_shutdown()
981 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) in xhci_pci_shutdown()
1000 /* handle any USB 3.0 xHCI controller */
1009 * load firmware, so don't encumber the xhci-pci driver with it.
1048 MODULE_DESCRIPTION("xHCI PCI Host Controller Driver");