The mv88e6390_serdes_irq_link_sgmii IRQ handler reads the SERDES PHY
status register to determine speed, among other things. If cmode of the
port is set to 2500base-x, though, the PHY still reports 1000 Mbps (the
PHY register itself does not differentiate between 1000 Mbps and 2500
Mbps - it thinks it is running at 1000 Mbps, although clock is 2.5x
faster).
Look at the cmode and set SPEED_2500 if cmode is set to 2500base-x.

Signed-off-by: Marek Behún <marek.be...@nic.cz>
Cc: Andrew Lunn <and...@lunn.ch>
Cc: Florian Fainelli <f.faine...@gmail.com>
Cc: Vladimir Oltean <olte...@gmail.com>
Cc: Vivien Didelot <vivien.dide...@gmail.com>
---
 drivers/net/dsa/mv88e6xxx/serdes.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c 
b/drivers/net/dsa/mv88e6xxx/serdes.c
index 20c526c2a9ee..17bb4a705d44 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -506,6 +506,7 @@ static void mv88e6390_serdes_irq_link_sgmii(struct 
mv88e6xxx_chip *chip,
                                            int port, int lane)
 {
        struct dsa_switch *ds = chip->ds;
+       u8 cmode = chip->ports[port].cmode;
        int duplex = DUPLEX_UNKNOWN;
        int speed = SPEED_UNKNOWN;
        int link, err;
@@ -527,7 +528,10 @@ static void mv88e6390_serdes_irq_link_sgmii(struct 
mv88e6xxx_chip *chip,
 
                switch (status & MV88E6390_SGMII_PHY_STATUS_SPEED_MASK) {
                case MV88E6390_SGMII_PHY_STATUS_SPEED_1000:
-                       speed = SPEED_1000;
+                       if (cmode == MV88E6XXX_PORT_STS_CMODE_2500BASEX)
+                               speed = SPEED_2500;
+                       else
+                               speed = SPEED_1000;
                        break;
                case MV88E6390_SGMII_PHY_STATUS_SPEED_100:
                        speed = SPEED_100;
-- 
2.21.0

Reply via email to