aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-09-11 18:15:24 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-12 23:35:39 -0400
commitd700ec4118f9d5e88db8f678e7342f28c93037b9 (patch)
tree084d2e9b6b53fdbe7e3298dd201411cb59703917
parentf8a1988f655192ae8ea6e1d940706a8340924bbc (diff)
net: dsa: mv88e6xxx: Make sure to configure ports with external PHYs
The MV88E6xxx can have external PHYs attached to certain ports and those PHYs could even be on different MDIO bus than the one within the switch. This patch makes sure that ports with such PHYs are configured correctly according to the information provided by the PHY. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index e07838430d16..78ce820b5257 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -575,6 +575,13 @@ restore_link:
575 return err; 575 return err;
576} 576}
577 577
578static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port)
579{
580 struct mv88e6xxx_chip *chip = ds->priv;
581
582 return port < chip->info->num_internal_phys;
583}
584
578/* We expect the switch to perform auto negotiation if there is a real 585/* We expect the switch to perform auto negotiation if there is a real
579 * phy. However, in the case of a fixed link phy, we force the port 586 * phy. However, in the case of a fixed link phy, we force the port
580 * settings from the fixed link settings. 587 * settings from the fixed link settings.
@@ -585,7 +592,8 @@ static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port,
585 struct mv88e6xxx_chip *chip = ds->priv; 592 struct mv88e6xxx_chip *chip = ds->priv;
586 int err; 593 int err;
587 594
588 if (!phy_is_pseudo_fixed_link(phydev)) 595 if (!phy_is_pseudo_fixed_link(phydev) &&
596 mv88e6xxx_phy_is_internal(ds, port))
589 return; 597 return;
590 598
591 mutex_lock(&chip->reg_lock); 599 mutex_lock(&chip->reg_lock);
@@ -709,13 +717,17 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
709 struct mv88e6xxx_chip *chip = ds->priv; 717 struct mv88e6xxx_chip *chip = ds->priv;
710 int speed, duplex, link, pause, err; 718 int speed, duplex, link, pause, err;
711 719
712 if (mode == MLO_AN_PHY) 720 if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port))
713 return; 721 return;
714 722
715 if (mode == MLO_AN_FIXED) { 723 if (mode == MLO_AN_FIXED) {
716 link = LINK_FORCED_UP; 724 link = LINK_FORCED_UP;
717 speed = state->speed; 725 speed = state->speed;
718 duplex = state->duplex; 726 duplex = state->duplex;
727 } else if (!mv88e6xxx_phy_is_internal(ds, port)) {
728 link = state->link;
729 speed = state->speed;
730 duplex = state->duplex;
719 } else { 731 } else {
720 speed = SPEED_UNFORCED; 732 speed = SPEED_UNFORCED;
721 duplex = DUPLEX_UNFORCED; 733 duplex = DUPLEX_UNFORCED;