Re: [PATCH net-next v1 3/3] net: phy: micrel: Fix forced link mode for KSZ886X switches
From: Russell King (Oracle)
Date: Fri Oct 13 2023 - 12:05:47 EST
On Wed, Oct 11, 2023 at 03:29:49PM +0200, Alexander Stein wrote:
> Hi Oleksij,
>
> Am Mittwoch, 11. Oktober 2023, 14:38:56 CEST schrieb Oleksij Rempel:
> > + if (phydev->autoneg != AUTONEG_ENABLE) {
> > + ret = genphy_setup_forced(phydev);
> > + if (ret)
> > + return ret;
> > +
...
> > + ret = phy_set_bits(phydev, MII_KSZPHY_CTRL,
> > + KSZ886X_CTRL_FORCE_LINK);
> > + if (ret)
> > + return ret;
> > + } else {
...
> > + ret = phy_clear_bits(phydev, MII_KSZPHY_CTRL,
> > + KSZ886X_CTRL_FORCE_LINK);
> > + if (ret)
> > + return ret;
>
> Isn't this call to phy_clear_bits() a fix for autonegotiation mode? This
> should be a separate patch then.
No, I don't think that is the case. Compare the two paths above, noting
that patch 1 introduces the definition for KSZ886X_CTRL_FORCE_LINK.
If autoneg is disabled, then this bit is then set, which forces the
link. Clearly, if autoneg is then re-enabled, this bit has to be
cleared to allow the effects of the autoneg-disabled path to be undone.
So both of these, the phy_set_bits() and the phy_clear_bits() belong in
the same patch. Splitting them up, so we introduce phy_set_bits() first
will create a regression - which we don't want.
These two belong logically together.
What does concern me, however, is that the autoneg-disabled path avoids
calling genphy_setup_master_slave(), and since establishing which end
of the link is part of the fundamentals of a 1000base-T link, I wonder
whether both paths should still call genphy_config_aneg().
Apart from that, I think the patch is otherwise fine.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!