Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[safe/jmp/linux-2.6] / drivers / net / e1000e / 82571.c
index 227f3d0..f654db9 100644 (file)
@@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
        mac->mta_reg_count = 128;
        /* Set rar entry count */
        mac->rar_entry_count = E1000_RAR_ENTRIES;
-       /* Set if manageability features are enabled. */
-       mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
-                       ? true : false;
+       /* Adaptive IFS supported */
+       mac->adaptive_ifs = true;
 
        /* check for link */
        switch (hw->phy.media_type) {
@@ -265,14 +264,33 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
        }
 
        switch (hw->mac.type) {
+       case e1000_82573:
+               func->set_lan_id = e1000_set_lan_id_single_port;
+               func->check_mng_mode = e1000e_check_mng_mode_generic;
+               func->led_on = e1000e_led_on_generic;
+
+               /* FWSM register */
+               mac->has_fwsm = true;
+               /*
+                * ARC supported; valid only if manageability features are
+                * enabled.
+                */
+               mac->arc_subsystem_valid =
+                       (er32(FWSM) & E1000_FWSM_MODE_MASK)
+                       ? true : false;
+               break;
        case e1000_82574:
        case e1000_82583:
+               func->set_lan_id = e1000_set_lan_id_single_port;
                func->check_mng_mode = e1000_check_mng_mode_82574;
                func->led_on = e1000_led_on_82574;
                break;
        default:
                func->check_mng_mode = e1000e_check_mng_mode_generic;
                func->led_on = e1000e_led_on_generic;
+
+               /* FWSM register */
+               mac->has_fwsm = true;
                break;
        }
 
@@ -315,7 +333,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
        }
 
        /*
-        * Initialze device specific counter of SMBI acquisition
+        * Initialize device specific counter of SMBI acquisition
         * timeouts.
         */
         hw->dev_spec.e82571.smb_counter = 0;
@@ -328,7 +346,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
        struct e1000_hw *hw = &adapter->hw;
        static int global_quad_port_a; /* global port a indication */
        struct pci_dev *pdev = adapter->pdev;
-       u16 eeprom_data = 0;
        int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1;
        s32 rc;
 
@@ -379,16 +396,15 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
                if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD)
                        adapter->flags &= ~FLAG_HAS_WOL;
                break;
-
        case e1000_82573:
+       case e1000_82574:
+       case e1000_82583:
+               /* Disable ASPM L0s due to hardware errata */
+               e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S);
+
                if (pdev->device == E1000_DEV_ID_82573L) {
-                       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;
-                               adapter->max_hw_frame_size = DEFAULT_JUMBO;
-                       }
+                       adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
+                       adapter->max_hw_frame_size = DEFAULT_JUMBO;
                }
                break;
        default:
@@ -920,9 +936,12 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
        ew32(IMC, 0xffffffff);
        icr = er32(ICR);
 
-       if (hw->mac.type == e1000_82571 &&
-               hw->dev_spec.e82571.alt_mac_addr_is_present)
-                       e1000e_set_laa_state_82571(hw, true);
+       /* Install any alternate MAC address into RAR0 */
+       ret_val = e1000_check_alt_mac_addr_generic(hw);
+       if (ret_val)
+               return ret_val;
+
+       e1000e_set_laa_state_82571(hw, true);
 
        /* Reinitialize the 82571 serdes link state machine */
        if (hw->phy.media_type == e1000_media_type_internal_serdes)
@@ -984,9 +1003,10 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
        /* ...for both queues. */
        switch (mac->type) {
        case e1000_82573:
+               e1000e_enable_tx_pkt_filtering(hw);
+               /* fall through */
        case e1000_82574:
        case e1000_82583:
-               e1000e_enable_tx_pkt_filtering(hw);
                reg_data = er32(GCR);
                reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
                ew32(GCR, reg_data);
@@ -1128,8 +1148,6 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
        default:
                break;
        }
