36#include <sys/kernel.h>
37#include <sys/module.h>
42#include <machine/bus.h>
44#include <dev/ofw/ofw_bus.h>
45#include <dev/ofw/ofw_bus_subr.h>
47#include <dev/extres/clk/clk.h>
48#include <dev/extres/regulator/regulator.h>
49#include <dev/extres/phy/phy_usb.h>
51#include "phynode_if.h"
74 sizeof(
struct phynode_usb_sc), phynode_usb_class);
84 dev = phynode_get_device(phynode);
85 phy = phynode_get_id(phynode);
86 sc = device_get_softc(
dev);
97 device_printf(
dev,
"Cannot set clock to %dMhz\n",
107 device_printf(
dev,
"Cannot %sable the clock\n",
108 enable ?
"En" :
"Dis");
118 device_printf(
dev,
"Cannot %sable the regulator\n",
119 enable ?
"En" :
"Dis");
134 if (!ofw_bus_status_okay(
dev))
140 device_set_desc(
dev,
"USB NOP PHY");
141 return (BUS_PROBE_DEFAULT);
148 struct phynode *phynode;
149 struct phynode_init_def phy_init;
153 sc = device_get_softc(
dev);
155 node = ofw_bus_get_node(
dev);
158 OF_getencprop(node,
"clock-frequency", &sc->
clk_freq,
sizeof(uint32_t));
160 error = clk_get_by_ofw_name(
dev, node,
"main_clk", &sc->
clk);
162 device_printf(
dev,
"clock property is mandatory if clock-frequency is present\n");
166 regulator_get_by_ofw_property(
dev, node,
"vcc-supply", &sc->
vcc_supply);
169 phy_init.ofw_node = node;
170 phynode = phynode_create(
dev, &usb_nop_xceiv_phynode_class,
172 if (phynode == NULL) {
173 device_printf(
dev,
"failed to create USB NOP PHY\n");
176 if (phynode_register(phynode) == NULL) {
177 device_printf(
dev,
"failed to create USB NOP PHY\n");
181 OF_device_register_xref(OF_xref_from_node(node),
dev);
static int usb_nop_xceiv_attach(device_t dev)
EARLY_DRIVER_MODULE(usb_nop_xceiv, simplebus, usb_nop_xceiv_driver, usb_nop_xceiv_devclass, 0, 0, BUS_PASS_SUPPORTDEV+BUS_PASS_ORDER_MIDDLE)
DEFINE_CLASS_1(usb_nop_xceiv_phynode, usb_nop_xceiv_phynode_class, usb_nop_xceiv_phynode_methods, sizeof(struct phynode_usb_sc), phynode_usb_class)
static driver_t usb_nop_xceiv_driver
static phynode_usb_method_t usb_nop_xceiv_phynode_methods[]
static struct ofw_compat_data compat_data[]
static devclass_t usb_nop_xceiv_devclass
static device_method_t usb_nop_xceiv_methods[]
static int usb_nop_xceiv_phy_enable(struct phynode *phy, bool enable)
static int usb_nop_xceiv_probe(device_t dev)
static int usb_nop_xceiv_detach(device_t dev)