The speed status register reports 0x40 for a 10M link, not 0x0 as
VEND1_SPEED_10 describes.
Attempting to force a 10M link would therefore match no case of the
switch in aeon_read_status() and make it fail with -EINVAL, generating
the following splat:
[ 740.903011] _phy_start_aneg+0x0/0x98: returned: -22
[ 740.907932] WARNING: CPU: 0 PID: 6774 at _phy_state_machine+0x60/0x2dc
[...]
[ 741.192990] Call trace:
[ 741.195429] _phy_state_machine+0x60/0x2dc
[ 741.199526] phy_state_machine+0x28/0x80
[ 741.203449] process_one_work+0x174/0x300
[...]
The bug was hidden because the status was masked with VEND1_SPEED_STATUS
(the register address) instead of VEND1_SPEED_MASK. 0x40 & 0x4002
evaluates to 0, which happened to match the wrong VEND1_SPEED_10 value,
so 10M links were still reported correctly. Fixing the mask exposes the
bad definition.
Describe the value the PHY actually reports.
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 ff6c2005c442..8d46fdfc279a 100644
--- a/drivers/net/phy/as21xxx.c
+++ b/drivers/net/phy/as21xxx.c
@@ -47,7 +47,7 @@
#define VEND1_SPEED_2500 FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x9)
#define VEND1_SPEED_1000 FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x10)
#define VEND1_SPEED_100 FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x20)
-#define VEND1_SPEED_10 FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x0)
+#define VEND1_SPEED_10 FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x40)
#define VEND1_IPC_CMD 0x5801
#define AEON_IPC_CMD_PARITY BIT(15)
--
2.56.0