* @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 */
| 468 | * @return phy device pointer or NULL if not found |
| 469 | */ |
| 470 | struct 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 | |
| 493 | static struct rt_phy_driver genphy = { |
| 494 | .uid = 0xffffffff, |
nothing calls this directly
no test coverage detected