ixgbe: Assign set_phy_power dynamically where needed
authorDon Skidmore <donald.c.skidmore@intel.com>
Thu, 11 Jun 2015 00:42:30 +0000 (20:42 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 1 Sep 2015 23:42:39 +0000 (16:42 -0700)
There are various reasons why this method may or may not need to be
defined and some of these we don't know until runtime.  So we will
set the value in get_invariants.

Signed-off-by: Donald C Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

index 032a5870abd11bab111e2e317d821fbf454572c2..4e758435ece872943231ee490ab222df6a86fa25 100644 (file)
@@ -54,6 +54,11 @@ enum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw)
 s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw)
 {
        struct ixgbe_mac_info *mac = &hw->mac;
+       struct ixgbe_phy_info *phy = &hw->phy;
+
+       /* set_phy_power was set by default to NULL */
+       if (!ixgbe_mng_present(hw))
+               phy->ops.set_phy_power = ixgbe_set_copper_phy_power;
 
        mac->mcft_size = IXGBE_X540_MC_TBL_SIZE;
        mac->vft_size = IXGBE_X540_VFT_TBL_SIZE;
index 7581da13e92a3cecbb6782cf040d3d9f03290468..662d2e8962862bdba275a6da5888c4a8119ab84a 100644 (file)
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
 
+static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw)
+{
+       struct ixgbe_mac_info *mac = &hw->mac;
+       struct ixgbe_phy_info *phy = &hw->phy;
+
+       /* Start with X540 invariants, since so simular */
+       ixgbe_get_invariants_X540(hw);
+
+       if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper)
+               phy->ops.set_phy_power = NULL;
+
+       return 0;
+}
+
 /** ixgbe_setup_mux_ctl - Setup ESDP register for I2C mux control
  *  @hw: pointer to hardware structure
  **/
@@ -1855,7 +1869,7 @@ static struct ixgbe_eeprom_operations eeprom_ops_X550EM_x = {
        .read_reg               = &ixgbe_read_phy_reg_generic, \
        .write_reg              = &ixgbe_write_phy_reg_generic, \
        .setup_link             = &ixgbe_setup_phy_link_generic, \
-       .set_phy_power          = &ixgbe_set_copper_phy_power, \
+       .set_phy_power          = NULL, \
        .check_overtemp         = &ixgbe_tn_check_overtemp, \
        .get_firmware_version   = &ixgbe_get_phy_firmware_version_generic,
 
@@ -1893,7 +1907,7 @@ struct ixgbe_info ixgbe_X550_info = {
 
 struct ixgbe_info ixgbe_X550EM_x_info = {
        .mac                    = ixgbe_mac_X550EM_x,
-       .get_invariants         = &ixgbe_get_invariants_X540,
+       .get_invariants         = &ixgbe_get_invariants_X550_x,
        .mac_ops                = &mac_ops_X550EM_x,
        .eeprom_ops             = &eeprom_ops_X550EM_x,
        .phy_ops                = &phy_ops_X550EM_x,