mbox series

[v2,0/3] net: dsa: mv88e6xxx: serdes link without phy

Message ID 20201019024355.30717-1-chris.packham@alliedtelesis.co.nz
Headers show
Series net: dsa: mv88e6xxx: serdes link without phy | expand

Message

Chris Packham Oct. 19, 2020, 2:43 a.m. UTC
This small series gets my hardware into a working state. The key points are to
make sure we don't force the link and that we ask the MAC for the link status.
I also have updated my dts to say `phy-mode = "1000base-x";` and `managed =
"in-band-status";`

I've included patch #3 in this series but I don't have anything to test it on.
It's just a guess based on the datasheets.

Chris Packham (3):
  net: dsa: mv88e6xxx: Don't force link when using in-band-status
  net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185
  net: dsa: mv88e6xxx: Support serdes ports on MV88E6123/6131

 drivers/net/dsa/mv88e6xxx/chip.c   |  26 +++++++-
 drivers/net/dsa/mv88e6xxx/serdes.c | 102 +++++++++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/serdes.h |   9 +++
 3 files changed, 135 insertions(+), 2 deletions(-)

Comments

Andrew Lunn Oct. 20, 2020, 12:17 a.m. UTC | #1
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@alliedtelesis.co.nz>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

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