-
-       return;
 }
 
 /**
@@ -1223,32 +1241,6 @@ static s32 e1000_led_on_82574(struct e1000_hw *hw)
 }
 
 /**
- *  e1000_update_mc_addr_list_82571 - Update Multicast addresses
- *  @hw: pointer to the HW structure
- *  @mc_addr_list: array of multicast addresses to program
- *  @mc_addr_count: number of multicast addresses to program
- *  @rar_used_count: the first RAR register free to program
- *  @rar_count: total number of supported Receive Address Registers
- *
- *  Updates the Receive Address Registers and Multicast Table Array.
- *  The caller must have a packed mc_addr_list of multicast addresses.
- *  The parameter rar_count will usually be hw->mac.rar_entry_count
- *  unless there are workarounds that change this.
- **/
-static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw,
-                                           u8 *mc_addr_list,
-                                           u32 mc_addr_count,
-                                           u32 rar_used_count,
-                                           u32 rar_count)
-{
-       if (e1000e_get_laa_state_82571(hw))
-               rar_count--;
-
-       e1000e_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count,
-                                          rar_used_count, rar_count);
-}
-
-/**
  *  e1000_setup_link_82571 - Setup flow control and link settings
  *  @hw: pointer to the HW structure
  *
@@ -1290,7 +1282,6 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
 static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
 {
        u32 ctrl;
-       u32 led_ctrl;
        s32 ret_val;
 
        ctrl = er32(CTRL);
@@ -1305,11 +1296,6 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
                break;
        case e1000_phy_igp_2:
                ret_val = e1000e_copper_link_setup_igp(hw);
-               /* Setup activity LED */
-               led_ctrl = er32(LEDCTL);
-               led_ctrl &= IGP_ACTIVITY_LED_MASK;
-               led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
-               ew32(LEDCTL, led_ctrl);
                break;
        default:
                return -E1000_ERR_PHY;
@@ -1367,7 +1353,7 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
  *
  *  1) down
  *  2) autoneg_progress
- *  3) autoneg_complete (the link sucessfully autonegotiated)
+ *  3) autoneg_complete (the link successfully autonegotiated)
  *  4) forced_up (the link has been forced up, it did not autonegotiate)
  *
  **/
@@ -1551,7 +1537,7 @@ bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
  *  @hw: pointer to the HW structure
  *  @state: enable/disable locally administered address
  *
- *  Enable/Disable the current locally administers address state.
+ *  Enable/Disable the current locally administered address state.
  **/
 void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
 {
@@ -1625,6 +1611,29 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
 }
 
 /**
+ *  e1000_read_mac_addr_82571 - Read device MAC address
+ *  @hw: pointer to the HW structure
+ **/
+static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw)
+{
+       s32 ret_val = 0;
+
+       /*
+        * If there's an alternate MAC address place it in RAR0
+        * so that it will override the Si installed default perm
+        * address.
+        */
+       ret_val = e1000_check_alt_mac_addr_generic(hw);
+       if (ret_val)
+               goto out;
+
+       ret_val = e1000_read_mac_addr_generic(hw);
+
+out:
+       return ret_val;
+}
+
+/**
  * e1000_power_down_phy_copper_82571 - Remove link during PHY power down
  * @hw: pointer to the HW structure
  *
@@ -1642,8 +1651,6 @@ static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw)
        /* If the management interface is not enabled, then power down */
        if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw)))
                e1000_power_down_phy_copper(hw);
-
-       return;
 }
 
 /**
@@ -1699,10 +1706,11 @@ static struct e1000_mac_operations e82571_mac_ops = {
        .cleanup_led            = e1000e_cleanup_led_generic,
        .clear_hw_cntrs         = e1000_clear_hw_cntrs_82571,
        .get_bus_info           = e1000e_get_bus_info_pcie,
+       .set_lan_id             = e1000_set_lan_id_multi_port_pcie,
        /* .get_link_up_info: media type dependent */
        /* .led_on: mac type dependent */
        .led_off                = e1000e_led_off_generic,
-       .update_mc_addr_list    = e1000_update_mc_addr_list_82571,
+       .update_mc_addr_list    = e1000e_update_mc_addr_list_generic,
        .write_vfta             = e1000_write_vfta_generic,
        .clear_vfta             = e1000_clear_vfta_82571,
        .reset_hw               = e1000_reset_hw_82571,
