Lines Matching +full:phy +full:- +full:cadence

1 // SPDX-License-Identifier: GPL-2.0
3 * Cadence USBSS DRD Driver.
5 * Copyright (C) 2018-2020 Cadence.
6 * Copyright (C) 2017-2018 NXP
11 * Pawel Laszczak <pawell@cadence.com>
22 #include "gadget-export.h"
29 ret = phy_power_on(cdns->usb2_phy); in set_phy_power_on()
33 ret = phy_power_on(cdns->usb3_phy); in set_phy_power_on()
35 phy_power_off(cdns->usb2_phy); in set_phy_power_on()
42 phy_power_off(cdns->usb3_phy); in set_phy_power_off()
43 phy_power_off(cdns->usb2_phy); in set_phy_power_off()
47 * cdns3_plat_probe - probe for cdns3 core device
54 struct device *dev = &pdev->dev; in cdns3_plat_probe()
62 return -ENOMEM; in cdns3_plat_probe()
64 cdns->dev = dev; in cdns3_plat_probe()
65 cdns->pdata = dev_get_platdata(dev); in cdns3_plat_probe()
73 cdns->xhci_res[0].start = ret; in cdns3_plat_probe()
74 cdns->xhci_res[0].end = ret; in cdns3_plat_probe()
75 cdns->xhci_res[0].flags = IORESOURCE_IRQ | irq_get_trigger_type(ret); in cdns3_plat_probe()
76 cdns->xhci_res[0].name = "host"; in cdns3_plat_probe()
81 return -ENXIO; in cdns3_plat_probe()
84 cdns->xhci_res[1] = *res; in cdns3_plat_probe()
86 cdns->dev_irq = platform_get_irq_byname(pdev, "peripheral"); in cdns3_plat_probe()
88 if (cdns->dev_irq < 0) in cdns3_plat_probe()
89 return cdns->dev_irq; in cdns3_plat_probe()
94 cdns->dev_regs = regs; in cdns3_plat_probe()
96 cdns->otg_irq = platform_get_irq_byname(pdev, "otg"); in cdns3_plat_probe()
97 if (cdns->otg_irq < 0) in cdns3_plat_probe()
98 return cdns->otg_irq; in cdns3_plat_probe()
103 return -ENXIO; in cdns3_plat_probe()
106 cdns->phyrst_a_enable = device_property_read_bool(dev, "cdns,phyrst-a-enable"); in cdns3_plat_probe()
108 cdns->otg_res = *res; in cdns3_plat_probe()
110 cdns->wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup"); in cdns3_plat_probe()
111 if (cdns->wakeup_irq == -EPROBE_DEFER) in cdns3_plat_probe()
112 return cdns->wakeup_irq; in cdns3_plat_probe()
114 if (cdns->wakeup_irq < 0) { in cdns3_plat_probe()
116 cdns->wakeup_irq = 0x0; in cdns3_plat_probe()
119 cdns->usb2_phy = devm_phy_optional_get(dev, "cdns3,usb2-phy"); in cdns3_plat_probe()
120 if (IS_ERR(cdns->usb2_phy)) in cdns3_plat_probe()
121 return PTR_ERR(cdns->usb2_phy); in cdns3_plat_probe()
123 ret = phy_init(cdns->usb2_phy); in cdns3_plat_probe()
127 cdns->usb3_phy = devm_phy_optional_get(dev, "cdns3,usb3-phy"); in cdns3_plat_probe()
128 if (IS_ERR(cdns->usb3_phy)) in cdns3_plat_probe()
129 return PTR_ERR(cdns->usb3_phy); in cdns3_plat_probe()
131 ret = phy_init(cdns->usb3_phy); in cdns3_plat_probe()
139 cdns->gadget_init = cdns3_gadget_init; in cdns3_plat_probe()
148 if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))) in cdns3_plat_probe()
165 phy_exit(cdns->usb3_phy); in cdns3_plat_probe()
167 phy_exit(cdns->usb2_phy); in cdns3_plat_probe()
173 * cdns3_plat_remove() - unbind drd driver and clean up
181 struct device *dev = cdns->dev; in cdns3_plat_remove()
188 phy_exit(cdns->usb2_phy); in cdns3_plat_remove()
189 phy_exit(cdns->usb3_phy); in cdns3_plat_remove()
201 if (cdns->pdata && cdns->pdata->platform_suspend) in cdns3_set_platform_suspend()
202 ret = cdns->pdata->platform_suspend(dev, suspend, wakeup); in cdns3_set_platform_suspend()
213 if (cdns->in_lpm) in cdns3_controller_suspend()
221 cdns3_set_platform_suspend(cdns->dev, true, wakeup); in cdns3_controller_suspend()
223 spin_lock_irqsave(&cdns->lock, flags); in cdns3_controller_suspend()
224 cdns->in_lpm = true; in cdns3_controller_suspend()
225 spin_unlock_irqrestore(&cdns->lock, flags); in cdns3_controller_suspend()
226 dev_dbg(cdns->dev, "%s ends\n", __func__); in cdns3_controller_suspend()
237 if (!cdns->in_lpm) in cdns3_controller_resume()
241 phy_exit(cdns->usb2_phy); in cdns3_controller_resume()
242 ret = phy_init(cdns->usb2_phy); in cdns3_controller_resume()
246 phy_exit(cdns->usb3_phy); in cdns3_controller_resume()
247 ret = phy_init(cdns->usb3_phy); in cdns3_controller_resume()
256 cdns3_set_platform_suspend(cdns->dev, false, false); in cdns3_controller_resume()
258 spin_lock_irqsave(&cdns->lock, flags); in cdns3_controller_resume()
260 cdns->in_lpm = false; in cdns3_controller_resume()
261 spin_unlock_irqrestore(&cdns->lock, flags); in cdns3_controller_resume()
262 if (cdns->wakeup_pending) { in cdns3_controller_resume()
263 cdns->wakeup_pending = false; in cdns3_controller_resume()
264 enable_irq(cdns->wakeup_irq); in cdns3_controller_resume()
266 dev_dbg(cdns->dev, "%s ends\n", __func__); in cdns3_controller_resume()
294 if (device_may_wakeup(dev) && cdns->wakeup_irq) in cdns3_plat_suspend()
295 enable_irq_wake(cdns->wakeup_irq); in cdns3_plat_suspend()
325 .name = "cdns-usb3",
334 MODULE_AUTHOR("Pawel Laszczak <pawell@cadence.com>");
336 MODULE_DESCRIPTION("Cadence USB3 DRD Controller Driver");