From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH net-next v1 3/3] net: phy: micrel: Fix forced link mode for KSZ886X switches
Date: Wed, 11 Oct 2023 16:25:26 +0200 [thread overview]
Message-ID: <20231011142526.GA3306548@pengutronix.de> (raw)
In-Reply-To: <3767760.kQq0lBPeGt@steina-w>
Hi Alexander,
thank you for review!
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:
> > Address a link speed detection issue in KSZ886X PHY driver when in
> > forced link mode. Previously, link partners like "ASIX AX88772B"
> > with KSZ8873 could fall back to 10Mbit instead of configured 100Mbit.
> >
> > The issue arises as KSZ886X PHY continues sending Fast Link Pulses (FLPs)
> > even with autonegotiation off, misleading link partners in autoneg mode,
> > leading to incorrect link speed detection.
> >
> > Now, when autonegotiation is disabled, the driver sets the link state
> > forcefully using KSZ886X_CTRL_FORCE_LINK bit. This action, beyond just
> > disabling autonegotiation, makes the PHY state more reliably detected by
> > link partners using parallel detection, thus fixing the link speed
> > misconfiguration.
> >
> > With autonegotiation enabled, link state is not forced, allowing proper
> > autonegotiation process participation.
> >
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> > drivers/net/phy/micrel.c | 32 +++++++++++++++++++++++++++++---
> > 1 file changed, 29 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> > index 927d3d54658e..12f093aed4ff 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -1729,9 +1729,35 @@ static int ksz886x_config_aneg(struct phy_device
> > *phydev) {
> > int ret;
> >
> > - ret = genphy_config_aneg(phydev);
> > - if (ret)
> > - return ret;
> > + if (phydev->autoneg != AUTONEG_ENABLE) {
> > + ret = genphy_setup_forced(phydev);
> > + if (ret)
> > + return ret;
> > +
> > + /* When autonegotation is disabled, we need to manually
> force
> > + * the link state. If we don't do this, the PHY will keep
> > + * sending Fast Link Pulses (FLPs) which are part of the
> > + * autonegotiation process. This is not desired when
> > + * autonegotiation is off.
> > + */
> > + ret = phy_set_bits(phydev, MII_KSZPHY_CTRL,
> > + KSZ886X_CTRL_FORCE_LINK);
> > + if (ret)
> > + return ret;
> > + } else {
> > + /* Make sure, the link state is not forced.
> > + * Otherwise, the PHY we create a link by skipping the
>
> PHY will create?
>
> > + * autonegotiation process.
> > + */
> > + 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.
First time this bit is set by this patch, I assume this problem would
not exist without fixed link fix.
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 |
next prev parent reply other threads:[~2023-10-11 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 12:38 [PATCH net-next v1 1/3] net: phy: micrel: Extend KSZ886X PHY Special Ctrl/Status Reg definitions Oleksij Rempel
2023-10-11 12:38 ` [PATCH net-next v1 2/3] net: dsa: microchip: ksz8: Enable MIIM PHY Control reg access Oleksij Rempel
2023-10-11 14:35 ` kernel test robot
2023-10-13 15:47 ` Simon Horman
2023-10-11 12:38 ` [PATCH net-next v1 3/3] net: phy: micrel: Fix forced link mode for KSZ886X switches Oleksij Rempel
2023-10-11 13:29 ` Alexander Stein
2023-10-11 14:25 ` Oleksij Rempel [this message]
2023-10-13 16:04 ` Russell King (Oracle)
2023-10-13 15:48 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231011142526.GA3306548@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexander.stein@ew.tq-group.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox