Lines Matching +full:phyrst +full:- +full:a +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2018-2020 Cadence.
6 * Copyright (C) 2017-2018 NXP
23 #include "gadget-export.h"
30 ret = phy_power_on(cdns->usb2_phy); in set_phy_power_on()
34 ret = phy_power_on(cdns->usb3_phy); in set_phy_power_on()
36 phy_power_off(cdns->usb2_phy); in set_phy_power_on()
43 phy_power_off(cdns->usb3_phy); in set_phy_power_off()
44 phy_power_off(cdns->usb2_phy); in set_phy_power_off()
48 * cdns3_plat_probe - probe for cdns3 core device
55 struct device *dev = &pdev->dev; in cdns3_plat_probe()
63 return -ENOMEM; in cdns3_plat_probe()
65 cdns->dev = dev; in cdns3_plat_probe()
66 cdns->pdata = dev_get_platdata(dev); in cdns3_plat_probe()
74 cdns->xhci_res[0].start = ret; in cdns3_plat_probe()
75 cdns->xhci_res[0].end = ret; in cdns3_plat_probe()
76 cdns->xhci_res[0].flags = IORESOURCE_IRQ | irq_get_trigger_type(ret); in cdns3_plat_probe()
77 cdns->xhci_res[0].name = "host"; in cdns3_plat_probe()
82 return -ENXIO; in cdns3_plat_probe()
85 cdns->xhci_res[1] = *res; in cdns3_plat_probe()
87 cdns->dev_irq = platform_get_irq_byname(pdev, "peripheral"); in cdns3_plat_probe()
89 if (cdns->dev_irq < 0) in cdns3_plat_probe()
90 return dev_err_probe(dev, cdns->dev_irq, in cdns3_plat_probe()
98 cdns->dev_regs = regs; in cdns3_plat_probe()
100 cdns->otg_irq = platform_get_irq_byname(pdev, "otg"); in cdns3_plat_probe()
101 if (cdns->otg_irq < 0) in cdns3_plat_probe()
102 return dev_err_probe(dev, cdns->otg_irq, in cdns3_plat_probe()
108 return -ENXIO; in cdns3_plat_probe()
111 cdns->phyrst_a_enable = device_property_read_bool(dev, "cdns,phyrst-a-enable"); in cdns3_plat_probe()
113 cdns->otg_res = *res; in cdns3_plat_probe()
115 cdns->wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup"); in cdns3_plat_probe()
116 if (cdns->wakeup_irq == -EPROBE_DEFER) in cdns3_plat_probe()
117 return cdns->wakeup_irq; in cdns3_plat_probe()
119 if (cdns->wakeup_irq < 0) { in cdns3_plat_probe()
121 cdns->wakeup_irq = 0x0; in cdns3_plat_probe()
124 cdns->usb2_phy = devm_phy_optional_get(dev, "cdns3,usb2-phy"); in cdns3_plat_probe()
125 if (IS_ERR(cdns->usb2_phy)) in cdns3_plat_probe()
126 return dev_err_probe(dev, PTR_ERR(cdns->usb2_phy), in cdns3_plat_probe()
127 "Failed to get cdn3,usb2-phy\n"); in cdns3_plat_probe()
129 ret = phy_init(cdns->usb2_phy); in cdns3_plat_probe()
133 cdns->usb3_phy = devm_phy_optional_get(dev, "cdns3,usb3-phy"); in cdns3_plat_probe()
134 if (IS_ERR(cdns->usb3_phy)) in cdns3_plat_probe()
135 return dev_err_probe(dev, PTR_ERR(cdns->usb3_phy), in cdns3_plat_probe()
136 "Failed to get cdn3,usb3-phy\n"); in cdns3_plat_probe()
138 ret = phy_init(cdns->usb3_phy); in cdns3_plat_probe()
146 cdns->gadget_init = cdns3_gadget_init; in cdns3_plat_probe()
155 if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))) in cdns3_plat_probe()
160 * and we also needs a small delay to avoid frequently entering low in cdns3_plat_probe()
172 phy_exit(cdns->usb3_phy); in cdns3_plat_probe()
174 phy_exit(cdns->usb2_phy); in cdns3_plat_probe()
180 * cdns3_plat_remove() - unbind drd driver and clean up
188 struct device *dev = cdns->dev; in cdns3_plat_remove()
195 phy_exit(cdns->usb2_phy); in cdns3_plat_remove()
196 phy_exit(cdns->usb3_phy); in cdns3_plat_remove()
207 if (cdns->pdata && cdns->pdata->platform_suspend) in cdns3_set_platform_suspend()
208 ret = cdns->pdata->platform_suspend(dev, suspend, wakeup); in cdns3_set_platform_suspend()
219 if (cdns->in_lpm) in cdns3_controller_suspend()
227 cdns3_set_platform_suspend(cdns->dev, true, wakeup); in cdns3_controller_suspend()
229 spin_lock_irqsave(&cdns->lock, flags); in cdns3_controller_suspend()
230 cdns->in_lpm = true; in cdns3_controller_suspend()
231 spin_unlock_irqrestore(&cdns->lock, flags); in cdns3_controller_suspend()
232 dev_dbg(cdns->dev, "%s ends\n", __func__); in cdns3_controller_suspend()
243 if (!cdns->in_lpm) in cdns3_controller_resume()
247 phy_exit(cdns->usb2_phy); in cdns3_controller_resume()
248 ret = phy_init(cdns->usb2_phy); in cdns3_controller_resume()
252 phy_exit(cdns->usb3_phy); in cdns3_controller_resume()
253 ret = phy_init(cdns->usb3_phy); in cdns3_controller_resume()
262 cdns3_set_platform_suspend(cdns->dev, false, false); in cdns3_controller_resume()
264 spin_lock_irqsave(&cdns->lock, flags); in cdns3_controller_resume()
266 cdns->in_lpm = false; in cdns3_controller_resume()
267 spin_unlock_irqrestore(&cdns->lock, flags); in cdns3_controller_resume()
269 if (cdns->wakeup_pending) { in cdns3_controller_resume()
270 cdns->wakeup_pending = false; in cdns3_controller_resume()
271 enable_irq(cdns->wakeup_irq); in cdns3_controller_resume()
273 dev_dbg(cdns->dev, "%s ends\n", __func__); in cdns3_controller_resume()
301 if (device_may_wakeup(dev) && cdns->wakeup_irq) in cdns3_plat_suspend()
302 enable_irq_wake(cdns->wakeup_irq); in cdns3_plat_suspend()
332 .name = "cdns-usb3",