ixgbe: Read and set instance id
authorMark Rustad <mark.d.rustad@intel.com>
Fri, 1 Apr 2016 19:18:20 +0000 (12:18 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 7 Apr 2016 23:33:11 +0000 (16:33 -0700)
Read the instance number from EEPROM and save it for later use.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

index 11450bd8ec9c26f8088dbefbf416355f018bddff..737443a015d5cc63dfcaec31cc25b588471b3ee1 100644 (file)
@@ -682,6 +682,7 @@ s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
 void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw)
 {
        struct ixgbe_bus_info *bus = &hw->bus;
+       u16 ee_ctrl_4;
        u32 reg;
 
        reg = IXGBE_READ_REG(hw, IXGBE_STATUS);
@@ -692,6 +693,13 @@ void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw)
        reg = IXGBE_READ_REG(hw, IXGBE_FACTPS(hw));
        if (reg & IXGBE_FACTPS_LFS)
                bus->func ^= 0x1;
+
+       /* Get MAC instance from EEPROM for configuring CS4227 */
+       if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) {
+               hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4, &ee_ctrl_4);
+               bus->instance_id = (ee_ctrl_4 & IXGBE_EE_CTRL_4_INST_ID) >>
+                                  IXGBE_EE_CTRL_4_INST_ID_SHIFT;
+       }
 }
 
 /**
index ced38c19436c820c6396b7952df718b81efaab42..a5c789e30de30005d256a9e43da125e58198ffb1 100644 (file)
@@ -82,6 +82,7 @@
 #define IXGBE_DEV_ID_X550EM_X_10G_T    0x15AD
 #define IXGBE_DEV_ID_X550EM_X_1G_T     0x15AE
 #define IXGBE_DEV_ID_X550EM_A_SFP_N    0x15C4
+#define IXGBE_DEV_ID_X550EM_A_SFP      0x15CE
 
 /* VF Device IDs */
 #define IXGBE_DEV_ID_X550_VF_HV        0x1564
@@ -2000,6 +2001,9 @@ enum {
 #define IXGBE_PBANUM_PTR_GUARD         0xFAFA
 #define IXGBE_EEPROM_CHECKSUM          0x3F
 #define IXGBE_EEPROM_SUM               0xBABA
+#define IXGBE_EEPROM_CTRL_4            0x45
+#define IXGBE_EE_CTRL_4_INST_ID                0x10
+#define IXGBE_EE_CTRL_4_INST_ID_SHIFT  4
 #define IXGBE_PCIE_ANALOG_PTR          0x03
 #define IXGBE_ATLAS0_CONFIG_PTR                0x04
 #define IXGBE_PHY_PTR                  0x04
@@ -3175,6 +3179,7 @@ struct ixgbe_bus_info {
 
        u8 func;
        u8 lan_id;
+       u8 instance_id;
 };
 
 /* Flow control parameters */