On Fri, Oct 05, 2018 at 04:42:27PM +0200, Marek BehĂșn wrote: > The port_set_speed method for the Topaz family must not be the same > as for Peridot family, since on Topaz port 5 is the SERDES port and it > can be set to 2500mbps speed mode. > > This patch adds a new method for the Topaz family, allowing the alt_bit > mode only for port 0 and the 2500 mbps mode for port 5. > > diff --git a/drivers/net/dsa/mv88e6xxx/port.c > b/drivers/net/dsa/mv88e6xxx/port.c > index 92945841c8e8..cd7db60a508b 100644 > --- a/drivers/net/dsa/mv88e6xxx/port.c > +++ b/drivers/net/dsa/mv88e6xxx/port.c > @@ -228,8 +228,11 @@ static int mv88e6xxx_port_set_speed(struct > mv88e6xxx_chip *chip, int port, > ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_1000; > break; > case 2500: > - ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000 | > - MV88E6390_PORT_MAC_CTL_ALTSPEED; > + if (alt_bit) > + ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000 | > + MV88E6390_PORT_MAC_CTL_ALTSPEED; > + else > + ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000; > break; > case 10000: > /* all bits set, fall through... */ > @@ -291,6 +294,24 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip > *chip, int port, int speed) > return mv88e6xxx_port_set_speed(chip, port, speed, false, false); > } > > +/* Support 10, 100, 200, 1000, 2500 Mbps (e.g. 88E6341) */ > +int mv88e6341_port_set_speed(struct mv88e6xxx_chip *chip, int port, int > speed) > +{ > + if (speed == SPEED_MAX) > + speed = port < 5 ? 1000 : 2500; > + > + if (speed > 2500) > + return -EOPNOTSUPP; > + > + if (speed == 200 && port != 0) > + return -EOPNOTSUPP; > + > + if (speed == 2500 && port < 5) > + return -EOPNOTSUPP; > + > + return mv88e6xxx_port_set_speed(chip, port, speed, !port, true);
Hi Marek I'm confused. The alt bit is used for configuring 2500. You say 2500 is only supported on port 5. But !port is only true for port 0? Andrew