net: dsa: mv88e6xxx: 88E6141/6341 SERDES support

The 88E6141/6341 switches (also known as Topaz) have 1 SGMII lane,
which can be configured the same way as the SERDES lane on 88E6390.

Signed-off-by: Marek Behun <marek.behun@nic.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Marek Behún 2018-05-04 19:26:10 +02:00 committed by David S. Miller
parent 4dbbe8dde8
commit 5bafeb6e7e
3 changed files with 25 additions and 0 deletions

View File

@ -2529,6 +2529,7 @@ static const struct mv88e6xxx_ops mv88e6085_ops = {
.reset = mv88e6185_g1_reset, .reset = mv88e6185_g1_reset,
.vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_getnext = mv88e6352_g1_vtu_getnext,
.vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
.serdes_power = mv88e6341_serdes_power,
}; };
static const struct mv88e6xxx_ops mv88e6095_ops = { static const struct mv88e6xxx_ops mv88e6095_ops = {
@ -2848,6 +2849,7 @@ static const struct mv88e6xxx_ops mv88e6175_ops = {
.reset = mv88e6352_g1_reset, .reset = mv88e6352_g1_reset,
.vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_getnext = mv88e6352_g1_vtu_getnext,
.vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
.serdes_power = mv88e6341_serdes_power,
}; };
static const struct mv88e6xxx_ops mv88e6176_ops = { static const struct mv88e6xxx_ops mv88e6176_ops = {

View File

@ -326,3 +326,23 @@ int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on)
return 0; return 0;
} }
int mv88e6341_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on)
{
int err;
u8 cmode;
if (port != 5)
return 0;
err = mv88e6xxx_port_get_cmode(chip, port, &cmode);
if (err)
return err;
if (cmode == MV88E6XXX_PORT_STS_CMODE_1000BASE_X ||
cmode == MV88E6XXX_PORT_STS_CMODE_SGMII ||
cmode == MV88E6XXX_PORT_STS_CMODE_2500BASEX)
return mv88e6390_serdes_sgmii(chip, MV88E6341_ADDR_SERDES, on);
return 0;
}

View File

@ -19,6 +19,8 @@
#define MV88E6352_ADDR_SERDES 0x0f #define MV88E6352_ADDR_SERDES 0x0f
#define MV88E6352_SERDES_PAGE_FIBER 0x01 #define MV88E6352_SERDES_PAGE_FIBER 0x01
#define MV88E6341_ADDR_SERDES 0x15
#define MV88E6390_PORT9_LANE0 0x09 #define MV88E6390_PORT9_LANE0 0x09
#define MV88E6390_PORT9_LANE1 0x12 #define MV88E6390_PORT9_LANE1 0x12
#define MV88E6390_PORT9_LANE2 0x13 #define MV88E6390_PORT9_LANE2 0x13
@ -42,6 +44,7 @@
#define MV88E6390_SGMII_CONTROL_LOOPBACK BIT(14) #define MV88E6390_SGMII_CONTROL_LOOPBACK BIT(14)
#define MV88E6390_SGMII_CONTROL_PDOWN BIT(11) #define MV88E6390_SGMII_CONTROL_PDOWN BIT(11)
int mv88e6341_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on);
int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on); int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on);
int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on); int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on);
int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port);