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