Lines Matching refs:cdns

25 static int set_phy_power_on(struct cdns *cdns)  in set_phy_power_on()  argument
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()
40 static void set_phy_power_off(struct cdns *cdns) in set_phy_power_off() argument
42 phy_power_off(cdns->usb3_phy); in set_phy_power_off()
43 phy_power_off(cdns->usb2_phy); in set_phy_power_off()
56 struct cdns *cdns; in cdns3_plat_probe() local
60 cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL); in cdns3_plat_probe()
61 if (!cdns) in cdns3_plat_probe()
64 cdns->dev = dev; in cdns3_plat_probe()
65 cdns->pdata = dev_get_platdata(dev); in cdns3_plat_probe()
67 platform_set_drvdata(pdev, cdns); 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()
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()
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()
135 ret = set_phy_power_on(cdns); in cdns3_plat_probe()
139 cdns->gadget_init = cdns3_gadget_init; in cdns3_plat_probe()
141 ret = cdns_init(cdns); in cdns3_plat_probe()
148 if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))) in cdns3_plat_probe()
163 set_phy_power_off(cdns); in cdns3_plat_probe()
165 phy_exit(cdns->usb3_phy); in cdns3_plat_probe()
167 phy_exit(cdns->usb2_phy); in cdns3_plat_probe()
180 struct cdns *cdns = platform_get_drvdata(pdev); in cdns3_plat_remove() local
181 struct device *dev = cdns->dev; in cdns3_plat_remove()
186 cdns_remove(cdns); in cdns3_plat_remove()
187 set_phy_power_off(cdns); in cdns3_plat_remove()
188 phy_exit(cdns->usb2_phy); in cdns3_plat_remove()
189 phy_exit(cdns->usb3_phy); in cdns3_plat_remove()
198 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_set_platform_suspend() local
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()
209 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_controller_suspend() local
213 if (cdns->in_lpm) in cdns3_controller_suspend()
221 cdns3_set_platform_suspend(cdns->dev, true, wakeup); in cdns3_controller_suspend()
222 set_phy_power_off(cdns); 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()
233 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_controller_resume() local
237 if (!cdns->in_lpm) in cdns3_controller_resume()
240 if (cdns_power_is_lost(cdns)) { 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()
252 ret = set_phy_power_on(cdns); 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()
259 cdns_resume(cdns, !PMSG_IS_AUTO(msg)); 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()
285 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_plat_suspend() local
288 cdns_suspend(cdns); in cdns3_plat_suspend()
294 if (device_may_wakeup(dev) && cdns->wakeup_irq) in cdns3_plat_suspend()
295 enable_irq_wake(cdns->wakeup_irq); in cdns3_plat_suspend()