net: ethernet: ti: am65-cpsw: Move phy_set_mode_ext() to correct location
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Mon, 22 Aug 2022 07:01:25 +0000 (12:31 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Aug 2022 08:52:04 +0000 (09:52 +0100)
In TI's J7200 SoC CPSW5G ports, each of the 4 ports can be configured
as a QSGMII main or QSGMII-SUB port. This configuration is performed
by phy-gmii-sel driver on invoking the phy_set_mode_ext() function.

It is necessary for the QSGMII main port to be configured before any of
the QSGMII-SUB interfaces are brought up. Currently, the QSGMII-SUB
interfaces come up before the QSGMII main port is configured.

Fix this by moving the call to phy_set_mode_ext() from
am65_cpsw_nuss_ndo_slave_open() to am65_cpsw_nuss_init_slave_ports(),
thereby ensuring that the QSGMII main port is configured before any of
the QSGMII-SUB ports are brought up.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/am65-cpsw-nuss.c

index 033b40649308a46cdf8bcdf94e1c7538aea22c2c..7ef5d8208a4e5823926e06fb791962911e536b49 100644 (file)
@@ -593,11 +593,6 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
        /* mac_sl should be configured via phy-link interface */
        am65_cpsw_sl_ctl_reset(port);
 
-       ret = phy_set_mode_ext(port->slave.ifphy, PHY_MODE_ETHERNET,
-                              port->slave.phy_if);
-       if (ret)
-               goto error_cleanup;
-
        ret = phylink_of_phy_connect(port->slave.phylink, port->slave.phy_node, 0);
        if (ret)
                goto error_cleanup;
@@ -1898,6 +1893,10 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
                        goto of_node_put;
                }
 
+               ret = phy_set_mode_ext(port->slave.ifphy, PHY_MODE_ETHERNET, port->slave.phy_if);
+               if (ret)
+                       goto of_node_put;
+
                ret = of_get_mac_address(port_np, port->slave.mac_addr);
                if (ret) {
                        am65_cpsw_am654_get_efuse_macid(port_np,