Re: [PATCH net-next v2 7/7] net: dsa: mv88e6xxx: enable support for 88E6361 switch

From: Andrew Lunn
Date: Fri May 19 2023 - 12:22:14 EST


> @@ -421,9 +421,14 @@ phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
> int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port,
> int speed, int duplex)
> {
> + bool is_6361 =
> + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
> u16 reg, ctrl;
> int err;
>
> + if (is_6361 && speed > 2500)
> + return -EOPNOTSUPP;

I would move the comparison inside the if, so removing the ugly looking split is_6361 line.

> +
> if (speed == 200 && port != 0)
> return -EOPNOTSUPP;
>
> @@ -506,8 +511,12 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port,
> phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
> int port)
> {
> + bool is_6361 =
> + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
> +
> if (port == 0 || port == 9 || port == 10)
> - return PHY_INTERFACE_MODE_10GBASER;
> + return is_6361 ? PHY_INTERFACE_MODE_2500BASEX :
> + PHY_INTERFACE_MODE_10GBASER;

Please see if you can rearrange this code as well.

Thanks
Andrew