Lines Matching +full:syscon +full:- +full:phy +full:- +full:mode
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
41 #include <dev/phy/phy_usb.h>
43 #include <dev/syscon/syscon.h>
47 #include <dev/syscon/syscon.h>
55 /* Phy registers */
67 #define WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res, (_r), (_v))
68 #define RD4(_sc, _r) bus_read_4((_sc)->mem_res, (_r))
72 {"rockchip,rk3288-usb-phy", 1},
83 int mode; member
87 struct syscon *syscon; member
91 rk_phynode_phy_enable(struct phynode *phy, bool enable) in rk_phynode_phy_enable() argument
96 sc = phynode_get_softc(phy); in rk_phynode_phy_enable()
98 rv = SYSCON_MODIFY_4(sc->syscon, in rk_phynode_phy_enable()
99 sc->base + UOC_CON0, in rk_phynode_phy_enable()
108 rk_phynode_get_mode(struct phynode *phynode, int *mode) in rk_phynode_get_mode() argument
113 *mode = sc->mode; in rk_phynode_get_mode()
118 rk_phynode_set_mode(struct phynode *phynode, int mode) in rk_phynode_set_mode() argument
123 sc->mode = mode; in rk_phynode_set_mode()
129 /* Phy controller class and methods. */
150 struct syscon *syscon; in rk_usbphy_init_phy() local
158 device_printf(sc->dev, "cannot get 'reg' property.\n"); in rk_usbphy_init_phy()
163 rv = clk_get_by_ofw_name(sc->dev, node, "phyclk", &clk); in rk_usbphy_init_phy()
165 device_printf(sc->dev, "cannot get 'phyclk' clock.\n"); in rk_usbphy_init_phy()
168 rv = hwreset_get_by_ofw_name(sc->dev, node, "phy-reset", &hwreset); in rk_usbphy_init_phy()
170 device_printf(sc->dev, "Cannot get 'phy-reset' reset\n"); in rk_usbphy_init_phy()
173 rv = regulator_get_by_ofw_property(sc->dev, node, "vbus-supply", in rk_usbphy_init_phy()
176 device_printf(sc->dev, "Cannot get 'vbus' regulator.\n"); in rk_usbphy_init_phy()
180 rv = SYSCON_GET_HANDLE(sc->dev, &syscon); in rk_usbphy_init_phy()
182 device_printf(sc->dev, "Cannot get parent syscon\n"); in rk_usbphy_init_phy()
190 device_printf(sc->dev, "Cannot assert reset\n"); in rk_usbphy_init_phy()
197 device_printf(sc->dev, in rk_usbphy_init_phy()
206 device_printf(sc->dev, "Cannot deassert reset\n"); in rk_usbphy_init_phy()
211 /* Create and register phy. */ in rk_usbphy_init_phy()
215 phynode = phynode_create(sc->dev, &rk_phynode_class, &phy_init); in rk_usbphy_init_phy()
217 device_printf(sc->dev, "Cannot create phy.\n"); in rk_usbphy_init_phy()
222 phy_sc->base = base; in rk_usbphy_init_phy()
223 phy_sc->clk = clk; in rk_usbphy_init_phy()
224 phy_sc->hwreset = hwreset; in rk_usbphy_init_phy()
225 phy_sc->supply_vbus = supply_vbus; in rk_usbphy_init_phy()
226 phy_sc->syscon = syscon; in rk_usbphy_init_phy()
228 device_printf(sc->dev, "Cannot register phy.\n"); in rk_usbphy_init_phy()
253 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in rk_usbphy_probe()
256 device_set_desc(dev, "RockChip USB Phy"); in rk_usbphy_probe()
268 sc->dev = dev; in rk_usbphy_attach()
269 node = ofw_bus_get_node(sc->dev); in rk_usbphy_attach()