Lines Matching +full:lpm +full:- +full:gpios

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
64 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
74 * struct dwc3_pci - Driver private structure
95 { "reset-gpios", &reset_gpios, 1 },
96 { "cs-gpios", &cs_gpios, 1 },
116 return -ENOMEM; in dwc3_byt_enable_ulpi_refclock()
154 * be re-allocated if being used because the side band flow control signals
156 * - 1 High BW Bulk IN (IN#1) (RTIT)
157 * - 1 1KB BW Bulk IN (IN#8) + 1 1KB BW Bulk OUT (Run Control) (OUT#8)
163 PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
166 PROPERTY_ENTRY_U8_ARRAY("snps,reserved-endpoints", dwc3_pci_mrfld_reserved_endpoints),
167 PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"),
173 PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
174 PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
194 PROPERTY_ENTRY_BOOL("usb-role-switch"),
195 PROPERTY_ENTRY_STRING("role-switch-default-mode", "host"),
227 struct pci_dev *pdev = dwc->pci; in dwc3_pci_quirks()
229 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in dwc3_pci_quirks()
230 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || in dwc3_pci_quirks()
231 pdev->device == PCI_DEVICE_ID_INTEL_BXT_M || in dwc3_pci_quirks()
232 pdev->device == PCI_DEVICE_ID_INTEL_EHL) { in dwc3_pci_quirks()
233 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); in dwc3_pci_quirks()
234 dwc->has_dsm_for_pm = true; in dwc3_pci_quirks()
237 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { in dwc3_pci_quirks()
247 ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, in dwc3_pci_quirks()
250 dev_dbg(&pdev->dev, "failed to add mapping table\n"); in dwc3_pci_quirks()
254 * the GPIOs. If the ACPI entry for the GPIO controller in dwc3_pci_quirks()
256 * design GPIOs which all boards seem to use. in dwc3_pci_quirks()
258 if (acpi_dev_present("INT33FC", NULL, -1)) in dwc3_pci_quirks()
262 * These GPIOs will turn on the USB2 PHY. Note that we have to in dwc3_pci_quirks()
266 gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); in dwc3_pci_quirks()
273 gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); in dwc3_pci_quirks()
285 * and patch the phy dev-name into the lookup table so in dwc3_pci_quirks()
286 * that the phy-driver can get the GPIOs. in dwc3_pci_quirks()
288 dwc->dwc3->id = PLATFORM_DEVID_NONE; in dwc3_pci_quirks()
303 dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n"); in dwc3_pci_quirks()
309 return device_add_software_node(&dwc->dwc3->dev, swnode); in dwc3_pci_quirks()
316 struct platform_device *dwc3 = dwc->dwc3; in dwc3_pci_resume_work()
319 ret = pm_runtime_get_sync(&dwc3->dev); in dwc3_pci_resume_work()
321 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
325 pm_runtime_mark_last_busy(&dwc3->dev); in dwc3_pci_resume_work()
326 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
335 struct device *dev = &pci->dev; in dwc3_pci_probe()
340 return -ENODEV; in dwc3_pci_probe()
347 return -ENOMEM; in dwc3_pci_probe()
349 dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); in dwc3_pci_probe()
350 if (!dwc->dwc3) in dwc3_pci_probe()
351 return -ENOMEM; in dwc3_pci_probe()
360 res[1].start = pci->irq; in dwc3_pci_probe()
364 ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res)); in dwc3_pci_probe()
370 dwc->pci = pci; in dwc3_pci_probe()
371 dwc->dwc3->dev.parent = dev; in dwc3_pci_probe()
372 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); in dwc3_pci_probe()
374 ret = dwc3_pci_quirks(dwc, (void *)id->driver_data); in dwc3_pci_probe()
378 ret = platform_device_add(dwc->dwc3); in dwc3_pci_probe()
388 INIT_WORK(&dwc->wakeup_work, dwc3_pci_resume_work); in dwc3_pci_probe()
393 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_probe()
394 platform_device_put(dwc->dwc3); in dwc3_pci_probe()
401 struct pci_dev *pdev = dwc->pci; in dwc3_pci_remove()
403 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) in dwc3_pci_remove()
406 cancel_work_sync(&dwc->wakeup_work); in dwc3_pci_remove()
408 device_init_wakeup(&pci->dev, false); in dwc3_pci_remove()
409 pm_runtime_get(&pci->dev); in dwc3_pci_remove()
410 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_remove()
411 platform_device_unregister(dwc->dwc3); in dwc3_pci_remove()
468 if (!dwc->has_dsm_for_pm) in dwc3_pci_dsm()
474 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid, in dwc3_pci_dsm()
477 dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n"); in dwc3_pci_dsm()
478 return -EIO; in dwc3_pci_dsm()
495 return -EBUSY; in dwc3_pci_runtime_suspend()
507 queue_work(pm_wq, &dwc->wakeup_work); in dwc3_pci_runtime_resume()
536 .name = "dwc3-pci",