Lines Matching +full:pme +full:- +full:active +full:- +full:high

1 // SPDX-License-Identifier: GPL-2.0
19 #include "xhci-trace.h"
20 #include "xhci-pci.h"
102 * All MSI-X IRQs and secondary MSI IRQs should be synced here.
108 if (hcd->msix_enabled) { in xhci_msix_sync_irqs()
109 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_msix_sync_irqs()
120 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_cleanup_msix()
122 if (hcd->irq > 0) in xhci_cleanup_msix()
127 hcd->msix_enabled = 0; in xhci_cleanup_msix()
130 /* Try enabling MSI-X with MSI and legacy IRQ as fallback */
133 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_try_enable_msi()
141 if (xhci->quirks & XHCI_BROKEN_MSI) in xhci_try_enable_msi()
145 if (hcd->irq) in xhci_try_enable_msi()
146 free_irq(hcd->irq, hcd); in xhci_try_enable_msi()
147 hcd->irq = 0; in xhci_try_enable_msi()
150 * Calculate number of MSI/MSI-X vectors supported. in xhci_try_enable_msi()
151 * - max_interrupters: the max number of interrupts requested, capped to xhci HCSPARAMS1. in xhci_try_enable_msi()
152 * - num_online_cpus: one vector per CPUs core, with at least one overall. in xhci_try_enable_msi()
154 xhci->nvecs = min(num_online_cpus() + 1, xhci->max_interrupters); in xhci_try_enable_msi()
157 xhci->nvecs = pci_alloc_irq_vectors(pdev, 1, xhci->nvecs, in xhci_try_enable_msi()
159 if (xhci->nvecs < 0) { in xhci_try_enable_msi()
170 hcd->msi_enabled = 1; in xhci_try_enable_msi()
171 hcd->msix_enabled = pdev->msix_enabled; in xhci_try_enable_msi()
176 pdev->msix_enabled ? "MSI-X" : "MSI"); in xhci_try_enable_msi()
180 if (!pdev->irq) { in xhci_try_enable_msi()
181 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); in xhci_try_enable_msi()
182 return -EINVAL; in xhci_try_enable_msi()
185 if (!strlen(hcd->irq_descr)) in xhci_try_enable_msi()
186 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", in xhci_try_enable_msi()
187 hcd->driver->description, hcd->self.busnum); in xhci_try_enable_msi()
190 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, hcd->irq_descr, hcd); in xhci_try_enable_msi()
192 xhci_err(xhci, "request interrupt %d failed\n", pdev->irq); in xhci_try_enable_msi()
195 hcd->irq = pdev->irq; in xhci_try_enable_msi()
222 /* called after powerup, by probe or system-pm "wakeup" */
231 /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ in xhci_pci_reinit()
233 xhci_dbg(xhci, "MWI active\n"); in xhci_pci_reinit()
243 /* Look for vendor-specific quirks */ in xhci_pci_quirks()
244 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
245 (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || in xhci_pci_quirks()
246 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { in xhci_pci_quirks()
247 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
248 pdev->revision == 0x0) { in xhci_pci_quirks()
249 xhci->quirks |= XHCI_RESET_EP_QUIRK; in xhci_pci_quirks()
253 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
254 pdev->revision == 0x4) { in xhci_pci_quirks()
255 xhci->quirks |= XHCI_SLOW_SUSPEND; in xhci_pci_quirks()
259 pdev->revision); in xhci_pci_quirks()
261 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) in xhci_pci_quirks()
262 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
267 xhci->quirks |= XHCI_BROKEN_MSI; in xhci_pci_quirks()
271 pdev->revision); in xhci_pci_quirks()
274 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
275 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) in xhci_pci_quirks()
276 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
278 if (pdev->vendor == PCI_VENDOR_ID_NEC) in xhci_pci_quirks()
279 xhci->quirks |= XHCI_NEC_HOST; in xhci_pci_quirks()
281 if (pdev->vendor == PCI_VENDOR_ID_AMD && xhci->hci_version == 0x96) in xhci_pci_quirks()
282 xhci->quirks |= XHCI_AMD_0x96_HOST; in xhci_pci_quirks()
285 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_quirk_pll_check()) in xhci_pci_quirks()
286 xhci->quirks |= XHCI_AMD_PLL_FIX; in xhci_pci_quirks()
288 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
289 (pdev->device == 0x145c || in xhci_pci_quirks()
290 pdev->device == 0x15e0 || in xhci_pci_quirks()
291 pdev->device == 0x15e1 || in xhci_pci_quirks()
292 pdev->device == 0x43bb)) in xhci_pci_quirks()
293 xhci->quirks |= XHCI_SUSPEND_DELAY; in xhci_pci_quirks()
295 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
296 (pdev->device == 0x15e0 || pdev->device == 0x15e1)) in xhci_pci_quirks()
297 xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; in xhci_pci_quirks()
299 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x15e5) { in xhci_pci_quirks()
300 xhci->quirks |= XHCI_DISABLE_SPARSE; in xhci_pci_quirks()
301 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
304 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43f7) in xhci_pci_quirks()
305 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
307 if ((pdev->vendor == PCI_VENDOR_ID_AMD) && in xhci_pci_quirks()
308 ((pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4) || in xhci_pci_quirks()
309 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_3) || in xhci_pci_quirks()
310 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2) || in xhci_pci_quirks()
311 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) in xhci_pci_quirks()
312 xhci->quirks |= XHCI_U2_DISABLE_WAKE; in xhci_pci_quirks()
314 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
315 pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) in xhci_pci_quirks()
316 xhci->quirks |= XHCI_BROKEN_D3COLD_S2I; in xhci_pci_quirks()
318 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in xhci_pci_quirks()
319 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
320 xhci->quirks |= XHCI_INTEL_HOST; in xhci_pci_quirks()
321 xhci->quirks |= XHCI_AVOID_BEI; in xhci_pci_quirks()
323 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
324 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { in xhci_pci_quirks()
325 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; in xhci_pci_quirks()
326 xhci->limit_active_eps = 64; in xhci_pci_quirks()
327 xhci->quirks |= XHCI_SW_BW_CHECKING; in xhci_pci_quirks()
336 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
338 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
339 (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI || in xhci_pci_quirks()
340 pdev->device == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI)) { in xhci_pci_quirks()
341 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
342 xhci->quirks |= XHCI_SPURIOUS_WAKEUP; in xhci_pci_quirks()
344 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
345 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
346 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
347 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
348 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || in xhci_pci_quirks()
349 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || in xhci_pci_quirks()
350 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI || in xhci_pci_quirks()
351 pdev->device == PCI_DEVICE_ID_INTEL_DENVERTON_XHCI || in xhci_pci_quirks()
352 pdev->device == PCI_DEVICE_ID_INTEL_COMET_LAKE_XHCI)) { in xhci_pci_quirks()
353 xhci->quirks |= XHCI_PME_STUCK_QUIRK; in xhci_pci_quirks()
355 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
356 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) in xhci_pci_quirks()
357 xhci->quirks |= XHCI_SSIC_PORT_UNUSED; in xhci_pci_quirks()
358 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
359 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
360 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
361 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI)) in xhci_pci_quirks()
362 xhci->quirks |= XHCI_INTEL_USB_ROLE_SW; in xhci_pci_quirks()
363 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
364 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
365 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
366 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
367 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI || in xhci_pci_quirks()
368 pdev->device == PCI_DEVICE_ID_INTEL_DENVERTON_XHCI)) in xhci_pci_quirks()
369 xhci->quirks |= XHCI_MISSING_CAS; in xhci_pci_quirks()
371 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
372 (pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_PCH_XHCI || in xhci_pci_quirks()
373 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI || in xhci_pci_quirks()
374 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI)) in xhci_pci_quirks()
375 xhci->quirks |= XHCI_RESET_TO_DEFAULT; in xhci_pci_quirks()
377 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
378 (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || in xhci_pci_quirks()
379 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || in xhci_pci_quirks()
380 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || in xhci_pci_quirks()
381 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI || in xhci_pci_quirks()
382 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || in xhci_pci_quirks()
383 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || in xhci_pci_quirks()
384 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI || in xhci_pci_quirks()
385 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || in xhci_pci_quirks()
386 pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || in xhci_pci_quirks()
387 pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || in xhci_pci_quirks()
388 pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI)) in xhci_pci_quirks()
389 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
391 if (pdev->vendor == PCI_VENDOR_ID_ETRON && in xhci_pci_quirks()
392 (pdev->device == PCI_DEVICE_ID_ETRON_EJ168 || in xhci_pci_quirks()
393 pdev->device == PCI_DEVICE_ID_ETRON_EJ188)) { in xhci_pci_quirks()
394 xhci->quirks |= XHCI_ETRON_HOST; in xhci_pci_quirks()
395 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
396 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
397 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
400 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
401 pdev->device == 0x0014) { in xhci_pci_quirks()
402 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
404 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
405 pdev->device == 0x0015) { in xhci_pci_quirks()
406 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
407 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
409 if (pdev->vendor == PCI_VENDOR_ID_VIA) in xhci_pci_quirks()
410 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
412 if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM && in xhci_pci_quirks()
413 pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI) in xhci_pci_quirks()
414 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
417 if (pdev->vendor == PCI_VENDOR_ID_VIA && in xhci_pci_quirks()
418 pdev->device == 0x3432) in xhci_pci_quirks()
419 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
421 if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) in xhci_pci_quirks()
422 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
424 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
425 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { in xhci_pci_quirks()
430 xhci->quirks |= XHCI_SPURIOUS_SUCCESS; in xhci_pci_quirks()
431 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
433 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
434 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) { in xhci_pci_quirks()
435 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
437 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
438 (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI || in xhci_pci_quirks()
439 pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI || in xhci_pci_quirks()
440 pdev->device == PCI_DEVICE_ID_ASMEDIA_3242_XHCI)) in xhci_pci_quirks()
441 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
443 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
444 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) in xhci_pci_quirks()
445 xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; in xhci_pci_quirks()
447 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
448 pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI) in xhci_pci_quirks()
449 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
451 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) in xhci_pci_quirks()
452 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; in xhci_pci_quirks()
454 if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM || in xhci_pci_quirks()
455 pdev->vendor == PCI_VENDOR_ID_CAVIUM) && in xhci_pci_quirks()
456 pdev->device == 0x9026) in xhci_pci_quirks()
457 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; in xhci_pci_quirks()
459 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
460 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 || in xhci_pci_quirks()
461 pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) in xhci_pci_quirks()
462 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
464 if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) { in xhci_pci_quirks()
465 xhci->quirks |= XHCI_ZHAOXIN_HOST; in xhci_pci_quirks()
466 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
468 if (pdev->device == 0x9202) { in xhci_pci_quirks()
469 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
470 xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; in xhci_pci_quirks()
473 if (pdev->device == 0x9203) in xhci_pci_quirks()
474 xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; in xhci_pci_quirks()
477 if (pdev->vendor == PCI_VENDOR_ID_CDNS && in xhci_pci_quirks()
478 pdev->device == PCI_DEVICE_ID_CDNS_USBSSP) in xhci_pci_quirks()
479 xhci->quirks |= XHCI_CDNS_SCTX_QUIRK; in xhci_pci_quirks()
482 if (xhci->hci_version >= 0x120) in xhci_pci_quirks()
483 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
485 if (xhci->quirks & XHCI_RESET_ON_RESUME) in xhci_pci_quirks()
498 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), &intel_dsm_guid, 3, 1, in xhci_pme_acpi_rtd3_enable()
506 struct xhci_hub *rhub = &xhci->usb3_rhub; in xhci_find_lpm_incapable_ports()
511 if (hcd != rhub->hcd) in xhci_find_lpm_incapable_ports()
514 if (hdev->maxchild > rhub->num_ports) { in xhci_find_lpm_incapable_ports()
515 dev_err(&hdev->dev, "USB3 roothub port number mismatch\n"); in xhci_find_lpm_incapable_ports()
519 for (i = 0; i < hdev->maxchild; i++) { in xhci_find_lpm_incapable_ports()
522 dev_dbg(&hdev->dev, "port-%d disable U1/U2 _DSM: %d\n", i + 1, ret); in xhci_find_lpm_incapable_ports()
525 rhub->ports[i]->lpm_incapable = ret; in xhci_find_lpm_incapable_ports()
540 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_setup()
547 xhci->imod_interval = 40000; in xhci_pci_setup()
556 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_setup()
570 if (!hdev->parent) in xhci_pci_update_hub_device()
587 reset = devm_reset_control_get_optional_exclusive(&dev->dev, NULL); in xhci_pci_common_probe()
592 /* Prevent runtime suspending between USB-2 and USB-3 initialization */ in xhci_pci_common_probe()
593 pm_runtime_get_noresume(&dev->dev); in xhci_pci_common_probe()
607 hcd = dev_get_drvdata(&dev->dev); in xhci_pci_common_probe()
609 xhci->reset = reset; in xhci_pci_common_probe()
610 xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev, in xhci_pci_common_probe()
612 if (!xhci->shared_hcd) { in xhci_pci_common_probe()
613 retval = -ENOMEM; in xhci_pci_common_probe()
621 retval = usb_add_hcd(xhci->shared_hcd, dev->irq, in xhci_pci_common_probe()
627 if (!(xhci->quirks & XHCI_BROKEN_STREAMS) && in xhci_pci_common_probe()
628 HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_pci_common_probe()
629 xhci->shared_hcd->can_do_streams = 1; in xhci_pci_common_probe()
631 /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ in xhci_pci_common_probe()
632 pm_runtime_put_noidle(&dev->dev); in xhci_pci_common_probe()
635 pm_runtime_get(&dev->dev); in xhci_pci_common_probe()
636 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_common_probe()
637 pm_runtime_allow(&dev->dev); in xhci_pci_common_probe()
639 dma_set_max_seg_size(&dev->dev, UINT_MAX); in xhci_pci_common_probe()
641 if (device_property_read_bool(&dev->dev, "ti,pwron-active-high")) in xhci_pci_common_probe()
647 usb_put_hcd(xhci->shared_hcd); in xhci_pci_common_probe()
651 pm_runtime_put_noidle(&dev->dev); in xhci_pci_common_probe()
657 /* handled by xhci-pci-renesas */
666 return -ENODEV; in xhci_pci_probe()
677 set_power_d3 = xhci->quirks & XHCI_SPURIOUS_WAKEUP; in xhci_pci_remove()
679 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_pci_remove()
682 pm_runtime_put(&dev->dev); in xhci_pci_remove()
683 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_remove()
684 pm_runtime_forbid(&dev->dev); in xhci_pci_remove()
686 if (xhci->shared_hcd) { in xhci_pci_remove()
687 usb_remove_hcd(xhci->shared_hcd); in xhci_pci_remove()
688 usb_put_hcd(xhci->shared_hcd); in xhci_pci_remove()
689 xhci->shared_hcd = NULL; in xhci_pci_remove()
715 reg = (void __iomem *) xhci->cap_regs + in xhci_ssic_port_unused_quirk()
739 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
740 * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
748 reg = (void __iomem *) xhci->cap_regs + 0x80a4; in xhci_pme_quirk()
758 reg = readl(hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
760 writel(reg, hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
766 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_suspend()
773 if (xhci->quirks & XHCI_COMP_MODE_QUIRK) in xhci_pci_suspend()
779 xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)) in xhci_pci_suspend()
783 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_suspend()
786 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_suspend()
789 if (xhci->quirks & XHCI_DISABLE_SPARSE) in xhci_pci_suspend()
794 /* synchronize irq when using MSI-X */ in xhci_pci_suspend()
797 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED)) in xhci_pci_suspend()
806 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_resume()
808 reset_control_reset(xhci->reset); in xhci_pci_resume()
828 if (pdev->vendor == PCI_VENDOR_ID_INTEL) in xhci_pci_resume()
831 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_resume()
834 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_resume()
857 if (!(xhci->quirks & XHCI_RESET_TO_DEFAULT)) in xhci_pci_poweroff_late()
860 for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { in xhci_pci_poweroff_late()
861 port = &xhci->hw_ports[i]; in xhci_pci_poweroff_late()
862 portsc = readl(port->addr); in xhci_pci_poweroff_late()
867 if (!port->slot_id || !xhci->devs[port->slot_id]) { in xhci_pci_poweroff_late()
868 xhci_err(xhci, "No dev for slot_id %d for port %d-%d in U3\n", in xhci_pci_poweroff_late()
869 port->slot_id, port->rhub->hcd->self.busnum, in xhci_pci_poweroff_late()
870 port->hcd_portnum + 1); in xhci_pci_poweroff_late()
874 udev = xhci->devs[port->slot_id]->udev; in xhci_pci_poweroff_late()
877 if (udev->do_remote_wakeup && do_wakeup) in xhci_pci_poweroff_late()
880 xhci_dbg(xhci, "port %d-%d in U3 without wakeup, disable it\n", in xhci_pci_poweroff_late()
881 port->rhub->hcd->self.busnum, port->hcd_portnum + 1); in xhci_pci_poweroff_late()
883 writel(portsc | PORT_PE, port->addr); in xhci_pci_poweroff_late()
892 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_shutdown()
898 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) in xhci_pci_shutdown()
902 /*-------------------------------------------------------------------------*/