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