devices/e1000e/82571-2.6.37-orig.c
author Florian Pose <fp@igh-essen.com>
Fri, 16 Dec 2011 16:29:00 +0100
branchredundancy
changeset 2305 668bdb89879b
parent 2135 f99b2249704c
permissions -rw-r--r--
Removed unnecessary call of ec_master_inject_external_datagrams().
2135
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*******************************************************************************
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
  Intel PRO/1000 Linux driver
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
  Copyright(c) 1999 - 2010 Intel Corporation.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
  This program is free software; you can redistribute it and/or modify it
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
  under the terms and conditions of the GNU General Public License,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
  version 2, as published by the Free Software Foundation.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
  This program is distributed in the hope it will be useful, but WITHOUT
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
  more details.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
  You should have received a copy of the GNU General Public License along with
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
  this program; if not, write to the Free Software Foundation, Inc.,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
  The full GNU General Public License is included in this distribution in
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
  the file called "COPYING".
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
  Contact Information:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
  Linux NICS <linux.nics@intel.com>
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
*******************************************************************************/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 * 82571EB Gigabit Ethernet Controller
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 * 82571EB Gigabit Ethernet Controller (Copper)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 * 82571EB Gigabit Ethernet Controller (Fiber)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
 * 82571EB Dual Port Gigabit Mezzanine Adapter
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
 * 82571EB Quad Port Gigabit Mezzanine Adapter
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
 * 82571PT Gigabit PT Quad Port Server ExpressModule
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
 * 82572EI Gigabit Ethernet Controller (Copper)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
 * 82572EI Gigabit Ethernet Controller (Fiber)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
 * 82572EI Gigabit Ethernet Controller
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
 * 82573V Gigabit Ethernet Controller (Copper)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
 * 82573E Gigabit Ethernet Controller (Copper)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
 * 82573L Gigabit Ethernet Controller
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
 * 82574L Gigabit Network Connection
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
 * 82583V Gigabit Network Connection
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
#include "e1000.h"
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
#define ID_LED_RESERVED_F746 0xF746
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
#define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
			      (ID_LED_OFF1_ON2  <<  8) | \
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
			      (ID_LED_DEF1_DEF2 <<  4) | \
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
			      (ID_LED_DEF1_DEF2))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
#define E1000_BASE1000T_STATUS          10
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
#define E1000_IDLE_ERROR_COUNT_MASK     0xFF
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
#define E1000_RECEIVE_ERROR_COUNTER     21
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
#define E1000_RECEIVE_ERROR_MAX         0xFFFF
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
				      u16 words, u16 *data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
