Lines Matching +full:usb2 +full:- +full:lpm +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0
3 * dwc3-pci.c - PCI Specific glue layer
5 * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
49 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
59 * struct dwc3_pci - Driver private structure
80 { "reset-gpios", &reset_gpios, 1 },
81 { "cs-gpios", &cs_gpios, 1 },
101 return -ENOMEM; in dwc3_byt_enable_ulpi_refclock()
124 PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
127 PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"),
133 PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
134 PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
154 PROPERTY_ENTRY_BOOL("usb-role-switch"),
155 PROPERTY_ENTRY_STRING("role-switch-default-mode", "host"),
178 struct pci_dev *pdev = dwc->pci; in dwc3_pci_quirks()
180 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in dwc3_pci_quirks()
181 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || in dwc3_pci_quirks()
182 pdev->device == PCI_DEVICE_ID_INTEL_BXT_M || in dwc3_pci_quirks()
183 pdev->device == PCI_DEVICE_ID_INTEL_EHL) { in dwc3_pci_quirks()
184 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); in dwc3_pci_quirks()
185 dwc->has_dsm_for_pm = true; in dwc3_pci_quirks()
188 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { in dwc3_pci_quirks()
197 ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, in dwc3_pci_quirks()
200 dev_dbg(&pdev->dev, "failed to add mapping table\n"); in dwc3_pci_quirks()
210 * These GPIOs will turn on the USB2 PHY. Note that we have to in dwc3_pci_quirks()
214 gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); in dwc3_pci_quirks()
221 gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); in dwc3_pci_quirks()
240 struct platform_device *dwc3 = dwc->dwc3; in dwc3_pci_resume_work()
243 ret = pm_runtime_get_sync(&dwc3->dev); in dwc3_pci_resume_work()
245 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
249 pm_runtime_mark_last_busy(&dwc3->dev); in dwc3_pci_resume_work()
250 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
259 struct device *dev = &pci->dev; in dwc3_pci_probe()
264 return -ENODEV; in dwc3_pci_probe()
271 return -ENOMEM; in dwc3_pci_probe()
273 dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); in dwc3_pci_probe()
274 if (!dwc->dwc3) in dwc3_pci_probe()
275 return -ENOMEM; in dwc3_pci_probe()
284 res[1].start = pci->irq; in dwc3_pci_probe()
288 ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res)); in dwc3_pci_probe()
294 dwc->pci = pci; in dwc3_pci_probe()
295 dwc->dwc3->dev.parent = dev; in dwc3_pci_probe()
296 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); in dwc3_pci_probe()
298 ret = device_add_software_node(&dwc->dwc3->dev, (void *)id->driver_data); in dwc3_pci_probe()
306 ret = platform_device_add(dwc->dwc3); in dwc3_pci_probe()
316 INIT_WORK(&dwc->wakeup_work, dwc3_pci_resume_work); in dwc3_pci_probe()
321 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_probe()
322 platform_device_put(dwc->dwc3); in dwc3_pci_probe()
329 struct pci_dev *pdev = dwc->pci; in dwc3_pci_remove()
331 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) in dwc3_pci_remove()
334 cancel_work_sync(&dwc->wakeup_work); in dwc3_pci_remove()
336 device_init_wakeup(&pci->dev, false); in dwc3_pci_remove()
337 pm_runtime_get(&pci->dev); in dwc3_pci_remove()
338 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_remove()
339 platform_device_unregister(dwc->dwc3); in dwc3_pci_remove()
432 if (!dwc->has_dsm_for_pm) in dwc3_pci_dsm()
438 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid, in dwc3_pci_dsm()
441 dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n"); in dwc3_pci_dsm()
442 return -EIO; in dwc3_pci_dsm()
459 return -EBUSY; in dwc3_pci_runtime_suspend()
471 queue_work(pm_wq, &dwc->wakeup_work); in dwc3_pci_runtime_resume()
500 .name = "dwc3-pci",