The i210 has two EEPROM access registers that are located in
non-standard offsets: EEARBC and EEMNGCTL. EEARBC was fixed previously
and EEMNGCTL should also be corrected.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu at intel.com>
---
 drivers/net/e1000/base/e1000_i210.c | 30 ++++++++++++++++++++++++++++++
 drivers/net/e1000/base/e1000_regs.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/e1000/base/e1000_i210.c 
b/drivers/net/e1000/base/e1000_i210.c
index fedf88e..277331c 100644
--- a/drivers/net/e1000/base/e1000_i210.c
+++ b/drivers/net/e1000/base/e1000_i210.c
@@ -982,6 +982,35 @@ STATIC s32 e1000_pll_workaround_i210(struct e1000_hw *hw)
 }

 /**
+ *  e1000_get_cfg_done_i210 - Read config done bit
+ *  @hw: pointer to the HW structure
+ *
+ *  Read the management control register for the config done bit for
+ *  completion status.  NOTE: silicon which is EEPROM-less will fail trying
+ *  to read the config done bit, so an error is *ONLY* logged and returns
+ *  E1000_SUCCESS.  If we were to return with error, EEPROM-less silicon
+ *  would not be able to be reset or change link.
+ **/
+STATIC s32 e1000_get_cfg_done_i210(struct e1000_hw *hw)
+{
+       s32 timeout = PHY_CFG_TIMEOUT;
+       u32 mask = E1000_NVM_CFG_DONE_PORT_0;
+
+       DEBUGFUNC("e1000_get_cfg_done_i210");
+
+       while (timeout) {
+               if (E1000_READ_REG(hw, E1000_EEMNGCTL_I210) & mask)
+                       break;
+               msec_delay(1);
+               timeout--;
+       }
+       if (!timeout)
+               DEBUGOUT("MNG configuration cycle has not completed.\n");
+
+       return E1000_SUCCESS;
+}
+
+/**
  *  e1000_init_hw_i210 - Init hw for I210/I211
  *  @hw: pointer to the HW structure
  *
@@ -998,6 +1027,7 @@ s32 e1000_init_hw_i210(struct e1000_hw *hw)
                if (ret_val != E1000_SUCCESS)
                        return ret_val;
        }
+       hw->phy.ops.get_cfg_done = e1000_get_cfg_done_i210;
        ret_val = e1000_init_hw_82575(hw);
        return ret_val;
 }
diff --git a/drivers/net/e1000/base/e1000_regs.h 
b/drivers/net/e1000/base/e1000_regs.h
index e23e1e8..84531a9 100644
--- a/drivers/net/e1000/base/e1000_regs.h
+++ b/drivers/net/e1000/base/e1000_regs.h
@@ -110,6 +110,7 @@ POSSIBILITY OF SUCH DAMAGE.
 #define E1000_PBS      0x01008  /* Packet Buffer Size */
 #define E1000_PBECCSTS 0x0100C  /* Packet Buffer ECC Status - RW */
 #define E1000_EEMNGCTL 0x01010  /* MNG EEprom Control */
+#define E1000_EEMNGCTL_I210    0x01010  /* i210 MNG EEprom Mode Control */
 #define E1000_EEARBC   0x01024  /* EEPROM Auto Read Bus Control */
 #define E1000_EEARBC_I210      0x12024 /* EEPROM Auto Read Bus Control */
 #define E1000_FLASHT   0x01028  /* FLASH Timer Register */
-- 
1.9.3

Reply via email to