mirror of https://gitee.com/openkylin/linux.git
Merge branch 'mv88e6xxx-Support-more-SERDES-interfacxes'
Andrew Lunn says: ==================== net: dsa: mv88e6xxx: Support more SERDES interfacxes Currently the SERDES interfaces for ports 9 and 10 on the mv88e6390x are supported, allowing upto 10G. However, when unused, these SERDES interfaces can be used by some of the lower ports for 1000Base-X. The tricky bit here is ordering. The SERDES have to become free from ports 9 or 10 before they can be used with lower ports. Normally, this would happen only when these ports would be configured up, which is too late. So at probe time, defaulting ports 9 and 10 to 1000BaseX frees them for use with lower ports. If they are actually needed, they will be taken back when port 9 and 10 goes up. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
0cf3a68a53
|
@ -3234,6 +3234,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = {
|
|||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3276,6 +3277,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = {
|
|||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390x_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3291,8 +3293,8 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = {
|
|||
.vtu_getnext = mv88e6390_g1_vtu_getnext,
|
||||
.vtu_loadpurge = mv88e6390_g1_vtu_loadpurge,
|
||||
.serdes_power = mv88e6390x_serdes_power,
|
||||
.serdes_irq_setup = mv88e6390_serdes_irq_setup,
|
||||
.serdes_irq_free = mv88e6390_serdes_irq_free,
|
||||
.serdes_irq_setup = mv88e6390x_serdes_irq_setup,
|
||||
.serdes_irq_free = mv88e6390x_serdes_irq_free,
|
||||
.gpio_ops = &mv88e6352_gpio_ops,
|
||||
.phylink_validate = mv88e6390x_phylink_validate,
|
||||
};
|
||||
|
@ -3318,6 +3320,7 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
|
|||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3405,11 +3408,11 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
|
|||
.port_set_egress_floods = mv88e6352_port_set_egress_floods,
|
||||
.port_set_ether_type = mv88e6351_port_set_ether_type,
|
||||
.port_pause_limit = mv88e6390_port_pause_limit,
|
||||
.port_set_cmode = mv88e6390x_port_set_cmode,
|
||||
.port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
|
||||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3710,11 +3713,11 @@ static const struct mv88e6xxx_ops mv88e6390_ops = {
|
|||
.port_set_jumbo_size = mv88e6165_port_set_jumbo_size,
|
||||
.port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
|
||||
.port_pause_limit = mv88e6390_port_pause_limit,
|
||||
.port_set_cmode = mv88e6390x_port_set_cmode,
|
||||
.port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
|
||||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3757,11 +3760,11 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = {
|
|||
.port_set_jumbo_size = mv88e6165_port_set_jumbo_size,
|
||||
.port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
|
||||
.port_pause_limit = mv88e6390_port_pause_limit,
|
||||
.port_set_cmode = mv88e6390x_port_set_cmode,
|
||||
.port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
|
||||
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
|
||||
.port_link_state = mv88e6352_port_link_state,
|
||||
.port_get_cmode = mv88e6352_port_get_cmode,
|
||||
.port_set_cmode = mv88e6390x_port_set_cmode,
|
||||
.stats_snapshot = mv88e6390_g1_stats_snapshot,
|
||||
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
|
||||
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
|
||||
|
@ -3777,8 +3780,8 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = {
|
|||
.vtu_getnext = mv88e6390_g1_vtu_getnext,
|
||||
.vtu_loadpurge = mv88e6390_g1_vtu_loadpurge,
|
||||
.serdes_power = mv88e6390x_serdes_power,
|
||||
.serdes_irq_setup = mv88e6390_serdes_irq_setup,
|
||||
.serdes_irq_free = mv88e6390_serdes_irq_free,
|
||||
.serdes_irq_setup = mv88e6390x_serdes_irq_setup,
|
||||
.serdes_irq_free = mv88e6390x_serdes_irq_free,
|
||||
.gpio_ops = &mv88e6352_gpio_ops,
|
||||
.avb_ops = &mv88e6390_avb_ops,
|
||||
.ptp_ops = &mv88e6352_ptp_ops,
|
||||
|
|
|
@ -368,12 +368,15 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
|
|||
u16 reg;
|
||||
int err;
|
||||
|
||||
if (mode == PHY_INTERFACE_MODE_NA)
|
||||
return 0;
|
||||
|
||||
if (port != 9 && port != 10)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* Default to a slow mode, so freeing up SERDES interfaces for
|
||||
* other ports which might use them for SFPs.
|
||||
*/
|
||||
if (mode == PHY_INTERFACE_MODE_NA)
|
||||
mode = PHY_INTERFACE_MODE_1000BASEX;
|
||||
|
||||
switch (mode) {
|
||||
case PHY_INTERFACE_MODE_1000BASEX:
|
||||
cmode = MV88E6XXX_PORT_STS_CMODE_1000BASE_X;
|
||||
|
@ -437,6 +440,21 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
|
||||
phy_interface_t mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case PHY_INTERFACE_MODE_XGMII:
|
||||
case PHY_INTERFACE_MODE_XAUI:
|
||||
case PHY_INTERFACE_MODE_RXAUI:
|
||||
return -EINVAL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return mv88e6390x_port_set_cmode(chip, port, mode);
|
||||
}
|
||||
|
||||
int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode)
|
||||
{
|
||||
int err;
|
||||
|
|
|
@ -310,6 +310,8 @@ int mv88e6097_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
|
|||
u8 out);
|
||||
int mv88e6390_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
|
||||
u8 out);
|
||||
int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
|
||||
phy_interface_t mode);
|
||||
int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
|
||||
phy_interface_t mode);
|
||||
int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode);
|
||||
|
|
|
@ -619,15 +619,11 @@ static irqreturn_t mv88e6390_serdes_thread_fn(int irq, void *dev_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port)
|
||||
int mv88e6390x_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port)
|
||||
{
|
||||
int lane;
|
||||
int err;
|
||||
|
||||
/* Only support ports 9 and 10 at the moment */
|
||||
if (port < 9)
|
||||
return 0;
|
||||
|
||||
lane = mv88e6390x_serdes_get_lane(chip, port);
|
||||
|
||||
if (lane == -ENODEV)
|
||||
|
@ -663,11 +659,19 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port)
|
|||
return mv88e6390_serdes_irq_enable(chip, port, lane);
|
||||
}
|
||||
|
||||
void mv88e6390_serdes_irq_free(struct mv88e6xxx_chip *chip, int port)
|
||||
int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port)
|
||||
{
|
||||
if (port < 9)
|
||||
return 0;
|
||||
|
||||
return mv88e6390_serdes_irq_setup(chip, port);
|
||||
}
|
||||
|
||||
void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port)
|
||||
{
|
||||
int lane = mv88e6390x_serdes_get_lane(chip, port);
|
||||
|
||||
if (port < 9)
|
||||
if (lane == -ENODEV)
|
||||
return;
|
||||
|
||||
if (lane < 0)
|
||||
|
@ -685,6 +689,14 @@ void mv88e6390_serdes_irq_free(struct mv88e6xxx_chip *chip, int port)
|
|||
chip->ports[port].serdes_irq = 0;
|
||||
}
|
||||
|
||||
void mv88e6390_serdes_irq_free(struct mv88e6xxx_chip *chip, int port)
|
||||
{
|
||||
if (port < 9)
|
||||
return;
|
||||
|
||||
mv88e6390x_serdes_irq_free(chip, port);
|
||||
}
|
||||
|
||||
int mv88e6341_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on)
|
||||
{
|
||||
u8 cmode = chip->ports[port].cmode;
|
||||
|
|
|
@ -77,6 +77,8 @@ int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on);
|
|||
int mv88e6390x_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on);
|
||||
int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port);
|
||||
void mv88e6390_serdes_irq_free(struct mv88e6xxx_chip *chip, int port);
|
||||
int mv88e6390x_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port);
|
||||
void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port);
|
||||
int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port);
|
||||
int mv88e6352_serdes_get_strings(struct mv88e6xxx_chip *chip,
|
||||
int port, uint8_t *data);
|
||||
|
|
Loading…
Reference in New Issue