Lines Matching refs:rk_phy
191 struct rockchip_usb_phy *rk_phy = data; in rockchip_usb_phy_action() local
193 if (!rk_phy->uart_enabled) { in rockchip_usb_phy_action()
194 of_clk_del_provider(rk_phy->np); in rockchip_usb_phy_action()
195 clk_unregister(rk_phy->clk480m); in rockchip_usb_phy_action()
198 if (rk_phy->clk) in rockchip_usb_phy_action()
199 clk_put(rk_phy->clk); in rockchip_usb_phy_action()
205 struct rockchip_usb_phy *rk_phy; in rockchip_usb_phy_init() local
211 rk_phy = devm_kzalloc(base->dev, sizeof(*rk_phy), GFP_KERNEL); in rockchip_usb_phy_init()
212 if (!rk_phy) in rockchip_usb_phy_init()
215 rk_phy->base = base; in rockchip_usb_phy_init()
216 rk_phy->np = child; in rockchip_usb_phy_init()
224 rk_phy->reset = of_reset_control_get(child, "phy-reset"); in rockchip_usb_phy_init()
225 if (IS_ERR(rk_phy->reset)) in rockchip_usb_phy_init()
226 rk_phy->reset = NULL; in rockchip_usb_phy_init()
228 rk_phy->reg_offset = reg_offset; in rockchip_usb_phy_init()
230 rk_phy->clk = of_clk_get_by_name(child, "phyclk"); in rockchip_usb_phy_init()
231 if (IS_ERR(rk_phy->clk)) in rockchip_usb_phy_init()
232 rk_phy->clk = NULL; in rockchip_usb_phy_init()
251 rk_phy->uart_enabled = true; in rockchip_usb_phy_init()
253 if (rk_phy->clk) { in rockchip_usb_phy_init()
254 clk_name = __clk_get_name(rk_phy->clk); in rockchip_usb_phy_init()
265 rk_phy->clk480m_hw.init = &init; in rockchip_usb_phy_init()
267 rk_phy->clk480m = clk_register(base->dev, &rk_phy->clk480m_hw); in rockchip_usb_phy_init()
268 if (IS_ERR(rk_phy->clk480m)) { in rockchip_usb_phy_init()
269 err = PTR_ERR(rk_phy->clk480m); in rockchip_usb_phy_init()
274 rk_phy->clk480m); in rockchip_usb_phy_init()
280 rk_phy); in rockchip_usb_phy_init()
284 rk_phy->phy = devm_phy_create(base->dev, child, &ops); in rockchip_usb_phy_init()
285 if (IS_ERR(rk_phy->phy)) { in rockchip_usb_phy_init()
287 return PTR_ERR(rk_phy->phy); in rockchip_usb_phy_init()
289 phy_set_drvdata(rk_phy->phy, rk_phy); in rockchip_usb_phy_init()
291 rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus"); in rockchip_usb_phy_init()
292 if (IS_ERR(rk_phy->vbus)) { in rockchip_usb_phy_init()
293 if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER) in rockchip_usb_phy_init()
294 return PTR_ERR(rk_phy->vbus); in rockchip_usb_phy_init()
295 rk_phy->vbus = NULL; in rockchip_usb_phy_init()
302 if (rk_phy->uart_enabled) in rockchip_usb_phy_init()
303 return clk_prepare_enable(rk_phy->clk); in rockchip_usb_phy_init()
305 return rockchip_usb_phy_power(rk_phy, 1); in rockchip_usb_phy_init()
308 if (!rk_phy->uart_enabled) in rockchip_usb_phy_init()
309 clk_unregister(rk_phy->clk480m); in rockchip_usb_phy_init()
311 if (rk_phy->clk) in rockchip_usb_phy_init()
312 clk_put(rk_phy->clk); in rockchip_usb_phy_init()