Re: [PATCH v4.4] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet phy

From: Jakub Kicinski
Date: Mon Aug 22 2022 - 23:23:29 EST


On Wed, 17 Aug 2022 19:25:54 +0800 Frank wrote:
> +static int yt8521_fiber_config_aneg(struct phy_device *phydev)
> +{
> + int err, changed;
> + u16 adv;
> +
> + if (phydev->autoneg != AUTONEG_ENABLE)
> + return yt8521_fiber_setup_forced(phydev);
> +
> + err = ytphy_modify_ext_with_lock(phydev, YTPHY_MISC_CONFIG_REG,
> + YTPHY_MCR_FIBER_SPEED_MASK,
> + YTPHY_MCR_FIBER_1000BX);
> + if (err < 0)
> + return err;
> +
> + /* enable Fiber auto sensing */
> + err = ytphy_modify_ext_with_lock(phydev, YT8521_LINK_TIMER_CFG2_REG,
> + 0, YT8521_LTCR_EN_AUTOSEN);
> + if (err < 0)
> + return err;
> +
> + /* Setup fiber advertisement */
> + adv = ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
> + ADVERTISE_1000XPSE_ASYM;

Is it okay to ignore phydev->advertising and always set the same mask?

> + err = phy_modify_changed(phydev, MII_ADVERTISE,
> + ADVERTISE_1000XHALF | ADVERTISE_1000XFULL |
> + ADVERTISE_1000XPAUSE | ADVERTISE_1000XPSE_ASYM,
> + adv);