static s32 e1000_setup_link_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
static void e1000_clear_vfta_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
static s32 e1000_led_on_82574(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
 *  e1000_init_phy_params_82571 - Init PHY func ptrs.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
	struct e1000_phy_info *phy = &hw->phy;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
	if (hw->phy.media_type != e1000_media_type_copper) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
		phy->type = e1000_phy_none;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
		return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
	phy->addr			 = 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
	phy->autoneg_mask		 = AUTONEG_ADVERTISE_SPEED_DEFAULT;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
	phy->reset_delay_us		 = 100;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
	phy->ops.power_up		 = e1000_power_up_phy_copper;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
	phy->ops.power_down		 = e1000_power_down_phy_copper_82571;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
		phy->type		 = e1000_phy_igp_2;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
		phy->type		 = e1000_phy_m88;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
		phy->type		 = e1000_phy_bm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
		return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
	/* This can only be done after all function pointers are setup. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
	ret_val = e1000_get_phy_id_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
	/* Verify phy id */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
		if (phy->id != IGP01E1000_I_PHY_ID)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
			return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
		if (phy->id != M88E1111_I_PHY_ID)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
			return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
		if (phy->id != BME1000_E_PHY_ID_R2)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
			return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
		return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
 *  e1000_init_nvm_params_82571 - Init NVM func ptrs.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
	struct e1000_nvm_info *nvm = &hw->nvm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
	u32 eecd = er32(EECD);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
	u16 size;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
	nvm->opcode_bits = 8;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
	nvm->delay_usec = 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
	switch (nvm->override) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
	case e1000_nvm_override_spi_large:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
		nvm->page_size = 32;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
		nvm->address_bits = 16;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
	case e1000_nvm_override_spi_small:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
		nvm->page_size = 8;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
		nvm->address_bits = 8;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
		nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
		nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
		if (((eecd >> 15) & 0x3) == 0x3) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
			nvm->type = e1000_nvm_flash_hw;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
			nvm->word_size = 2048;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
			/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
			 * Autonomous Flash update bit must be cleared due
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
			 * to Flash update issue.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
			eecd &= ~E1000_EECD_AUPDEN;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
			ew32(EECD, eecd);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
		/* Fall Through */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
		nvm->type = e1000_nvm_eeprom_spi;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
		size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
				  E1000_EECD_SIZE_EX_SHIFT);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
		 * Added to a constant, "size" becomes the left-shift value
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
		 * for setting word_size.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
		size += NVM_WORD_SIZE_BASE_SHIFT;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
		/* EEPROM access above 16k is unsupported */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
		if (size > 14)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
			size = 14;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
		nvm->word_size	= 1 << size;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
 *  e1000_init_mac_params_82571 - Init MAC func ptrs.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
	struct e1000_hw *hw = &adapter->hw;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
	struct e1000_mac_info *mac = &hw->mac;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
	struct e1000_mac_operations *func = &mac->ops;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
	u32 swsm = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
	u32 swsm2 = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
	bool force_clear_smbi = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
	/* Set media type */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
	switch (adapter->pdev->device) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
	case E1000_DEV_ID_82571EB_FIBER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
	case E1000_DEV_ID_82572EI_FIBER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
	case E1000_DEV_ID_82571EB_QUAD_FIBER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
		hw->phy.media_type = e1000_media_type_fiber;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
	case E1000_DEV_ID_82571EB_SERDES:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
	case E1000_DEV_ID_82572EI_SERDES:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
	case E1000_DEV_ID_82571EB_SERDES_DUAL:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
	case E1000_DEV_ID_82571EB_SERDES_QUAD:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
		hw->phy.media_type = e1000_media_type_internal_serdes;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
		hw->phy.media_type = e1000_media_type_copper;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
	/* Set mta register count */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
	mac->mta_reg_count = 128;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
	/* Set rar entry count */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   240
	mac->rar_entry_count = E1000_RAR_ENTRIES;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
	/* Adaptive IFS supported */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
	mac->adaptive_ifs = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
	/* check for link */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
	switch (hw->phy.media_type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
	case e1000_media_type_copper:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
		func->setup_physical_interface = e1000_setup_copper_link_82571;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
		func->check_for_link = e1000e_check_for_copper_link;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
		func->get_link_up_info = e1000e_get_speed_and_duplex_copper;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
	case e1000_media_type_fiber:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
		func->setup_physical_interface =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
			e1000_setup_fiber_serdes_link_82571;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
		func->check_for_link = e1000e_check_for_fiber_link;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
		func->get_link_up_info =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
			e1000e_get_speed_and_duplex_fiber_serdes;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
	case e1000_media_type_internal_serdes:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
		func->setup_physical_interface =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
			e1000_setup_fiber_serdes_link_82571;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
		func->check_for_link = e1000_check_for_serdes_link_82571;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
		func->get_link_up_info =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
			e1000e_get_speed_and_duplex_fiber_serdes;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
		return -E1000_ERR_CONFIG;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
		func->set_lan_id = e1000_set_lan_id_single_port;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
		func->check_mng_mode = e1000e_check_mng_mode_generic;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
		func->led_on = e1000e_led_on_generic;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
		/* FWSM register */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
		mac->has_fwsm = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
		 * ARC supported; valid only if manageability features are
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
		 * enabled.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
		mac->arc_subsystem_valid =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
			(er32(FWSM) & E1000_FWSM_MODE_MASK)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
			? true : false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
		func->set_lan_id = e1000_set_lan_id_single_port;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
		func->check_mng_mode = e1000_check_mng_mode_82574;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
		func->led_on = e1000_led_on_82574;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
		func->check_mng_mode = e1000e_check_mng_mode_generic;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
		func->led_on = e1000e_led_on_generic;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   295
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
		/* FWSM register */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
		mac->has_fwsm = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
	 * Ensure that the inter-port SWSM.SMBI lock bit is clear before
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
	 * first NVM or PHY acess. This should be done for single-port
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
	 * devices, and for one port only on dual-port devices so that
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
	 * for those devices we can still use the SMBI lock to synchronize
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
	 * inter-port accesses to the PHY & NVM.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   310
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   311
		swsm2 = er32(SWSM2);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   312
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   313
		if (!(swsm2 & E1000_SWSM2_LOCK)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   314
			/* Only do this for the first interface on this card */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   315
			ew32(SWSM2,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
			    swsm2 | E1000_SWSM2_LOCK);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
			force_clear_smbi = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
		} else
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   319
			force_clear_smbi = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   320
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
		force_clear_smbi = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   326
	if (force_clear_smbi) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
		/* Make sure SWSM.SMBI is clear */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
		swsm = er32(SWSM);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
		if (swsm & E1000_SWSM_SMBI) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
			/* This bit should not be set on a first interface, and
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
			 * indicates that the bootagent or EFI code has
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
			 * improperly left this bit enabled
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
			e_dbg("Please update your 82571 Bootagent\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
		ew32(SWSM, swsm & ~E1000_SWSM_SMBI);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   339
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
	 * Initialize device specific counter of SMBI acquisition
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   341
	 * timeouts.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   342
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   343
	 hw->dev_spec.e82571.smb_counter = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   344
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   345
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   346
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   347
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   348
static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   349
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   350
	struct e1000_hw *hw = &adapter->hw;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   351
	static int global_quad_port_a; /* global port a indication */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   352
	struct pci_dev *pdev = adapter->pdev;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   353
	int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   354
	s32 rc;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   355
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   356
	rc = e1000_init_mac_params_82571(adapter);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   357
	if (rc)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   358
		return rc;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   359
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
	rc = e1000_init_nvm_params_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   361
	if (rc)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   362
		return rc;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   363
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
	rc = e1000_init_phy_params_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
	if (rc)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
		return rc;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
	/* tag quad port adapters first, it's used below */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
	switch (pdev->device) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
	case E1000_DEV_ID_82571EB_QUAD_COPPER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
	case E1000_DEV_ID_82571EB_QUAD_FIBER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
	case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
	case E1000_DEV_ID_82571PT_QUAD_COPPER:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
		adapter->flags |= FLAG_IS_QUAD_PORT;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
		/* mark the first port */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
		if (global_quad_port_a == 0)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
			adapter->flags |= FLAG_IS_QUAD_PORT_A;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
		/* Reset for multiple quad port adapters */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
		global_quad_port_a++;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
		if (global_quad_port_a == 4)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
			global_quad_port_a = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
	switch (adapter->hw.mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
		/* these dual ports don't have WoL on port B at all */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
		if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) ||
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
		     (pdev->device == E1000_DEV_ID_82571EB_SERDES) ||
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
		     (pdev->device == E1000_DEV_ID_82571EB_COPPER)) &&
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
		    (is_port_b))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
			adapter->flags &= ~FLAG_HAS_WOL;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
		/* quad ports only support WoL on port A */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
		if (adapter->flags & FLAG_IS_QUAD_PORT &&
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
		    (!(adapter->flags & FLAG_IS_QUAD_PORT_A)))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
			adapter->flags &= ~FLAG_HAS_WOL;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
		/* Does not support WoL on any port */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
		if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
			adapter->flags &= ~FLAG_HAS_WOL;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   404
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
		/* Disable ASPM L0s due to hardware errata */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   407
		e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   408
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   409
		if (pdev->device == E1000_DEV_ID_82573L) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   410
			adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   411
			adapter->max_hw_frame_size = DEFAULT_JUMBO;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   412
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   414
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   415
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
 *  e1000_get_phy_id_82571 - Retrieve the PHY ID and revision
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   423
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   425
 *  Reads the PHY registers and stores the PHY ID and possibly the PHY
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   426
 *  revision in the hardware structure.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   427
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   428
static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   429
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   430
	struct e1000_phy_info *phy = &hw->phy;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   431
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   432
	u16 phy_id = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   433
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   434
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   435
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   436
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   437
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   438
		 * The 82571 firmware may still be configuring the PHY.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   439
		 * In this case, we cannot access the PHY until the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   440
		 * configuration is done.  So we explicitly set the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   441
		 * PHY ID.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   442
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   443
		phy->id = IGP01E1000_I_PHY_ID;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   444
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   445
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   446
		return e1000e_get_phy_id(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   447
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   448
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   449
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   450
		ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   451
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   452
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   453
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   454
		phy->id = (u32)(phy_id << 16);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   455
		udelay(20);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   456
		ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   457
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   458
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   459
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   460
		phy->id |= (u32)(phy_id);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   461
		phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   462
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   463
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   464
		return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   465
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   466
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   467
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   468
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   469
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   470
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   471
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   472
 *  e1000_get_hw_semaphore_82571 - Acquire hardware semaphore
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   473
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   474
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   475
 *  Acquire the HW semaphore to access the PHY or NVM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   476
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   477
static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   478
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   479
	u32 swsm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   480
	s32 sw_timeout = hw->nvm.word_size + 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   481
	s32 fw_timeout = hw->nvm.word_size + 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   482
	s32 i = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   483
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   484
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   485
	 * If we have timedout 3 times on trying to acquire
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   486
	 * the inter-port SMBI semaphore, there is old code
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   487
	 * operating on the other port, and it is not
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   488
	 * releasing SMBI. Modify the number of times that
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   489
	 * we try for the semaphore to interwork with this
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   490
	 * older code.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   491
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   492
	if (hw->dev_spec.e82571.smb_counter > 2)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   493
		sw_timeout = 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   494
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   495
	/* Get the SW semaphore */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   496
	while (i < sw_timeout) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   497
		swsm = er32(SWSM);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   498
		if (!(swsm & E1000_SWSM_SMBI))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   499
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   500
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   501
		udelay(50);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   502
		i++;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   503
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   504
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   505
	if (i == sw_timeout) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   506
		e_dbg("Driver can't access device - SMBI bit is set.\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   507
		hw->dev_spec.e82571.smb_counter++;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   508
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   509
	/* Get the FW semaphore. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   510
	for (i = 0; i < fw_timeout; i++) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   511
		swsm = er32(SWSM);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   512
		ew32(SWSM, swsm | E1000_SWSM_SWESMBI);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   513
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   514
		/* Semaphore acquired if bit latched */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   515
		if (er32(SWSM) & E1000_SWSM_SWESMBI)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   516
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   517
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   518
		udelay(50);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   519
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   520
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   521
	if (i == fw_timeout) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   522
		/* Release semaphores */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   523
		e1000_put_hw_semaphore_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   524
		e_dbg("Driver can't access the NVM\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   525
		return -E1000_ERR_NVM;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   526
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   527
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   528
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   529
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   530
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   531
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   532
 *  e1000_put_hw_semaphore_82571 - Release hardware semaphore
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   533
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   534
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   535
 *  Release hardware semaphore used to access the PHY or NVM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   536
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   537
static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   538
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   539
	u32 swsm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   540
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   541
	swsm = er32(SWSM);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   542
	swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   543
	ew32(SWSM, swsm);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   544
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   545
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   546
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   547
 *  e1000_acquire_nvm_82571 - Request for access to the EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   548
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   549
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   550
 *  To gain access to the EEPROM, first we must obtain a hardware semaphore.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   551
 *  Then for non-82573 hardware, set the EEPROM access request bit and wait
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   552
 *  for EEPROM access grant bit.  If the access grant bit is not set, release
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   553
 *  hardware semaphore.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   554
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   555
static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   556
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   557
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   558
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   559
	ret_val = e1000_get_hw_semaphore_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   560
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   561
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   562
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   563
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   564
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   565
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   566
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   567
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   568
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   569
		ret_val = e1000e_acquire_nvm(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   570
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   571
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   572
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   573
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   574
		e1000_put_hw_semaphore_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   575
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   576
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   577
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   578
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   579
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   580
 *  e1000_release_nvm_82571 - Release exclusive access to EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   581
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   582
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   583
 *  Stop any current commands to the EEPROM and clear the EEPROM request bit.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   584
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   585
static void e1000_release_nvm_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   586
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   587
	e1000e_release_nvm(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   588
	e1000_put_hw_semaphore_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   589
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   590
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   591
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   592
 *  e1000_write_nvm_82571 - Write to EEPROM using appropriate interface
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   593
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   594
 *  @offset: offset within the EEPROM to be written to
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   595
 *  @words: number of words to write
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   596
 *  @data: 16 bit word(s) to be written to the EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   597
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   598
 *  For non-82573 silicon, write data to EEPROM at offset using SPI interface.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   599
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   600
 *  If e1000e_update_nvm_checksum is not called after this function, the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   601
 *  EEPROM will most likely contain an invalid checksum.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   602
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   603
static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   604
				 u16 *data)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   605
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   606
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   607
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   608
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   609
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   610
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   611
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   612
		ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   613
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   614
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   615
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   616
		ret_val = e1000e_write_nvm_spi(hw, offset, words, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   617
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   618
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   619
		ret_val = -E1000_ERR_NVM;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   620
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   621
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   622
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   623
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   624
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   625
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   626
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   627
 *  e1000_update_nvm_checksum_82571 - Update EEPROM checksum
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   628
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   629
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   630
 *  Updates the EEPROM checksum by reading/adding each word of the EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   631
 *  up to the checksum.  Then calculates the EEPROM checksum and writes the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   632
 *  value to the EEPROM.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   633
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   634
static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   635
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   636
	u32 eecd;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   637
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   638
	u16 i;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   639
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   640
	ret_val = e1000e_update_nvm_checksum_generic(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   641
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   642
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   643
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   644
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   645
	 * If our nvm is an EEPROM, then we're done
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   646
	 * otherwise, commit the checksum to the flash NVM.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   647
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   648
	if (hw->nvm.type != e1000_nvm_flash_hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   649
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   650
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   651
	/* Check for pending operations. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   652
	for (i = 0; i < E1000_FLASH_UPDATES; i++) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   653
		msleep(1);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   654
		if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   655
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   656
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   657
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   658
	if (i == E1000_FLASH_UPDATES)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   659
		return -E1000_ERR_NVM;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   660
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   661
	/* Reset the firmware if using STM opcode. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   662
	if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   663
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   664
		 * The enabling of and the actual reset must be done
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   665
		 * in two write cycles.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   666
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   667
		ew32(HICR, E1000_HICR_FW_RESET_ENABLE);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   668
		e1e_flush();
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   669
		ew32(HICR, E1000_HICR_FW_RESET);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   670
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   671
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   672
	/* Commit the write to flash */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   673
	eecd = er32(EECD) | E1000_EECD_FLUPD;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   674
	ew32(EECD, eecd);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   675
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   676
	for (i = 0; i < E1000_FLASH_UPDATES; i++) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   677
		msleep(1);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   678
		if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   679
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   680
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   681
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   682
	if (i == E1000_FLASH_UPDATES)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   683
		return -E1000_ERR_NVM;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   684
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   685
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   686
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   687
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   688
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   689
 *  e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   690
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   691
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   692
 *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   693
 *  and then verifies that the sum of the EEPROM is equal to 0xBABA.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   694
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   695
static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   696
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   697
	if (hw->nvm.type == e1000_nvm_flash_hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   698
		e1000_fix_nvm_checksum_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   699
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   700
	return e1000e_validate_nvm_checksum_generic(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   701
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   702
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   703
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   704
 *  e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   705
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   706
 *  @offset: offset within the EEPROM to be written to
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   707
 *  @words: number of words to write
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   708
 *  @data: 16 bit word(s) to be written to the EEPROM
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   709
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   710
 *  After checking for invalid values, poll the EEPROM to ensure the previous
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   711
 *  command has completed before trying to write the next word.  After write
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   712
 *  poll for completion.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   713
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   714
 *  If e1000e_update_nvm_checksum is not called after this function, the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   715
 *  EEPROM will most likely contain an invalid checksum.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   716
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   717
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   718
				      u16 words, u16 *data)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   719
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   720
	struct e1000_nvm_info *nvm = &hw->nvm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   721
	u32 i, eewr = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   722
	s32 ret_val = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   723
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   724
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   725
	 * A check for invalid values:  offset too large, too many words,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   726
	 * and not enough words.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   727
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   728
	if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   729
	    (words == 0)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   730
		e_dbg("nvm parameter(s) out of bounds\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   731
		return -E1000_ERR_NVM;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   732
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   733
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   734
	for (i = 0; i < words; i++) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   735
		eewr = (data[i] << E1000_NVM_RW_REG_DATA) |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   736
		       ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   737
		       E1000_NVM_RW_REG_START;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   738
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   739
		ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   740
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   741
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   742
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   743
		ew32(EEWR, eewr);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   744
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   745
		ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   746
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   747
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   748
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   749
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   750
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   751
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   752
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   753
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   754
 *  e1000_get_cfg_done_82571 - Poll for configuration done
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   755
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   756
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   757
 *  Reads the management control register for the config done bit to be set.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   758
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   759
static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   760
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   761
	s32 timeout = PHY_CFG_TIMEOUT;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   762
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   763
	while (timeout) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   764
		if (er32(EEMNGCTL) &
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   765
		    E1000_NVM_CFG_DONE_PORT_0)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   766
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   767
		msleep(1);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   768
		timeout--;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   769
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   770
	if (!timeout) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   771
		e_dbg("MNG configuration cycle has not completed.\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   772
		return -E1000_ERR_RESET;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   773
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   774
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   775
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   776
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   777
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   778
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   779
 *  e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   780
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   781
 *  @active: true to enable LPLU, false to disable
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   782
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   783
 *  Sets the LPLU D0 state according to the active flag.  When activating LPLU
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   784
 *  this function also disables smart speed and vice versa.  LPLU will not be
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   785
 *  activated unless the device autonegotiation advertisement meets standards
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   786
 *  of either 10 or 10/100 or 10/100/1000 at all duplexes.  This is a function
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   787
 *  pointer entry point only called by PHY setup routines.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   788
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   789
static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   790
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   791
	struct e1000_phy_info *phy = &hw->phy;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   792
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   793
	u16 data;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   794
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   795
	ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   796
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   797
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   798
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   799
	if (active) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   800
		data |= IGP02E1000_PM_D0_LPLU;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   801
		ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   802
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   803
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   804
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   805
		/* When LPLU is enabled, we should disable SmartSpeed */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   806
		ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   807
		data &= ~IGP01E1000_PSCFR_SMART_SPEED;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   808
		ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   809
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   810
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   811
	} else {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   812
		data &= ~IGP02E1000_PM_D0_LPLU;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   813
		ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   814
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   815
		 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   816
		 * during Dx states where the power conservation is most
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   817
		 * important.  During driver activity we should enable
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   818
		 * SmartSpeed, so performance is maintained.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   819
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   820
		if (phy->smart_speed == e1000_smart_speed_on) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   821
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   822
					   &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   823
			if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   824
				return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   825
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   826
			data |= IGP01E1000_PSCFR_SMART_SPEED;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   827
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   828
					   data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   829
			if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   830
				return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   831
		} else if (phy->smart_speed == e1000_smart_speed_off) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   832
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   833
					   &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   834
			if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   835
				return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   836
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   837
			data &= ~IGP01E1000_PSCFR_SMART_SPEED;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   838
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   839
					   data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   840
			if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   841
				return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   842
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   843
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   844
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   845
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   846
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   847
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   848
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   849
 *  e1000_reset_hw_82571 - Reset hardware
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   850
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   851
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   852
 *  This resets the hardware into a known state.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   853
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   854
static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   855
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   856
	u32 ctrl, extcnf_ctrl, ctrl_ext, icr;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   857
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   858
	u16 i = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   859
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   860
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   861
	 * Prevent the PCI-E bus from sticking if there is no TLP connection
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   862
	 * on the last TLP read/write transaction when MAC is reset.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   863
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   864
	ret_val = e1000e_disable_pcie_master(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   865
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   866
		e_dbg("PCI-E Master disable polling has failed.\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   867
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   868
	e_dbg("Masking off all interrupts\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   869
	ew32(IMC, 0xffffffff);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   870
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   871
	ew32(RCTL, 0);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   872
	ew32(TCTL, E1000_TCTL_PSP);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   873
	e1e_flush();
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   874
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   875
	msleep(10);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   876
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   877
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   878
	 * Must acquire the MDIO ownership before MAC reset.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   879
	 * Ownership defaults to firmware after a reset.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   880
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   881
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   882
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   883
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   884
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   885
		extcnf_ctrl = er32(EXTCNF_CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   886
		extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   887
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   888
		do {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   889
			ew32(EXTCNF_CTRL, extcnf_ctrl);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   890
			extcnf_ctrl = er32(EXTCNF_CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   891
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   892
			if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   893
				break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   894
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   895
			extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   896
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   897
			msleep(2);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   898
			i++;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   899
		} while (i < MDIO_OWNERSHIP_TIMEOUT);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   900
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   901
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   902
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   903
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   904
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   905
	ctrl = er32(CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   906
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   907
	e_dbg("Issuing a global reset to MAC\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   908
	ew32(CTRL, ctrl | E1000_CTRL_RST);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   909
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   910
	if (hw->nvm.type == e1000_nvm_flash_hw) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   911
		udelay(10);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   912
		ctrl_ext = er32(CTRL_EXT);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   913
		ctrl_ext |= E1000_CTRL_EXT_EE_RST;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   914
		ew32(CTRL_EXT, ctrl_ext);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   915
		e1e_flush();
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   916
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   917
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   918
	ret_val = e1000e_get_auto_rd_done(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   919
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   920
		/* We don't want to continue accessing MAC registers. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   921
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   922
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   923
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   924
	 * Phy configuration from NVM just starts after EECD_AUTO_RD is set.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   925
	 * Need to wait for Phy configuration completion before accessing
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   926
	 * NVM and Phy.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   927
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   928
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   929
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   930
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   931
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   932
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   933
		msleep(25);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   934
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   935
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   936
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   937
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   938
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   939
	/* Clear any pending interrupt events. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   940
	ew32(IMC, 0xffffffff);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   941
	icr = er32(ICR);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   942
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   943
	if (hw->mac.type == e1000_82571) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   944
		/* Install any alternate MAC address into RAR0 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   945
		ret_val = e1000_check_alt_mac_addr_generic(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   946
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   947
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   948
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   949
		e1000e_set_laa_state_82571(hw, true);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   950
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   951
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   952
	/* Reinitialize the 82571 serdes link state machine */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   953
	if (hw->phy.media_type == e1000_media_type_internal_serdes)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   954
		hw->mac.serdes_link_state = e1000_serdes_link_down;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   955
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   956
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   957
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   958
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   959
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   960
 *  e1000_init_hw_82571 - Initialize hardware
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   961
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   962
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   963
 *  This inits the hardware readying it for operation.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   964
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   965
static s32 e1000_init_hw_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   966
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   967
	struct e1000_mac_info *mac = &hw->mac;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   968
	u32 reg_data;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   969
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   970
	u16 i, rar_count = mac->rar_entry_count;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   971
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   972
	e1000_initialize_hw_bits_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   973
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   974
	/* Initialize identification LED */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   975
	ret_val = e1000e_id_led_init(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   976
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   977
		e_dbg("Error initializing identification LED\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   978
		/* This is not fatal and we should not stop init due to this */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   979
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   980
	/* Disabling VLAN filtering */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   981
	e_dbg("Initializing the IEEE VLAN\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   982
	mac->ops.clear_vfta(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   983
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   984
	/* Setup the receive address. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   985
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   986
	 * If, however, a locally administered address was assigned to the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   987
	 * 82571, we must reserve a RAR for it to work around an issue where
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   988
	 * resetting one port will reload the MAC on the other port.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   989
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   990
	if (e1000e_get_laa_state_82571(hw))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   991
		rar_count--;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   992
	e1000e_init_rx_addrs(hw, rar_count);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   993
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   994
	/* Zero out the Multicast HASH table */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   995
	e_dbg("Zeroing the MTA\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   996
	for (i = 0; i < mac->mta_reg_count; i++)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   997
		E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   998
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   999
	/* Setup link and flow control */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1000
	ret_val = e1000_setup_link_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1001
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1002
	/* Set the transmit descriptor write-back policy */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1003
	reg_data = er32(TXDCTL(0));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1004
	reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1005
		   E1000_TXDCTL_FULL_TX_DESC_WB |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1006
		   E1000_TXDCTL_COUNT_DESC;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1007
	ew32(TXDCTL(0), reg_data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1008
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1009
	/* ...for both queues. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1010
	switch (mac->type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1011
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1012
		e1000e_enable_tx_pkt_filtering(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1013
		/* fall through */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1014
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1015
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1016
		reg_data = er32(GCR);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1017
		reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1018
		ew32(GCR, reg_data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1019
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1020
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1021
		reg_data = er32(TXDCTL(1));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1022
		reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1023
			   E1000_TXDCTL_FULL_TX_DESC_WB |
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1024
			   E1000_TXDCTL_COUNT_DESC;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1025
		ew32(TXDCTL(1), reg_data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1026
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1027
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1028
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1029
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1030
	 * Clear all of the statistics registers (clear on read).  It is
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1031
	 * important that we do this after we have tried to establish link
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1032
	 * because the symbol error count will increment wildly if there
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1033
	 * is no link.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1034
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1035
	e1000_clear_hw_cntrs_82571(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1036
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1037
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1038
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1039
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1040
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1041
 *  e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1042
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1043
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1044
 *  Initializes required hardware-dependent bits needed for normal operation.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1045
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1046
static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1047
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1048
	u32 reg;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1049
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1050
	/* Transmit Descriptor Control 0 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1051
	reg = er32(TXDCTL(0));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1052
	reg |= (1 << 22);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1053
	ew32(TXDCTL(0), reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1054
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1055
	/* Transmit Descriptor Control 1 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1056
	reg = er32(TXDCTL(1));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1057
	reg |= (1 << 22);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1058
	ew32(TXDCTL(1), reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1059
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1060
	/* Transmit Arbitration Control 0 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1061
	reg = er32(TARC(0));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1062
	reg &= ~(0xF << 27); /* 30:27 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1063
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1064
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1065
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1066
		reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1067
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1068
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1069
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1070
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1071
	ew32(TARC(0), reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1072
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1073
	/* Transmit Arbitration Control 1 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1074
	reg = er32(TARC(1));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1075
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1076
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1077
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1078
		reg &= ~((1 << 29) | (1 << 30));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1079
		reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1080
		if (er32(TCTL) & E1000_TCTL_MULR)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1081
			reg &= ~(1 << 28);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1082
		else
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1083
			reg |= (1 << 28);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1084
		ew32(TARC(1), reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1085
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1086
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1087
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1088
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1089
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1090
	/* Device Control */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1091
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1092
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1093
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1094
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1095
		reg = er32(CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1096
		reg &= ~(1 << 29);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1097
		ew32(CTRL, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1098
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1099
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1100
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1101
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1102
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1103
	/* Extended Device Control */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1104
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1105
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1106
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1107
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1108
		reg = er32(CTRL_EXT);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1109
		reg &= ~(1 << 23);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1110
		reg |= (1 << 22);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1111
		ew32(CTRL_EXT, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1112
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1113
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1114
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1115
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1116
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1117
	if (hw->mac.type == e1000_82571) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1118
		reg = er32(PBA_ECC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1119
		reg |= E1000_PBA_ECC_CORR_EN;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1120
		ew32(PBA_ECC, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1121
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1122
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1123
	 * Workaround for hardware errata.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1124
	 * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1125
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1126
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1127
        if ((hw->mac.type == e1000_82571) ||
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1128
           (hw->mac.type == e1000_82572)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1129
                reg = er32(CTRL_EXT);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1130
                reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1131
                ew32(CTRL_EXT, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1132
        }
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1133
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1134
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1135
	/* PCI-Ex Control Registers */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1136
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1137
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1138
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1139
		reg = er32(GCR);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1140
		reg |= (1 << 22);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1141
		ew32(GCR, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1142
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1143
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1144
		 * Workaround for hardware errata.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1145
		 * apply workaround for hardware errata documented in errata
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1146
		 * docs Fixes issue where some error prone or unreliable PCIe
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1147
		 * completions are occurring, particularly with ASPM enabled.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1148
		 * Without fix, issue can cause tx timeouts.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1149
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1150
		reg = er32(GCR2);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1151
		reg |= 1;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1152
		ew32(GCR2, reg);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1153
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1154
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1155
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1156
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1157
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1158
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1159
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1160
 *  e1000_clear_vfta_82571 - Clear VLAN filter table
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1161
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1162
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1163
 *  Clears the register array which contains the VLAN filter table by
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1164
 *  setting all the values to 0.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1165
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1166
static void e1000_clear_vfta_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1167
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1168
	u32 offset;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1169
	u32 vfta_value = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1170
	u32 vfta_offset = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1171
	u32 vfta_bit_in_reg = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1172
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1173
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1174
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1175
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1176
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1177
		if (hw->mng_cookie.vlan_id != 0) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1178
			/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1179
			 * The VFTA is a 4096b bit-field, each identifying
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1180
			 * a single VLAN ID.  The following operations
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1181
			 * determine which 32b entry (i.e. offset) into the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1182
			 * array we want to set the VLAN ID (i.e. bit) of
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1183
			 * the manageability unit.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1184
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1185
			vfta_offset = (hw->mng_cookie.vlan_id >>
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1186
				       E1000_VFTA_ENTRY_SHIFT) &
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1187
				      E1000_VFTA_ENTRY_MASK;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1188
			vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id &
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1189
					       E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1190
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1191
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1192
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1193
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1194
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1195
	for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1196
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1197
		 * If the offset we want to clear is the same offset of the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1198
		 * manageability VLAN ID, then clear all bits except that of
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1199
		 * the manageability unit.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1200
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1201
		vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1202
		E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1203
		e1e_flush();
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1204
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1205
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1206
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1207
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1208
 *  e1000_check_mng_mode_82574 - Check manageability is enabled
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1209
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1210
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1211
 *  Reads the NVM Initialization Control Word 2 and returns true
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1212
 *  (>0) if any manageability is enabled, else false (0).
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1213
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1214
static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1215
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1216
	u16 data;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1217
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1218
	e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1219
	return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1220
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1221
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1222
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1223
 *  e1000_led_on_82574 - Turn LED on
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1224
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1225
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1226
 *  Turn LED on.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1227
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1228
static s32 e1000_led_on_82574(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1229
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1230
	u32 ctrl;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1231
	u32 i;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1232
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1233
	ctrl = hw->mac.ledctl_mode2;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1234
	if (!(E1000_STATUS_LU & er32(STATUS))) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1235
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1236
		 * If no link, then turn LED on by setting the invert bit
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1237
		 * for each LED that's "on" (0x0E) in ledctl_mode2.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1238
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1239
		for (i = 0; i < 4; i++)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1240
			if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1241
			    E1000_LEDCTL_MODE_LED_ON)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1242
				ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1243
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1244
	ew32(LEDCTL, ctrl);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1245
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1246
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1247
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1248
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1249
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1250
 *  e1000_check_phy_82574 - check 82574 phy hung state
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1251
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1252
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1253
 *  Returns whether phy is hung or not
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1254
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1255
bool e1000_check_phy_82574(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1256
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1257
	u16 status_1kbt = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1258
	u16 receive_errors = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1259
	bool phy_hung = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1260
	s32 ret_val = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1261
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1262
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1263
	 * Read PHY Receive Error counter first, if its is max - all F's then
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1264
	 * read the Base1000T status register If both are max then PHY is hung.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1265
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1266
	ret_val = e1e_rphy(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1267
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1268
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1269
		goto out;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1270
	if (receive_errors == E1000_RECEIVE_ERROR_MAX)  {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1271
		ret_val = e1e_rphy(hw, E1000_BASE1000T_STATUS, &status_1kbt);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1272
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1273
			goto out;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1274
		if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) ==
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1275
		    E1000_IDLE_ERROR_COUNT_MASK)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1276
			phy_hung = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1277
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1278
out:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1279
	return phy_hung;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1280
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1281
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1282
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1283
 *  e1000_setup_link_82571 - Setup flow control and link settings
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1284
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1285
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1286
 *  Determines which flow control settings to use, then configures flow
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1287
 *  control.  Calls the appropriate media-specific link configuration
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1288
 *  function.  Assuming the adapter has a valid link partner, a valid link
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1289
 *  should be established.  Assumes the hardware has previously been reset
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1290
 *  and the transmitter and receiver are not enabled.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1291
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1292
static s32 e1000_setup_link_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1293
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1294
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1295
	 * 82573 does not have a word in the NVM to determine
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1296
	 * the default flow control setting, so we explicitly
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1297
	 * set it to full.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1298
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1299
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1300
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1301
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1302
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1303
		if (hw->fc.requested_mode == e1000_fc_default)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1304
			hw->fc.requested_mode = e1000_fc_full;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1305
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1306
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1307
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1308
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1309
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1310
	return e1000e_setup_link(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1311
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1312
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1313
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1314
 *  e1000_setup_copper_link_82571 - Configure copper link settings
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1315
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1316
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1317
 *  Configures the link for auto-neg or forced speed and duplex.  Then we check
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1318
 *  for link, once link is established calls to configure collision distance
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1319
 *  and flow control are called.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1320
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1321
static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1322
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1323
	u32 ctrl;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1324
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1325
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1326
	ctrl = er32(CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1327
	ctrl |= E1000_CTRL_SLU;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1328
	ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1329
	ew32(CTRL, ctrl);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1330
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1331
	switch (hw->phy.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1332
	case e1000_phy_m88:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1333
	case e1000_phy_bm:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1334
		ret_val = e1000e_copper_link_setup_m88(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1335
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1336
	case e1000_phy_igp_2:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1337
		ret_val = e1000e_copper_link_setup_igp(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1338
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1339
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1340
		return -E1000_ERR_PHY;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1341
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1342
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1343
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1344
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1345
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1346
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1347
	ret_val = e1000e_setup_copper_link(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1348
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1349
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1350
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1351
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1352
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1353
 *  e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1354
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1355
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1356
 *  Configures collision distance and flow control for fiber and serdes links.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1357
 *  Upon successful setup, poll for link.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1358
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1359
static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1360
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1361
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1362
	case e1000_82571:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1363
	case e1000_82572:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1364
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1365
		 * If SerDes loopback mode is entered, there is no form
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1366
		 * of reset to take the adapter out of that mode.  So we
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1367
		 * have to explicitly take the adapter out of loopback
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1368
		 * mode.  This prevents drivers from twiddling their thumbs
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1369
		 * if another tool failed to take it out of loopback mode.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1370
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1371
		ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1372
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1373
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1374
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1375
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1376
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1377
	return e1000e_setup_fiber_serdes_link(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1378
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1379
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1380
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1381
 *  e1000_check_for_serdes_link_82571 - Check for link (Serdes)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1382
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1383
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1384
 *  Reports the link state as up or down.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1385
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1386
 *  If autonegotiation is supported by the link partner, the link state is
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1387
 *  determined by the result of autonegotiation. This is the most likely case.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1388
 *  If autonegotiation is not supported by the link partner, and the link
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1389
 *  has a valid signal, force the link up.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1390
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1391
 *  The link state is represented internally here by 4 states:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1392
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1393
 *  1) down
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1394
 *  2) autoneg_progress
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1395
 *  3) autoneg_complete (the link successfully autonegotiated)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1396
 *  4) forced_up (the link has been forced up, it did not autonegotiate)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1397
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1398
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1399
static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1400
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1401
	struct e1000_mac_info *mac = &hw->mac;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1402
	u32 rxcw;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1403
	u32 ctrl;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1404
	u32 status;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1405
	s32 ret_val = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1406
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1407
	ctrl = er32(CTRL);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1408
	status = er32(STATUS);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1409
	rxcw = er32(RXCW);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1410
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1411
	if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1412
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1413
		/* Receiver is synchronized with no invalid bits.  */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1414
		switch (mac->serdes_link_state) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1415
		case e1000_serdes_link_autoneg_complete:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1416
			if (!(status & E1000_STATUS_LU)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1417
				/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1418
				 * We have lost link, retry autoneg before
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1419
				 * reporting link failure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1420
				 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1421
				mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1422
				    e1000_serdes_link_autoneg_progress;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1423
				mac->serdes_has_link = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1424
				e_dbg("AN_UP     -> AN_PROG\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1425
			}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1426
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1427
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1428
		case e1000_serdes_link_forced_up:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1429
			/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1430
			 * If we are receiving /C/ ordered sets, re-enable
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1431
			 * auto-negotiation in the TXCW register and disable
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1432
			 * forced link in the Device Control register in an
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1433
			 * attempt to auto-negotiate with our link partner.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1434
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1435
			if (rxcw & E1000_RXCW_C) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1436
				/* Enable autoneg, and unforce link up */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1437
				ew32(TXCW, mac->txcw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1438
				ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1439
				mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1440
				    e1000_serdes_link_autoneg_progress;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1441
				mac->serdes_has_link = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1442
				e_dbg("FORCED_UP -> AN_PROG\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1443
			}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1444
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1445
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1446
		case e1000_serdes_link_autoneg_progress:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1447
			if (rxcw & E1000_RXCW_C) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1448
				/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1449
				 * We received /C/ ordered sets, meaning the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1450
				 * link partner has autonegotiated, and we can
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1451
				 * trust the Link Up (LU) status bit.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1452
				 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1453
				if (status & E1000_STATUS_LU) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1454
					mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1455
					    e1000_serdes_link_autoneg_complete;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1456
					e_dbg("AN_PROG   -> AN_UP\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1457
					mac->serdes_has_link = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1458
				} else {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1459
					/* Autoneg completed, but failed. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1460
					mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1461
					    e1000_serdes_link_down;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1462
					e_dbg("AN_PROG   -> DOWN\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1463
				}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1464
			} else {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1465
				/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1466
				 * The link partner did not autoneg.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1467
				 * Force link up and full duplex, and change
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1468
				 * state to forced.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1469
				 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1470
				ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1471
				ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1472
				ew32(CTRL, ctrl);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1473
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1474
				/* Configure Flow Control after link up. */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1475
				ret_val = e1000e_config_fc_after_link_up(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1476
				if (ret_val) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1477
					e_dbg("Error config flow control\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1478
					break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1479
				}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1480
				mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1481
				    e1000_serdes_link_forced_up;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1482
				mac->serdes_has_link = true;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1483
				e_dbg("AN_PROG   -> FORCED_UP\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1484
			}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1485
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1486
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1487
		case e1000_serdes_link_down:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1488
		default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1489
			/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1490
			 * The link was down but the receiver has now gained
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1491
			 * valid sync, so lets see if we can bring the link
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1492
			 * up.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1493
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1494
			ew32(TXCW, mac->txcw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1495
			ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1496
			mac->serdes_link_state =
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1497
			    e1000_serdes_link_autoneg_progress;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1498
			e_dbg("DOWN      -> AN_PROG\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1499
			break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1500
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1501
	} else {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1502
		if (!(rxcw & E1000_RXCW_SYNCH)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1503
			mac->serdes_has_link = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1504
			mac->serdes_link_state = e1000_serdes_link_down;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1505
			e_dbg("ANYSTATE  -> DOWN\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1506
		} else {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1507
			/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1508
			 * We have sync, and can tolerate one invalid (IV)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1509
			 * codeword before declaring link down, so reread
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1510
			 * to look again.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1511
			 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1512
			udelay(10);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1513
			rxcw = er32(RXCW);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1514
			if (rxcw & E1000_RXCW_IV) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1515
				mac->serdes_link_state = e1000_serdes_link_down;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1516
				mac->serdes_has_link = false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1517
				e_dbg("ANYSTATE  -> DOWN\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1518
			}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1519
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1520
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1521
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1522
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1523
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1524
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1525
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1526
 *  e1000_valid_led_default_82571 - Verify a valid default LED config
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1527
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1528
 *  @data: pointer to the NVM (EEPROM)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1529
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1530
 *  Read the EEPROM for the current default LED configuration.  If the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1531
 *  LED configuration is not valid, set to a valid LED configuration.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1532
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1533
static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1534
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1535
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1536
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1537
	ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1538
	if (ret_val) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1539
		e_dbg("NVM Read Error\n");
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1540
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1541
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1542
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1543
	switch (hw->mac.type) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1544
	case e1000_82573:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1545
	case e1000_82574:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1546
	case e1000_82583:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1547
		if (*data == ID_LED_RESERVED_F746)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1548
			*data = ID_LED_DEFAULT_82573;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1549
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1550
	default:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1551
		if (*data == ID_LED_RESERVED_0000 ||
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1552
		    *data == ID_LED_RESERVED_FFFF)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1553
			*data = ID_LED_DEFAULT;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1554
		break;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1555
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1556
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1557
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1558
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1559
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1560
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1561
 *  e1000e_get_laa_state_82571 - Get locally administered address state
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1562
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1563
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1564
 *  Retrieve and return the current locally administered address state.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1565
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1566
bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1567
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1568
	if (hw->mac.type != e1000_82571)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1569
		return false;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1570
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1571
	return hw->dev_spec.e82571.laa_is_present;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1572
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1573
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1574
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1575
 *  e1000e_set_laa_state_82571 - Set locally administered address state
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1576
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1577
 *  @state: enable/disable locally administered address
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1578
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1579
 *  Enable/Disable the current locally administered address state.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1580
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1581
void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1582
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1583
	if (hw->mac.type != e1000_82571)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1584
		return;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1585
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1586
	hw->dev_spec.e82571.laa_is_present = state;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1587
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1588
	/* If workaround is activated... */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1589
	if (state)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1590
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1591
		 * Hold a copy of the LAA in RAR[14] This is done so that
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1592
		 * between the time RAR[0] gets clobbered and the time it
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1593
		 * gets fixed, the actual LAA is in one of the RARs and no
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1594
		 * incoming packets directed to this port are dropped.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1595
		 * Eventually the LAA will be in RAR[0] and RAR[14].
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1596
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1597
		e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1598
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1599
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1600
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1601
 *  e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1602
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1603
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1604
 *  Verifies that the EEPROM has completed the update.  After updating the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1605
 *  EEPROM, we need to check bit 15 in work 0x23 for the checksum fix.  If
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1606
 *  the checksum fix is not implemented, we need to set the bit and update
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1607
 *  the checksum.  Otherwise, if bit 15 is set and the checksum is incorrect,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1608
 *  we need to return bad checksum.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1609
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1610
static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1611
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1612
	struct e1000_nvm_info *nvm = &hw->nvm;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1613
	s32 ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1614
	u16 data;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1615
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1616
	if (nvm->type != e1000_nvm_flash_hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1617
		return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1618
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1619
	/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1620
	 * Check bit 4 of word 10h.  If it is 0, firmware is done updating
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1621
	 * 10h-12h.  Checksum may need to be fixed.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1622
	 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1623
	ret_val = e1000_read_nvm(hw, 0x10, 1, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1624
	if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1625
		return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1626
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1627
	if (!(data & 0x10)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1628
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1629
		 * Read 0x23 and check bit 15.  This bit is a 1
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1630
		 * when the checksum has already been fixed.  If
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1631
		 * the checksum is still wrong and this bit is a
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1632
		 * 1, we need to return bad checksum.  Otherwise,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1633
		 * we need to set this bit to a 1 and update the
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1634
		 * checksum.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1635
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1636
		ret_val = e1000_read_nvm(hw, 0x23, 1, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1637
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1638
			return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1639
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1640
		if (!(data & 0x8000)) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1641
			data |= 0x8000;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1642
			ret_val = e1000_write_nvm(hw, 0x23, 1, &data);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1643
			if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1644
				return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1645
			ret_val = e1000e_update_nvm_checksum(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1646
		}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1647
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1648
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1649
	return 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1650
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1651
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1652
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1653
 *  e1000_read_mac_addr_82571 - Read device MAC address
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1654
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1655
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1656
static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1657
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1658
	s32 ret_val = 0;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1659
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1660
	if (hw->mac.type == e1000_82571) {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1661
		/*
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1662
		 * If there's an alternate MAC address place it in RAR0
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1663
		 * so that it will override the Si installed default perm
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1664
		 * address.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1665
		 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1666
		ret_val = e1000_check_alt_mac_addr_generic(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1667
		if (ret_val)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1668
			goto out;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1669
	}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1670
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1671
	ret_val = e1000_read_mac_addr_generic(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1672
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1673
out:
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1674
	return ret_val;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1675
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1676
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1677
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1678
 * e1000_power_down_phy_copper_82571 - Remove link during PHY power down
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1679
 * @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1680
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1681
 * In the case of a PHY power down to save power, or to turn off link during a
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1682
 * driver unload, or wake on lan is not enabled, remove the link.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1683
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1684
static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1685
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1686
	struct e1000_phy_info *phy = &hw->phy;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1687
	struct e1000_mac_info *mac = &hw->mac;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1688
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1689
	if (!(phy->ops.check_reset_block))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1690
		return;
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1691
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1692
	/* If the management interface is not enabled, then power down */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1693
	if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw)))
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1694
		e1000_power_down_phy_copper(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1695
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1696
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1697
/**
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1698
 *  e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1699
 *  @hw: pointer to the HW structure
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1700
 *
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1701
 *  Clears the hardware counters by reading the counter registers.
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1702
 **/
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1703
static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1704
{
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1705
	e1000e_clear_hw_cntrs_base(hw);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1706
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1707
	er32(PRC64);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1708
	er32(PRC127);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1709
	er32(PRC255);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1710
	er32(PRC511);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1711
	er32(PRC1023);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1712
	er32(PRC1522);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1713
	er32(PTC64);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1714
	er32(PTC127);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1715
	er32(PTC255);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1716
	er32(PTC511);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1717
	er32(PTC1023);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1718
	er32(PTC1522);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1719
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1720
	er32(ALGNERRC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1721
	er32(RXERRC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1722
	er32(TNCRS);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1723
	er32(CEXTERR);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1724
	er32(TSCTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1725
	er32(TSCTFC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1726
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1727
	er32(MGTPRC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1728
	er32(MGTPDC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1729
	er32(MGTPTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1730
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1731
	er32(IAC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1732
	er32(ICRXOC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1733
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1734
	er32(ICRXPTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1735
	er32(ICRXATC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1736
	er32(ICTXPTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1737
	er32(ICTXATC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1738
	er32(ICTXQEC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1739
	er32(ICTXQMTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1740
	er32(ICRXDMTC);
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1741
}
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1742
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1743
static struct e1000_mac_operations e82571_mac_ops = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1744
	/* .check_mng_mode: mac type dependent */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1745
	/* .check_for_link: media type dependent */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1746
	.id_led_init		= e1000e_id_led_init,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1747
	.cleanup_led		= e1000e_cleanup_led_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1748
	.clear_hw_cntrs		= e1000_clear_hw_cntrs_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1749
	.get_bus_info		= e1000e_get_bus_info_pcie,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1750
	.set_lan_id		= e1000_set_lan_id_multi_port_pcie,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1751
	/* .get_link_up_info: media type dependent */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1752
	/* .led_on: mac type dependent */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1753
	.led_off		= e1000e_led_off_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1754
	.update_mc_addr_list	= e1000e_update_mc_addr_list_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1755
	.write_vfta		= e1000_write_vfta_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1756
	.clear_vfta		= e1000_clear_vfta_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1757
	.reset_hw		= e1000_reset_hw_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1758
	.init_hw		= e1000_init_hw_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1759
	.setup_link		= e1000_setup_link_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1760
	/* .setup_physical_interface: media type dependent */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1761
	.setup_led		= e1000e_setup_led_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1762
	.read_mac_addr		= e1000_read_mac_addr_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1763
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1764
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1765
static struct e1000_phy_operations e82_phy_ops_igp = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1766
	.acquire		= e1000_get_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1767
	.check_polarity		= e1000_check_polarity_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1768
	.check_reset_block	= e1000e_check_reset_block_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1769
	.commit			= NULL,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1770
	.force_speed_duplex	= e1000e_phy_force_speed_duplex_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1771
	.get_cfg_done		= e1000_get_cfg_done_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1772
	.get_cable_length	= e1000e_get_cable_length_igp_2,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1773
	.get_info		= e1000e_get_phy_info_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1774
	.read_reg		= e1000e_read_phy_reg_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1775
	.release		= e1000_put_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1776
	.reset			= e1000e_phy_hw_reset_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1777
	.set_d0_lplu_state	= e1000_set_d0_lplu_state_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1778
	.set_d3_lplu_state	= e1000e_set_d3_lplu_state,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1779
	.write_reg		= e1000e_write_phy_reg_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1780
	.cfg_on_link_up      	= NULL,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1781
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1782
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1783
static struct e1000_phy_operations e82_phy_ops_m88 = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1784
	.acquire		= e1000_get_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1785
	.check_polarity		= e1000_check_polarity_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1786
	.check_reset_block	= e1000e_check_reset_block_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1787
	.commit			= e1000e_phy_sw_reset,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1788
	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1789
	.get_cfg_done		= e1000e_get_cfg_done,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1790
	.get_cable_length	= e1000e_get_cable_length_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1791
	.get_info		= e1000e_get_phy_info_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1792
	.read_reg		= e1000e_read_phy_reg_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1793
	.release		= e1000_put_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1794
	.reset			= e1000e_phy_hw_reset_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1795
	.set_d0_lplu_state	= e1000_set_d0_lplu_state_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1796
	.set_d3_lplu_state	= e1000e_set_d3_lplu_state,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1797
	.write_reg		= e1000e_write_phy_reg_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1798
	.cfg_on_link_up      	= NULL,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1799
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1800
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1801
static struct e1000_phy_operations e82_phy_ops_bm = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1802
	.acquire		= e1000_get_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1803
	.check_polarity		= e1000_check_polarity_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1804
	.check_reset_block	= e1000e_check_reset_block_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1805
	.commit			= e1000e_phy_sw_reset,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1806
	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1807
	.get_cfg_done		= e1000e_get_cfg_done,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1808
	.get_cable_length	= e1000e_get_cable_length_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1809
	.get_info		= e1000e_get_phy_info_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1810
	.read_reg		= e1000e_read_phy_reg_bm2,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1811
	.release		= e1000_put_hw_semaphore_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1812
	.reset			= e1000e_phy_hw_reset_generic,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1813
	.set_d0_lplu_state	= e1000_set_d0_lplu_state_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1814
	.set_d3_lplu_state	= e1000e_set_d3_lplu_state,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1815
	.write_reg		= e1000e_write_phy_reg_bm2,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1816
	.cfg_on_link_up      	= NULL,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1817
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1818
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1819
static struct e1000_nvm_operations e82571_nvm_ops = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1820
	.acquire		= e1000_acquire_nvm_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1821
	.read			= e1000e_read_nvm_eerd,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1822
	.release		= e1000_release_nvm_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1823
	.update			= e1000_update_nvm_checksum_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1824
	.valid_led_default	= e1000_valid_led_default_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1825
	.validate		= e1000_validate_nvm_checksum_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1826
	.write			= e1000_write_nvm_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1827
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1828
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1829
struct e1000_info e1000_82571_info = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1830
	.mac			= e1000_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1831
	.flags			= FLAG_HAS_HW_VLAN_FILTER
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1832
				  | FLAG_HAS_JUMBO_FRAMES
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1833
				  | FLAG_HAS_WOL
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1834
				  | FLAG_APME_IN_CTRL3
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1835
				  | FLAG_RX_CSUM_ENABLED
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1836
				  | FLAG_HAS_CTRLEXT_ON_LOAD
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1837
				  | FLAG_HAS_SMART_POWER_DOWN
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1838
				  | FLAG_RESET_OVERWRITES_LAA /* errata */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1839
				  | FLAG_TARC_SPEED_MODE_BIT /* errata */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1840
				  | FLAG_APME_CHECK_PORT_B,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1841
	.flags2			= FLAG2_DISABLE_ASPM_L1 /* errata 13 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1842
				  | FLAG2_DMA_BURST,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1843
	.pba			= 38,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1844
	.max_hw_frame_size	= DEFAULT_JUMBO,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1845
	.get_variants		= e1000_get_variants_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1846
	.mac_ops		= &e82571_mac_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1847
	.phy_ops		= &e82_phy_ops_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1848
	.nvm_ops		= &e82571_nvm_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1849
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1850
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1851
struct e1000_info e1000_82572_info = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1852
	.mac			= e1000_82572,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1853
	.flags			= FLAG_HAS_HW_VLAN_FILTER
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1854
				  | FLAG_HAS_JUMBO_FRAMES
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1855
				  | FLAG_HAS_WOL
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1856
				  | FLAG_APME_IN_CTRL3
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1857
				  | FLAG_RX_CSUM_ENABLED
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1858
				  | FLAG_HAS_CTRLEXT_ON_LOAD
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1859
				  | FLAG_TARC_SPEED_MODE_BIT, /* errata */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1860
	.flags2			= FLAG2_DISABLE_ASPM_L1 /* errata 13 */
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1861
				  | FLAG2_DMA_BURST,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1862
	.pba			= 38,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1863
	.max_hw_frame_size	= DEFAULT_JUMBO,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1864
	.get_variants		= e1000_get_variants_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1865
	.mac_ops		= &e82571_mac_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1866
	.phy_ops		= &e82_phy_ops_igp,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1867
	.nvm_ops		= &e82571_nvm_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1868
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1869
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1870
struct e1000_info e1000_82573_info = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1871
	.mac			= e1000_82573,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1872
	.flags			= FLAG_HAS_HW_VLAN_FILTER
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1873
				  | FLAG_HAS_WOL
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1874
				  | FLAG_APME_IN_CTRL3
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1875
				  | FLAG_RX_CSUM_ENABLED
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1876
				  | FLAG_HAS_SMART_POWER_DOWN
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1877
				  | FLAG_HAS_AMT
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1878
				  | FLAG_HAS_SWSM_ON_LOAD,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1879
	.flags2			= FLAG2_DISABLE_ASPM_L1,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1880
	.pba			= 20,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1881
	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1882
	.get_variants		= e1000_get_variants_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1883
	.mac_ops		= &e82571_mac_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1884
	.phy_ops		= &e82_phy_ops_m88,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1885
	.nvm_ops		= &e82571_nvm_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1886
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1887
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1888
struct e1000_info e1000_82574_info = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1889
	.mac			= e1000_82574,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1890
	.flags			= FLAG_HAS_HW_VLAN_FILTER
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1891
				  | FLAG_HAS_MSIX
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1892
				  | FLAG_HAS_JUMBO_FRAMES
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1893
				  | FLAG_HAS_WOL
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1894
				  | FLAG_APME_IN_CTRL3
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1895
				  | FLAG_RX_CSUM_ENABLED
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1896
				  | FLAG_HAS_SMART_POWER_DOWN
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1897
				  | FLAG_HAS_AMT
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1898
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1899
	.flags2			  = FLAG2_CHECK_PHY_HANG,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1900
	.pba			= 36,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1901
	.max_hw_frame_size	= DEFAULT_JUMBO,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1902
	.get_variants		= e1000_get_variants_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1903
	.mac_ops		= &e82571_mac_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1904
	.phy_ops		= &e82_phy_ops_bm,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1905
	.nvm_ops		= &e82571_nvm_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1906
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1907
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1908
struct e1000_info e1000_82583_info = {
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1909
	.mac			= e1000_82583,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1910
	.flags			= FLAG_HAS_HW_VLAN_FILTER
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1911
				  | FLAG_HAS_WOL
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1912
				  | FLAG_APME_IN_CTRL3
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1913
				  | FLAG_RX_CSUM_ENABLED
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1914
				  | FLAG_HAS_SMART_POWER_DOWN
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1915
				  | FLAG_HAS_AMT
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1916
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1917
	.pba			= 36,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1918
	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1919
	.get_variants		= e1000_get_variants_82571,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1920
	.mac_ops		= &e82571_mac_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1921
	.phy_ops		= &e82_phy_ops_bm,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1922
	.nvm_ops		= &e82571_nvm_ops,
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1923
};
f99b2249704c Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1924