]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: lan743x: PCI11010 / PCI11414 fix
authorRaju Lakkaraju <Raju.Lakkaraju@microchip.com>
Fri, 27 May 2022 04:17:28 +0000 (09:47 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 May 2022 11:09:46 +0000 (12:09 +0100)
Fix the MDIO interface declarations to reflect what is currently supported by
the PCI11010 / PCI11414 devices (C22 for RGMII and C22_C45 for SGMII)

Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/lan743x_main.c

index efbddf24ba31bb23f3bcca36462785e9f68d63e1..af81236b4b4e49458ace4613472a520c28df5299 100644 (file)
@@ -1164,9 +1164,14 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
                if (!phydev)
                        goto return_error;
 
-               ret = phy_connect_direct(netdev, phydev,
-                                        lan743x_phy_link_status_change,
-                                        PHY_INTERFACE_MODE_GMII);
+               if (adapter->is_pci11x1x)
+                       ret = phy_connect_direct(netdev, phydev,
+                                                lan743x_phy_link_status_change,
+                                                PHY_INTERFACE_MODE_RGMII);
+               else
+                       ret = phy_connect_direct(netdev, phydev,
+                                                lan743x_phy_link_status_change,
+                                                PHY_INTERFACE_MODE_GMII);
                if (ret)
                        goto return_error;
        }
@@ -2936,20 +2941,27 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
                        lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
                        netif_dbg(adapter, drv, adapter->netdev,
                                  "SGMII operation\n");
+                       adapter->mdiobus->probe_capabilities = MDIOBUS_C22_C45;
+                       adapter->mdiobus->read = lan743x_mdiobus_c45_read;
+                       adapter->mdiobus->write = lan743x_mdiobus_c45_write;
+                       adapter->mdiobus->name = "lan743x-mdiobus-c45";
+                       netif_dbg(adapter, drv, adapter->netdev,
+                                 "lan743x-mdiobus-c45\n");
                } else {
                        sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL);
                        sgmii_ctl &= ~SGMII_CTL_SGMII_ENABLE_;
                        sgmii_ctl |= SGMII_CTL_SGMII_POWER_DN_;
                        lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl);
                        netif_dbg(adapter, drv, adapter->netdev,
-                                         "(R)GMII operation\n");
+                                 "RGMII operation\n");
+                       // Only C22 support when RGMII I/F
+                       adapter->mdiobus->probe_capabilities = MDIOBUS_C22;
+                       adapter->mdiobus->read = lan743x_mdiobus_read;
+                       adapter->mdiobus->write = lan743x_mdiobus_write;
+                       adapter->mdiobus->name = "lan743x-mdiobus";
+                       netif_dbg(adapter, drv, adapter->netdev,
+                                 "lan743x-mdiobus\n");
                }
-
-               adapter->mdiobus->probe_capabilities = MDIOBUS_C22_C45;
-               adapter->mdiobus->read = lan743x_mdiobus_c45_read;
-               adapter->mdiobus->write = lan743x_mdiobus_c45_write;
-               adapter->mdiobus->name = "lan743x-mdiobus-c45";
-               netif_dbg(adapter, drv, adapter->netdev, "lan743x-mdiobus-c45\n");
        } else {
                adapter->mdiobus->read = lan743x_mdiobus_read;
                adapter->mdiobus->write = lan743x_mdiobus_write;