| 287 | } |
| 288 | |
| 289 | int rt_genphy_config(struct rt_phy_device *phydev) |
| 290 | { |
| 291 | int val; |
| 292 | rt_uint32_t features; |
| 293 | |
| 294 | features = (RT_SUPPORTED_TP | RT_SUPPORTED_MII |
| 295 | | RT_SUPPORTED_AUI | RT_SUPPORTED_FIBRE | |
| 296 | RT_SUPPORTED_BNC); |
| 297 | |
| 298 | val = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMSR); |
| 299 | |
| 300 | if (val < 0) |
| 301 | return val; |
| 302 | |
| 303 | if (val & RT_BMSR_ANEGCAPABLE) |
| 304 | features |= RT_SUPPORTED_Autoneg; |
| 305 | |
| 306 | if (val & RT_BMSR_100FULL) |
| 307 | features |= RT_SUPPORTED_100baseT_Full; |
| 308 | if (val & RT_BMSR_100HALF) |
| 309 | features |= RT_SUPPORTED_100baseT_Half; |
| 310 | if (val & RT_BMSR_10FULL) |
| 311 | features |= RT_SUPPORTED_10baseT_Full; |
| 312 | if (val & RT_BMSR_10HALF) |
| 313 | features |= RT_SUPPORTED_10baseT_Half; |
| 314 | |
| 315 | if (val & RT_BMSR_ESTATEN) |
| 316 | { |
| 317 | val = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_ESTATUS); |
| 318 | |
| 319 | if (val < 0) |
| 320 | return val; |
| 321 | |
| 322 | if (val & RT_SUPORT_1000B_TFULL) |
| 323 | features |= RT_SUPPORTED_1000baseT_Full; |
| 324 | if (val & RT_SUPORT_1000B_THALF) |
| 325 | features |= RT_SUPPORTED_1000baseT_Half; |
| 326 | if (val & RT_SUPORT_1000B_XFULL) |
| 327 | features |= RT_SUPPORTED_1000baseX_Full; |
| 328 | if (val & RT_SUPORT_1000B_XHALF) |
| 329 | features |= RT_SUPPORTED_1000baseX_Half; |
| 330 | } |
| 331 | |
| 332 | phydev->supported &= features; |
| 333 | phydev->advertising &= features; |
| 334 | |
| 335 | rt_genphy_config_aneg(phydev); |
| 336 | |
| 337 | return 0; |
| 338 | } |
| 339 | |
| 340 | int rt_genphy_startup(struct rt_phy_device *phydev) |
| 341 | { |
nothing calls this directly
no test coverage detected