* @brief create phy device by mask * * it will create phy device by c22 mode or c45 mode * * @param bus mii bus pointer * @param phy_mask PHY mask it depend on the phy addr, the phy addr corresponding will be set 1 * * @return if create success return the phy device pointer,if create fail return NULL */
| 394 | * @return if create success return the phy device pointer,if create fail return NULL |
| 395 | */ |
| 396 | static struct rt_phy_device *rt_phydev_create_by_mask(struct mii_bus *bus, unsigned int phy_mask) |
| 397 | { |
| 398 | struct rt_phy_device *phy; |
| 399 | /* |
| 400 | *The bit of devad is dev addr which is the new features in c45 |
| 401 | *so if devad equal to zero it means it is c22 mode ,and if not |
| 402 | *equal to zero it means it is c45 mode,which include PMD/PMA , |
| 403 | *WIS ,PCS,PHY XS,PHY XS .... |
| 404 | */ |
| 405 | int devad[] = { |
| 406 | /* Clause-22 */ |
| 407 | RT_MDIO_DEVAD_NONE, |
| 408 | /* Clause-45 */ |
| 409 | RT_MDIO_MMD_PMAPMD, |
| 410 | RT_MDIO_MMD_WIS, |
| 411 | RT_MDIO_MMD_PCS, |
| 412 | RT_MDIO_MMD_PHYXS, |
| 413 | RT_MDIO_MMD_VEND1, |
| 414 | }; |
| 415 | |
| 416 | for (int i = 0; i < sizeof(devad)/sizeof(devad[0]); i++) |
| 417 | { |
| 418 | phy = create_phy_by_mask(bus, phy_mask, devad[i]); |
| 419 | if(phy) |
| 420 | return phy; |
| 421 | } |
| 422 | |
| 423 | return RT_NULL; |
| 424 | } |
| 425 | |
| 426 | struct rt_phy_device *rt_phy_find_by_mask(struct mii_bus *bus, unsigned int phy_mask) |
| 427 | { |
no test coverage detected