Messages in this thread | | | Date | Sat, 18 May 2024 01:43:15 +0200 | From | Andrew Lunn <> | Subject | Re: [PATCH net-next v2 4/5] net: phy: mediatek: Extend 1G TX/RX link pulse time |
| |
> +int mtk_gphy_cl22_read_status(struct phy_device *phydev) > +{ > + int err, old_link = phydev->link; > + int mii_ctrl; > + > + /* Update the link, but return if there was an error */ > + err = genphy_update_link(phydev); > + if (err) > + return err; > + > + /* why bother the PHY if nothing can have changed */ > + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) > + return 0; > + > + phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED; > + phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; > + phydev->speed = SPEED_UNKNOWN; > + phydev->duplex = DUPLEX_UNKNOWN; > + phydev->pause = 0; > + phydev->asym_pause = 0; > + > + if (phydev->is_gigabit_capable) { > + err = genphy_read_master_slave(phydev); > + if (err < 0) > + return err; > + } > + > + err = genphy_read_lpa(phydev); > + if (err < 0) > + return err; > + > + if (phydev->autoneg == AUTONEG_ENABLE) { > + if (phydev->autoneg_complete) { > + phy_resolve_aneg_linkmode(phydev); > + } else { > + mii_ctrl = phy_read(phydev, MII_CTRL1000); > + if ((mii_ctrl & ADVERTISE_1000FULL) || (mii_ctrl & ADVERTISE_1000HALF)) > + extend_an_new_lp_cnt_limit(phydev);
This all looks very similar to genphy_read_status(), except these three.
Would it be possible to call genphy_read_status() to do most of the work, and then do these couple of lines of code.
Andrew
| |