aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dsa/slave.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index a47305c72fcc..19bc2b39c9d1 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -617,6 +617,23 @@ static int dsa_slave_fixed_link_update(struct net_device *dev,
617} 617}
618 618
619/* slave device setup *******************************************************/ 619/* slave device setup *******************************************************/
620static int dsa_slave_phy_connect(struct dsa_slave_priv *p,
621 struct net_device *slave_dev)
622{
623 struct dsa_switch *ds = p->parent;
624
625 p->phy = ds->slave_mii_bus->phy_map[p->port];
626 if (!p->phy)
627 return -ENODEV;
628
629 /* Use already configured phy mode */
630 p->phy_interface = p->phy->interface;
631 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
632 p->phy_interface);
633
634 return 0;
635}
636
620static int dsa_slave_phy_setup(struct dsa_slave_priv *p, 637static int dsa_slave_phy_setup(struct dsa_slave_priv *p,
621 struct net_device *slave_dev) 638 struct net_device *slave_dev)
622{ 639{
@@ -662,14 +679,9 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p,
662 * MDIO bus instead 679 * MDIO bus instead
663 */ 680 */
664 if (!p->phy) { 681 if (!p->phy) {
665 p->phy = ds->slave_mii_bus->phy_map[p->port]; 682 ret = dsa_slave_phy_connect(p, slave_dev);
666 if (!p->phy) 683 if (ret)
667 return -ENODEV; 684 return ret;
668
669 /* Use already configured phy mode */
670 p->phy_interface = p->phy->interface;
671 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
672 p->phy_interface);
673 } else { 685 } else {
674 netdev_info(slave_dev, "attached PHY at address %d [%s]\n", 686 netdev_info(slave_dev, "attached PHY at address %d [%s]\n",
675 p->phy->addr, p->phy->drv->name); 687 p->phy->addr, p->phy->drv->name);