Re: [PATCH v2 2/3] net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185

From: Andrew Lunn
Date: Mon Oct 19 2020 - 20:18:14 EST


On Mon, Oct 19, 2020 at 03:43:54PM +1300, Chris Packham wrote:
> Implement serdes_power, serdes_get_lane and serdes_pcs_get_state ops for
> the MV88E6097/6095/6185 so that ports 8 & 9 can be supported as serdes
> ports and directly connected to other network interfaces or to SFPs
> without a PHY.
>
> Signed-off-by: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx>

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Just a nit pick below.

> +int mv88e6185_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane,
> + bool up)
> +{
> + /* The serdes power can't be controlled on this switch chip but we need
> + * to supply this function to avoid returning -EOPNOTSUPP in
> + * mv88e6xxx_serdes_power_up/mv88e6xxx_serdes_power_down
> + */
> + return 0;
> +}
> +
> +u8 mv88e6185_serdes_get_lane(struct mv88e6xxx_chip *chip, int port)
> +{
> + switch (chip->ports[port].cmode) {
> + case MV88E6185_PORT_STS_CMODE_SERDES:
> + case MV88E6185_PORT_STS_CMODE_1000BASE_X:
> + return 0xff; /* Unused */
> + default:
> + return 0;
> + }
> +}

mv88e6185_serdes_power() has a nice comment about why it exists and
just returns 0. It would be nice to have something similar here, that
there are no SERDES lane registers, but something other than 0 has to
be returned to indicate there is in fact a SERDES for the given port.

Andrew