as21xxx_read_status() masks the speed status with VEND1_SPEED_STATUS,
the address of the register it just read, instead of VEND1_SPEED_MASK,
which is the field mask the speed values are built with.
This affects the path taken when auto-negotiation is disabled. For
example, after setting "speed 100 duplex full autoneg off", ethtool
would incorrectly report "Speed: 10Mb/s" instead of "Speed: 100Mb/s".
Switch to the correct field mask so the speed is decoded properly.
Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")
Signed-off-by: Cristian Ciocaltea <cris…@collabora.com>
---
drivers/net/phy/as21xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c
index 5b38c641329a..ff6c2005c442 100644
--- a/drivers/net/phy/as21xxx.c
+++ b/drivers/net/phy/as21xxx.c
@@ -740,7 +740,7 @@ static int as21xxx_read_status(struct phy_device *phydev)
if (speed < 0)
return speed;
- switch (speed & VEND1_SPEED_STATUS) {
+ switch (speed & VEND1_SPEED_MASK) {
case VEND1_SPEED_10000:
phydev->speed = SPEED_10000;
phydev->duplex = DUPLEX_FULL;
--
2.56.0