Lines Matching full:cdns
26 static int set_phy_power_on(struct cdns *cdns) in set_phy_power_on() argument
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()
41 static void set_phy_power_off(struct cdns *cdns) in set_phy_power_off() argument
43 phy_power_off(cdns->usb3_phy); in set_phy_power_off()
44 phy_power_off(cdns->usb2_phy); in set_phy_power_off()
57 struct cdns *cdns; in cdns3_plat_probe() local
61 cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL); in cdns3_plat_probe()
62 if (!cdns) in cdns3_plat_probe()
65 cdns->dev = dev; in cdns3_plat_probe()
66 cdns->pdata = dev_get_platdata(dev); in cdns3_plat_probe()
68 platform_set_drvdata(pdev, cdns); 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()
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()
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()
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()
138 ret = phy_init(cdns->usb3_phy); in cdns3_plat_probe()
142 ret = set_phy_power_on(cdns); in cdns3_plat_probe()
146 cdns->gadget_init = cdns3_gadget_init; in cdns3_plat_probe()
148 ret = cdns_init(cdns); in cdns3_plat_probe()
155 if (!(cdns->pdata && (cdns->pdata->quirks & CDNS3_DEFAULT_PM_RUNTIME_ALLOW))) in cdns3_plat_probe()
170 set_phy_power_off(cdns); in cdns3_plat_probe()
172 phy_exit(cdns->usb3_phy); in cdns3_plat_probe()
174 phy_exit(cdns->usb2_phy); in cdns3_plat_probe()
187 struct cdns *cdns = platform_get_drvdata(pdev); in cdns3_plat_remove() local
188 struct device *dev = cdns->dev; in cdns3_plat_remove()
193 cdns_remove(cdns); in cdns3_plat_remove()
194 set_phy_power_off(cdns); in cdns3_plat_remove()
195 phy_exit(cdns->usb2_phy); in cdns3_plat_remove()
196 phy_exit(cdns->usb3_phy); in cdns3_plat_remove()
204 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_set_platform_suspend() local
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()
215 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_controller_suspend() local
219 if (cdns->in_lpm) in cdns3_controller_suspend()
227 cdns3_set_platform_suspend(cdns->dev, true, wakeup); in cdns3_controller_suspend()
228 set_phy_power_off(cdns); 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()
239 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_controller_resume() local
243 if (!cdns->in_lpm) in cdns3_controller_resume()
246 if (cdns_power_is_lost(cdns)) { 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()
258 ret = set_phy_power_on(cdns); 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()
265 cdns_resume(cdns); in cdns3_controller_resume()
266 cdns->in_lpm = false; in cdns3_controller_resume()
267 spin_unlock_irqrestore(&cdns->lock, flags); in cdns3_controller_resume()
268 cdns_set_active(cdns, !PMSG_IS_AUTO(msg)); 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()
292 struct cdns *cdns = dev_get_drvdata(dev); in cdns3_plat_suspend() local
295 cdns_suspend(cdns); in cdns3_plat_suspend()
301 if (device_may_wakeup(dev) && cdns->wakeup_irq) in cdns3_plat_suspend()
302 enable_irq_wake(cdns->wakeup_irq); in cdns3_plat_suspend()
322 { .compatible = "cdns,usb3" },
332 .name = "cdns-usb3",