Lines Matching +full:phy +full:- +full:grf

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
47 #include <dev/phy/phy_usb.h>
83 { "rockchip,rk3399-usb2phy", (uintptr_t)&rk3399_regs },
84 { "rockchip,rk3568-usb2phy", (uintptr_t)&rk3568_regs },
90 struct syscon *grf; member
96 /* Phy class and methods. */
98 static int rk_usb2phy_get_mode(struct phynode *phy, int *mode);
99 static int rk_usb2phy_set_mode(struct phynode *phy, int mode);
122 intptr_t phy; in rk_usb2phy_enable() local
126 phy = phynode_get_id(phynode); in rk_usb2phy_enable()
129 if (phy != RK_USBPHY_HOST) in rk_usb2phy_enable()
132 if (sc->phy_supply) { in rk_usb2phy_enable()
134 error = regulator_enable(sc->phy_supply); in rk_usb2phy_enable()
136 error = regulator_disable(sc->phy_supply); in rk_usb2phy_enable()
153 intptr_t phy; in rk_usb2phy_get_mode() local
157 phy = phynode_get_id(phynode); in rk_usb2phy_get_mode()
160 if (phy != RK_USBPHY_HOST) in rk_usb2phy_get_mode()
163 *mode = sc->mode; in rk_usb2phy_get_mode()
172 intptr_t phy; in rk_usb2phy_set_mode() local
176 phy = phynode_get_id(phynode); in rk_usb2phy_set_mode()
179 if (phy != RK_USBPHY_HOST) in rk_usb2phy_set_mode()
182 sc->mode = mode; in rk_usb2phy_set_mode()
190 struct syscon *grf; member
210 SYSCON_WRITE_4(sc->grf, sc->regs->clk_ctl.offset, in rk_usb2phy_clk_set_gate()
211 sc->regs->clk_ctl.enable_mask); in rk_usb2phy_clk_set_gate()
213 SYSCON_WRITE_4(sc->grf, sc->regs->clk_ctl.offset, in rk_usb2phy_clk_set_gate()
214 sc->regs->clk_ctl.disable_mask); in rk_usb2phy_clk_set_gate()
268 node = ofw_bus_get_node(devsc->dev); in rk_usb2phy_export_clock()
271 "#clock-cells", &ncells); in rk_usb2phy_export_clock()
273 device_printf(devsc->dev, "couldn't find parent clock\n"); in rk_usb2phy_export_clock()
277 nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", in rk_usb2phy_export_clock()
282 clkdom = clkdom_create(devsc->dev); in rk_usb2phy_export_clock()
290 error = clk_get_by_ofw_index(devsc->dev, 0, i, &clk_parent); in rk_usb2phy_export_clock()
292 device_printf(devsc->dev, "cannot get clock %d\n", error); in rk_usb2phy_export_clock()
302 device_printf(devsc->dev, "cannot create clknode\n"); in rk_usb2phy_export_clock()
307 sc->clkdev = device_get_parent(devsc->dev); in rk_usb2phy_export_clock()
308 sc->grf = devsc->grf; in rk_usb2phy_export_clock()
309 sc->regs = (struct rk_usb2phy_regs *)ofw_bus_search_compatible(devsc->dev, compat_data)->ocd_data; in rk_usb2phy_export_clock()
310 if (sc->regs->clk_ctl.offset == 0) { in rk_usb2phy_export_clock()
312 sc->regs->clk_ctl.offset = regs[0]; in rk_usb2phy_export_clock()
317 device_printf(devsc->dev, "cannot finalize clkdom initialization\n"); in rk_usb2phy_export_clock()
334 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in rk_usb2phy_probe()
351 sc->dev = dev; in rk_usb2phy_attach()
356 &sc->grf)) { in rk_usb2phy_attach()
362 if (syscon_get_handle_default(dev, &sc->grf)) { in rk_usb2phy_attach()
368 if (clk_get_by_ofw_name(dev, 0, "phyclk", &sc->clk) != 0) { in rk_usb2phy_attach()
372 err = clk_enable(sc->clk); in rk_usb2phy_attach()
375 clk_get_name(sc->clk)); in rk_usb2phy_attach()
385 host = ofw_bus_find_child(node, "host-port"); in rk_usb2phy_attach()
387 device_printf(dev, "Cannot find host-port child node\n"); in rk_usb2phy_attach()
392 device_printf(dev, "host-port isn't okay\n"); in rk_usb2phy_attach()
396 regulator_get_by_ofw_property(dev, host, "phy-supply", &sc->phy_supply); in rk_usb2phy_attach()