Lines Matching +full:- +full:refclk
56 struct clk *refclk; member
64 otg->host = host; in dm816x_usb_phy_set_host()
66 otg->state = OTG_STATE_UNDEFINED; in dm816x_usb_phy_set_host()
74 otg->gadget = gadget; in dm816x_usb_phy_set_peripheral()
76 otg->state = OTG_STATE_UNDEFINED; in dm816x_usb_phy_set_peripheral()
86 if (clk_get_rate(phy->refclk) != 24000000) in dm816x_usb_phy_init()
87 dev_warn(phy->dev, "nonstandard phy refclk\n"); in dm816x_usb_phy_init()
90 regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_init()
95 regmap_read(phy->syscon, phy->usb_ctrl, &val); in dm816x_usb_phy_init()
97 dev_info(phy->dev, in dm816x_usb_phy_init()
106 regmap_read(phy->syscon, phy->usbphy_ctrl, &val); in dm816x_usb_phy_init()
110 regmap_write(phy->syscon, phy->usbphy_ctrl, val); in dm816x_usb_phy_init()
126 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
127 val = ~BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
128 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_suspend()
131 dev_err(phy->dev, "phy%i failed to power off\n", in dm816x_usb_phy_runtime_suspend()
132 phy->instance); in dm816x_usb_phy_runtime_suspend()
133 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_suspend()
144 error = clk_enable(phy->refclk); in dm816x_usb_phy_runtime_resume()
154 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
155 val = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
156 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_resume()
159 dev_err(phy->dev, "phy%i failed to power on\n", in dm816x_usb_phy_runtime_resume()
160 phy->instance); in dm816x_usb_phy_runtime_resume()
161 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_resume()
176 .compatible = "ti,dm8168-usb-phy",
194 &pdev->dev); in dm816x_usb_phy_probe()
196 return -EINVAL; in dm816x_usb_phy_probe()
198 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); in dm816x_usb_phy_probe()
200 return -ENOMEM; in dm816x_usb_phy_probe()
204 return -ENOENT; in dm816x_usb_phy_probe()
206 phy->syscon = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, in dm816x_usb_phy_probe()
208 if (IS_ERR(phy->syscon)) in dm816x_usb_phy_probe()
209 return PTR_ERR(phy->syscon); in dm816x_usb_phy_probe()
216 phy->usb_ctrl = 0x20; in dm816x_usb_phy_probe()
217 phy->usbphy_ctrl = (res->start & 0xff) + 4; in dm816x_usb_phy_probe()
218 if (phy->usbphy_ctrl == 0x2c) in dm816x_usb_phy_probe()
219 phy->instance = 1; in dm816x_usb_phy_probe()
221 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); in dm816x_usb_phy_probe()
223 return -ENOMEM; in dm816x_usb_phy_probe()
225 phy->dev = &pdev->dev; in dm816x_usb_phy_probe()
226 phy->phy.dev = phy->dev; in dm816x_usb_phy_probe()
227 phy->phy.label = "dm8168_usb_phy"; in dm816x_usb_phy_probe()
228 phy->phy.otg = otg; in dm816x_usb_phy_probe()
229 phy->phy.type = USB_PHY_TYPE_USB2; in dm816x_usb_phy_probe()
230 otg->set_host = dm816x_usb_phy_set_host; in dm816x_usb_phy_probe()
231 otg->set_peripheral = dm816x_usb_phy_set_peripheral; in dm816x_usb_phy_probe()
232 otg->usb_phy = &phy->phy; in dm816x_usb_phy_probe()
236 phy->refclk = devm_clk_get(phy->dev, "refclk"); in dm816x_usb_phy_probe()
237 if (IS_ERR(phy->refclk)) in dm816x_usb_phy_probe()
238 return PTR_ERR(phy->refclk); in dm816x_usb_phy_probe()
239 error = clk_prepare(phy->refclk); in dm816x_usb_phy_probe()
243 pm_runtime_enable(phy->dev); in dm816x_usb_phy_probe()
244 generic_phy = devm_phy_create(phy->dev, NULL, &ops); in dm816x_usb_phy_probe()
250 phy_provider = devm_of_phy_provider_register(phy->dev, in dm816x_usb_phy_probe()
255 usb_add_phy_dev(&phy->phy); in dm816x_usb_phy_probe()
264 usb_remove_phy(&phy->phy); in dm816x_usb_phy_remove()
265 pm_runtime_disable(phy->dev); in dm816x_usb_phy_remove()
266 clk_unprepare(phy->refclk); in dm816x_usb_phy_remove()
275 .name = "dm816x-usb-phy",