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"
104 * All MSI-X IRQs and secondary MSI IRQs should be synced here.
110 if (hcd->msix_enabled) { in xhci_msix_sync_irqs()
111 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_msix_sync_irqs()
122 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_cleanup_msix()
124 if (hcd->irq > 0) in xhci_cleanup_msix()
129 hcd->msix_enabled = 0; in xhci_cleanup_msix()
132 /* Try enabling MSI-X with MSI and legacy IRQ as fallback */
135 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_try_enable_msi()
143 if (xhci->quirks & XHCI_BROKEN_MSI) in xhci_try_enable_msi()
147 if (hcd->irq) in xhci_try_enable_msi()
148 free_irq(hcd->irq, hcd); in xhci_try_enable_msi()
149 hcd->irq = 0; in xhci_try_enable_msi()
152 * Calculate number of MSI/MSI-X vectors supported. in xhci_try_enable_msi()
153 * - max_interrupters: the max number of interrupts requested, capped to xhci HCSPARAMS1. in xhci_try_enable_msi()
154 * - num_online_cpus: one vector per CPUs core, with at least one overall. in xhci_try_enable_msi()
156 xhci->nvecs = min(num_online_cpus() + 1, xhci->max_interrupters); in xhci_try_enable_msi()
159 xhci->nvecs = pci_alloc_irq_vectors(pdev, 1, xhci->nvecs, in xhci_try_enable_msi()
161 if (xhci->nvecs < 0) { in xhci_try_enable_msi()
172 hcd->msi_enabled = 1; in xhci_try_enable_msi()
173 hcd->msix_enabled = pdev->msix_enabled; in xhci_try_enable_msi()
178 pdev->msix_enabled ? "MSI-X" : "MSI"); in xhci_try_enable_msi()
182 if (!pdev->irq) { in xhci_try_enable_msi()
183 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); in xhci_try_enable_msi()
184 return -EINVAL; in xhci_try_enable_msi()
187 if (!strlen(hcd->irq_descr)) in xhci_try_enable_msi()
188 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", in xhci_try_enable_msi()
189 hcd->driver->description, hcd->self.busnum); in xhci_try_enable_msi()
192 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, hcd->irq_descr, hcd); in xhci_try_enable_msi()
194 xhci_err(xhci, "request interrupt %d failed\n", pdev->irq); in xhci_try_enable_msi()
197 hcd->irq = pdev->irq; in xhci_try_enable_msi()
224 /* called after powerup, by probe or system-pm "wakeup" */
233 /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ in xhci_pci_reinit()
235 xhci_dbg(xhci, "MWI active\n"); in xhci_pci_reinit()
245 /* Look for vendor-specific quirks */ in xhci_pci_quirks()
246 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
247 (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || in xhci_pci_quirks()
248 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { in xhci_pci_quirks()
249 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
250 pdev->revision == 0x0) { in xhci_pci_quirks()
251 xhci->quirks |= XHCI_RESET_EP_QUIRK; in xhci_pci_quirks()
255 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
256 pdev->revision == 0x4) { in xhci_pci_quirks()
257 xhci->quirks |= XHCI_SLOW_SUSPEND; in xhci_pci_quirks()
261 pdev->revision); in xhci_pci_quirks()
263 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) in xhci_pci_quirks()
264 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
269 xhci->quirks |= XHCI_BROKEN_MSI; in xhci_pci_quirks()
273 pdev->revision); in xhci_pci_quirks()
276 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
277 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) in xhci_pci_quirks()
278 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
280 if (pdev->vendor == PCI_VENDOR_ID_NEC) in xhci_pci_quirks()
281 xhci->quirks |= XHCI_NEC_HOST; in xhci_pci_quirks()
283 if (pdev->vendor == PCI_VENDOR_ID_AMD && xhci->hci_version == 0x96) in xhci_pci_quirks()
284 xhci->quirks |= XHCI_AMD_0x96_HOST; in xhci_pci_quirks()
287 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_quirk_pll_check()) in xhci_pci_quirks()
288 xhci->quirks |= XHCI_AMD_PLL_FIX; in xhci_pci_quirks()
290 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
291 (pdev->device == 0x145c || in xhci_pci_quirks()
292 pdev->device == 0x15e0 || in xhci_pci_quirks()
293 pdev->device == 0x15e1 || in xhci_pci_quirks()
294 pdev->device == 0x43bb)) in xhci_pci_quirks()
295 xhci->quirks |= XHCI_SUSPEND_DELAY; in xhci_pci_quirks()
297 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
298 (pdev->device == 0x15e0 || pdev->device == 0x15e1)) in xhci_pci_quirks()
299 xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; in xhci_pci_quirks()
301 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x15e5) { in xhci_pci_quirks()
302 xhci->quirks |= XHCI_DISABLE_SPARSE; in xhci_pci_quirks()
303 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
306 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43f7) in xhci_pci_quirks()
307 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
309 if ((pdev->vendor == PCI_VENDOR_ID_AMD) && in xhci_pci_quirks()
310 ((pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4) || in xhci_pci_quirks()
311 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_3) || in xhci_pci_quirks()
312 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2) || in xhci_pci_quirks()
313 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) in xhci_pci_quirks()
314 xhci->quirks |= XHCI_U2_DISABLE_WAKE; in xhci_pci_quirks()
316 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
317 pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) in xhci_pci_quirks()
318 xhci->quirks |= XHCI_BROKEN_D3COLD_S2I; in xhci_pci_quirks()
320 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in xhci_pci_quirks()
321 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
322 xhci->quirks |= XHCI_INTEL_HOST; in xhci_pci_quirks()
323 xhci->quirks |= XHCI_AVOID_BEI; in xhci_pci_quirks()
325 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
326 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { in xhci_pci_quirks()
327 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; in xhci_pci_quirks()
328 xhci->limit_active_eps = 64; in xhci_pci_quirks()
329 xhci->quirks |= XHCI_SW_BW_CHECKING; in xhci_pci_quirks()
338 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
340 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
341 (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI || in xhci_pci_quirks()
342 pdev->device == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI)) { in xhci_pci_quirks()
343 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
344 xhci->quirks |= XHCI_SPURIOUS_WAKEUP; in xhci_pci_quirks()
346 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
347 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
348 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
349 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
350 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || in xhci_pci_quirks()
351 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || in xhci_pci_quirks()
352 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI || in xhci_pci_quirks()
353 pdev->device == PCI_DEVICE_ID_INTEL_DENVERTON_XHCI || in xhci_pci_quirks()
354 pdev->device == PCI_DEVICE_ID_INTEL_COMET_LAKE_XHCI)) { in xhci_pci_quirks()
355 xhci->quirks |= XHCI_PME_STUCK_QUIRK; in xhci_pci_quirks()
357 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
358 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) in xhci_pci_quirks()
359 xhci->quirks |= XHCI_SSIC_PORT_UNUSED; in xhci_pci_quirks()
360 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
361 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
362 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
363 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI)) in xhci_pci_quirks()
364 xhci->quirks |= XHCI_INTEL_USB_ROLE_SW; in xhci_pci_quirks()
365 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
366 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
367 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
368 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
369 pdev->device == PCI_DEVICE_ID_INTEL_APOLLO_LAKE_XHCI || in xhci_pci_quirks()
370 pdev->device == PCI_DEVICE_ID_INTEL_DENVERTON_XHCI)) in xhci_pci_quirks()
371 xhci->quirks |= XHCI_MISSING_CAS; in xhci_pci_quirks()
373 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
374 (pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_PCH_XHCI || in xhci_pci_quirks()
375 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI || in xhci_pci_quirks()
376 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI)) in xhci_pci_quirks()
377 xhci->quirks |= XHCI_RESET_TO_DEFAULT; in xhci_pci_quirks()
379 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
380 (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || in xhci_pci_quirks()
381 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || in xhci_pci_quirks()
382 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || in xhci_pci_quirks()
383 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI || in xhci_pci_quirks()
384 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || in xhci_pci_quirks()
385 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || in xhci_pci_quirks()
386 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI || in xhci_pci_quirks()
387 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || in xhci_pci_quirks()
388 pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || in xhci_pci_quirks()
389 pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || in xhci_pci_quirks()
390 pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI)) in xhci_pci_quirks()
391 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
393 if (pdev->vendor == PCI_VENDOR_ID_ETRON && in xhci_pci_quirks()
394 (pdev->device == PCI_DEVICE_ID_ETRON_EJ168 || in xhci_pci_quirks()
395 pdev->device == PCI_DEVICE_ID_ETRON_EJ188)) { in xhci_pci_quirks()
396 xhci->quirks |= XHCI_ETRON_HOST; in xhci_pci_quirks()
397 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
398 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
399 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
402 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
403 pdev->device == 0x0014) { in xhci_pci_quirks()
404 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
406 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
407 pdev->device == 0x0015) { in xhci_pci_quirks()
408 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
409 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
411 if (pdev->vendor == PCI_VENDOR_ID_VIA) in xhci_pci_quirks()
412 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
414 if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM && in xhci_pci_quirks()
415 pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI) in xhci_pci_quirks()
416 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
419 if (pdev->vendor == PCI_VENDOR_ID_VIA && in xhci_pci_quirks()
420 pdev->device == 0x3432) in xhci_pci_quirks()
421 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
423 if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == PCI_DEVICE_ID_VIA_VL805) { in xhci_pci_quirks()
424 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
425 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
428 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
429 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { in xhci_pci_quirks()
434 xhci->quirks |= XHCI_SPURIOUS_SUCCESS; in xhci_pci_quirks()
435 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
437 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
438 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) { in xhci_pci_quirks()
439 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
441 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
442 (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI || in xhci_pci_quirks()
443 pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI || in xhci_pci_quirks()
444 pdev->device == PCI_DEVICE_ID_ASMEDIA_3242_XHCI)) in xhci_pci_quirks()
445 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
447 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
448 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) in xhci_pci_quirks()
449 xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; in xhci_pci_quirks()
451 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
452 pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI) in xhci_pci_quirks()
453 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
455 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) in xhci_pci_quirks()
456 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; in xhci_pci_quirks()
458 if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM || in xhci_pci_quirks()
459 pdev->vendor == PCI_VENDOR_ID_CAVIUM) && in xhci_pci_quirks()
460 pdev->device == 0x9026) in xhci_pci_quirks()
461 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; in xhci_pci_quirks()
463 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
464 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 || in xhci_pci_quirks()
465 pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) in xhci_pci_quirks()
466 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
468 if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) { in xhci_pci_quirks()
469 xhci->quirks |= XHCI_ZHAOXIN_HOST; in xhci_pci_quirks()
470 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
472 if (pdev->device == 0x9202) { in xhci_pci_quirks()
473 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
474 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
477 if (pdev->device == 0x9203) in xhci_pci_quirks()
478 xhci->quirks |= XHCI_TRB_OVERFETCH; in xhci_pci_quirks()
481 if (pdev->vendor == PCI_VENDOR_ID_CDNS && in xhci_pci_quirks()
482 pdev->device == PCI_DEVICE_ID_CDNS_USBSSP) in xhci_pci_quirks()
483 xhci->quirks |= XHCI_CDNS_SCTX_QUIRK; in xhci_pci_quirks()
486 if (xhci->hci_version >= 0x120) in xhci_pci_quirks()
487 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
489 if (xhci->quirks & XHCI_RESET_ON_RESUME) in xhci_pci_quirks()
502 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), &intel_dsm_guid, 3, 1, in xhci_pme_acpi_rtd3_enable()
510 struct xhci_hub *rhub = &xhci->usb3_rhub; in xhci_find_lpm_incapable_ports()
515 if (hcd != rhub->hcd) in xhci_find_lpm_incapable_ports()
518 if (hdev->maxchild > rhub->num_ports) { in xhci_find_lpm_incapable_ports()
519 dev_err(&hdev->dev, "USB3 roothub port number mismatch\n"); in xhci_find_lpm_incapable_ports()
523 for (i = 0; i < hdev->maxchild; i++) { in xhci_find_lpm_incapable_ports()
526 dev_dbg(&hdev->dev, "port-%d disable U1/U2 _DSM: %d\n", i + 1, ret); in xhci_find_lpm_incapable_ports()
529 rhub->ports[i]->lpm_incapable = ret; in xhci_find_lpm_incapable_ports()
544 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_setup()
551 xhci->imod_interval = 40000; in xhci_pci_setup()
560 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_setup()
574 if (!hdev->parent) in xhci_pci_update_hub_device()
591 reset = devm_reset_control_get_optional_exclusive(&dev->dev, NULL); in xhci_pci_common_probe()
596 /* Prevent runtime suspending between USB-2 and USB-3 initialization */ in xhci_pci_common_probe()
597 pm_runtime_get_noresume(&dev->dev); in xhci_pci_common_probe()
611 hcd = dev_get_drvdata(&dev->dev); in xhci_pci_common_probe()
613 xhci->reset = reset; in xhci_pci_common_probe()
614 xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev, in xhci_pci_common_probe()
616 if (!xhci->shared_hcd) { in xhci_pci_common_probe()
617 retval = -ENOMEM; in xhci_pci_common_probe()
625 retval = usb_add_hcd(xhci->shared_hcd, dev->irq, in xhci_pci_common_probe()
631 if (!(xhci->quirks & XHCI_BROKEN_STREAMS) && in xhci_pci_common_probe()
632 HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_pci_common_probe()
633 xhci->shared_hcd->can_do_streams = 1; in xhci_pci_common_probe()
635 /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ in xhci_pci_common_probe()
636 pm_runtime_put_noidle(&dev->dev); in xhci_pci_common_probe()
639 pm_runtime_get(&dev->dev); in xhci_pci_common_probe()
640 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_common_probe()
641 pm_runtime_allow(&dev->dev); in xhci_pci_common_probe()
643 dma_set_max_seg_size(&dev->dev, UINT_MAX); in xhci_pci_common_probe()
645 if (device_property_read_bool(&dev->dev, "ti,pwron-active-high")) in xhci_pci_common_probe()
651 usb_put_hcd(xhci->shared_hcd); in xhci_pci_common_probe()
655 pm_runtime_put_noidle(&dev->dev); in xhci_pci_common_probe()
660 /* handled by xhci-pci-renesas if enabled */
671 return -ENODEV; in xhci_pci_probe()
682 set_power_d3 = xhci->quirks & XHCI_SPURIOUS_WAKEUP; in xhci_pci_remove()
684 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_pci_remove()
687 pm_runtime_put(&dev->dev); in xhci_pci_remove()
688 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_remove()
689 pm_runtime_forbid(&dev->dev); in xhci_pci_remove()
691 if (xhci->shared_hcd) { in xhci_pci_remove()
692 usb_remove_hcd(xhci->shared_hcd); in xhci_pci_remove()
693 usb_put_hcd(xhci->shared_hcd); in xhci_pci_remove()
694 xhci->shared_hcd = NULL; in xhci_pci_remove()
720 reg = (void __iomem *) xhci->cap_regs + in xhci_ssic_port_unused_quirk()
744 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
745 * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
753 reg = (void __iomem *) xhci->cap_regs + 0x80a4; in xhci_pme_quirk()
763 reg = readl(hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
765 writel(reg, hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
771 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_suspend()
778 if (xhci->quirks & XHCI_COMP_MODE_QUIRK) in xhci_pci_suspend()
784 xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)) in xhci_pci_suspend()
788 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_suspend()
791 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_suspend()
794 if (xhci->quirks & XHCI_DISABLE_SPARSE) in xhci_pci_suspend()
799 /* synchronize irq when using MSI-X */ in xhci_pci_suspend()
802 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED)) in xhci_pci_suspend()
811 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_resume()
813 reset_control_reset(xhci->reset); in xhci_pci_resume()
833 if (pdev->vendor == PCI_VENDOR_ID_INTEL) in xhci_pci_resume()
836 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_resume()
839 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_resume()
862 if (!(xhci->quirks & XHCI_RESET_TO_DEFAULT)) in xhci_pci_poweroff_late()
865 for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { in xhci_pci_poweroff_late()
866 port = &xhci->hw_ports[i]; in xhci_pci_poweroff_late()
867 portsc = readl(port->addr); in xhci_pci_poweroff_late()
872 if (!port->slot_id || !xhci->devs[port->slot_id]) { in xhci_pci_poweroff_late()
873 xhci_err(xhci, "No dev for slot_id %d for port %d-%d in U3\n", in xhci_pci_poweroff_late()
874 port->slot_id, port->rhub->hcd->self.busnum, in xhci_pci_poweroff_late()
875 port->hcd_portnum + 1); in xhci_pci_poweroff_late()
879 udev = xhci->devs[port->slot_id]->udev; in xhci_pci_poweroff_late()
882 if (udev->do_remote_wakeup && do_wakeup) in xhci_pci_poweroff_late()
885 xhci_dbg(xhci, "port %d-%d in U3 without wakeup, disable it\n", in xhci_pci_poweroff_late()
886 port->rhub->hcd->self.busnum, port->hcd_portnum + 1); in xhci_pci_poweroff_late()
888 writel(portsc | PORT_PE, port->addr); in xhci_pci_poweroff_late()
897 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_shutdown()
903 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) in xhci_pci_shutdown()
907 /*-------------------------------------------------------------------------*/