]> www.infradead.org Git - users/willy/xarray.git/commitdiff
net: dsa: mv88e6xxx: Fix 6095/6097/6185 ports in non-SERDES CMODE
authorTobias Waldekranz <tobias@waldekranz.com>
Mon, 26 Apr 2021 16:17:34 +0000 (18:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Apr 2021 21:06:19 +0000 (14:06 -0700)
The .serdes_get_lane op used the magic value 0xff to indicate a valid
SERDES lane and 0 signaled that a non-SERDES mode was set on the port.

Unfortunately, "0" is also a valid lane ID, so even when these ports
where configured to e.g. RGMII the driver would set them up as SERDES
ports.

- Replace 0xff with 0 to indicate a valid lane ID. The number is on
  the one hand just as arbitrary, but it is at least the first valid one
  and therefore less of a surprise.

- Follow the other .serdes_get_lane implementations and return -ENODEV
  in the case where no SERDES is assigned to the port.

Fixes: f5be107c3338 ("net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/serdes.c

index 470856bcd2f3b8202bb1ee3e9d297ff962fd38c9..e4fbef81bc52d38111e316624385e3b27c28e7ba 100644 (file)
@@ -443,15 +443,15 @@ int mv88e6185_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
 int mv88e6185_serdes_get_lane(struct mv88e6xxx_chip *chip, int port)
 {
        /* There are no configurable serdes lanes on this switch chip but we
-        * need to return non-zero so that callers of
+        * need to return a non-negative lane number so that callers of
         * mv88e6xxx_serdes_get_lane() know this is a serdes port.
         */
        switch (chip->ports[port].cmode) {
        case MV88E6185_PORT_STS_CMODE_SERDES:
        case MV88E6185_PORT_STS_CMODE_1000BASE_X:
-               return 0xff;
-       default:
                return 0;
+       default:
+               return -ENODEV;
        }
 }