e1000e: workaround hw errata
[firefly-linux-kernel-4.4.55.git] / drivers / net / e1000e / 82571.c
index 11e72b64e87dfd3bb147dbe399ab3f6958f80396..0890162953e9045795ba7906d6332dd44ca02a5a 100644 (file)
@@ -332,8 +332,9 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
 
        case e1000_82573:
                if (pdev->device == E1000_DEV_ID_82573L) {
-                       e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1,
-                                      &eeprom_data);
+                       if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1,
+                                      &eeprom_data) < 0)
+                               break;
                        if (eeprom_data & NVM_WORD1A_ASPM_MASK)
                                adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES;
                }
@@ -980,11 +981,15 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
                ew32(PBA_ECC, reg);
        }
 
-       /* PCI-Ex Control Register */
+       /* PCI-Ex Control Registers */
        if (hw->mac.type == e1000_82574) {
                reg = er32(GCR);
                reg |= (1 << 22);
                ew32(GCR, reg);
+
+               reg = er32(GCR2);
+               reg |= 1;
+               ew32(GCR2, reg);
        }
 
        return;
@@ -1118,8 +1123,8 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
         * set it to full.
         */
        if ((hw->mac.type == e1000_82573 || hw->mac.type == e1000_82574) &&
-           hw->fc.type == e1000_fc_default)
-               hw->fc.type = e1000_fc_full;
+           hw->fc.requested_mode == e1000_fc_default)
+               hw->fc.requested_mode = e1000_fc_full;
 
        return e1000e_setup_link(hw);
 }