[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4a99edc-e514-4a18-9d85-0355ddf4686a@lunn.ch>
Date: Sat, 18 May 2024 01:43:15 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sky Huang <SkyLake.Huang@...iatek.com>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Daniel Golle <daniel@...rotopia.org>,
Qingfang Deng <dqfext@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Steven Liu <Steven.Liu@...iatek.com>
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
Powered by blists - more mailing lists