Staging: octeon-ethernet: Convert to use PHY Abstraction Layer.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / octeon / ethernet-rgmii.c
index fbaa465d2fac3e2424d81f92d1a446b9cb107133..3820f1ec11d16a98dd24357f4c32e5036178b1ac 100644 (file)
@@ -147,32 +147,36 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
                cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
                               gmxx_rxx_int_reg.u64);
        }
-
-       link_info = cvmx_helper_link_autoconf(priv->port);
-       priv->link_info = link_info.u64;
+       if (priv->phydev == NULL) {
+               link_info = cvmx_helper_link_autoconf(priv->port);
+               priv->link_info = link_info.u64;
+       }
        spin_unlock_irqrestore(&global_register_lock, flags);
 
-       /* Tell Linux */
-       if (link_info.s.link_up) {
-
-               if (!netif_carrier_ok(dev))
-                       netif_carrier_on(dev);
-               if (priv->queue != -1)
-                       DEBUGPRINT
-                           ("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
-                            dev->name, link_info.s.speed,
-                            (link_info.s.full_duplex) ? "Full" : "Half",
-                            priv->port, priv->queue);
-               else
-                       DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n",
-                                  dev->name, link_info.s.speed,
-                                  (link_info.s.full_duplex) ? "Full" : "Half",
-                                  priv->port);
-       } else {
-
-               if (netif_carrier_ok(dev))
-                       netif_carrier_off(dev);
-               DEBUGPRINT("%s: Link down\n", dev->name);
+       if (priv->phydev == NULL) {
+               /* Tell core. */
+               if (link_info.s.link_up) {
+                       if (!netif_carrier_ok(dev))
+                               netif_carrier_on(dev);
+                       if (priv->queue != -1)
+                               DEBUGPRINT("%s: %u Mbps %s duplex, "
+                                          "port %2d, queue %2d\n",
+                                          dev->name, link_info.s.speed,
+                                          (link_info.s.full_duplex) ?
+                                               "Full" : "Half",
+                                          priv->port, priv->queue);
+                       else
+                               DEBUGPRINT("%s: %u Mbps %s duplex, "
+                                          "port %2d, POW\n",
+                                          dev->name, link_info.s.speed,
+                                          (link_info.s.full_duplex) ?
+                                               "Full" : "Half",
+                                          priv->port);
+               } else {
+                       if (netif_carrier_ok(dev))
+                               netif_carrier_off(dev);
+                       DEBUGPRINT("%s: Link down\n", dev->name);
+               }
        }
 }