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