Lines Matching refs:rk_phy

183 	struct rockchip_usb_phy *rk_phy = data;  in rockchip_usb_phy_action()  local
185 if (!rk_phy->uart_enabled) { in rockchip_usb_phy_action()
186 of_clk_del_provider(rk_phy->np); in rockchip_usb_phy_action()
187 clk_unregister(rk_phy->clk480m); in rockchip_usb_phy_action()
190 if (rk_phy->clk) in rockchip_usb_phy_action()
191 clk_put(rk_phy->clk); in rockchip_usb_phy_action()
197 struct rockchip_usb_phy *rk_phy; in rockchip_usb_phy_init() local
203 rk_phy = devm_kzalloc(base->dev, sizeof(*rk_phy), GFP_KERNEL); in rockchip_usb_phy_init()
204 if (!rk_phy) in rockchip_usb_phy_init()
207 rk_phy->base = base; in rockchip_usb_phy_init()
208 rk_phy->np = child; in rockchip_usb_phy_init()
216 rk_phy->reset = of_reset_control_get(child, "phy-reset"); in rockchip_usb_phy_init()
217 if (IS_ERR(rk_phy->reset)) in rockchip_usb_phy_init()
218 rk_phy->reset = NULL; in rockchip_usb_phy_init()
220 rk_phy->reg_offset = reg_offset; in rockchip_usb_phy_init()
222 rk_phy->clk = of_clk_get_by_name(child, "phyclk"); in rockchip_usb_phy_init()
223 if (IS_ERR(rk_phy->clk)) in rockchip_usb_phy_init()
224 rk_phy->clk = NULL; in rockchip_usb_phy_init()
243 rk_phy->uart_enabled = true; in rockchip_usb_phy_init()
245 if (rk_phy->clk) { in rockchip_usb_phy_init()
246 clk_name = __clk_get_name(rk_phy->clk); in rockchip_usb_phy_init()
257 rk_phy->clk480m_hw.init = &init; in rockchip_usb_phy_init()
259 rk_phy->clk480m = clk_register(base->dev, &rk_phy->clk480m_hw); in rockchip_usb_phy_init()
260 if (IS_ERR(rk_phy->clk480m)) { in rockchip_usb_phy_init()
261 err = PTR_ERR(rk_phy->clk480m); in rockchip_usb_phy_init()
266 rk_phy->clk480m); in rockchip_usb_phy_init()
272 rk_phy); in rockchip_usb_phy_init()
276 rk_phy->phy = devm_phy_create(base->dev, child, &ops); in rockchip_usb_phy_init()
277 if (IS_ERR(rk_phy->phy)) { in rockchip_usb_phy_init()
279 return PTR_ERR(rk_phy->phy); in rockchip_usb_phy_init()
281 phy_set_drvdata(rk_phy->phy, rk_phy); in rockchip_usb_phy_init()
283 rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus"); in rockchip_usb_phy_init()
284 if (IS_ERR(rk_phy->vbus)) { in rockchip_usb_phy_init()
285 if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER) in rockchip_usb_phy_init()
286 return PTR_ERR(rk_phy->vbus); in rockchip_usb_phy_init()
287 rk_phy->vbus = NULL; in rockchip_usb_phy_init()
294 if (rk_phy->uart_enabled) in rockchip_usb_phy_init()
295 return clk_prepare_enable(rk_phy->clk); in rockchip_usb_phy_init()
297 return rockchip_usb_phy_power(rk_phy, 1); in rockchip_usb_phy_init()
300 if (!rk_phy->uart_enabled) in rockchip_usb_phy_init()
301 clk_unregister(rk_phy->clk480m); in rockchip_usb_phy_init()
303 if (rk_phy->clk) in rockchip_usb_phy_init()
304 clk_put(rk_phy->clk); in rockchip_usb_phy_init()