/** * genphy_config_aneg - restart auto-negotiation or write BMCR * @phydev: target phy_device struct * * Description: If auto-negotiation is enabled, we configure the * advertising, and then restart auto-negotiation. If it is not * enabled, then we write the BMCR. */ int genphy_config_aneg(struct phy_device *phydev) { int err = 0; if (AUTONEG_ENABLE == phydev->autoneg) { err = genphy_config_advert(phydev); if (err < 0) return err; err = genphy_restart_aneg(phydev); } else err = genphy_setup_forced(phydev); return err; }
/* vsc82x4_config_aneg - restart auto-negotiation or write BMCR * @phydev: target phy_device struct * * Description: If auto-negotiation is enabled, we configure the * advertising, and then restart auto-negotiation. If it is not * enabled, then we write the BMCR and also start the auto * MDI/MDI-X feature */ static int vsc82x4_config_aneg(struct phy_device *phydev) { int ret; /* Enable auto MDI/MDI-X when in 10/100 forced link speeds by * writing special values in the VSC8234 extended reserved registers */ if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) { ret = genphy_setup_forced(phydev); if (ret < 0) /* error */ return ret; return vsc82x4_config_autocross_enable(phydev); } return genphy_config_aneg(phydev); }