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

Function rt_phy_get_device

components/drivers/phy/phy.c:470–491  ·  view source on GitHub ↗

* @brief get phy device by given mii bus, node and address * @param bus MII bus pointer * @param np the dtb node of device which need to get phy device * @param addr address of phy device * @param interface interface of phy device * * @return phy device pointer or NULL if not found */

Source from the content-addressed store, hash-verified

468 * @return phy device pointer or NULL if not found
469 */
470struct rt_phy_device *rt_phy_get_device(struct mii_bus *bus,struct rt_ofw_node *np, int addr,rt_phy_interface interface)
471{
472 struct rt_phy_device *phy = RT_NULL;
473 unsigned int phy_mask = addr? 1 << addr:0xffffffff;
474
475#ifdef RT_USING_OFW
476 if(np)
477 phy = rt_ofw_create_phy(bus,np,addr);
478#endif
479 if(!phy)
480 phy = rt_phy_find_by_mask(bus,phy_mask);
481
482 if(phy)
483 {
484 rt_phy_reset(phy);
485 phy->interface = interface;
486 return phy;
487 }
488
489 LOG_D("PHY device get failed");
490 return RT_NULL;
491}
492
493static struct rt_phy_driver genphy = {
494 .uid = 0xffffffff,

Callers

nothing calls this directly

Calls 3

rt_ofw_create_phyFunction · 0.85
rt_phy_find_by_maskFunction · 0.85
rt_phy_resetFunction · 0.85

Tested by

no test coverage detected