Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / drivers / net / ethernet / marvell / mvpp2 / mvpp2_main.c
index 14e372c..cd32c71 100644 (file)
@@ -4792,6 +4792,8 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                        phylink_set(mask, 10000baseER_Full);
                        phylink_set(mask, 10000baseKR_Full);
                }
+               if (state->interface != PHY_INTERFACE_MODE_NA)
+                       break;
                /* Fall-through */
        case PHY_INTERFACE_MODE_RGMII:
        case PHY_INTERFACE_MODE_RGMII_ID:
@@ -4802,13 +4804,23 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                phylink_set(mask, 10baseT_Full);
                phylink_set(mask, 100baseT_Half);
                phylink_set(mask, 100baseT_Full);
+               phylink_set(mask, 1000baseT_Full);
+               phylink_set(mask, 1000baseX_Full);
+               if (state->interface != PHY_INTERFACE_MODE_NA)
+                       break;
                /* Fall-through */
        case PHY_INTERFACE_MODE_1000BASEX:
        case PHY_INTERFACE_MODE_2500BASEX:
-               phylink_set(mask, 1000baseT_Full);
-               phylink_set(mask, 1000baseX_Full);
-               phylink_set(mask, 2500baseT_Full);
-               phylink_set(mask, 2500baseX_Full);
+               if (port->comphy ||
+                   state->interface != PHY_INTERFACE_MODE_2500BASEX) {
+                       phylink_set(mask, 1000baseT_Full);
+                       phylink_set(mask, 1000baseX_Full);
+               }
+               if (port->comphy ||
+                   state->interface == PHY_INTERFACE_MODE_2500BASEX) {
+                       phylink_set(mask, 2500baseT_Full);
+                       phylink_set(mask, 2500baseX_Full);
+               }
                break;
        default:
                goto empty_set;
@@ -4817,6 +4829,8 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
        bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
        bitmap_and(state->advertising, state->advertising, mask,
                   __ETHTOOL_LINK_MODE_MASK_NBITS);
+
+       phylink_helper_basex_speed(state);
        return;
 
 empty_set:
@@ -5411,6 +5425,16 @@ static int mvpp2_port_probe(struct platform_device *pdev,
                port->phylink = NULL;
        }
 
+       /* Cycle the comphy to power it down, saving 270mW per port -
+        * don't worry about an error powering it up. When the comphy
+        * driver does this, we can remove this code.
+        */
+       if (port->comphy) {
+               err = mvpp22_comphy_init(port);
+               if (err == 0)
+                       phy_power_off(port->comphy);
+       }
+
        err = register_netdev(dev);
        if (err < 0) {
                dev_err(&pdev->dev, "failed to register netdev\n");