MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_ofw_create_phy

Function rt_ofw_create_phy

components/drivers/phy/ofw.c:127–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125
126}
127struct rt_phy_device *rt_ofw_create_phy(struct mii_bus *bus,struct rt_ofw_node *np,int phyaddr)
128{
129 struct rt_phy_device *dev = RT_NULL;
130 struct rt_ofw_node *phy_node;
131 int ret;
132 rt_uint32_t id = 0xffff;
133
134 phy_node = rt_ofw_parse_phandle(np, "phy-handle", 0);
135 if (!phy_node)
136 {
137 LOG_D("Failed to find phy-handle");
138 return RT_NULL;
139 }
140
141 ret = rt_ofw_get_phyid(np, &id);
142 if (ret)
143 {
144 LOG_D("Failed to read eth PHY id, err: %d\n", ret);
145 return RT_NULL;
146 }
147
148 LOG_D("Found a PHY id: 0x%x\n", id);
149
150 dev = rt_phy_device_create(bus, phyaddr, id, RT_FALSE);
151
152 if(dev)
153 dev->node = phy_node;
154
155 return dev;
156}

Callers 1

rt_phy_get_deviceFunction · 0.85

Calls 3

rt_ofw_parse_phandleFunction · 0.85
rt_ofw_get_phyidFunction · 0.85
rt_phy_device_createFunction · 0.85

Tested by

no test coverage detected