Re: [PATCH net-next v1 2/4] net: phy: micrel: add EEE configuration support for KSZ9477 variants of PHYs
From: Oleksij Rempel
Date: Fri Jan 20 2023 - 00:51:06 EST
On Thu, Jan 19, 2023 at 03:08:59PM +0100, Andrew Lunn wrote:
> > +static int ksz9477_get_eee_caps(struct phy_device *phydev,
> > + struct ethtool_eee *data)
> > +{
> > + int val;
> > +
> > + /* At least on KSZ8563 (which has same PHY_ID as KSZ9477), the
> > + * MDIO_PCS_EEE_ABLE register is a mirror of MDIO_AN_EEE_ADV register.
> > + * So, we need to provide this information by driver.
> > + */
> > + data->supported = SUPPORTED_100baseT_Full;
> > +
> > + /* KSZ8563 is able to advertise not supported MDIO_EEE_1000T.
> > + * We need to test if the PHY is 1Gbit capable.
> > + */
> > + val = phy_read(phydev, MII_BMSR);
> > + if (val < 0)
> > + return val;
> > +
> > + if (val & BMSR_ERCAP)
> > + data->supported |= SUPPORTED_1000baseT_Full;
>
> This works, but you could also look at phydev->supported and see if
> one of the 1G modes is listed. That should be faster, since there is
> no MDIO transaction involved. Not that this is on any sort of hot
> path.
ack. Sounds good.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |