devices/e1000e/ich8lan-2.6.32-orig.c
author Gavin Lambert <gavinl@compacsort.com>
Tue, 14 Apr 2015 09:33:24 -0400
changeset 2618 3affe9cd0b66
parent 2131 2cefec773772
permissions -rw-r--r--
Ignore NXIO error otherwise this causes spam if network is empty or refclk not
selected yet, and syncing refclk time to master.
2131
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*******************************************************************************
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
  Intel PRO/1000 Linux driver
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
  Copyright(c) 1999 - 2008 Intel Corporation.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
  This program is free software; you can redistribute it and/or modify it
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
  under the terms and conditions of the GNU General Public License,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
  version 2, as published by the Free Software Foundation.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
  This program is distributed in the hope it will be useful, but WITHOUT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
  more details.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
  You should have received a copy of the GNU General Public License along with
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
  this program; if not, write to the Free Software Foundation, Inc.,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
  The full GNU General Public License is included in this distribution in
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
  the file called "COPYING".
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
  Contact Information:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
  Linux NICS <linux.nics@intel.com>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
*******************************************************************************/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 * 82562G 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 * 82562G-2 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 * 82562GT 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
 * 82562GT-2 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
 * 82562V 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
 * 82562V-2 10/100 Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
 * 82566DC-2 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
 * 82566DC Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
 * 82566DM-2 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
 * 82566DM Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
 * 82566MC Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
 * 82566MM Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
 * 82567LM Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
 * 82567LF Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
 * 82567V Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
 * 82567LM-2 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
 * 82567LF-2 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
 * 82567V-2 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
 * 82567LF-3 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
 * 82567LM-3 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
 * 82567LM-4 Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
 * 82577LM Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
 * 82577LC Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
 * 82578DM Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
 * 82578DC Gigabit Network Connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
#include <linux/netdevice.h>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
#include <linux/ethtool.h>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
#include <linux/delay.h>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
#include <linux/pci.h>
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
#include "e1000.h"
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
#define ICH_FLASH_GFPREG		0x0000
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
#define ICH_FLASH_HSFSTS		0x0004
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
#define ICH_FLASH_HSFCTL		0x0006
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
#define ICH_FLASH_FADDR			0x0008
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
#define ICH_FLASH_FDATA0		0x0010
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
#define ICH_FLASH_PR0			0x0074
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
#define ICH_FLASH_READ_COMMAND_TIMEOUT	500
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
#define ICH_FLASH_WRITE_COMMAND_TIMEOUT	500
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
#define ICH_FLASH_ERASE_COMMAND_TIMEOUT	3000000
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
#define ICH_FLASH_LINEAR_ADDR_MASK	0x00FFFFFF
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
#define ICH_FLASH_CYCLE_REPEAT_COUNT	10
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
#define ICH_CYCLE_READ			0
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
#define ICH_CYCLE_WRITE			2
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
#define ICH_CYCLE_ERASE			3
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
#define FLASH_GFPREG_BASE_MASK		0x1FFF
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
#define FLASH_SECTOR_ADDR_SHIFT		12
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
#define ICH_FLASH_SEG_SIZE_256		256
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
#define ICH_FLASH_SEG_SIZE_4K		4096
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
#define ICH_FLASH_SEG_SIZE_8K		8192
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
#define ICH_FLASH_SEG_SIZE_64K		65536
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
#define E1000_ICH_FWSM_RSPCIPHY	0x00000040 /* Reset PHY on PCI Reset */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
#define E1000_ICH_MNG_IAMT_MODE		0x2
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
#define ID_LED_DEFAULT_ICH8LAN  ((ID_LED_DEF1_DEF2 << 12) | \
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
				 (ID_LED_DEF1_OFF2 <<  8) | \
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
				 (ID_LED_DEF1_ON2  <<  4) | \
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
				 (ID_LED_DEF1_DEF2))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
#define E1000_ICH_NVM_SIG_WORD		0x13
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
#define E1000_ICH_NVM_SIG_MASK		0xC000
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
#define E1000_ICH_NVM_VALID_SIG_MASK    0xC0
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
#define E1000_ICH_NVM_SIG_VALUE         0x80
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
#define E1000_ICH8_LAN_INIT_TIMEOUT	1500
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
#define E1000_FEXTNVM_SW_CONFIG		1
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
#define PCIE_ICH8_SNOOP_ALL		PCIE_NO_SNOOP_ALL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
#define E1000_ICH_RAR_ENTRIES		7
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
#define PHY_PAGE_SHIFT 5
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
			   ((reg) & MAX_PHY_REG_ADDRESS))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
#define IGP3_KMRN_DIAG  PHY_REG(770, 19) /* KMRN Diagnostic */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
#define IGP3_VR_CTRL    PHY_REG(776, 18) /* Voltage Regulator Control */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS	0x0002
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
#define IGP3_VR_CTRL_MODE_SHUTDOWN	0x0200
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
#define HV_LED_CONFIG		PHY_REG(768, 30) /* LED Configuration */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
#define SW_FLAG_TIMEOUT    1000 /* SW Semaphore flag timeout in milliseconds */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
/* SMBus Address Phy Register */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
#define HV_SMB_ADDR            PHY_REG(768, 26)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
#define HV_SMB_ADDR_PEC_EN     0x0200
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
#define HV_SMB_ADDR_VALID      0x0080
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
/* Strapping Option Register - RO */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
#define E1000_STRAP                     0x0000C
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
#define E1000_STRAP_SMBUS_ADDRESS_MASK  0x00FE0000
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
/* OEM Bits Phy Register */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
#define HV_OEM_BITS            PHY_REG(768, 25)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
#define HV_OEM_BITS_LPLU       0x0004 /* Low Power Link Up */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
#define HV_OEM_BITS_GBE_DIS    0x0040 /* Gigabit Disable */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
#define E1000_NVM_K1_ENABLE 0x1  /* NVM Enable K1 bit */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
/* Offset 04h HSFSTS */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
union ich8_hws_flash_status {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
	struct ich8_hsfsts {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
		u16 flcdone    :1; /* bit 0 Flash Cycle Done */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
		u16 flcerr     :1; /* bit 1 Flash Cycle Error */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
		u16 dael       :1; /* bit 2 Direct Access error Log */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
		u16 berasesz   :2; /* bit 4:3 Sector Erase Size */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
		u16 flcinprog  :1; /* bit 5 flash cycle in Progress */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
		u16 reserved1  :2; /* bit 13:6 Reserved */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
		u16 reserved2  :6; /* bit 13:6 Reserved */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
		u16 fldesvalid :1; /* bit 14 Flash Descriptor Valid */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
		u16 flockdn    :1; /* bit 15 Flash Config Lock-Down */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
	} hsf_status;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
	u16 regval;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
/* ICH GbE Flash Hardware Sequencing Flash control Register bit breakdown */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
/* Offset 06h FLCTL */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
union ich8_hws_flash_ctrl {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
	struct ich8_hsflctl {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
		u16 flcgo      :1;   /* 0 Flash Cycle Go */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
		u16 flcycle    :2;   /* 2:1 Flash Cycle */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
		u16 reserved   :5;   /* 7:3 Reserved  */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
		u16 fldbcount  :2;   /* 9:8 Flash Data Byte Count */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
		u16 flockdn    :6;   /* 15:10 Reserved */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
	} hsf_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
	u16 regval;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
/* ICH Flash Region Access Permissions */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
union ich8_hws_flash_regacc {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
	struct ich8_flracc {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
		u32 grra      :8; /* 0:7 GbE region Read Access */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
		u32 grwa      :8; /* 8:15 GbE region Write Access */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
		u32 gmrag     :8; /* 23:16 GbE Master Read Access Grant */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
		u32 gmwag     :8; /* 31:24 GbE Master Write Access Grant */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
	} hsf_flregacc;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
	u16 regval;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
/* ICH Flash Protected Region */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
union ich8_flash_protected_range {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
	struct ich8_pr {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
		u32 base:13;     /* 0:12 Protected Range Base */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
		u32 reserved1:2; /* 13:14 Reserved */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
		u32 rpe:1;       /* 15 Read Protection Enable */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
		u32 limit:13;    /* 16:28 Protected Range Limit */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
		u32 reserved2:2; /* 29:30 Reserved */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
		u32 wpe:1;       /* 31 Write Protection Enable */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
	} range;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
	u32 regval;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
						u32 offset, u8 byte);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
					 u8 *data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
					 u16 *data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
					 u8 size, u16 *data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
static s32 e1000_led_on_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
static s32 e1000_led_off_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
static s32 e1000_setup_led_pchlan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
static s32  e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
	return readw(hw->flash_address + reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
	return readl(hw->flash_address + reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   240
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
	writew(val, hw->flash_address + reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
	writel(val, hw->flash_address + reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
#define er16flash(reg)		__er16flash(hw, (reg))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
#define er32flash(reg)		__er32flash(hw, (reg))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
#define ew16flash(reg,val)	__ew16flash(hw, (reg), (val))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
#define ew32flash(reg,val)	__ew32flash(hw, (reg), (val))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
 *  e1000_init_phy_params_pchlan - Initialize PHY function pointers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
 *  Initialize family-specific PHY parameters and function pointers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
	phy->addr                     = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
	phy->reset_delay_us           = 100;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
	phy->ops.check_polarity       = e1000_check_polarity_ife_ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
	phy->ops.read_phy_reg         = e1000_read_phy_reg_hv;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
	phy->ops.read_phy_reg_locked  = e1000_read_phy_reg_hv_locked;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
	phy->ops.set_d0_lplu_state    = e1000_set_lplu_state_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
	phy->ops.set_d3_lplu_state    = e1000_set_lplu_state_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
	phy->ops.write_phy_reg        = e1000_write_phy_reg_hv;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
	phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
	phy->autoneg_mask             = AUTONEG_ADVERTISE_SPEED_DEFAULT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
	phy->id = e1000_phy_unknown;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
	e1000e_get_phy_id(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
	phy->type = e1000e_get_phy_type_from_id(phy->id);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
	if (phy->type == e1000_phy_82577) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
		phy->ops.check_polarity = e1000_check_polarity_82577;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
		phy->ops.force_speed_duplex =
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
			e1000_phy_force_speed_duplex_82577;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
		phy->ops.get_cable_length   = e1000_get_cable_length_82577;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
		phy->ops.get_phy_info = e1000_get_phy_info_82577;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
		phy->ops.commit_phy = e1000e_phy_sw_reset;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
 *  e1000_init_phy_params_ich8lan - Initialize PHY function pointers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   295
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
 *  Initialize family-specific PHY parameters and function pointers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
	u16 i = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
	phy->addr			= 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
	phy->reset_delay_us		= 100;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
	 * We may need to do this twice - once for IGP and if that fails,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   310
	 * we'll set BM func pointers and try again
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   311
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   312
	ret_val = e1000e_determine_phy_address(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   313
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   314
		hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   315
		hw->phy.ops.read_phy_reg  = e1000e_read_phy_reg_bm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
		ret_val = e1000e_determine_phy_address(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   319
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   320
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
	phy->id = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
	while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
	       (i++ < 100)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
		msleep(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
		ret_val = e1000e_get_phy_id(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   326
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
	/* Verify phy id */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
	switch (phy->id) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
	case IGP03E1000_E_PHY_ID:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
		phy->type = e1000_phy_igp_3;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
		phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
		phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
		phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
	case IFE_E_PHY_ID:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   339
	case IFE_PLUS_E_PHY_ID:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
	case IFE_C_E_PHY_ID:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   341
		phy->type = e1000_phy_ife;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   342
		phy->autoneg_mask = E1000_ALL_NOT_GIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   343
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   344
	case BME1000_E_PHY_ID:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   345
		phy->type = e1000_phy_bm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   346
		phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   347
		hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   348
		hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   349
		hw->phy.ops.commit_phy = e1000e_phy_sw_reset;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   350
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   351
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   352
		return -E1000_ERR_PHY;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   353
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   354
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   355
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   356
	phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   357
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   358
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   359
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   361
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   362
 *  e1000_init_nvm_params_ich8lan - Initialize NVM function pointers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   363
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
 *  Initialize family-specific NVM parameters and function
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
 *  pointers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
	u32 gfpreg, sector_base_addr, sector_end_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
	u16 i;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
	/* Can't read flash registers if the register set isn't mapped. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
	if (!hw->flash_address) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
		hw_dbg(hw, "ERROR: Flash registers not mapped\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
		return -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
	nvm->type = e1000_nvm_flash_sw;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
	gfpreg = er32flash(ICH_FLASH_GFPREG);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
	 * sector_X_addr is a "sector"-aligned address (4096 bytes)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
	 * Add 1 to sector_end_addr since this sector is included in
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
	 * the overall size.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
	sector_base_addr = gfpreg & FLASH_GFPREG_BASE_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
	sector_end_addr = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK) + 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
	/* flash_base_addr is byte-aligned */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
	nvm->flash_base_addr = sector_base_addr << FLASH_SECTOR_ADDR_SHIFT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
	 * find total size of the NVM, then cut in half since the total
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
	 * size represents two separate NVM banks.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
	nvm->flash_bank_size = (sector_end_addr - sector_base_addr)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
				<< FLASH_SECTOR_ADDR_SHIFT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
	nvm->flash_bank_size /= 2;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
	/* Adjust to word count */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   404
	nvm->flash_bank_size /= sizeof(u16);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
	nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   407
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   408
	/* Clear shadow ram */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   409
	for (i = 0; i < nvm->word_size; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   410
		dev_spec->shadow_ram[i].modified = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   411
		dev_spec->shadow_ram[i].value    = 0xFFFF;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   412
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   414
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   415
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
 *  e1000_init_mac_params_ich8lan - Initialize MAC function pointers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
 *  Initialize family-specific MAC parameters and function
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
 *  pointers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   423
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   425
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   426
	struct e1000_hw *hw = &adapter->hw;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   427
	struct e1000_mac_info *mac = &hw->mac;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   428
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   429
	/* Set media type function pointer */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   430
	hw->phy.media_type = e1000_media_type_copper;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   431
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   432
	/* Set mta register count */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   433
	mac->mta_reg_count = 32;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   434
	/* Set rar entry count */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   435
	mac->rar_entry_count = E1000_ICH_RAR_ENTRIES;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   436
	if (mac->type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   437
		mac->rar_entry_count--;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   438
	/* Set if manageability features are enabled. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   439
	mac->arc_subsystem_valid = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   440
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   441
	/* LED operations */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   442
	switch (mac->type) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   443
	case e1000_ich8lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   444
	case e1000_ich9lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   445
	case e1000_ich10lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   446
		/* ID LED init */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   447
		mac->ops.id_led_init = e1000e_id_led_init;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   448
		/* setup LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   449
		mac->ops.setup_led = e1000e_setup_led_generic;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   450
		/* cleanup LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   451
		mac->ops.cleanup_led = e1000_cleanup_led_ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   452
		/* turn on/off LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   453
		mac->ops.led_on = e1000_led_on_ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   454
		mac->ops.led_off = e1000_led_off_ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   455
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   456
	case e1000_pchlan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   457
		/* ID LED init */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   458
		mac->ops.id_led_init = e1000_id_led_init_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   459
		/* setup LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   460
		mac->ops.setup_led = e1000_setup_led_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   461
		/* cleanup LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   462
		mac->ops.cleanup_led = e1000_cleanup_led_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   463
		/* turn on/off LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   464
		mac->ops.led_on = e1000_led_on_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   465
		mac->ops.led_off = e1000_led_off_pchlan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   466
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   467
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   468
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   469
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   470
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   471
	/* Enable PCS Lock-loss workaround for ICH8 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   472
	if (mac->type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   473
		e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   474
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   475
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   476
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   477
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   478
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   479
 *  e1000_check_for_copper_link_ich8lan - Check for link (Copper)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   480
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   481
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   482
 *  Checks to see of the link status of the hardware has changed.  If a
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   483
 *  change in link status has been detected, then we read the PHY registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   484
 *  to get the current speed/duplex if link exists.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   485
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   486
static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   487
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   488
	struct e1000_mac_info *mac = &hw->mac;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   489
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   490
	bool link;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   491
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   492
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   493
	 * We only want to go out to the PHY registers to see if Auto-Neg
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   494
	 * has completed and/or if our link status has changed.  The
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   495
	 * get_link_status flag is set upon receiving a Link Status
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   496
	 * Change or Rx Sequence Error interrupt.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   497
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   498
	if (!mac->get_link_status) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   499
		ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   500
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   501
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   502
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   503
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   504
	 * First we want to see if the MII Status Register reports
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   505
	 * link.  If so, then we want to get the current speed/duplex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   506
	 * of the PHY.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   507
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   508
	ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   509
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   510
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   511
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   512
	if (hw->mac.type == e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   513
		ret_val = e1000_k1_gig_workaround_hv(hw, link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   514
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   515
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   516
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   517
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   518
	if (!link)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   519
		goto out; /* No link detected */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   520
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   521
	mac->get_link_status = false;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   522
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   523
	if (hw->phy.type == e1000_phy_82578) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   524
		ret_val = e1000_link_stall_workaround_hv(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   525
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   526
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   527
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   528
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   529
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   530
	 * Check if there was DownShift, must be checked
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   531
	 * immediately after link-up
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   532
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   533
	e1000e_check_downshift(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   534
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   535
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   536
	 * If we are forcing speed/duplex, then we simply return since
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   537
	 * we have already determined whether we have link or not.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   538
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   539
	if (!mac->autoneg) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   540
		ret_val = -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   541
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   542
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   543
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   544
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   545
	 * Auto-Neg is enabled.  Auto Speed Detection takes care
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   546
	 * of MAC speed/duplex configuration.  So we only need to
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   547
	 * configure Collision Distance in the MAC.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   548
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   549
	e1000e_config_collision_dist(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   550
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   551
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   552
	 * Configure Flow Control now that Auto-Neg has completed.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   553
	 * First, we need to restore the desired flow control
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   554
	 * settings because we may have had to re-autoneg with a
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   555
	 * different link partner.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   556
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   557
	ret_val = e1000e_config_fc_after_link_up(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   558
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   559
		hw_dbg(hw, "Error configuring flow control\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   560
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   561
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   562
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   563
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   564
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   565
static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   566
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   567
	struct e1000_hw *hw = &adapter->hw;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   568
	s32 rc;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   569
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   570
	rc = e1000_init_mac_params_ich8lan(adapter);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   571
	if (rc)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   572
		return rc;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   573
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   574
	rc = e1000_init_nvm_params_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   575
	if (rc)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   576
		return rc;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   577
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   578
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   579
		rc = e1000_init_phy_params_pchlan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   580
	else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   581
		rc = e1000_init_phy_params_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   582
	if (rc)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   583
		return rc;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   584
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   585
	if (adapter->hw.phy.type == e1000_phy_ife) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   586
		adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   587
		adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   588
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   589
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   590
	if ((adapter->hw.mac.type == e1000_ich8lan) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   591
	    (adapter->hw.phy.type == e1000_phy_igp_3))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   592
		adapter->flags |= FLAG_LSC_GIG_SPEED_DROP;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   593
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   594
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   595
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   596
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   597
static DEFINE_MUTEX(nvm_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   598
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   599
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   600
 *  e1000_acquire_nvm_ich8lan - Acquire NVM mutex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   601
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   602
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   603
 *  Acquires the mutex for performing NVM operations.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   604
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   605
static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   606
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   607
	mutex_lock(&nvm_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   608
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   609
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   610
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   611
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   612
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   613
 *  e1000_release_nvm_ich8lan - Release NVM mutex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   614
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   615
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   616
 *  Releases the mutex used while performing NVM operations.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   617
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   618
static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   619
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   620
	mutex_unlock(&nvm_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   621
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   622
	return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   623
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   624
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   625
static DEFINE_MUTEX(swflag_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   626
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   627
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   628
 *  e1000_acquire_swflag_ich8lan - Acquire software control flag
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   629
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   630
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   631
 *  Acquires the software control flag for performing PHY and select
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   632
 *  MAC CSR accesses.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   633
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   634
static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   635
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   636
	u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   637
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   638
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   639
	might_sleep();
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   640
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   641
	mutex_lock(&swflag_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   642
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   643
	while (timeout) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   644
		extcnf_ctrl = er32(EXTCNF_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   645
		if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   646
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   647
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   648
		mdelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   649
		timeout--;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   650
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   651
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   652
	if (!timeout) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   653
		hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   654
		ret_val = -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   655
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   656
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   657
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   658
	timeout = SW_FLAG_TIMEOUT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   659
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   660
	extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   661
	ew32(EXTCNF_CTRL, extcnf_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   662
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   663
	while (timeout) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   664
		extcnf_ctrl = er32(EXTCNF_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   665
		if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   666
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   667
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   668
		mdelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   669
		timeout--;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   670
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   671
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   672
	if (!timeout) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   673
		hw_dbg(hw, "Failed to acquire the semaphore.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   674
		extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   675
		ew32(EXTCNF_CTRL, extcnf_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   676
		ret_val = -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   677
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   678
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   679
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   680
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   681
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   682
		mutex_unlock(&swflag_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   683
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   684
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   685
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   686
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   687
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   688
 *  e1000_release_swflag_ich8lan - Release software control flag
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   689
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   690
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   691
 *  Releases the software control flag for performing PHY and select
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   692
 *  MAC CSR accesses.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   693
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   694
static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   695
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   696
	u32 extcnf_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   697
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   698
	extcnf_ctrl = er32(EXTCNF_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   699
	extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   700
	ew32(EXTCNF_CTRL, extcnf_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   701
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   702
	mutex_unlock(&swflag_mutex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   703
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   704
	return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   705
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   706
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   707
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   708
 *  e1000_check_mng_mode_ich8lan - Checks management mode
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   709
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   710
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   711
 *  This checks if the adapter has manageability enabled.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   712
 *  This is a function pointer entry point only called by read/write
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   713
 *  routines for the PHY and NVM parts.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   714
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   715
static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   716
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   717
	u32 fwsm = er32(FWSM);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   718
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   719
	return (fwsm & E1000_FWSM_MODE_MASK) ==
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   720
		(E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   721
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   722
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   723
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   724
 *  e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   725
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   726
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   727
 *  Checks if firmware is blocking the reset of the PHY.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   728
 *  This is a function pointer entry point only called by
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   729
 *  reset routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   730
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   731
static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   732
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   733
	u32 fwsm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   734
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   735
	fwsm = er32(FWSM);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   736
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   737
	return (fwsm & E1000_ICH_FWSM_RSPCIPHY) ? 0 : E1000_BLK_PHY_RESET;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   738
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   739
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   740
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   741
 *  e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   742
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   743
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   744
 *  Forces the speed and duplex settings of the PHY.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   745
 *  This is a function pointer entry point only called by
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   746
 *  PHY setup routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   747
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   748
static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   749
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   750
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   751
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   752
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   753
	bool link;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   754
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   755
	if (phy->type != e1000_phy_ife) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   756
		ret_val = e1000e_phy_force_speed_duplex_igp(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   757
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   758
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   759
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   760
	ret_val = e1e_rphy(hw, PHY_CONTROL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   761
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   762
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   763
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   764
	e1000e_phy_force_speed_duplex_setup(hw, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   765
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   766
	ret_val = e1e_wphy(hw, PHY_CONTROL, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   767
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   768
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   769
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   770
	/* Disable MDI-X support for 10/100 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   771
	ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   772
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   773
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   774
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   775
	data &= ~IFE_PMC_AUTO_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   776
	data &= ~IFE_PMC_FORCE_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   777
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   778
	ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   779
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   780
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   781
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   782
	hw_dbg(hw, "IFE PMC: %X\n", data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   783
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   784
	udelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   785
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   786
	if (phy->autoneg_wait_to_complete) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   787
		hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   788
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   789
		ret_val = e1000e_phy_has_link_generic(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   790
						     PHY_FORCE_LIMIT,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   791
						     100000,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   792
						     &link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   793
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   794
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   795
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   796
		if (!link)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   797
			hw_dbg(hw, "Link taking longer than expected.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   798
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   799
		/* Try once more */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   800
		ret_val = e1000e_phy_has_link_generic(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   801
						     PHY_FORCE_LIMIT,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   802
						     100000,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   803
						     &link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   804
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   805
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   806
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   807
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   808
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   809
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   810
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   811
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   812
 *  e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   813
 *  @hw:   pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   814
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   815
 *  SW should configure the LCD from the NVM extended configuration region
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   816
 *  as a workaround for certain parts.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   817
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   818
static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   819
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   820
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   821
	u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   822
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   823
	u16 word_addr, reg_data, reg_addr, phy_page = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   824
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   825
	ret_val = hw->phy.ops.acquire_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   826
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   827
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   828
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   829
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   830
	 * Initialize the PHY from the NVM on ICH platforms.  This
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   831
	 * is needed due to an issue where the NVM configuration is
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   832
	 * not properly autoloaded after power transitions.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   833
	 * Therefore, after each PHY reset, we will load the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   834
	 * configuration data out of the NVM manually.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   835
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   836
	if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   837
		(hw->mac.type == e1000_pchlan)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   838
		struct e1000_adapter *adapter = hw->adapter;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   839
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   840
		/* Check if SW needs to configure the PHY */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   841
		if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   842
		    (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   843
		    (hw->mac.type == e1000_pchlan))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   844
			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   845
		else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   846
			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   847
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   848
		data = er32(FEXTNVM);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   849
		if (!(data & sw_cfg_mask))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   850
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   851
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   852
		/* Wait for basic configuration completes before proceeding */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   853
		e1000_lan_init_done_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   854
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   855
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   856
		 * Make sure HW does not configure LCD from PHY
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   857
		 * extended configuration before SW configuration
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   858
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   859
		data = er32(EXTCNF_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   860
		if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   861
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   862
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   863
		cnf_size = er32(EXTCNF_SIZE);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   864
		cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   865
		cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   866
		if (!cnf_size)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   867
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   868
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   869
		cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   870
		cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   871
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   872
		if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   873
		    (hw->mac.type == e1000_pchlan)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   874
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   875
			 * HW configures the SMBus address and LEDs when the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   876
			 * OEM and LCD Write Enable bits are set in the NVM.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   877
			 * When both NVM bits are cleared, SW will configure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   878
			 * them instead.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   879
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   880
			data = er32(STRAP);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   881
			data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   882
			reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   883
			reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   884
			ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   885
			                                        reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   886
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   887
				goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   888
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   889
			data = er32(LEDCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   890
			ret_val = e1000_write_phy_reg_hv_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   891
			                                        HV_LED_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   892
			                                        (u16)data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   893
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   894
				goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   895
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   896
		/* Configure LCD from extended configuration region. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   897
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   898
		/* cnf_base_addr is in DWORD */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   899
		word_addr = (u16)(cnf_base_addr << 1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   900
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   901
		for (i = 0; i < cnf_size; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   902
			ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   903
			                           &reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   904
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   905
				goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   906
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   907
			ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   908
			                           1, &reg_addr);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   909
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   910
				goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   911
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   912
			/* Save off the PHY page for future writes. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   913
			if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   914
				phy_page = reg_data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   915
				continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   916
			}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   917
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   918
			reg_addr &= PHY_REG_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   919
			reg_addr |= phy_page;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   920
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   921
			ret_val = phy->ops.write_phy_reg_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   922
			                                    (u32)reg_addr,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   923
			                                    reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   924
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   925
				goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   926
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   927
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   928
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   929
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   930
	hw->phy.ops.release_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   931
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   932
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   933
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   934
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   935
 *  e1000_k1_gig_workaround_hv - K1 Si workaround
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   936
 *  @hw:   pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   937
 *  @link: link up bool flag
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   938
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   939
 *  If K1 is enabled for 1Gbps, the MAC might stall when transitioning
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   940
 *  from a lower speed.  This workaround disables K1 whenever link is at 1Gig
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   941
 *  If link is down, the function will restore the default K1 setting located
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   942
 *  in the NVM.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   943
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   944
static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   945
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   946
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   947
	u16 status_reg = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   948
	bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   949
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   950
	if (hw->mac.type != e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   951
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   952
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   953
	/* Wrap the whole flow with the sw flag */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   954
	ret_val = hw->phy.ops.acquire_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   955
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   956
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   957
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   958
	/* Disable K1 when link is 1Gbps, otherwise use the NVM setting */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   959
	if (link) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   960
		if (hw->phy.type == e1000_phy_82578) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   961
			ret_val = hw->phy.ops.read_phy_reg_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   962
			                                          BM_CS_STATUS,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   963
			                                          &status_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   964
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   965
				goto release;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   966
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   967
			status_reg &= BM_CS_STATUS_LINK_UP |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   968
			              BM_CS_STATUS_RESOLVED |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   969
			              BM_CS_STATUS_SPEED_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   970
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   971
			if (status_reg == (BM_CS_STATUS_LINK_UP |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   972
			                   BM_CS_STATUS_RESOLVED |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   973
			                   BM_CS_STATUS_SPEED_1000))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   974
				k1_enable = false;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   975
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   976
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   977
		if (hw->phy.type == e1000_phy_82577) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   978
			ret_val = hw->phy.ops.read_phy_reg_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   979
			                                          HV_M_STATUS,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   980
			                                          &status_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   981
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   982
				goto release;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   983
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   984
			status_reg &= HV_M_STATUS_LINK_UP |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   985
			              HV_M_STATUS_AUTONEG_COMPLETE |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   986
			              HV_M_STATUS_SPEED_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   987
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   988
			if (status_reg == (HV_M_STATUS_LINK_UP |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   989
			                   HV_M_STATUS_AUTONEG_COMPLETE |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   990
			                   HV_M_STATUS_SPEED_1000))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   991
				k1_enable = false;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   992
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   993
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   994
		/* Link stall fix for link up */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   995
		ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   996
		                                           0x0100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   997
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   998
			goto release;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   999
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1000
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1001
		/* Link stall fix for link down */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1002
		ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1003
		                                           0x4100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1004
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1005
			goto release;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1006
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1007
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1008
	ret_val = e1000_configure_k1_ich8lan(hw, k1_enable);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1009
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1010
release:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1011
	hw->phy.ops.release_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1012
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1013
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1014
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1015
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1016
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1017
 *  e1000_configure_k1_ich8lan - Configure K1 power state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1018
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1019
 *  @enable: K1 state to configure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1020
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1021
 *  Configure the K1 power state based on the provided parameter.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1022
 *  Assumes semaphore already acquired.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1023
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1024
 *  Success returns 0, Failure returns -E1000_ERR_PHY (-2)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1025
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1026
static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1027
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1028
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1029
	u32 ctrl_reg = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1030
	u32 ctrl_ext = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1031
	u32 reg = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1032
	u16 kmrn_reg = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1033
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1034
	ret_val = e1000e_read_kmrn_reg_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1035
	                                     E1000_KMRNCTRLSTA_K1_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1036
	                                     &kmrn_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1037
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1038
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1039
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1040
	if (k1_enable)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1041
		kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1042
	else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1043
		kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1044
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1045
	ret_val = e1000e_write_kmrn_reg_locked(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1046
	                                      E1000_KMRNCTRLSTA_K1_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1047
	                                      kmrn_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1048
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1049
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1050
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1051
	udelay(20);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1052
	ctrl_ext = er32(CTRL_EXT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1053
	ctrl_reg = er32(CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1054
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1055
	reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1056
	reg |= E1000_CTRL_FRCSPD;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1057
	ew32(CTRL, reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1058
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1059
	ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1060
	udelay(20);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1061
	ew32(CTRL, ctrl_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1062
	ew32(CTRL_EXT, ctrl_ext);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1063
	udelay(20);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1064
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1065
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1066
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1067
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1068
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1069
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1070
 *  e1000_oem_bits_config_ich8lan - SW-based LCD Configuration
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1071
 *  @hw:       pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1072
 *  @d0_state: boolean if entering d0 or d3 device state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1073
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1074
 *  SW will configure Gbe Disable and LPLU based on the NVM. The four bits are
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1075
 *  collectively called OEM bits.  The OEM Write Enable bit and SW Config bit
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1076
 *  in NVM determines whether HW should configure LPLU and Gbe Disable.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1077
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1078
static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1079
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1080
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1081
	u32 mac_reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1082
	u16 oem_reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1083
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1084
	if (hw->mac.type != e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1085
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1086
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1087
	ret_val = hw->phy.ops.acquire_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1088
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1089
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1090
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1091
	mac_reg = er32(EXTCNF_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1092
	if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1093
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1094
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1095
	mac_reg = er32(FEXTNVM);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1096
	if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1097
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1098
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1099
	mac_reg = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1100
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1101
	ret_val = hw->phy.ops.read_phy_reg_locked(hw, HV_OEM_BITS, &oem_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1102
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1103
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1104
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1105
	oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1106
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1107
	if (d0_state) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1108
		if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1109
			oem_reg |= HV_OEM_BITS_GBE_DIS;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1110
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1111
		if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1112
			oem_reg |= HV_OEM_BITS_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1113
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1114
		if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1115
			oem_reg |= HV_OEM_BITS_GBE_DIS;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1116
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1117
		if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1118
			oem_reg |= HV_OEM_BITS_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1119
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1120
	/* Restart auto-neg to activate the bits */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1121
	if (!e1000_check_reset_block(hw))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1122
		oem_reg |= HV_OEM_BITS_RESTART_AN;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1123
	ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1124
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1125
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1126
	hw->phy.ops.release_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1127
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1128
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1129
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1130
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1131
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1132
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1133
 *  e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1134
 *  done after every PHY reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1135
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1136
static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1137
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1138
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1139
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1140
	if (hw->mac.type != e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1141
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1142
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1143
	if (((hw->phy.type == e1000_phy_82577) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1144
	     ((hw->phy.revision == 1) || (hw->phy.revision == 2))) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1145
	    ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1146
		/* Disable generation of early preamble */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1147
		ret_val = e1e_wphy(hw, PHY_REG(769, 25), 0x4431);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1148
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1149
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1150
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1151
		/* Preamble tuning for SSC */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1152
		ret_val = e1e_wphy(hw, PHY_REG(770, 16), 0xA204);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1153
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1154
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1155
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1156
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1157
	if (hw->phy.type == e1000_phy_82578) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1158
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1159
		 * Return registers to default by doing a soft reset then
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1160
		 * writing 0x3140 to the control register.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1161
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1162
		if (hw->phy.revision < 2) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1163
			e1000e_phy_sw_reset(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1164
			ret_val = e1e_wphy(hw, PHY_CONTROL, 0x3140);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1165
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1166
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1167
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1168
	/* Select page 0 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1169
	ret_val = hw->phy.ops.acquire_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1170
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1171
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1172
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1173
	hw->phy.addr = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1174
	ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1175
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1176
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1177
	hw->phy.ops.release_phy(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1178
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1179
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1180
	 * Configure the K1 Si workaround during phy reset assuming there is
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1181
	 * link so that it disables K1 if link is in 1Gbps.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1182
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1183
	ret_val = e1000_k1_gig_workaround_hv(hw, true);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1184
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1185
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1186
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1187
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1188
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1189
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1190
 *  e1000_lan_init_done_ich8lan - Check for PHY config completion
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1191
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1192
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1193
 *  Check the appropriate indication the MAC has finished configuring the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1194
 *  PHY after a software reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1195
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1196
static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1197
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1198
	u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1199
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1200
	/* Wait for basic configuration completes before proceeding */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1201
	do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1202
		data = er32(STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1203
		data &= E1000_STATUS_LAN_INIT_DONE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1204
		udelay(100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1205
	} while ((!data) && --loop);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1206
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1207
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1208
	 * If basic configuration is incomplete before the above loop
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1209
	 * count reaches 0, loading the configuration from NVM will
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1210
	 * leave the PHY in a bad state possibly resulting in no link.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1211
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1212
	if (loop == 0)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1213
		hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1214
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1215
	/* Clear the Init Done bit for the next init event */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1216
	data = er32(STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1217
	data &= ~E1000_STATUS_LAN_INIT_DONE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1218
	ew32(STATUS, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1219
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1220
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1221
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1222
 *  e1000_phy_hw_reset_ich8lan - Performs a PHY reset
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1223
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1224
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1225
 *  Resets the PHY
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1226
 *  This is a function pointer entry point called by drivers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1227
 *  or other shared routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1228
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1229
static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1230
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1231
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1232
	u16 reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1233
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1234
	ret_val = e1000e_phy_hw_reset_generic(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1235
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1236
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1237
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1238
	/* Allow time for h/w to get to a quiescent state after reset */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1239
	mdelay(10);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1240
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1241
	if (hw->mac.type == e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1242
		ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1243
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1244
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1245
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1246
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1247
	/* Dummy read to clear the phy wakeup bit after lcd reset */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1248
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1249
		e1e_rphy(hw, BM_WUC, &reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1250
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1251
	/* Configure the LCD with the extended configuration region in NVM */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1252
	ret_val = e1000_sw_lcd_config_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1253
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1254
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1255
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1256
	/* Configure the LCD with the OEM bits in NVM */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1257
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1258
		ret_val = e1000_oem_bits_config_ich8lan(hw, true);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1259
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1260
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1261
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1262
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1263
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1264
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1265
 *  e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1266
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1267
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1268
 *  Populates "phy" structure with various feature states.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1269
 *  This function is only called by other family-specific
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1270
 *  routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1271
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1272
static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1273
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1274
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1275
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1276
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1277
	bool link;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1278
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1279
	ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1280
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1281
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1282
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1283
	if (!link) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1284
		hw_dbg(hw, "Phy info is only valid if link is up\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1285
		return -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1286
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1287
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1288
	ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1289
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1290
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1291
	phy->polarity_correction = (!(data & IFE_PSC_AUTO_POLARITY_DISABLE));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1292
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1293
	if (phy->polarity_correction) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1294
		ret_val = phy->ops.check_polarity(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1295
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1296
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1297
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1298
		/* Polarity is forced */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1299
		phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1300
				      ? e1000_rev_polarity_reversed
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1301
				      : e1000_rev_polarity_normal;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1302
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1303
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1304
	ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1305
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1306
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1307
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1308
	phy->is_mdix = (data & IFE_PMC_MDIX_STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1309
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1310
	/* The following parameters are undefined for 10/100 operation. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1311
	phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1312
	phy->local_rx = e1000_1000t_rx_status_undefined;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1313
	phy->remote_rx = e1000_1000t_rx_status_undefined;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1314
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1315
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1316
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1317
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1318
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1319
 *  e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1320
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1321
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1322
 *  Wrapper for calling the get_phy_info routines for the appropriate phy type.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1323
 *  This is a function pointer entry point called by drivers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1324
 *  or other shared routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1325
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1326
static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1327
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1328
	switch (hw->phy.type) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1329
	case e1000_phy_ife:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1330
		return e1000_get_phy_info_ife_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1331
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1332
	case e1000_phy_igp_3:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1333
	case e1000_phy_bm:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1334
	case e1000_phy_82578:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1335
	case e1000_phy_82577:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1336
		return e1000e_get_phy_info_igp(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1337
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1338
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1339
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1340
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1341
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1342
	return -E1000_ERR_PHY_TYPE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1343
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1344
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1345
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1346
 *  e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1347
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1348
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1349
 *  Polarity is determined on the polarity reversal feature being enabled.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1350
 *  This function is only called by other family-specific
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1351
 *  routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1352
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1353
static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1354
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1355
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1356
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1357
	u16 phy_data, offset, mask;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1358
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1359
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1360
	 * Polarity is determined based on the reversal feature being enabled.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1361
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1362
	if (phy->polarity_correction) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1363
		offset	= IFE_PHY_EXTENDED_STATUS_CONTROL;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1364
		mask	= IFE_PESC_POLARITY_REVERSED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1365
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1366
		offset	= IFE_PHY_SPECIAL_CONTROL;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1367
		mask	= IFE_PSC_FORCE_POLARITY;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1368
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1369
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1370
	ret_val = e1e_rphy(hw, offset, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1371
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1372
	if (!ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1373
		phy->cable_polarity = (phy_data & mask)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1374
				      ? e1000_rev_polarity_reversed
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1375
				      : e1000_rev_polarity_normal;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1376
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1377
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1378
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1379
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1380
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1381
 *  e1000_set_lplu_state_pchlan - Set Low Power Link Up state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1382
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1383
 *  @active: true to enable LPLU, false to disable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1384
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1385
 *  Sets the LPLU state according to the active flag.  For PCH, if OEM write
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1386
 *  bit are disabled in the NVM, writing the LPLU bits in the MAC will not set
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1387
 *  the phy speed. This function will manually set the LPLU bit and restart
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1388
 *  auto-neg as hw would do. D3 and D0 LPLU will call the same function
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1389
 *  since it configures the same bit.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1390
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1391
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1392
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1393
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1394
	u16 oem_reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1395
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1396
	ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1397
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1398
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1399
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1400
	if (active)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1401
		oem_reg |= HV_OEM_BITS_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1402
	else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1403
		oem_reg &= ~HV_OEM_BITS_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1404
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1405
	oem_reg |= HV_OEM_BITS_RESTART_AN;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1406
	ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1407
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1408
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1409
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1410
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1411
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1412
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1413
 *  e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1414
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1415
 *  @active: TRUE to enable LPLU, FALSE to disable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1416
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1417
 *  Sets the LPLU D0 state according to the active flag.  When
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1418
 *  activating LPLU this function also disables smart speed
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1419
 *  and vice versa.  LPLU will not be activated unless the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1420
 *  device autonegotiation advertisement meets standards of
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1421
 *  either 10 or 10/100 or 10/100/1000 at all duplexes.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1422
 *  This is a function pointer entry point only called by
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1423
 *  PHY setup routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1424
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1425
static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1426
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1427
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1428
	u32 phy_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1429
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1430
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1431
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1432
	if (phy->type == e1000_phy_ife)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1433
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1434
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1435
	phy_ctrl = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1436
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1437
	if (active) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1438
		phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1439
		ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1440
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1441
		if (phy->type != e1000_phy_igp_3)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1442
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1443
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1444
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1445
		 * Call gig speed drop workaround on LPLU before accessing
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1446
		 * any PHY registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1447
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1448
		if (hw->mac.type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1449
			e1000e_gig_downshift_workaround_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1450
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1451
		/* When LPLU is enabled, we should disable SmartSpeed */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1452
		ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1453
		data &= ~IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1454
		ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1455
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1456
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1457
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1458
		phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1459
		ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1460
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1461
		if (phy->type != e1000_phy_igp_3)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1462
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1463
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1464
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1465
		 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1466
		 * during Dx states where the power conservation is most
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1467
		 * important.  During driver activity we should enable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1468
		 * SmartSpeed, so performance is maintained.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1469
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1470
		if (phy->smart_speed == e1000_smart_speed_on) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1471
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1472
					   &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1473
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1474
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1475
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1476
			data |= IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1477
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1478
					   data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1479
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1480
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1481
		} else if (phy->smart_speed == e1000_smart_speed_off) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1482
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1483
					   &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1484
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1485
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1486
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1487
			data &= ~IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1488
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1489
					   data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1490
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1491
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1492
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1493
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1494
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1495
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1496
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1497
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1498
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1499
 *  e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1500
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1501
 *  @active: TRUE to enable LPLU, FALSE to disable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1502
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1503
 *  Sets the LPLU D3 state according to the active flag.  When
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1504
 *  activating LPLU this function also disables smart speed
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1505
 *  and vice versa.  LPLU will not be activated unless the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1506
 *  device autonegotiation advertisement meets standards of
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1507
 *  either 10 or 10/100 or 10/100/1000 at all duplexes.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1508
 *  This is a function pointer entry point only called by
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1509
 *  PHY setup routines.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1510
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1511
static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1512
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1513
	struct e1000_phy_info *phy = &hw->phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1514
	u32 phy_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1515
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1516
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1517
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1518
	phy_ctrl = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1519
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1520
	if (!active) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1521
		phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1522
		ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1523
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1524
		if (phy->type != e1000_phy_igp_3)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1525
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1526
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1527
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1528
		 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1529
		 * during Dx states where the power conservation is most
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1530
		 * important.  During driver activity we should enable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1531
		 * SmartSpeed, so performance is maintained.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1532
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1533
		if (phy->smart_speed == e1000_smart_speed_on) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1534
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1535
					   &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1536
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1537
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1538
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1539
			data |= IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1540
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1541
					   data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1542
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1543
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1544
		} else if (phy->smart_speed == e1000_smart_speed_off) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1545
			ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1546
					   &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1547
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1548
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1549
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1550
			data &= ~IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1551
			ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1552
					   data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1553
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1554
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1555
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1556
	} else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1557
		   (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1558
		   (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1559
		phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1560
		ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1561
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1562
		if (phy->type != e1000_phy_igp_3)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1563
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1564
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1565
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1566
		 * Call gig speed drop workaround on LPLU before accessing
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1567
		 * any PHY registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1568
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1569
		if (hw->mac.type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1570
			e1000e_gig_downshift_workaround_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1571
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1572
		/* When LPLU is enabled, we should disable SmartSpeed */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1573
		ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1574
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1575
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1576
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1577
		data &= ~IGP01E1000_PSCFR_SMART_SPEED;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1578
		ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1579
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1580
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1581
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1582
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1583
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1584
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1585
 *  e1000_valid_nvm_bank_detect_ich8lan - finds out the valid bank 0 or 1
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1586
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1587
 *  @bank:  pointer to the variable that returns the active bank
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1588
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1589
 *  Reads signature byte from the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1590
 *  Word 0x13 bits 15:14 = 10b indicate a valid signature for that bank.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1591
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1592
static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1593
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1594
	u32 eecd;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1595
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1596
	u32 bank1_offset = nvm->flash_bank_size * sizeof(u16);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1597
	u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1598
	u8 sig_byte = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1599
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1600
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1601
	switch (hw->mac.type) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1602
	case e1000_ich8lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1603
	case e1000_ich9lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1604
		eecd = er32(EECD);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1605
		if ((eecd & E1000_EECD_SEC1VAL_VALID_MASK) ==
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1606
		    E1000_EECD_SEC1VAL_VALID_MASK) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1607
			if (eecd & E1000_EECD_SEC1VAL)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1608
				*bank = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1609
			else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1610
				*bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1611
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1612
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1613
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1614
		hw_dbg(hw, "Unable to determine valid NVM bank via EEC - "
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1615
		       "reading flash signature\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1616
		/* fall-thru */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1617
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1618
		/* set bank to 0 in case flash read fails */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1619
		*bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1620
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1621
		/* Check bank 0 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1622
		ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1623
		                                        &sig_byte);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1624
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1625
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1626
		if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1627
		    E1000_ICH_NVM_SIG_VALUE) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1628
			*bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1629
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1630
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1631
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1632
		/* Check bank 1 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1633
		ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset +
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1634
		                                        bank1_offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1635
		                                        &sig_byte);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1636
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1637
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1638
		if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1639
		    E1000_ICH_NVM_SIG_VALUE) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1640
			*bank = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1641
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1642
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1643
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1644
		hw_dbg(hw, "ERROR: No valid NVM bank present\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1645
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1646
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1647
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1648
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1649
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1650
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1651
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1652
 *  e1000_read_nvm_ich8lan - Read word(s) from the NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1653
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1654
 *  @offset: The offset (in bytes) of the word(s) to read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1655
 *  @words: Size of data to read in words
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1656
 *  @data: Pointer to the word(s) to read at offset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1657
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1658
 *  Reads a word(s) from the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1659
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1660
static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1661
				  u16 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1662
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1663
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1664
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1665
	u32 act_offset;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1666
	s32 ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1667
	u32 bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1668
	u16 i, word;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1669
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1670
	if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1671
	    (words == 0)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1672
		hw_dbg(hw, "nvm parameter(s) out of bounds\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1673
		ret_val = -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1674
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1675
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1676
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1677
	nvm->ops.acquire_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1678
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1679
	ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1680
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1681
		hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1682
		bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1683
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1684
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1685
	act_offset = (bank) ? nvm->flash_bank_size : 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1686
	act_offset += offset;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1687
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1688
	ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1689
	for (i = 0; i < words; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1690
		if ((dev_spec->shadow_ram) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1691
		    (dev_spec->shadow_ram[offset+i].modified)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1692
			data[i] = dev_spec->shadow_ram[offset+i].value;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1693
		} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1694
			ret_val = e1000_read_flash_word_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1695
								act_offset + i,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1696
								&word);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1697
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1698
				break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1699
			data[i] = word;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1700
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1701
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1702
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1703
	nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1704
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1705
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1706
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1707
		hw_dbg(hw, "NVM read error: %d\n", ret_val);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1708
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1709
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1710
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1711
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1712
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1713
 *  e1000_flash_cycle_init_ich8lan - Initialize flash
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1714
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1715
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1716
 *  This function does initial flash setup so that a new read/write/erase cycle
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1717
 *  can be started.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1718
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1719
static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1720
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1721
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1722
	s32 ret_val = -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1723
	s32 i = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1724
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1725
	hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1726
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1727
	/* Check if the flash descriptor is valid */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1728
	if (hsfsts.hsf_status.fldesvalid == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1729
		hw_dbg(hw, "Flash descriptor invalid.  "
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1730
			 "SW Sequencing must be used.");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1731
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1732
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1733
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1734
	/* Clear FCERR and DAEL in hw status by writing 1 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1735
	hsfsts.hsf_status.flcerr = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1736
	hsfsts.hsf_status.dael = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1737
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1738
	ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1739
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1740
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1741
	 * Either we should have a hardware SPI cycle in progress
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1742
	 * bit to check against, in order to start a new cycle or
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1743
	 * FDONE bit should be changed in the hardware so that it
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1744
	 * is 1 after hardware reset, which can then be used as an
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1745
	 * indication whether a cycle is in progress or has been
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1746
	 * completed.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1747
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1748
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1749
	if (hsfsts.hsf_status.flcinprog == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1750
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1751
		 * There is no cycle running at present,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1752
		 * so we can start a cycle
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1753
		 * Begin by setting Flash Cycle Done.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1754
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1755
		hsfsts.hsf_status.flcdone = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1756
		ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1757
		ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1758
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1759
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1760
		 * otherwise poll for sometime so the current
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1761
		 * cycle has a chance to end before giving up.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1762
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1763
		for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1764
			hsfsts.regval = __er16flash(hw, ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1765
			if (hsfsts.hsf_status.flcinprog == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1766
				ret_val = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1767
				break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1768
			}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1769
			udelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1770
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1771
		if (ret_val == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1772
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1773
			 * Successful in waiting for previous cycle to timeout,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1774
			 * now set the Flash Cycle Done.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1775
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1776
			hsfsts.hsf_status.flcdone = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1777
			ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1778
		} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1779
			hw_dbg(hw, "Flash controller busy, cannot get access");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1780
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1781
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1782
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1783
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1784
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1785
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1786
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1787
 *  e1000_flash_cycle_ich8lan - Starts flash cycle (read/write/erase)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1788
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1789
 *  @timeout: maximum time to wait for completion
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1790
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1791
 *  This function starts a flash cycle and waits for its completion.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1792
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1793
static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1794
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1795
	union ich8_hws_flash_ctrl hsflctl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1796
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1797
	s32 ret_val = -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1798
	u32 i = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1799
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1800
	/* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1801
	hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1802
	hsflctl.hsf_ctrl.flcgo = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1803
	ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1804
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1805
	/* wait till FDONE bit is set to 1 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1806
	do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1807
		hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1808
		if (hsfsts.hsf_status.flcdone == 1)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1809
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1810
		udelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1811
	} while (i++ < timeout);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1812
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1813
	if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1814
		return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1815
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1816
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1817
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1818
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1819
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1820
 *  e1000_read_flash_word_ich8lan - Read word from flash
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1821
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1822
 *  @offset: offset to data location
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1823
 *  @data: pointer to the location for storing the data
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1824
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1825
 *  Reads the flash word at offset into data.  Offset is converted
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1826
 *  to bytes before read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1827
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1828
static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1829
					 u16 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1830
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1831
	/* Must convert offset into bytes. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1832
	offset <<= 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1833
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1834
	return e1000_read_flash_data_ich8lan(hw, offset, 2, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1835
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1836
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1837
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1838
 *  e1000_read_flash_byte_ich8lan - Read byte from flash
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1839
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1840
 *  @offset: The offset of the byte to read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1841
 *  @data: Pointer to a byte to store the value read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1842
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1843
 *  Reads a single byte from the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1844
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1845
static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1846
					 u8 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1847
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1848
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1849
	u16 word = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1850
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1851
	ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1852
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1853
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1854
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1855
	*data = (u8)word;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1856
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1857
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1858
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1859
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1860
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1861
 *  e1000_read_flash_data_ich8lan - Read byte or word from NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1862
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1863
 *  @offset: The offset (in bytes) of the byte or word to read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1864
 *  @size: Size of data to read, 1=byte 2=word
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1865
 *  @data: Pointer to the word to store the value read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1866
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1867
 *  Reads a byte or word from the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1868
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1869
static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1870
					 u8 size, u16 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1871
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1872
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1873
	union ich8_hws_flash_ctrl hsflctl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1874
	u32 flash_linear_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1875
	u32 flash_data = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1876
	s32 ret_val = -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1877
	u8 count = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1878
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1879
	if (size < 1  || size > 2 || offset > ICH_FLASH_LINEAR_ADDR_MASK)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1880
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1881
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1882
	flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) +
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1883
			    hw->nvm.flash_base_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1884
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1885
	do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1886
		udelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1887
		/* Steps */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1888
		ret_val = e1000_flash_cycle_init_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1889
		if (ret_val != 0)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1890
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1891
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1892
		hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1893
		/* 0b/1b corresponds to 1 or 2 byte size, respectively. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1894
		hsflctl.hsf_ctrl.fldbcount = size - 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1895
		hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_READ;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1896
		ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1897
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1898
		ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1899
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1900
		ret_val = e1000_flash_cycle_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1901
						ICH_FLASH_READ_COMMAND_TIMEOUT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1902
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1903
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1904
		 * Check if FCERR is set to 1, if set to 1, clear it
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1905
		 * and try the whole sequence a few more times, else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1906
		 * read in (shift in) the Flash Data0, the order is
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1907
		 * least significant byte first msb to lsb
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1908
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1909
		if (ret_val == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1910
			flash_data = er32flash(ICH_FLASH_FDATA0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1911
			if (size == 1) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1912
				*data = (u8)(flash_data & 0x000000FF);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1913
			} else if (size == 2) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1914
				*data = (u16)(flash_data & 0x0000FFFF);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1915
			}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1916
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1917
		} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1918
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1919
			 * If we've gotten here, then things are probably
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1920
			 * completely hosed, but if the error condition is
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1921
			 * detected, it won't hurt to give it another try...
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1922
			 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1923
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1924
			hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1925
			if (hsfsts.hsf_status.flcerr == 1) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1926
				/* Repeat for some time before giving up. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1927
				continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1928
			} else if (hsfsts.hsf_status.flcdone == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1929
				hw_dbg(hw, "Timeout error - flash cycle "
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1930
					 "did not complete.");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1931
				break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1932
			}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1933
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1934
	} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1935
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1936
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1937
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1938
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1939
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1940
 *  e1000_write_nvm_ich8lan - Write word(s) to the NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1941
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1942
 *  @offset: The offset (in bytes) of the word(s) to write.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1943
 *  @words: Size of data to write in words
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1944
 *  @data: Pointer to the word(s) to write at offset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1945
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1946
 *  Writes a byte or word to the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1947
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1948
static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1949
				   u16 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1950
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1951
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1952
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1953
	u16 i;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1954
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1955
	if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1956
	    (words == 0)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1957
		hw_dbg(hw, "nvm parameter(s) out of bounds\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1958
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1959
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1960
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1961
	nvm->ops.acquire_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1962
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1963
	for (i = 0; i < words; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1964
		dev_spec->shadow_ram[offset+i].modified = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1965
		dev_spec->shadow_ram[offset+i].value = data[i];
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1966
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1967
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1968
	nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1969
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1970
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1971
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1972
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1973
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1974
 *  e1000_update_nvm_checksum_ich8lan - Update the checksum for NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1975
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1976
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1977
 *  The NVM checksum is updated by calling the generic update_nvm_checksum,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1978
 *  which writes the checksum to the shadow ram.  The changes in the shadow
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1979
 *  ram are then committed to the EEPROM by processing each bank at a time
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1980
 *  checking for the modified bit and writing only the pending changes.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1981
 *  After a successful commit, the shadow ram is cleared and is ready for
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1982
 *  future writes.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1983
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1984
static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1985
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1986
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1987
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1988
	u32 i, act_offset, new_bank_offset, old_bank_offset, bank;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1989
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1990
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1991
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1992
	ret_val = e1000e_update_nvm_checksum_generic(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1993
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1994
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1995
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1996
	if (nvm->type != e1000_nvm_flash_sw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1997
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1998
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1999
	nvm->ops.acquire_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2000
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2001
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2002
	 * We're writing to the opposite bank so if we're on bank 1,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2003
	 * write to bank 0 etc.  We also need to erase the segment that
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2004
	 * is going to be written
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2005
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2006
	ret_val =  e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2007
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2008
		hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2009
		bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2010
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2011
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2012
	if (bank == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2013
		new_bank_offset = nvm->flash_bank_size;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2014
		old_bank_offset = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2015
		ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2016
		if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2017
			nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2018
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2019
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2020
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2021
		old_bank_offset = nvm->flash_bank_size;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2022
		new_bank_offset = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2023
		ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2024
		if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2025
			nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2026
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2027
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2028
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2029
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2030
	for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2031
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2032
		 * Determine whether to write the value stored
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2033
		 * in the other NVM bank or a modified value stored
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2034
		 * in the shadow RAM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2035
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2036
		if (dev_spec->shadow_ram[i].modified) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2037
			data = dev_spec->shadow_ram[i].value;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2038
		} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2039
			ret_val = e1000_read_flash_word_ich8lan(hw, i +
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2040
			                                        old_bank_offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2041
			                                        &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2042
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2043
				break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2044
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2045
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2046
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2047
		 * If the word is 0x13, then make sure the signature bits
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2048
		 * (15:14) are 11b until the commit has completed.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2049
		 * This will allow us to write 10b which indicates the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2050
		 * signature is valid.  We want to do this after the write
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2051
		 * has completed so that we don't mark the segment valid
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2052
		 * while the write is still in progress
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2053
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2054
		if (i == E1000_ICH_NVM_SIG_WORD)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2055
			data |= E1000_ICH_NVM_SIG_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2056
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2057
		/* Convert offset to bytes. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2058
		act_offset = (i + new_bank_offset) << 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2059
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2060
		udelay(100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2061
		/* Write the bytes to the new bank. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2062
		ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2063
							       act_offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2064
							       (u8)data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2065
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2066
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2067
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2068
		udelay(100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2069
		ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2070
							  act_offset + 1,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2071
							  (u8)(data >> 8));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2072
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2073
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2074
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2075
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2076
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2077
	 * Don't bother writing the segment valid bits if sector
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2078
	 * programming failed.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2079
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2080
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2081
		/* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2082
		hw_dbg(hw, "Flash commit failed.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2083
		nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2084
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2085
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2086
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2087
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2088
	 * Finally validate the new segment by setting bit 15:14
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2089
	 * to 10b in word 0x13 , this can be done without an
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2090
	 * erase as well since these bits are 11 to start with
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2091
	 * and we need to change bit 14 to 0b
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2092
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2093
	act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2094
	ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2095
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2096
		nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2097
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2098
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2099
	data &= 0xBFFF;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2100
	ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2101
						       act_offset * 2 + 1,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2102
						       (u8)(data >> 8));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2103
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2104
		nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2105
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2106
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2107
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2108
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2109
	 * And invalidate the previously valid segment by setting
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2110
	 * its signature word (0x13) high_byte to 0b. This can be
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2111
	 * done without an erase because flash erase sets all bits
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2112
	 * to 1's. We can write 1's to 0's without an erase
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2113
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2114
	act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2115
	ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2116
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2117
		nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2118
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2119
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2120
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2121
	/* Great!  Everything worked, we can now clear the cached entries. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2122
	for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2123
		dev_spec->shadow_ram[i].modified = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2124
		dev_spec->shadow_ram[i].value = 0xFFFF;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2125
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2126
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2127
	nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2128
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2129
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2130
	 * Reload the EEPROM, or else modifications will not appear
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2131
	 * until after the next adapter reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2132
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2133
	e1000e_reload_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2134
	msleep(10);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2135
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2136
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2137
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2138
		hw_dbg(hw, "NVM update error: %d\n", ret_val);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2139
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2140
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2141
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2142
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2143
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2144
 *  e1000_validate_nvm_checksum_ich8lan - Validate EEPROM checksum
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2145
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2146
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2147
 *  Check to see if checksum needs to be fixed by reading bit 6 in word 0x19.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2148
 *  If the bit is 0, that the EEPROM had been modified, but the checksum was not
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2149
 *  calculated, in which case we need to calculate the checksum and set bit 6.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2150
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2151
static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2152
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2153
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2154
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2155
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2156
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2157
	 * Read 0x19 and check bit 6.  If this bit is 0, the checksum
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2158
	 * needs to be fixed.  This bit is an indication that the NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2159
	 * was prepared by OEM software and did not calculate the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2160
	 * checksum...a likely scenario.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2161
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2162
	ret_val = e1000_read_nvm(hw, 0x19, 1, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2163
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2164
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2165
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2166
	if ((data & 0x40) == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2167
		data |= 0x40;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2168
		ret_val = e1000_write_nvm(hw, 0x19, 1, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2169
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2170
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2171
		ret_val = e1000e_update_nvm_checksum(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2172
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2173
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2174
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2175
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2176
	return e1000e_validate_nvm_checksum_generic(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2177
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2178
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2179
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2180
 *  e1000e_write_protect_nvm_ich8lan - Make the NVM read-only
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2181
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2182
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2183
 *  To prevent malicious write/erase of the NVM, set it to be read-only
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2184
 *  so that the hardware ignores all write/erase cycles of the NVM via
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2185
 *  the flash control registers.  The shadow-ram copy of the NVM will
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2186
 *  still be updated, however any updates to this copy will not stick
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2187
 *  across driver reloads.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2188
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2189
void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2190
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2191
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2192
	union ich8_flash_protected_range pr0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2193
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2194
	u32 gfpreg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2195
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2196
	nvm->ops.acquire_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2197
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2198
	gfpreg = er32flash(ICH_FLASH_GFPREG);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2199
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2200
	/* Write-protect GbE Sector of NVM */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2201
	pr0.regval = er32flash(ICH_FLASH_PR0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2202
	pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2203
	pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2204
	pr0.range.wpe = true;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2205
	ew32flash(ICH_FLASH_PR0, pr0.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2206
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2207
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2208
	 * Lock down a subset of GbE Flash Control Registers, e.g.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2209
	 * PR0 to prevent the write-protection from being lifted.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2210
	 * Once FLOCKDN is set, the registers protected by it cannot
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2211
	 * be written until FLOCKDN is cleared by a hardware reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2212
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2213
	hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2214
	hsfsts.hsf_status.flockdn = true;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2215
	ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2216
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2217
	nvm->ops.release_nvm(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2218
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2219
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2220
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2221
 *  e1000_write_flash_data_ich8lan - Writes bytes to the NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2222
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2223
 *  @offset: The offset (in bytes) of the byte/word to read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2224
 *  @size: Size of data to read, 1=byte 2=word
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2225
 *  @data: The byte(s) to write to the NVM.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2226
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2227
 *  Writes one/two bytes to the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2228
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2229
static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2230
					  u8 size, u16 data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2231
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2232
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2233
	union ich8_hws_flash_ctrl hsflctl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2234
	u32 flash_linear_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2235
	u32 flash_data = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2236
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2237
	u8 count = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2238
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2239
	if (size < 1 || size > 2 || data > size * 0xff ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2240
	    offset > ICH_FLASH_LINEAR_ADDR_MASK)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2241
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2242
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2243
	flash_linear_addr = (ICH_FLASH_LINEAR_ADDR_MASK & offset) +
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2244
			    hw->nvm.flash_base_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2245
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2246
	do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2247
		udelay(1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2248
		/* Steps */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2249
		ret_val = e1000_flash_cycle_init_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2250
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2251
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2252
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2253
		hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2254
		/* 0b/1b corresponds to 1 or 2 byte size, respectively. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2255
		hsflctl.hsf_ctrl.fldbcount = size -1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2256
		hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2257
		ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2258
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2259
		ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2260
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2261
		if (size == 1)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2262
			flash_data = (u32)data & 0x00FF;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2263
		else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2264
			flash_data = (u32)data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2265
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2266
		ew32flash(ICH_FLASH_FDATA0, flash_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2267
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2268
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2269
		 * check if FCERR is set to 1 , if set to 1, clear it
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2270
		 * and try the whole sequence a few more times else done
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2271
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2272
		ret_val = e1000_flash_cycle_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2273
					       ICH_FLASH_WRITE_COMMAND_TIMEOUT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2274
		if (!ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2275
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2276
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2277
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2278
		 * If we're here, then things are most likely
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2279
		 * completely hosed, but if the error condition
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2280
		 * is detected, it won't hurt to give it another
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2281
		 * try...ICH_FLASH_CYCLE_REPEAT_COUNT times.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2282
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2283
		hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2284
		if (hsfsts.hsf_status.flcerr == 1)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2285
			/* Repeat for some time before giving up. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2286
			continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2287
		if (hsfsts.hsf_status.flcdone == 0) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2288
			hw_dbg(hw, "Timeout error - flash cycle "
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2289
				 "did not complete.");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2290
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2291
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2292
	} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2293
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2294
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2295
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2296
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2297
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2298
 *  e1000_write_flash_byte_ich8lan - Write a single byte to NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2299
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2300
 *  @offset: The index of the byte to read.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2301
 *  @data: The byte to write to the NVM.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2302
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2303
 *  Writes a single byte to the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2304
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2305
static s32 e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2306
					  u8 data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2307
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2308
	u16 word = (u16)data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2309
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2310
	return e1000_write_flash_data_ich8lan(hw, offset, 1, word);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2311
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2312
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2313
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2314
 *  e1000_retry_write_flash_byte_ich8lan - Writes a single byte to NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2315
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2316
 *  @offset: The offset of the byte to write.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2317
 *  @byte: The byte to write to the NVM.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2318
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2319
 *  Writes a single byte to the NVM using the flash access registers.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2320
 *  Goes through a retry algorithm before giving up.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2321
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2322
static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2323
						u32 offset, u8 byte)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2324
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2325
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2326
	u16 program_retries;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2327
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2328
	ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2329
	if (!ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2330
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2331
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2332
	for (program_retries = 0; program_retries < 100; program_retries++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2333
		hw_dbg(hw, "Retrying Byte %2.2X at offset %u\n", byte, offset);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2334
		udelay(100);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2335
		ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2336
		if (!ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2337
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2338
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2339
	if (program_retries == 100)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2340
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2341
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2342
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2343
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2344
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2345
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2346
 *  e1000_erase_flash_bank_ich8lan - Erase a bank (4k) from NVM
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2347
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2348
 *  @bank: 0 for first bank, 1 for second bank, etc.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2349
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2350
 *  Erases the bank specified. Each bank is a 4k block. Banks are 0 based.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2351
 *  bank N is 4096 * N + flash_reg_addr.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2352
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2353
static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2354
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2355
	struct e1000_nvm_info *nvm = &hw->nvm;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2356
	union ich8_hws_flash_status hsfsts;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2357
	union ich8_hws_flash_ctrl hsflctl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2358
	u32 flash_linear_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2359
	/* bank size is in 16bit words - adjust to bytes */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2360
	u32 flash_bank_size = nvm->flash_bank_size * 2;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2361
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2362
	s32 count = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2363
	s32 iteration;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2364
	s32 sector_size;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2365
	s32 j;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2366
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2367
	hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2368
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2369
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2370
	 * Determine HW Sector size: Read BERASE bits of hw flash status
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2371
	 * register
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2372
	 * 00: The Hw sector is 256 bytes, hence we need to erase 16
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2373
	 *     consecutive sectors.  The start index for the nth Hw sector
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2374
	 *     can be calculated as = bank * 4096 + n * 256
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2375
	 * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2376
	 *     The start index for the nth Hw sector can be calculated
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2377
	 *     as = bank * 4096
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2378
	 * 10: The Hw sector is 8K bytes, nth sector = bank * 8192
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2379
	 *     (ich9 only, otherwise error condition)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2380
	 * 11: The Hw sector is 64K bytes, nth sector = bank * 65536
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2381
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2382
	switch (hsfsts.hsf_status.berasesz) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2383
	case 0:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2384
		/* Hw sector size 256 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2385
		sector_size = ICH_FLASH_SEG_SIZE_256;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2386
		iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_256;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2387
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2388
	case 1:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2389
		sector_size = ICH_FLASH_SEG_SIZE_4K;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2390
		iteration = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2391
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2392
	case 2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2393
		sector_size = ICH_FLASH_SEG_SIZE_8K;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2394
		iteration = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2395
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2396
	case 3:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2397
		sector_size = ICH_FLASH_SEG_SIZE_64K;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2398
		iteration = 1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2399
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2400
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2401
		return -E1000_ERR_NVM;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2402
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2403
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2404
	/* Start with the base address, then add the sector offset. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2405
	flash_linear_addr = hw->nvm.flash_base_addr;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2406
	flash_linear_addr += (bank) ? flash_bank_size : 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2407
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2408
	for (j = 0; j < iteration ; j++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2409
		do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2410
			/* Steps */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2411
			ret_val = e1000_flash_cycle_init_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2412
			if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2413
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2414
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2415
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2416
			 * Write a value 11 (block Erase) in Flash
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2417
			 * Cycle field in hw flash control
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2418
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2419
			hsflctl.regval = er16flash(ICH_FLASH_HSFCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2420
			hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2421
			ew16flash(ICH_FLASH_HSFCTL, hsflctl.regval);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2422
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2423
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2424
			 * Write the last 24 bits of an index within the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2425
			 * block into Flash Linear address field in Flash
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2426
			 * Address.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2427
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2428
			flash_linear_addr += (j * sector_size);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2429
			ew32flash(ICH_FLASH_FADDR, flash_linear_addr);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2430
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2431
			ret_val = e1000_flash_cycle_ich8lan(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2432
					       ICH_FLASH_ERASE_COMMAND_TIMEOUT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2433
			if (ret_val == 0)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2434
				break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2435
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2436
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2437
			 * Check if FCERR is set to 1.  If 1,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2438
			 * clear it and try the whole sequence
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2439
			 * a few more times else Done
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2440
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2441
			hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2442
			if (hsfsts.hsf_status.flcerr == 1)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2443
				/* repeat for some time before giving up */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2444
				continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2445
			else if (hsfsts.hsf_status.flcdone == 0)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2446
				return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2447
		} while (++count < ICH_FLASH_CYCLE_REPEAT_COUNT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2448
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2449
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2450
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2451
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2452
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2453
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2454
 *  e1000_valid_led_default_ich8lan - Set the default LED settings
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2455
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2456
 *  @data: Pointer to the LED settings
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2457
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2458
 *  Reads the LED default settings from the NVM to data.  If the NVM LED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2459
 *  settings is all 0's or F's, set the LED default to a valid LED default
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2460
 *  setting.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2461
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2462
static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2463
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2464
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2465
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2466
	ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2467
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2468
		hw_dbg(hw, "NVM Read Error\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2469
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2470
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2471
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2472
	if (*data == ID_LED_RESERVED_0000 ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2473
	    *data == ID_LED_RESERVED_FFFF)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2474
		*data = ID_LED_DEFAULT_ICH8LAN;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2475
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2476
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2477
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2478
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2479
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2480
 *  e1000_id_led_init_pchlan - store LED configurations
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2481
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2482
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2483
 *  PCH does not control LEDs via the LEDCTL register, rather it uses
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2484
 *  the PHY LED configuration register.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2485
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2486
 *  PCH also does not have an "always on" or "always off" mode which
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2487
 *  complicates the ID feature.  Instead of using the "on" mode to indicate
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2488
 *  in ledctl_mode2 the LEDs to use for ID (see e1000e_id_led_init()),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2489
 *  use "link_up" mode.  The LEDs will still ID on request if there is no
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2490
 *  link based on logic in e1000_led_[on|off]_pchlan().
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2491
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2492
static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2493
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2494
	struct e1000_mac_info *mac = &hw->mac;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2495
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2496
	const u32 ledctl_on = E1000_LEDCTL_MODE_LINK_UP;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2497
	const u32 ledctl_off = E1000_LEDCTL_MODE_LINK_UP | E1000_PHY_LED0_IVRT;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2498
	u16 data, i, temp, shift;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2499
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2500
	/* Get default ID LED modes */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2501
	ret_val = hw->nvm.ops.valid_led_default(hw, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2502
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2503
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2504
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2505
	mac->ledctl_default = er32(LEDCTL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2506
	mac->ledctl_mode1 = mac->ledctl_default;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2507
	mac->ledctl_mode2 = mac->ledctl_default;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2508
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2509
	for (i = 0; i < 4; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2510
		temp = (data >> (i << 2)) & E1000_LEDCTL_LED0_MODE_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2511
		shift = (i * 5);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2512
		switch (temp) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2513
		case ID_LED_ON1_DEF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2514
		case ID_LED_ON1_ON2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2515
		case ID_LED_ON1_OFF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2516
			mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2517
			mac->ledctl_mode1 |= (ledctl_on << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2518
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2519
		case ID_LED_OFF1_DEF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2520
		case ID_LED_OFF1_ON2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2521
		case ID_LED_OFF1_OFF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2522
			mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2523
			mac->ledctl_mode1 |= (ledctl_off << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2524
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2525
		default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2526
			/* Do nothing */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2527
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2528
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2529
		switch (temp) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2530
		case ID_LED_DEF1_ON2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2531
		case ID_LED_ON1_ON2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2532
		case ID_LED_OFF1_ON2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2533
			mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2534
			mac->ledctl_mode2 |= (ledctl_on << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2535
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2536
		case ID_LED_DEF1_OFF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2537
		case ID_LED_ON1_OFF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2538
		case ID_LED_OFF1_OFF2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2539
			mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2540
			mac->ledctl_mode2 |= (ledctl_off << shift);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2541
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2542
		default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2543
			/* Do nothing */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2544
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2545
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2546
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2547
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2548
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2549
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2550
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2551
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2552
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2553
 *  e1000_get_bus_info_ich8lan - Get/Set the bus type and width
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2554
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2555
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2556
 *  ICH8 use the PCI Express bus, but does not contain a PCI Express Capability
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2557
 *  register, so the the bus width is hard coded.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2558
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2559
static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2560
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2561
	struct e1000_bus_info *bus = &hw->bus;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2562
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2563
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2564
	ret_val = e1000e_get_bus_info_pcie(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2565
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2566
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2567
	 * ICH devices are "PCI Express"-ish.  They have
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2568
	 * a configuration space, but do not contain
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2569
	 * PCI Express Capability registers, so bus width
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2570
	 * must be hardcoded.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2571
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2572
	if (bus->width == e1000_bus_width_unknown)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2573
		bus->width = e1000_bus_width_pcie_x1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2574
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2575
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2576
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2577
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2578
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2579
 *  e1000_reset_hw_ich8lan - Reset the hardware
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2580
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2581
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2582
 *  Does a full reset of the hardware which includes a reset of the PHY and
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2583
 *  MAC.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2584
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2585
static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2586
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2587
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2588
	u16 reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2589
	u32 ctrl, icr, kab;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2590
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2591
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2592
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2593
	 * Prevent the PCI-E bus from sticking if there is no TLP connection
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2594
	 * on the last TLP read/write transaction when MAC is reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2595
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2596
	ret_val = e1000e_disable_pcie_master(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2597
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2598
		hw_dbg(hw, "PCI-E Master disable polling has failed.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2599
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2600
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2601
	hw_dbg(hw, "Masking off all interrupts\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2602
	ew32(IMC, 0xffffffff);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2603
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2604
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2605
	 * Disable the Transmit and Receive units.  Then delay to allow
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2606
	 * any pending transactions to complete before we hit the MAC
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2607
	 * with the global reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2608
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2609
	ew32(RCTL, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2610
	ew32(TCTL, E1000_TCTL_PSP);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2611
	e1e_flush();
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2612
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2613
	msleep(10);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2614
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2615
	/* Workaround for ICH8 bit corruption issue in FIFO memory */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2616
	if (hw->mac.type == e1000_ich8lan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2617
		/* Set Tx and Rx buffer allocation to 8k apiece. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2618
		ew32(PBA, E1000_PBA_8K);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2619
		/* Set Packet Buffer Size to 16k. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2620
		ew32(PBS, E1000_PBS_16K);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2621
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2622
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2623
	if (hw->mac.type == e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2624
		/* Save the NVM K1 bit setting*/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2625
		ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, &reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2626
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2627
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2628
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2629
		if (reg & E1000_NVM_K1_ENABLE)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2630
			dev_spec->nvm_k1_enabled = true;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2631
		else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2632
			dev_spec->nvm_k1_enabled = false;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2633
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2634
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2635
	ctrl = er32(CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2636
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2637
	if (!e1000_check_reset_block(hw)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2638
		/* Clear PHY Reset Asserted bit */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2639
		if (hw->mac.type >= e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2640
			u32 status = er32(STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2641
			ew32(STATUS, status & ~E1000_STATUS_PHYRA);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2642
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2643
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2644
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2645
		 * PHY HW reset requires MAC CORE reset at the same
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2646
		 * time to make sure the interface between MAC and the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2647
		 * external PHY is reset.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2648
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2649
		ctrl |= E1000_CTRL_PHY_RST;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2650
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2651
	ret_val = e1000_acquire_swflag_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2652
	/* Whether or not the swflag was acquired, we need to reset the part */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2653
	hw_dbg(hw, "Issuing a global reset to ich8lan\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2654
	ew32(CTRL, (ctrl | E1000_CTRL_RST));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2655
	msleep(20);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2656
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2657
	if (!ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2658
		e1000_release_swflag_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2659
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2660
	if (ctrl & E1000_CTRL_PHY_RST)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2661
		ret_val = hw->phy.ops.get_cfg_done(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2662
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2663
	if (hw->mac.type >= e1000_ich10lan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2664
		e1000_lan_init_done_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2665
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2666
		ret_val = e1000e_get_auto_rd_done(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2667
		if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2668
			/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2669
			 * When auto config read does not complete, do not
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2670
			 * return with an error. This can happen in situations
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2671
			 * where there is no eeprom and prevents getting link.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2672
			 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2673
			hw_dbg(hw, "Auto Read Done did not complete\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2674
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2675
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2676
	/* Dummy read to clear the phy wakeup bit after lcd reset */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2677
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2678
		e1e_rphy(hw, BM_WUC, &reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2679
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2680
	ret_val = e1000_sw_lcd_config_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2681
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2682
		goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2683
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2684
	if (hw->mac.type == e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2685
		ret_val = e1000_oem_bits_config_ich8lan(hw, true);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2686
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2687
			goto out;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2688
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2689
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2690
	 * For PCH, this write will make sure that any noise
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2691
	 * will be detected as a CRC error and be dropped rather than show up
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2692
	 * as a bad packet to the DMA engine.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2693
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2694
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2695
		ew32(CRC_OFFSET, 0x65656565);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2696
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2697
	ew32(IMC, 0xffffffff);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2698
	icr = er32(ICR);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2699
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2700
	kab = er32(KABGTXD);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2701
	kab |= E1000_KABGTXD_BGSQLBIAS;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2702
	ew32(KABGTXD, kab);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2703
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2704
	if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2705
		ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2706
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2707
out:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2708
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2709
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2710
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2711
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2712
 *  e1000_init_hw_ich8lan - Initialize the hardware
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2713
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2714
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2715
 *  Prepares the hardware for transmit and receive by doing the following:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2716
 *   - initialize hardware bits
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2717
 *   - initialize LED identification
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2718
 *   - setup receive address registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2719
 *   - setup flow control
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2720
 *   - setup transmit descriptors
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2721
 *   - clear statistics
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2722
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2723
static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2724
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2725
	struct e1000_mac_info *mac = &hw->mac;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2726
	u32 ctrl_ext, txdctl, snoop;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2727
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2728
	u16 i;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2729
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2730
	e1000_initialize_hw_bits_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2731
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2732
	/* Initialize identification LED */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2733
	ret_val = mac->ops.id_led_init(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2734
	if (ret_val) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2735
		hw_dbg(hw, "Error initializing identification LED\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2736
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2737
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2738
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2739
	/* Setup the receive address. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2740
	e1000e_init_rx_addrs(hw, mac->rar_entry_count);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2741
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2742
	/* Zero out the Multicast HASH table */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2743
	hw_dbg(hw, "Zeroing the MTA\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2744
	for (i = 0; i < mac->mta_reg_count; i++)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2745
		E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2746
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2747
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2748
	 * The 82578 Rx buffer will stall if wakeup is enabled in host and
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2749
	 * the ME.  Reading the BM_WUC register will clear the host wakeup bit.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2750
	 * Reset the phy after disabling host wakeup to reset the Rx buffer.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2751
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2752
	if (hw->phy.type == e1000_phy_82578) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2753
		hw->phy.ops.read_phy_reg(hw, BM_WUC, &i);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2754
		ret_val = e1000_phy_hw_reset_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2755
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2756
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2757
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2758
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2759
	/* Setup link and flow control */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2760
	ret_val = e1000_setup_link_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2761
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2762
	/* Set the transmit descriptor write-back policy for both queues */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2763
	txdctl = er32(TXDCTL(0));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2764
	txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2765
		 E1000_TXDCTL_FULL_TX_DESC_WB;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2766
	txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2767
		 E1000_TXDCTL_MAX_TX_DESC_PREFETCH;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2768
	ew32(TXDCTL(0), txdctl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2769
	txdctl = er32(TXDCTL(1));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2770
	txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2771
		 E1000_TXDCTL_FULL_TX_DESC_WB;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2772
	txdctl = (txdctl & ~E1000_TXDCTL_PTHRESH) |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2773
		 E1000_TXDCTL_MAX_TX_DESC_PREFETCH;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2774
	ew32(TXDCTL(1), txdctl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2775
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2776
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2777
	 * ICH8 has opposite polarity of no_snoop bits.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2778
	 * By default, we should use snoop behavior.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2779
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2780
	if (mac->type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2781
		snoop = PCIE_ICH8_SNOOP_ALL;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2782
	else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2783
		snoop = (u32) ~(PCIE_NO_SNOOP_ALL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2784
	e1000e_set_pcie_no_snoop(hw, snoop);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2785
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2786
	ctrl_ext = er32(CTRL_EXT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2787
	ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2788
	ew32(CTRL_EXT, ctrl_ext);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2789
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2790
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2791
	 * Clear all of the statistics registers (clear on read).  It is
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2792
	 * important that we do this after we have tried to establish link
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2793
	 * because the symbol error count will increment wildly if there
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2794
	 * is no link.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2795
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2796
	e1000_clear_hw_cntrs_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2797
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2798
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2799
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2800
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2801
 *  e1000_initialize_hw_bits_ich8lan - Initialize required hardware bits
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2802
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2803
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2804
 *  Sets/Clears required hardware bits necessary for correctly setting up the
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2805
 *  hardware for transmit and receive.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2806
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2807
static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2808
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2809
	u32 reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2810
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2811
	/* Extended Device Control */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2812
	reg = er32(CTRL_EXT);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2813
	reg |= (1 << 22);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2814
	/* Enable PHY low-power state when MAC is at D3 w/o WoL */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2815
	if (hw->mac.type >= e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2816
		reg |= E1000_CTRL_EXT_PHYPDEN;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2817
	ew32(CTRL_EXT, reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2818
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2819
	/* Transmit Descriptor Control 0 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2820
	reg = er32(TXDCTL(0));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2821
	reg |= (1 << 22);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2822
	ew32(TXDCTL(0), reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2823
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2824
	/* Transmit Descriptor Control 1 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2825
	reg = er32(TXDCTL(1));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2826
	reg |= (1 << 22);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2827
	ew32(TXDCTL(1), reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2828
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2829
	/* Transmit Arbitration Control 0 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2830
	reg = er32(TARC(0));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2831
	if (hw->mac.type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2832
		reg |= (1 << 28) | (1 << 29);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2833
	reg |= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2834
	ew32(TARC(0), reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2835
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2836
	/* Transmit Arbitration Control 1 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2837
	reg = er32(TARC(1));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2838
	if (er32(TCTL) & E1000_TCTL_MULR)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2839
		reg &= ~(1 << 28);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2840
	else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2841
		reg |= (1 << 28);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2842
	reg |= (1 << 24) | (1 << 26) | (1 << 30);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2843
	ew32(TARC(1), reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2844
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2845
	/* Device Status */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2846
	if (hw->mac.type == e1000_ich8lan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2847
		reg = er32(STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2848
		reg &= ~(1 << 31);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2849
		ew32(STATUS, reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2850
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2851
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2852
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2853
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2854
 *  e1000_setup_link_ich8lan - Setup flow control and link settings
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2855
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2856
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2857
 *  Determines which flow control settings to use, then configures flow
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2858
 *  control.  Calls the appropriate media-specific link configuration
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2859
 *  function.  Assuming the adapter has a valid link partner, a valid link
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2860
 *  should be established.  Assumes the hardware has previously been reset
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2861
 *  and the transmitter and receiver are not enabled.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2862
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2863
static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2864
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2865
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2866
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2867
	if (e1000_check_reset_block(hw))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2868
		return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2869
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2870
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2871
	 * ICH parts do not have a word in the NVM to determine
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2872
	 * the default flow control setting, so we explicitly
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2873
	 * set it to full.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2874
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2875
	if (hw->fc.requested_mode == e1000_fc_default) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2876
		/* Workaround h/w hang when Tx flow control enabled */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2877
		if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2878
			hw->fc.requested_mode = e1000_fc_rx_pause;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2879
		else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2880
			hw->fc.requested_mode = e1000_fc_full;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2881
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2882
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2883
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2884
	 * Save off the requested flow control mode for use later.  Depending
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2885
	 * on the link partner's capabilities, we may or may not use this mode.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2886
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2887
	hw->fc.current_mode = hw->fc.requested_mode;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2888
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2889
	hw_dbg(hw, "After fix-ups FlowControl is now = %x\n",
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2890
		hw->fc.current_mode);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2891
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2892
	/* Continue to configure the copper link. */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2893
	ret_val = e1000_setup_copper_link_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2894
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2895
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2896
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2897
	ew32(FCTTV, hw->fc.pause_time);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2898
	if ((hw->phy.type == e1000_phy_82578) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2899
	    (hw->phy.type == e1000_phy_82577)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2900
		ret_val = hw->phy.ops.write_phy_reg(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2901
		                             PHY_REG(BM_PORT_CTRL_PAGE, 27),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2902
		                             hw->fc.pause_time);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2903
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2904
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2905
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2906
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2907
	return e1000e_set_fc_watermarks(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2908
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2909
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2910
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2911
 *  e1000_setup_copper_link_ich8lan - Configure MAC/PHY interface
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2912
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2913
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2914
 *  Configures the kumeran interface to the PHY to wait the appropriate time
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2915
 *  when polling the PHY, then call the generic setup_copper_link to finish
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2916
 *  configuring the copper link.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2917
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2918
static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2919
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2920
	u32 ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2921
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2922
	u16 reg_data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2923
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2924
	ctrl = er32(CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2925
	ctrl |= E1000_CTRL_SLU;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2926
	ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2927
	ew32(CTRL, ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2928
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2929
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2930
	 * Set the mac to wait the maximum time between each iteration
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2931
	 * and increase the max iterations when polling the phy;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2932
	 * this fixes erroneous timeouts at 10Mbps.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2933
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2934
	ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2935
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2936
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2937
	ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), &reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2938
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2939
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2940
	reg_data |= 0x3F;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2941
	ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2942
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2943
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2944
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2945
	switch (hw->phy.type) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2946
	case e1000_phy_igp_3:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2947
		ret_val = e1000e_copper_link_setup_igp(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2948
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2949
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2950
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2951
	case e1000_phy_bm:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2952
	case e1000_phy_82578:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2953
		ret_val = e1000e_copper_link_setup_m88(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2954
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2955
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2956
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2957
	case e1000_phy_82577:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2958
		ret_val = e1000_copper_link_setup_82577(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2959
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2960
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2961
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2962
	case e1000_phy_ife:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2963
		ret_val = hw->phy.ops.read_phy_reg(hw, IFE_PHY_MDIX_CONTROL,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2964
		                               &reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2965
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2966
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2967
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2968
		reg_data &= ~IFE_PMC_AUTO_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2969
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2970
		switch (hw->phy.mdix) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2971
		case 1:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2972
			reg_data &= ~IFE_PMC_FORCE_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2973
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2974
		case 2:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2975
			reg_data |= IFE_PMC_FORCE_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2976
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2977
		case 0:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2978
		default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2979
			reg_data |= IFE_PMC_AUTO_MDIX;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2980
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2981
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2982
		ret_val = hw->phy.ops.write_phy_reg(hw, IFE_PHY_MDIX_CONTROL,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2983
		                                reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2984
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2985
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2986
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2987
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2988
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2989
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2990
	return e1000e_setup_copper_link(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2991
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2992
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2993
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2994
 *  e1000_get_link_up_info_ich8lan - Get current link speed and duplex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2995
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2996
 *  @speed: pointer to store current link speed
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2997
 *  @duplex: pointer to store the current link duplex
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2998
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  2999
 *  Calls the generic get_speed_and_duplex to retrieve the current link
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3000
 *  information and then calls the Kumeran lock loss workaround for links at
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3001
 *  gigabit speeds.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3002
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3003
static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3004
					  u16 *duplex)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3005
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3006
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3007
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3008
	ret_val = e1000e_get_speed_and_duplex_copper(hw, speed, duplex);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3009
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3010
		return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3011
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3012
	if ((hw->mac.type == e1000_ich8lan) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3013
	    (hw->phy.type == e1000_phy_igp_3) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3014
	    (*speed == SPEED_1000)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3015
		ret_val = e1000_kmrn_lock_loss_workaround_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3016
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3017
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3018
	return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3019
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3020
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3021
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3022
 *  e1000_kmrn_lock_loss_workaround_ich8lan - Kumeran workaround
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3023
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3024
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3025
 *  Work-around for 82566 Kumeran PCS lock loss:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3026
 *  On link status change (i.e. PCI reset, speed change) and link is up and
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3027
 *  speed is gigabit-
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3028
 *    0) if workaround is optionally disabled do nothing
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3029
 *    1) wait 1ms for Kumeran link to come up
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3030
 *    2) check Kumeran Diagnostic register PCS lock loss bit
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3031
 *    3) if not set the link is locked (all is good), otherwise...
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3032
 *    4) reset the PHY
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3033
 *    5) repeat up to 10 times
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3034
 *  Note: this is only called for IGP3 copper when speed is 1gb.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3035
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3036
static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3037
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3038
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3039
	u32 phy_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3040
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3041
	u16 i, data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3042
	bool link;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3043
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3044
	if (!dev_spec->kmrn_lock_loss_workaround_enabled)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3045
		return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3046
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3047
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3048
	 * Make sure link is up before proceeding.  If not just return.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3049
	 * Attempting this while link is negotiating fouled up link
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3050
	 * stability
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3051
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3052
	ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3053
	if (!link)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3054
		return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3055
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3056
	for (i = 0; i < 10; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3057
		/* read once to clear */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3058
		ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3059
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3060
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3061
		/* and again to get new status */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3062
		ret_val = e1e_rphy(hw, IGP3_KMRN_DIAG, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3063
		if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3064
			return ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3065
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3066
		/* check for PCS lock */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3067
		if (!(data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3068
			return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3069
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3070
		/* Issue PHY reset */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3071
		e1000_phy_hw_reset(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3072
		mdelay(5);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3073
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3074
	/* Disable GigE link negotiation */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3075
	phy_ctrl = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3076
	phy_ctrl |= (E1000_PHY_CTRL_GBE_DISABLE |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3077
		     E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3078
	ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3079
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3080
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3081
	 * Call gig speed drop workaround on Gig disable before accessing
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3082
	 * any PHY registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3083
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3084
	e1000e_gig_downshift_workaround_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3085
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3086
	/* unable to acquire PCS lock */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3087
	return -E1000_ERR_PHY;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3088
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3089
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3090
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3091
 *  e1000_set_kmrn_lock_loss_workaround_ich8lan - Set Kumeran workaround state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3092
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3093
 *  @state: boolean value used to set the current Kumeran workaround state
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3094
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3095
 *  If ICH8, set the current Kumeran workaround state (enabled - TRUE
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3096
 *  /disabled - FALSE).
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3097
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3098
void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3099
						 bool state)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3100
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3101
	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3102
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3103
	if (hw->mac.type != e1000_ich8lan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3104
		hw_dbg(hw, "Workaround applies to ICH8 only.\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3105
		return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3106
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3107
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3108
	dev_spec->kmrn_lock_loss_workaround_enabled = state;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3109
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3110
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3111
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3112
 *  e1000_ipg3_phy_powerdown_workaround_ich8lan - Power down workaround on D3
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3113
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3114
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3115
 *  Workaround for 82566 power-down on D3 entry:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3116
 *    1) disable gigabit link
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3117
 *    2) write VR power-down enable
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3118
 *    3) read it back
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3119
 *  Continue if successful, else issue LCD reset and repeat
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3120
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3121
void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3122
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3123
	u32 reg;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3124
	u16 data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3125
	u8  retry = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3126
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3127
	if (hw->phy.type != e1000_phy_igp_3)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3128
		return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3129
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3130
	/* Try the workaround twice (if needed) */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3131
	do {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3132
		/* Disable link */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3133
		reg = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3134
		reg |= (E1000_PHY_CTRL_GBE_DISABLE |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3135
			E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3136
		ew32(PHY_CTRL, reg);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3137
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3138
		/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3139
		 * Call gig speed drop workaround on Gig disable before
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3140
		 * accessing any PHY registers
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3141
		 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3142
		if (hw->mac.type == e1000_ich8lan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3143
			e1000e_gig_downshift_workaround_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3144
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3145
		/* Write VR power-down enable */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3146
		e1e_rphy(hw, IGP3_VR_CTRL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3147
		data &= ~IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3148
		e1e_wphy(hw, IGP3_VR_CTRL, data | IGP3_VR_CTRL_MODE_SHUTDOWN);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3149
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3150
		/* Read it back and test */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3151
		e1e_rphy(hw, IGP3_VR_CTRL, &data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3152
		data &= IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3153
		if ((data == IGP3_VR_CTRL_MODE_SHUTDOWN) || retry)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3154
			break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3155
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3156
		/* Issue PHY reset and repeat at most one more time */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3157
		reg = er32(CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3158
		ew32(CTRL, reg | E1000_CTRL_PHY_RST);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3159
		retry++;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3160
	} while (retry);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3161
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3162
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3163
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3164
 *  e1000e_gig_downshift_workaround_ich8lan - WoL from S5 stops working
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3165
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3166
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3167
 *  Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC),
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3168
 *  LPLU, Gig disable, MDIC PHY reset):
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3169
 *    1) Set Kumeran Near-end loopback
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3170
 *    2) Clear Kumeran Near-end loopback
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3171
 *  Should only be called for ICH8[m] devices with IGP_3 Phy.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3172
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3173
void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3174
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3175
	s32 ret_val;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3176
	u16 reg_data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3177
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3178
	if ((hw->mac.type != e1000_ich8lan) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3179
	    (hw->phy.type != e1000_phy_igp_3))
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3180
		return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3181
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3182
	ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3183
				      &reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3184
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3185
		return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3186
	reg_data |= E1000_KMRNCTRLSTA_DIAG_NELPBK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3187
	ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3188
				       reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3189
	if (ret_val)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3190
		return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3191
	reg_data &= ~E1000_KMRNCTRLSTA_DIAG_NELPBK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3192
	ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_DIAG_OFFSET,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3193
				       reg_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3194
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3195
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3196
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3197
 *  e1000e_disable_gig_wol_ich8lan - disable gig during WoL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3198
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3199
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3200
 *  During S0 to Sx transition, it is possible the link remains at gig
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3201
 *  instead of negotiating to a lower speed.  Before going to Sx, set
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3202
 *  'LPLU Enabled' and 'Gig Disable' to force link speed negotiation
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3203
 *  to a lower speed.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3204
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3205
 *  Should only be called for applicable parts.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3206
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3207
void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3208
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3209
	u32 phy_ctrl;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3210
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3211
	switch (hw->mac.type) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3212
	case e1000_ich8lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3213
	case e1000_ich9lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3214
	case e1000_ich10lan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3215
	case e1000_pchlan:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3216
		phy_ctrl = er32(PHY_CTRL);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3217
		phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU |
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3218
		            E1000_PHY_CTRL_GBE_DISABLE;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3219
		ew32(PHY_CTRL, phy_ctrl);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3220
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3221
		if (hw->mac.type == e1000_pchlan)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3222
			e1000_phy_hw_reset_ich8lan(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3223
	default:
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3224
		break;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3225
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3226
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3227
	return;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3228
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3229
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3230
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3231
 *  e1000_cleanup_led_ich8lan - Restore the default LED operation
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3232
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3233
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3234
 *  Return the LED back to the default configuration.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3235
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3236
static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3237
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3238
	if (hw->phy.type == e1000_phy_ife)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3239
		return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3240
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3241
	ew32(LEDCTL, hw->mac.ledctl_default);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3242
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3243
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3244
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3245
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3246
 *  e1000_led_on_ich8lan - Turn LEDs on
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3247
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3248
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3249
 *  Turn on the LEDs.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3250
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3251
static s32 e1000_led_on_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3252
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3253
	if (hw->phy.type == e1000_phy_ife)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3254
		return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3255
				(IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3256
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3257
	ew32(LEDCTL, hw->mac.ledctl_mode2);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3258
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3259
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3260
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3261
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3262
 *  e1000_led_off_ich8lan - Turn LEDs off
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3263
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3264
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3265
 *  Turn off the LEDs.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3266
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3267
static s32 e1000_led_off_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3268
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3269
	if (hw->phy.type == e1000_phy_ife)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3270
		return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3271
			       (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3272
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3273
	ew32(LEDCTL, hw->mac.ledctl_mode1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3274
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3275
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3276
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3277
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3278
 *  e1000_setup_led_pchlan - Configures SW controllable LED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3279
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3280
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3281
 *  This prepares the SW controllable LED for use.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3282
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3283
static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3284
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3285
	return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3286
					(u16)hw->mac.ledctl_mode1);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3287
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3288
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3289
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3290
 *  e1000_cleanup_led_pchlan - Restore the default LED operation
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3291
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3292
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3293
 *  Return the LED back to the default configuration.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3294
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3295
static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3296
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3297
	return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3298
					(u16)hw->mac.ledctl_default);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3299
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3300
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3301
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3302
 *  e1000_led_on_pchlan - Turn LEDs on
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3303
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3304
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3305
 *  Turn on the LEDs.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3306
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3307
static s32 e1000_led_on_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3308
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3309
	u16 data = (u16)hw->mac.ledctl_mode2;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3310
	u32 i, led;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3311
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3312
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3313
	 * If no link, then turn LED on by setting the invert bit
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3314
	 * for each LED that's mode is "link_up" in ledctl_mode2.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3315
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3316
	if (!(er32(STATUS) & E1000_STATUS_LU)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3317
		for (i = 0; i < 3; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3318
			led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3319
			if ((led & E1000_PHY_LED0_MODE_MASK) !=
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3320
			    E1000_LEDCTL_MODE_LINK_UP)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3321
				continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3322
			if (led & E1000_PHY_LED0_IVRT)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3323
				data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3324
			else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3325
				data |= (E1000_PHY_LED0_IVRT << (i * 5));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3326
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3327
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3328
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3329
	return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3330
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3331
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3332
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3333
 *  e1000_led_off_pchlan - Turn LEDs off
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3334
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3335
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3336
 *  Turn off the LEDs.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3337
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3338
static s32 e1000_led_off_pchlan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3339
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3340
	u16 data = (u16)hw->mac.ledctl_mode1;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3341
	u32 i, led;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3342
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3343
	/*
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3344
	 * If no link, then turn LED off by clearing the invert bit
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3345
	 * for each LED that's mode is "link_up" in ledctl_mode1.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3346
	 */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3347
	if (!(er32(STATUS) & E1000_STATUS_LU)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3348
		for (i = 0; i < 3; i++) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3349
			led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3350
			if ((led & E1000_PHY_LED0_MODE_MASK) !=
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3351
			    E1000_LEDCTL_MODE_LINK_UP)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3352
				continue;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3353
			if (led & E1000_PHY_LED0_IVRT)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3354
				data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3355
			else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3356
				data |= (E1000_PHY_LED0_IVRT << (i * 5));
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3357
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3358
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3359
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3360
	return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3361
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3362
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3363
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3364
 *  e1000_get_cfg_done_ich8lan - Read config done bit
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3365
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3366
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3367
 *  Read the management control register for the config done bit for
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3368
 *  completion status.  NOTE: silicon which is EEPROM-less will fail trying
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3369
 *  to read the config done bit, so an error is *ONLY* logged and returns
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3370
 *  0.  If we were to return with error, EEPROM-less silicon
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3371
 *  would not be able to be reset or change link.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3372
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3373
static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3374
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3375
	u32 bank = 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3376
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3377
	if (hw->mac.type >= e1000_pchlan) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3378
		u32 status = er32(STATUS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3379
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3380
		if (status & E1000_STATUS_PHYRA)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3381
			ew32(STATUS, status & ~E1000_STATUS_PHYRA);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3382
		else
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3383
			hw_dbg(hw,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3384
			       "PHY Reset Asserted not set - needs delay\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3385
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3386
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3387
	e1000e_get_cfg_done(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3388
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3389
	/* If EEPROM is not marked present, init the IGP 3 PHY manually */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3390
	if ((hw->mac.type != e1000_ich10lan) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3391
	    (hw->mac.type != e1000_pchlan)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3392
		if (((er32(EECD) & E1000_EECD_PRES) == 0) &&
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3393
		    (hw->phy.type == e1000_phy_igp_3)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3394
			e1000e_phy_init_script_igp3(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3395
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3396
	} else {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3397
		if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3398
			/* Maybe we should do a basic PHY config */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3399
			hw_dbg(hw, "EEPROM not present\n");
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3400
			return -E1000_ERR_CONFIG;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3401
		}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3402
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3403
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3404
	return 0;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3405
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3406
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3407
/**
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3408
 *  e1000_clear_hw_cntrs_ich8lan - Clear statistical counters
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3409
 *  @hw: pointer to the HW structure
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3410
 *
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3411
 *  Clears hardware counters specific to the silicon family and calls
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3412
 *  clear_hw_cntrs_generic to clear all general purpose counters.
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3413
 **/
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3414
static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3415
{
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3416
	u32 temp;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3417
	u16 phy_data;
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3418
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3419
	e1000e_clear_hw_cntrs_base(hw);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3420
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3421
	temp = er32(ALGNERRC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3422
	temp = er32(RXERRC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3423
	temp = er32(TNCRS);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3424
	temp = er32(CEXTERR);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3425
	temp = er32(TSCTC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3426
	temp = er32(TSCTFC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3427
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3428
	temp = er32(MGTPRC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3429
	temp = er32(MGTPDC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3430
	temp = er32(MGTPTC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3431
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3432
	temp = er32(IAC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3433
	temp = er32(ICRXOC);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3434
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3435
	/* Clear PHY statistics registers */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3436
	if ((hw->phy.type == e1000_phy_82578) ||
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3437
	    (hw->phy.type == e1000_phy_82577)) {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3438
		hw->phy.ops.read_phy_reg(hw, HV_SCC_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3439
		hw->phy.ops.read_phy_reg(hw, HV_SCC_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3440
		hw->phy.ops.read_phy_reg(hw, HV_ECOL_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3441
		hw->phy.ops.read_phy_reg(hw, HV_ECOL_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3442
		hw->phy.ops.read_phy_reg(hw, HV_MCC_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3443
		hw->phy.ops.read_phy_reg(hw, HV_MCC_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3444
		hw->phy.ops.read_phy_reg(hw, HV_LATECOL_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3445
		hw->phy.ops.read_phy_reg(hw, HV_LATECOL_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3446
		hw->phy.ops.read_phy_reg(hw, HV_COLC_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3447
		hw->phy.ops.read_phy_reg(hw, HV_COLC_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3448
		hw->phy.ops.read_phy_reg(hw, HV_DC_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3449
		hw->phy.ops.read_phy_reg(hw, HV_DC_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3450
		hw->phy.ops.read_phy_reg(hw, HV_TNCRS_UPPER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3451
		hw->phy.ops.read_phy_reg(hw, HV_TNCRS_LOWER, &phy_data);
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3452
	}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3453
}
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3454
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3455
static struct e1000_mac_operations ich8_mac_ops = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3456
	.id_led_init		= e1000e_id_led_init,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3457
	.check_mng_mode		= e1000_check_mng_mode_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3458
	.check_for_link		= e1000_check_for_copper_link_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3459
	/* cleanup_led dependent on mac type */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3460
	.clear_hw_cntrs		= e1000_clear_hw_cntrs_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3461
	.get_bus_info		= e1000_get_bus_info_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3462
	.get_link_up_info	= e1000_get_link_up_info_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3463
	/* led_on dependent on mac type */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3464
	/* led_off dependent on mac type */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3465
	.update_mc_addr_list	= e1000e_update_mc_addr_list_generic,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3466
	.reset_hw		= e1000_reset_hw_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3467
	.init_hw		= e1000_init_hw_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3468
	.setup_link		= e1000_setup_link_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3469
	.setup_physical_interface= e1000_setup_copper_link_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3470
	/* id_led_init dependent on mac type */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3471
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3472
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3473
static struct e1000_phy_operations ich8_phy_ops = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3474
	.acquire_phy		= e1000_acquire_swflag_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3475
	.check_reset_block	= e1000_check_reset_block_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3476
	.commit_phy		= NULL,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3477
	.force_speed_duplex	= e1000_phy_force_speed_duplex_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3478
	.get_cfg_done		= e1000_get_cfg_done_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3479
	.get_cable_length	= e1000e_get_cable_length_igp_2,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3480
	.get_phy_info		= e1000_get_phy_info_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3481
	.read_phy_reg		= e1000e_read_phy_reg_igp,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3482
	.release_phy		= e1000_release_swflag_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3483
	.reset_phy		= e1000_phy_hw_reset_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3484
	.set_d0_lplu_state	= e1000_set_d0_lplu_state_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3485
	.set_d3_lplu_state	= e1000_set_d3_lplu_state_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3486
	.write_phy_reg		= e1000e_write_phy_reg_igp,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3487
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3488
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3489
static struct e1000_nvm_operations ich8_nvm_ops = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3490
	.acquire_nvm		= e1000_acquire_nvm_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3491
	.read_nvm	 	= e1000_read_nvm_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3492
	.release_nvm		= e1000_release_nvm_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3493
	.update_nvm		= e1000_update_nvm_checksum_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3494
	.valid_led_default	= e1000_valid_led_default_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3495
	.validate_nvm		= e1000_validate_nvm_checksum_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3496
	.write_nvm		= e1000_write_nvm_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3497
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3498
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3499
struct e1000_info e1000_ich8_info = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3500
	.mac			= e1000_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3501
	.flags			= FLAG_HAS_WOL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3502
				  | FLAG_IS_ICH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3503
				  | FLAG_RX_CSUM_ENABLED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3504
				  | FLAG_HAS_CTRLEXT_ON_LOAD
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3505
				  | FLAG_HAS_AMT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3506
				  | FLAG_HAS_FLASH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3507
				  | FLAG_APME_IN_WUC,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3508
	.pba			= 8,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3509
	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3510
	.get_variants		= e1000_get_variants_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3511
	.mac_ops		= &ich8_mac_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3512
	.phy_ops		= &ich8_phy_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3513
	.nvm_ops		= &ich8_nvm_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3514
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3515
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3516
struct e1000_info e1000_ich9_info = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3517
	.mac			= e1000_ich9lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3518
	.flags			= FLAG_HAS_JUMBO_FRAMES
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3519
				  | FLAG_IS_ICH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3520
				  | FLAG_HAS_WOL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3521
				  | FLAG_RX_CSUM_ENABLED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3522
				  | FLAG_HAS_CTRLEXT_ON_LOAD
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3523
				  | FLAG_HAS_AMT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3524
				  | FLAG_HAS_ERT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3525
				  | FLAG_HAS_FLASH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3526
				  | FLAG_APME_IN_WUC,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3527
	.pba			= 10,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3528
	.max_hw_frame_size	= DEFAULT_JUMBO,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3529
	.get_variants		= e1000_get_variants_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3530
	.mac_ops		= &ich8_mac_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3531
	.phy_ops		= &ich8_phy_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3532
	.nvm_ops		= &ich8_nvm_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3533
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3534
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3535
struct e1000_info e1000_ich10_info = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3536
	.mac			= e1000_ich10lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3537
	.flags			= FLAG_HAS_JUMBO_FRAMES
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3538
				  | FLAG_IS_ICH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3539
				  | FLAG_HAS_WOL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3540
				  | FLAG_RX_CSUM_ENABLED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3541
				  | FLAG_HAS_CTRLEXT_ON_LOAD
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3542
				  | FLAG_HAS_AMT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3543
				  | FLAG_HAS_ERT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3544
				  | FLAG_HAS_FLASH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3545
				  | FLAG_APME_IN_WUC,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3546
	.pba			= 10,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3547
	.max_hw_frame_size	= DEFAULT_JUMBO,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3548
	.get_variants		= e1000_get_variants_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3549
	.mac_ops		= &ich8_mac_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3550
	.phy_ops		= &ich8_phy_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3551
	.nvm_ops		= &ich8_nvm_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3552
};
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3553
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3554
struct e1000_info e1000_pch_info = {
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3555
	.mac			= e1000_pchlan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3556
	.flags			= FLAG_IS_ICH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3557
				  | FLAG_HAS_WOL
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3558
				  | FLAG_RX_CSUM_ENABLED
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3559
				  | FLAG_HAS_CTRLEXT_ON_LOAD
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3560
				  | FLAG_HAS_AMT
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3561
				  | FLAG_HAS_FLASH
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3562
				  | FLAG_HAS_JUMBO_FRAMES
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3563
				  | FLAG_DISABLE_FC_PAUSE_TIME /* errata */
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3564
				  | FLAG_APME_IN_WUC,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3565
	.pba			= 26,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3566
	.max_hw_frame_size	= 4096,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3567
	.get_variants		= e1000_get_variants_ich8lan,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3568
	.mac_ops		= &ich8_mac_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3569
	.phy_ops		= &ich8_phy_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3570
	.nvm_ops		= &ich8_nvm_ops,
2cefec773772 Added e1000e driver for 2.6.32.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  3571
};