net: phy: micrel: Fix forced link mode for KSZ886X switches
authorOleksij Rempel <o.rempel@pengutronix.de>
Thu, 19 Oct 2023 11:14:59 +0000 (13:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Oct 2023 10:50:46 +0000 (11:50 +0100)
commit510f02febb10259919a41926ab6bf9ec5c72ee48
treecfe83a13ddeb46e11996548d06dd372a457b025e
parentf600bb612b06adf70ccdefbd3294c71275b650c2
net: phy: micrel: Fix forced link mode for KSZ886X switches

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>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Divya Koppera <divya.koppera@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/micrel.c