igb: Updates to read nvm function for i211 device
authorCarolyn Wyborny <carolyn.wyborny@intel.com>
Thu, 11 Oct 2012 02:15:45 +0000 (02:15 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 1 Dec 2012 10:41:39 +0000 (02:41 -0800)
The i211 has an integrated secure space to store configuration information that is
usually stored in an EEPROM or flash type device. This patch updates the
read functions to return values or appropriate error codes to prevent
unnecessary init failures on some configuration schemes.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igb/e1000_i210.c
drivers/net/ethernet/intel/igb/e1000_i210.h

index 41474298d365559b9c76d83dd6056a7872bfc91d..239650e5e54563a9697dfdec6bfcb6f9f34d0a4c 100644 (file)
@@ -350,16 +350,40 @@ s32 igb_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words,
                if (ret_val != E1000_SUCCESS)
                        hw_dbg("MAC Addr not found in iNVM\n");
                break;
-       case NVM_ID_LED_SETTINGS:
        case NVM_INIT_CTRL_2:
+               ret_val = igb_read_invm_i211(hw, (u8)offset, data);
+               if (ret_val != E1000_SUCCESS) {
+                       *data = NVM_INIT_CTRL_2_DEFAULT_I211;
+                       ret_val = E1000_SUCCESS;
+               }
+               break;
        case NVM_INIT_CTRL_4:
+               ret_val = igb_read_invm_i211(hw, (u8)offset, data);
+               if (ret_val != E1000_SUCCESS) {
+                       *data = NVM_INIT_CTRL_4_DEFAULT_I211;
+                       ret_val = E1000_SUCCESS;
+               }
+               break;
        case NVM_LED_1_CFG:
+               ret_val = igb_read_invm_i211(hw, (u8)offset, data);
+               if (ret_val != E1000_SUCCESS) {
+                       *data = NVM_LED_1_CFG_DEFAULT_I211;
+                       ret_val = E1000_SUCCESS;
+               }
+               break;
        case NVM_LED_0_2_CFG:
                igb_read_invm_i211(hw, offset, data);
+               if (ret_val != E1000_SUCCESS) {
+                       *data = NVM_LED_0_2_CFG_DEFAULT_I211;
+                       ret_val = E1000_SUCCESS;
+               }
                break;
-       case NVM_COMPAT:
-               *data = ID_LED_DEFAULT_I210;
-               break;
+       case NVM_ID_LED_SETTINGS:
+               ret_val = igb_read_invm_i211(hw, (u8)offset, data);
+               if (ret_val != E1000_SUCCESS) {
+                       *data = ID_LED_RESERVED_FFFF;
+                       ret_val = E1000_SUCCESS;
+               }
        case NVM_SUB_DEV_ID:
                *data = hw->subsystem_device_id;
                break;
index 974d23584d70e06680c0dccd6c3cc533c6fc0050..1c89358a99ab84b384f4d6819dd550aa7cc2a34d 100644 (file)
@@ -84,4 +84,10 @@ enum E1000_INVM_STRUCTURE_TYPE {
                                         (ID_LED_DEF1_DEF2 <<  4) | \
                                         (ID_LED_DEF1_DEF2))
 
+/* NVM offset defaults for i211 device */
+#define NVM_INIT_CTRL_2_DEFAULT_I211   0X7243
+#define NVM_INIT_CTRL_4_DEFAULT_I211   0x00C1
+#define NVM_LED_1_CFG_DEFAULT_I211     0x0184
+#define NVM_LED_0_2_CFG_DEFAULT_I211   0x200C
+
 #endif