Lines Matching +full:fw +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
59 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
69 * struct dwc3_pci - Driver private structure
90 { "reset-gpios", &reset_gpios, 1 },
91 { "cs-gpios", &cs_gpios, 1 },
111 return -ENOMEM; in dwc3_byt_enable_ulpi_refclock()
149 PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
152 PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"),
158 PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
159 PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
179 PROPERTY_ENTRY_BOOL("usb-role-switch"),
180 PROPERTY_ENTRY_STRING("role-switch-default-mode", "host"),
212 struct pci_dev *pdev = dwc->pci; in dwc3_pci_quirks()
214 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in dwc3_pci_quirks()
215 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || in dwc3_pci_quirks()
216 pdev->device == PCI_DEVICE_ID_INTEL_BXT_M || in dwc3_pci_quirks()
217 pdev->device == PCI_DEVICE_ID_INTEL_EHL) { in dwc3_pci_quirks()
218 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); in dwc3_pci_quirks()
219 dwc->has_dsm_for_pm = true; in dwc3_pci_quirks()
222 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { in dwc3_pci_quirks()
226 /* On BYT the FW does not always enable the refclock */ in dwc3_pci_quirks()
231 ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, in dwc3_pci_quirks()
234 dev_dbg(&pdev->dev, "failed to add mapping table\n"); in dwc3_pci_quirks()
238 * the GPIOs. If the ACPI entry for the GPIO controller in dwc3_pci_quirks()
240 * design GPIOs which all boards seem to use. in dwc3_pci_quirks()
242 if (acpi_dev_present("INT33FC", NULL, -1)) in dwc3_pci_quirks()
246 * These GPIOs will turn on the USB2 PHY. Note that we have to in dwc3_pci_quirks()
250 gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); in dwc3_pci_quirks()
257 gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); in dwc3_pci_quirks()
269 * and patch the phy dev-name into the lookup table so in dwc3_pci_quirks()
270 * that the phy-driver can get the GPIOs. in dwc3_pci_quirks()
272 dwc->dwc3->id = PLATFORM_DEVID_NONE; in dwc3_pci_quirks()
283 dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n"); in dwc3_pci_quirks()
289 return device_add_software_node(&dwc->dwc3->dev, swnode); in dwc3_pci_quirks()
296 struct platform_device *dwc3 = dwc->dwc3; in dwc3_pci_resume_work()
299 ret = pm_runtime_get_sync(&dwc3->dev); in dwc3_pci_resume_work()
301 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
305 pm_runtime_mark_last_busy(&dwc3->dev); in dwc3_pci_resume_work()
306 pm_runtime_put_sync_autosuspend(&dwc3->dev); in dwc3_pci_resume_work()
315 struct device *dev = &pci->dev; in dwc3_pci_probe()
320 return -ENODEV; in dwc3_pci_probe()
327 return -ENOMEM; in dwc3_pci_probe()
329 dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); in dwc3_pci_probe()
330 if (!dwc->dwc3) in dwc3_pci_probe()
331 return -ENOMEM; in dwc3_pci_probe()
340 res[1].start = pci->irq; in dwc3_pci_probe()
344 ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res)); in dwc3_pci_probe()
350 dwc->pci = pci; in dwc3_pci_probe()
351 dwc->dwc3->dev.parent = dev; in dwc3_pci_probe()
352 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); in dwc3_pci_probe()
354 ret = dwc3_pci_quirks(dwc, (void *)id->driver_data); in dwc3_pci_probe()
358 ret = platform_device_add(dwc->dwc3); in dwc3_pci_probe()
368 INIT_WORK(&dwc->wakeup_work, dwc3_pci_resume_work); in dwc3_pci_probe()
373 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_probe()
374 platform_device_put(dwc->dwc3); in dwc3_pci_probe()
381 struct pci_dev *pdev = dwc->pci; in dwc3_pci_remove()
383 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) in dwc3_pci_remove()
386 cancel_work_sync(&dwc->wakeup_work); in dwc3_pci_remove()
388 device_init_wakeup(&pci->dev, false); in dwc3_pci_remove()
389 pm_runtime_get(&pci->dev); in dwc3_pci_remove()
390 device_remove_software_node(&dwc->dwc3->dev); in dwc3_pci_remove()
391 platform_device_unregister(dwc->dwc3); in dwc3_pci_remove()
444 if (!dwc->has_dsm_for_pm) in dwc3_pci_dsm()
450 obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid, in dwc3_pci_dsm()
453 dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n"); in dwc3_pci_dsm()
454 return -EIO; in dwc3_pci_dsm()
471 return -EBUSY; in dwc3_pci_runtime_suspend()
483 queue_work(pm_wq, &dwc->wakeup_work); in dwc3_pci_runtime_resume()
512 .name = "dwc3-pci",