Lines Matching +full:needs +full:- +full:reset +full:- +full:on +full:- +full:resume

1 // SPDX-License-Identifier: GPL-2.0
15 #include <linux/reset.h>
18 #include "xhci-trace.h"
19 #include "xhci-pci.h"
81 .reset = xhci_pci_setup,
84 /* called after powerup, by probe or system-pm "wakeup" */
93 /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ in xhci_pci_reinit()
107 id = pci_match_id(pdev->driver->id_table, pdev); in xhci_pci_quirks()
109 if (id && id->driver_data) { in xhci_pci_quirks()
110 driver_data = (struct xhci_driver_data *)id->driver_data; in xhci_pci_quirks()
111 xhci->quirks |= driver_data->quirks; in xhci_pci_quirks()
114 /* Look for vendor-specific quirks */ in xhci_pci_quirks()
115 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
116 (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || in xhci_pci_quirks()
117 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || in xhci_pci_quirks()
118 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { in xhci_pci_quirks()
119 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
120 pdev->revision == 0x0) { in xhci_pci_quirks()
121 xhci->quirks |= XHCI_RESET_EP_QUIRK; in xhci_pci_quirks()
123 "QUIRK: Fresco Logic xHC needs configure" in xhci_pci_quirks()
124 " endpoint cmd after reset endpoint"); in xhci_pci_quirks()
126 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && in xhci_pci_quirks()
127 pdev->revision == 0x4) { in xhci_pci_quirks()
128 xhci->quirks |= XHCI_SLOW_SUSPEND; in xhci_pci_quirks()
132 pdev->revision); in xhci_pci_quirks()
134 if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) in xhci_pci_quirks()
135 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
140 xhci->quirks |= XHCI_BROKEN_MSI; in xhci_pci_quirks()
144 pdev->revision); in xhci_pci_quirks()
145 xhci->quirks |= XHCI_TRUST_TX_LENGTH; in xhci_pci_quirks()
148 if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && in xhci_pci_quirks()
149 pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) in xhci_pci_quirks()
150 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
152 if (pdev->vendor == PCI_VENDOR_ID_NEC) in xhci_pci_quirks()
153 xhci->quirks |= XHCI_NEC_HOST; in xhci_pci_quirks()
155 if (pdev->vendor == PCI_VENDOR_ID_AMD && xhci->hci_version == 0x96) in xhci_pci_quirks()
156 xhci->quirks |= XHCI_AMD_0x96_HOST; in xhci_pci_quirks()
159 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_quirk_pll_check()) in xhci_pci_quirks()
160 xhci->quirks |= XHCI_AMD_PLL_FIX; in xhci_pci_quirks()
162 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
163 (pdev->device == 0x145c || in xhci_pci_quirks()
164 pdev->device == 0x15e0 || in xhci_pci_quirks()
165 pdev->device == 0x15e1 || in xhci_pci_quirks()
166 pdev->device == 0x43bb)) in xhci_pci_quirks()
167 xhci->quirks |= XHCI_SUSPEND_DELAY; in xhci_pci_quirks()
169 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
170 (pdev->device == 0x15e0 || pdev->device == 0x15e1)) in xhci_pci_quirks()
171 xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; in xhci_pci_quirks()
173 if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x15e5) { in xhci_pci_quirks()
174 xhci->quirks |= XHCI_DISABLE_SPARSE; in xhci_pci_quirks()
175 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
178 if (pdev->vendor == PCI_VENDOR_ID_AMD) in xhci_pci_quirks()
179 xhci->quirks |= XHCI_TRUST_TX_LENGTH; in xhci_pci_quirks()
181 if ((pdev->vendor == PCI_VENDOR_ID_AMD) && in xhci_pci_quirks()
182 ((pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4) || in xhci_pci_quirks()
183 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_3) || in xhci_pci_quirks()
184 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2) || in xhci_pci_quirks()
185 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) in xhci_pci_quirks()
186 xhci->quirks |= XHCI_U2_DISABLE_WAKE; in xhci_pci_quirks()
188 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
189 pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI) in xhci_pci_quirks()
190 xhci->quirks |= XHCI_BROKEN_D3COLD; in xhci_pci_quirks()
192 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in xhci_pci_quirks()
193 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
194 xhci->quirks |= XHCI_INTEL_HOST; in xhci_pci_quirks()
195 xhci->quirks |= XHCI_AVOID_BEI; in xhci_pci_quirks()
197 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
198 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { in xhci_pci_quirks()
199 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; in xhci_pci_quirks()
200 xhci->limit_active_eps = 64; in xhci_pci_quirks()
201 xhci->quirks |= XHCI_SW_BW_CHECKING; in xhci_pci_quirks()
203 * PPT desktop boards DH77EB and DH77DF will power back on after in xhci_pci_quirks()
205 * switch the ports from xHCI to EHCI on shutdown. We can't use in xhci_pci_quirks()
210 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
212 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
213 (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI || in xhci_pci_quirks()
214 pdev->device == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI)) { in xhci_pci_quirks()
215 xhci->quirks |= XHCI_SPURIOUS_REBOOT; in xhci_pci_quirks()
216 xhci->quirks |= XHCI_SPURIOUS_WAKEUP; in xhci_pci_quirks()
218 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
219 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
220 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
221 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
222 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || in xhci_pci_quirks()
223 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || in xhci_pci_quirks()
224 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || in xhci_pci_quirks()
225 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI || in xhci_pci_quirks()
226 pdev->device == PCI_DEVICE_ID_INTEL_CML_XHCI)) { in xhci_pci_quirks()
227 xhci->quirks |= XHCI_PME_STUCK_QUIRK; in xhci_pci_quirks()
229 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
230 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) in xhci_pci_quirks()
231 xhci->quirks |= XHCI_SSIC_PORT_UNUSED; in xhci_pci_quirks()
232 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
233 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
234 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
235 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) in xhci_pci_quirks()
236 xhci->quirks |= XHCI_INTEL_USB_ROLE_SW; in xhci_pci_quirks()
237 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
238 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || in xhci_pci_quirks()
239 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || in xhci_pci_quirks()
240 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || in xhci_pci_quirks()
241 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || in xhci_pci_quirks()
242 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) in xhci_pci_quirks()
243 xhci->quirks |= XHCI_MISSING_CAS; in xhci_pci_quirks()
245 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in xhci_pci_quirks()
246 (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || in xhci_pci_quirks()
247 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || in xhci_pci_quirks()
248 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || in xhci_pci_quirks()
249 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI || in xhci_pci_quirks()
250 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || in xhci_pci_quirks()
251 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || in xhci_pci_quirks()
252 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI || in xhci_pci_quirks()
253 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || in xhci_pci_quirks()
254 pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || in xhci_pci_quirks()
255 pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || in xhci_pci_quirks()
256 pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || in xhci_pci_quirks()
257 pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI)) in xhci_pci_quirks()
258 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; in xhci_pci_quirks()
260 if (pdev->vendor == PCI_VENDOR_ID_ETRON && in xhci_pci_quirks()
261 pdev->device == PCI_DEVICE_ID_EJ168) { in xhci_pci_quirks()
262 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
263 xhci->quirks |= XHCI_TRUST_TX_LENGTH; in xhci_pci_quirks()
264 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
266 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
267 pdev->device == 0x0014) { in xhci_pci_quirks()
268 xhci->quirks |= XHCI_TRUST_TX_LENGTH; in xhci_pci_quirks()
269 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
271 if (pdev->vendor == PCI_VENDOR_ID_RENESAS && in xhci_pci_quirks()
272 pdev->device == 0x0015) { in xhci_pci_quirks()
273 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
274 xhci->quirks |= XHCI_ZERO_64B_REGS; in xhci_pci_quirks()
276 if (pdev->vendor == PCI_VENDOR_ID_VIA) in xhci_pci_quirks()
277 xhci->quirks |= XHCI_RESET_ON_RESUME; in xhci_pci_quirks()
280 if (pdev->vendor == PCI_VENDOR_ID_VIA && in xhci_pci_quirks()
281 pdev->device == 0x3432) in xhci_pci_quirks()
282 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
284 if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { in xhci_pci_quirks()
285 xhci->quirks |= XHCI_LPM_SUPPORT; in xhci_pci_quirks()
286 xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; in xhci_pci_quirks()
289 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
290 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) in xhci_pci_quirks()
291 xhci->quirks |= XHCI_BROKEN_STREAMS; in xhci_pci_quirks()
292 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
293 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) { in xhci_pci_quirks()
294 xhci->quirks |= XHCI_TRUST_TX_LENGTH; in xhci_pci_quirks()
295 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
297 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
298 (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI || in xhci_pci_quirks()
299 pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI || in xhci_pci_quirks()
300 pdev->device == PCI_DEVICE_ID_ASMEDIA_3242_XHCI)) in xhci_pci_quirks()
301 xhci->quirks |= XHCI_NO_64BIT_SUPPORT; in xhci_pci_quirks()
303 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && in xhci_pci_quirks()
304 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) in xhci_pci_quirks()
305 xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; in xhci_pci_quirks()
307 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) in xhci_pci_quirks()
308 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; in xhci_pci_quirks()
310 if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM || in xhci_pci_quirks()
311 pdev->vendor == PCI_VENDOR_ID_CAVIUM) && in xhci_pci_quirks()
312 pdev->device == 0x9026) in xhci_pci_quirks()
313 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; in xhci_pci_quirks()
315 if (pdev->vendor == PCI_VENDOR_ID_AMD && in xhci_pci_quirks()
316 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 || in xhci_pci_quirks()
317 pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) in xhci_pci_quirks()
318 xhci->quirks |= XHCI_NO_SOFT_RETRY; in xhci_pci_quirks()
320 if (xhci->quirks & XHCI_RESET_ON_RESUME) in xhci_pci_quirks()
322 "QUIRK: Resetting on resume"); in xhci_pci_quirks()
333 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), &intel_dsm_guid, 3, 1, in xhci_pme_acpi_rtd3_enable()
341 /* called during probe() after chip reset completes */
345 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_setup()
349 if (!xhci->sbrn) in xhci_pci_setup()
350 pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, &xhci->sbrn); in xhci_pci_setup()
353 xhci->imod_interval = 40000; in xhci_pci_setup()
362 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_setup()
365 xhci_dbg(xhci, "Got SBRN %u\n", (unsigned int) xhci->sbrn); in xhci_pci_setup()
381 struct reset_control *reset; in xhci_pci_probe() local
383 driver_data = (struct xhci_driver_data *)id->driver_data; in xhci_pci_probe()
384 if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) { in xhci_pci_probe()
390 reset = devm_reset_control_get_optional_exclusive(&dev->dev, NULL); in xhci_pci_probe()
391 if (IS_ERR(reset)) in xhci_pci_probe()
392 return PTR_ERR(reset); in xhci_pci_probe()
393 reset_control_reset(reset); in xhci_pci_probe()
395 /* Prevent runtime suspending between USB-2 and USB-3 initialization */ in xhci_pci_probe()
396 pm_runtime_get_noresume(&dev->dev); in xhci_pci_probe()
410 hcd = dev_get_drvdata(&dev->dev); in xhci_pci_probe()
412 xhci->reset = reset; in xhci_pci_probe()
413 xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev, in xhci_pci_probe()
415 if (!xhci->shared_hcd) { in xhci_pci_probe()
416 retval = -ENOMEM; in xhci_pci_probe()
424 retval = usb_add_hcd(xhci->shared_hcd, dev->irq, in xhci_pci_probe()
430 if (!(xhci->quirks & XHCI_BROKEN_STREAMS) && in xhci_pci_probe()
431 HCC_MAX_PSA(xhci->hcc_params) >= 4) in xhci_pci_probe()
432 xhci->shared_hcd->can_do_streams = 1; in xhci_pci_probe()
434 /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ in xhci_pci_probe()
435 pm_runtime_put_noidle(&dev->dev); in xhci_pci_probe()
437 if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_probe()
438 pm_runtime_allow(&dev->dev); in xhci_pci_probe()
443 usb_put_hcd(xhci->shared_hcd); in xhci_pci_probe()
447 pm_runtime_put_noidle(&dev->dev); in xhci_pci_probe()
457 xhci->xhc_state |= XHCI_STATE_REMOVING; in xhci_pci_remove()
459 if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) in xhci_pci_remove()
460 pm_runtime_forbid(&dev->dev); in xhci_pci_remove()
462 if (xhci->shared_hcd) { in xhci_pci_remove()
463 usb_remove_hcd(xhci->shared_hcd); in xhci_pci_remove()
464 usb_put_hcd(xhci->shared_hcd); in xhci_pci_remove()
465 xhci->shared_hcd = NULL; in xhci_pci_remove()
469 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) in xhci_pci_remove()
491 reg = (void __iomem *) xhci->cap_regs + in xhci_ssic_port_unused_quirk()
499 /* Mark SSIC port as unused(suspend) or used(resume) */ in xhci_ssic_port_unused_quirk()
515 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
524 reg = (void __iomem *) xhci->cap_regs + 0x80a4; in xhci_pme_quirk()
534 reg = readl(hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
536 writel(reg, hcd->regs + SPARSE_CNTL_ENABLE); in xhci_sparse_control_quirk()
542 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_suspend()
549 if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD)) in xhci_pci_suspend()
552 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_suspend()
555 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_suspend()
558 if (xhci->quirks & XHCI_DISABLE_SPARSE) in xhci_pci_suspend()
562 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED)) in xhci_pci_suspend()
571 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_resume()
574 reset_control_reset(xhci->reset); in xhci_pci_resume()
576 /* The BIOS on systems with the Intel Panther Point chipset may or may in xhci_pci_resume()
577 * not support xHCI natively. That means that during system resume, it in xhci_pci_resume()
579 * keyboard to select a kernel from GRUB after resume from hibernate. in xhci_pci_resume()
582 * enabled before resume, and switch the ports back to xHCI when the in xhci_pci_resume()
586 * Unconditionally switch the ports back to xHCI after a system resume. in xhci_pci_resume()
594 if (pdev->vendor == PCI_VENDOR_ID_INTEL) in xhci_pci_resume()
597 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED) in xhci_pci_resume()
600 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) in xhci_pci_resume()
610 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); in xhci_pci_shutdown()
615 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) in xhci_pci_shutdown()
620 /*-------------------------------------------------------------------------*/
644 * load firmware, so don't encumber the xhci-pci driver with it.
657 /* suspend and resume implemented later */