| 262 | } |
| 263 | } |
| 264 | int rt_genphy_parse_link(struct rt_phy_device *phydev) |
| 265 | { |
| 266 | int mii_reg = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMSR); |
| 267 | |
| 268 | if (phydev->autoneg == AUTONEG_ENABLE) |
| 269 | { |
| 270 | __genphy_auto_neg(phydev, mii_reg); |
| 271 | } else { |
| 272 | rt_uint32_t bmcr = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMCR); |
| 273 | |
| 274 | phydev->speed = SPEED_10; |
| 275 | phydev->duplex = DUPLEX_HALF; |
| 276 | |
| 277 | if (bmcr & RT_BMCR_FULLDPLX) |
| 278 | phydev->duplex = DUPLEX_FULL; |
| 279 | |
| 280 | if (bmcr & RT_BMCR_SPEED1000) |
| 281 | phydev->speed = SPEED_1000; |
| 282 | else if (bmcr & RT_BMCR_SPEED100) |
| 283 | phydev->speed = SPEED_100; |
| 284 | } |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | int rt_genphy_config(struct rt_phy_device *phydev) |
| 290 | { |
no test coverage detected