@@ -1710,10 +1718,12 @@ static struct e1000_mac_operations e82571_mac_ops = {
        .setup_link             = e1000_setup_link_82571,
        /* .setup_physical_interface: media type dependent */
        .setup_led              = e1000e_setup_led_generic,
+       .read_mac_addr          = e1000_read_mac_addr_82571,
 };
 
 static struct e1000_phy_operations e82_phy_ops_igp = {
        .acquire                = e1000_get_hw_semaphore_82571,
+       .check_polarity         = e1000_check_polarity_igp,
        .check_reset_block      = e1000e_check_reset_block_generic,
        .commit                 = NULL,
        .force_speed_duplex     = e1000e_phy_force_speed_duplex_igp,
@@ -1731,6 +1741,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = {
 
 static struct e1000_phy_operations e82_phy_ops_m88 = {
        .acquire                = e1000_get_hw_semaphore_82571,
+       .check_polarity         = e1000_check_polarity_m88,
        .check_reset_block      = e1000e_check_reset_block_generic,
        .commit                 = e1000e_phy_sw_reset,
        .force_speed_duplex     = e1000e_phy_force_speed_duplex_m88,
@@ -1748,6 +1759,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = {
 
 static struct e1000_phy_operations e82_phy_ops_bm = {
        .acquire                = e1000_get_hw_semaphore_82571,
+       .check_polarity         = e1000_check_polarity_m88,
        .check_reset_block      = e1000e_check_reset_block_generic,
        .commit                 = e1000e_phy_sw_reset,
        .force_speed_duplex     = e1000e_phy_force_speed_duplex_m88,
@@ -1785,6 +1797,7 @@ struct e1000_info e1000_82571_info = {
                                  | FLAG_RESET_OVERWRITES_LAA /* errata */
                                  | FLAG_TARC_SPEED_MODE_BIT /* errata */
                                  | FLAG_APME_CHECK_PORT_B,
+       .flags2                 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */
        .pba                    = 38,
        .max_hw_frame_size      = DEFAULT_JUMBO,
        .get_variants           = e1000_get_variants_82571,
@@ -1802,6 +1815,7 @@ struct e1000_info e1000_82572_info = {
                                  | FLAG_RX_CSUM_ENABLED
                                  | FLAG_HAS_CTRLEXT_ON_LOAD
                                  | FLAG_TARC_SPEED_MODE_BIT, /* errata */
+       .flags2                 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */
        .pba                    = 38,
        .max_hw_frame_size      = DEFAULT_JUMBO,
        .get_variants           = e1000_get_variants_82571,
@@ -1813,13 +1827,11 @@ struct e1000_info e1000_82572_info = {
 struct e1000_info e1000_82573_info = {
        .mac                    = e1000_82573,
        .flags                  = FLAG_HAS_HW_VLAN_FILTER
-                                 | FLAG_HAS_JUMBO_FRAMES
                                  | FLAG_HAS_WOL
                                  | FLAG_APME_IN_CTRL3
                                  | FLAG_RX_CSUM_ENABLED
                                  | FLAG_HAS_SMART_POWER_DOWN
                                  | FLAG_HAS_AMT
-                                 | FLAG_HAS_ERT
                                  | FLAG_HAS_SWSM_ON_LOAD,
        .pba                    = 20,
        .max_hw_frame_size      = ETH_FRAME_LEN + ETH_FCS_LEN,
@@ -1840,7 +1852,7 @@ struct e1000_info e1000_82574_info = {
                                  | FLAG_HAS_SMART_POWER_DOWN
                                  | FLAG_HAS_AMT
                                  | FLAG_HAS_CTRLEXT_ON_LOAD,
-       .pba                    = 20,
+       .pba                    = 36,
        .max_hw_frame_size      = DEFAULT_JUMBO,
        .get_variants           = e1000_get_variants_82571,
        .mac_ops                = &e82571_mac_ops,
@@ -1857,7 +1869,7 @@ struct e1000_info e1000_82583_info = {
                                  | FLAG_HAS_SMART_POWER_DOWN
                                  | FLAG_HAS_AMT
                                  | FLAG_HAS_CTRLEXT_ON_LOAD,
-       .pba                    = 20,
+       .pba                    = 36,
        .max_hw_frame_size      = ETH_FRAME_LEN + ETH_FCS_LEN,
        .get_variants           = e1000_get_variants_82571,
        .mac_ops                = &e82571_mac_ops,