aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 14:47:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 14:47:58 -0400
commit6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7 (patch)
tree8f3892fc44f1e403675a6d7e88fda5c70e56ee4c /drivers/net/e1000e
parent5abd9ccced7a726c817dd6b5b96bc933859138d1 (diff)
parent3ff1c25927e3af61c6bf0e4ed959504058ae4565 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1443 commits) phy/marvell: add 88ec048 support igb: Program MDICNFG register prior to PHY init e1000e: correct MAC-PHY interconnect register offset for 82579 hso: Add new product ID can: Add driver for esd CAN-USB/2 device l2tp: fix export of header file for userspace can-raw: Fix skb_orphan_try handling Revert "net: remove zap_completion_queue" net: cleanup inclusion phy/marvell: add 88e1121 interface mode support u32: negative offset fix net: Fix a typo from "dev" to "ndev" igb: Use irq_synchronize per vector when using MSI-X ixgbevf: fix null pointer dereference due to filter being set for VLAN 0 e1000e: Fix irq_synchronize in MSI-X case e1000e: register pm_qos request on hardware activation ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice net: Add getsockopt support for TCP thin-streams cxgb4: update driver version cxgb4: add new PCI IDs ... Manually fix up conflicts in: - drivers/net/e1000e/netdev.c: due to pm_qos registration infrastructure changes - drivers/net/phy/marvell.c: conflict between adding 88ec048 support and cleaning up the IDs - drivers/net/wireless/ipw2x00/ipw2100.c: trivial ipw2100_pm_qos_req conflict (registration change vs marking it static)
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/82571.c2
-rw-r--r--drivers/net/e1000e/defines.h4
-rw-r--r--drivers/net/e1000e/e1000.h10
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/ethtool.c144
-rw-r--r--drivers/net/e1000e/hw.h17
-rw-r--r--drivers/net/e1000e/ich8lan.c456
-rw-r--r--drivers/net/e1000e/lib.c2
-rw-r--r--drivers/net/e1000e/netdev.c352
-rw-r--r--drivers/net/e1000e/param.c2
-rw-r--r--drivers/net/e1000e/phy.c5
11 files changed, 754 insertions, 242 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index f654db9121de..a4a0d2b6eb1c 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 4dc02c71ffd6..307a72f483ee 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -359,6 +359,7 @@
359#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 359#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001
360#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 360#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008
361#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 361#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020
362#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080
362#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 363#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000
363#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 364#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16
364#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 365#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000
@@ -714,6 +715,7 @@
714#define BME1000_E_PHY_ID_R2 0x01410CB1 715#define BME1000_E_PHY_ID_R2 0x01410CB1
715#define I82577_E_PHY_ID 0x01540050 716#define I82577_E_PHY_ID 0x01540050
716#define I82578_E_PHY_ID 0x004DD040 717#define I82578_E_PHY_ID 0x004DD040
718#define I82579_E_PHY_ID 0x01540090
717 719
718/* M88E1000 Specific Registers */ 720/* M88E1000 Specific Registers */
719#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ 721#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c0b3db40bd73..f9a31c82f871 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -164,6 +164,7 @@ enum e1000_boards {
164 board_ich9lan, 164 board_ich9lan,
165 board_ich10lan, 165 board_ich10lan,
166 board_pchlan, 166 board_pchlan,
167 board_pch2lan,
167}; 168};
168 169
169struct e1000_queue_stats { 170struct e1000_queue_stats {
@@ -347,6 +348,7 @@ struct e1000_adapter {
347 u32 test_icr; 348 u32 test_icr;
348 349
349 u32 msg_enable; 350 u32 msg_enable;
351 unsigned int num_vectors;
350 struct msix_entry *msix_entries; 352 struct msix_entry *msix_entries;
351 int int_mode; 353 int int_mode;
352 u32 eiac_mask; 354 u32 eiac_mask;
@@ -421,6 +423,8 @@ struct e1000_info {
421#define FLAG2_HAS_PHY_WAKEUP (1 << 1) 423#define FLAG2_HAS_PHY_WAKEUP (1 << 1)
422#define FLAG2_IS_DISCARDING (1 << 2) 424#define FLAG2_IS_DISCARDING (1 << 2)
423#define FLAG2_DISABLE_ASPM_L1 (1 << 3) 425#define FLAG2_DISABLE_ASPM_L1 (1 << 3)
426#define FLAG2_HAS_PHY_STATS (1 << 4)
427#define FLAG2_HAS_EEE (1 << 5)
424 428
425#define E1000_RX_DESC_PS(R, i) \ 429#define E1000_RX_DESC_PS(R, i) \
426 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) 430 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
@@ -458,7 +462,6 @@ extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
458extern void e1000e_free_rx_resources(struct e1000_adapter *adapter); 462extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
459extern void e1000e_free_tx_resources(struct e1000_adapter *adapter); 463extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
460extern void e1000e_update_stats(struct e1000_adapter *adapter); 464extern void e1000e_update_stats(struct e1000_adapter *adapter);
461extern bool e1000e_has_link(struct e1000_adapter *adapter);
462extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); 465extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
463extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); 466extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
464extern void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); 467extern void e1000e_disable_aspm(struct pci_dev *pdev, u16 state);
@@ -476,6 +479,7 @@ extern struct e1000_info e1000_ich8_info;
476extern struct e1000_info e1000_ich9_info; 479extern struct e1000_info e1000_ich9_info;
477extern struct e1000_info e1000_ich10_info; 480extern struct e1000_info e1000_ich10_info;
478extern struct e1000_info e1000_pch_info; 481extern struct e1000_info e1000_pch_info;
482extern struct e1000_info e1000_pch2_info;
479extern struct e1000_info e1000_es2_info; 483extern struct e1000_info e1000_es2_info;
480 484
481extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num); 485extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
@@ -494,6 +498,8 @@ extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
494extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); 498extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
495extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw); 499extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
496extern s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); 500extern s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
501extern s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable);
502extern void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw);
497 503
498extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw); 504extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
499extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw); 505extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 38d79a669059..45aebb4a6fe1 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 2c521218102b..6355a1b779d3 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -118,7 +118,6 @@ static int e1000_get_settings(struct net_device *netdev,
118{ 118{
119 struct e1000_adapter *adapter = netdev_priv(netdev); 119 struct e1000_adapter *adapter = netdev_priv(netdev);
120 struct e1000_hw *hw = &adapter->hw; 120 struct e1000_hw *hw = &adapter->hw;
121 u32 status;
122 121
123 if (hw->phy.media_type == e1000_media_type_copper) { 122 if (hw->phy.media_type == e1000_media_type_copper) {
124 123
@@ -156,22 +155,29 @@ static int e1000_get_settings(struct net_device *netdev,
156 ecmd->transceiver = XCVR_EXTERNAL; 155 ecmd->transceiver = XCVR_EXTERNAL;
157 } 156 }
158 157
159 status = er32(STATUS); 158 ecmd->speed = -1;
160 if (status & E1000_STATUS_LU) { 159 ecmd->duplex = -1;
161 if (status & E1000_STATUS_SPEED_1000)
162 ecmd->speed = 1000;
163 else if (status & E1000_STATUS_SPEED_100)
164 ecmd->speed = 100;
165 else
166 ecmd->speed = 10;
167 160
168 if (status & E1000_STATUS_FD) 161 if (netif_running(netdev)) {
169 ecmd->duplex = DUPLEX_FULL; 162 if (netif_carrier_ok(netdev)) {
170 else 163 ecmd->speed = adapter->link_speed;
171 ecmd->duplex = DUPLEX_HALF; 164 ecmd->duplex = adapter->link_duplex - 1;
165 }
172 } else { 166 } else {
173 ecmd->speed = -1; 167 u32 status = er32(STATUS);
174 ecmd->duplex = -1; 168 if (status & E1000_STATUS_LU) {
169 if (status & E1000_STATUS_SPEED_1000)
170 ecmd->speed = 1000;
171 else if (status & E1000_STATUS_SPEED_100)
172 ecmd->speed = 100;
173 else
174 ecmd->speed = 10;
175
176 if (status & E1000_STATUS_FD)
177 ecmd->duplex = DUPLEX_FULL;
178 else
179 ecmd->duplex = DUPLEX_HALF;
180 }
175 } 181 }
176 182
177 ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || 183 ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
@@ -179,7 +185,7 @@ static int e1000_get_settings(struct net_device *netdev,
179 185
180 /* MDI-X => 2; MDI =>1; Invalid =>0 */ 186 /* MDI-X => 2; MDI =>1; Invalid =>0 */
181 if ((hw->phy.media_type == e1000_media_type_copper) && 187 if ((hw->phy.media_type == e1000_media_type_copper) &&
182 !hw->mac.get_link_status) 188 netif_carrier_ok(netdev))
183 ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X : 189 ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
184 ETH_TP_MDI; 190 ETH_TP_MDI;
185 else 191 else
@@ -191,19 +197,15 @@ static int e1000_get_settings(struct net_device *netdev,
191static u32 e1000_get_link(struct net_device *netdev) 197static u32 e1000_get_link(struct net_device *netdev)
192{ 198{
193 struct e1000_adapter *adapter = netdev_priv(netdev); 199 struct e1000_adapter *adapter = netdev_priv(netdev);
194 struct e1000_mac_info *mac = &adapter->hw.mac; 200 struct e1000_hw *hw = &adapter->hw;
195 201
196 /* 202 /*
197 * If the link is not reported up to netdev, interrupts are disabled, 203 * Avoid touching hardware registers when possible, otherwise
198 * and so the physical link state may have changed since we last 204 * link negotiation can get messed up when user-level scripts
199 * looked. Set get_link_status to make sure that the true link 205 * are rapidly polling the driver to see if link is up.
200 * state is interrogated, rather than pulling a cached and possibly
201 * stale link state from the driver.
202 */ 206 */
203 if (!netif_carrier_ok(netdev)) 207 return netif_running(netdev) ? netif_carrier_ok(netdev) :
204 mac->get_link_status = 1; 208 !!(er32(STATUS) & E1000_STATUS_LU);
205
206 return e1000e_has_link(adapter);
207} 209}
208 210
209static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) 211static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
@@ -880,6 +882,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
880 switch (mac->type) { 882 switch (mac->type) {
881 case e1000_ich10lan: 883 case e1000_ich10lan:
882 case e1000_pchlan: 884 case e1000_pchlan:
885 case e1000_pch2lan:
883 mask |= (1 << 18); 886 mask |= (1 << 18);
884 break; 887 break;
885 default: 888 default:
@@ -1263,33 +1266,36 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1263 1266
1264 hw->mac.autoneg = 0; 1267 hw->mac.autoneg = 0;
1265 1268
1266 /* Workaround: K1 must be disabled for stable 1Gbps operation */ 1269 if (hw->phy.type == e1000_phy_ife) {
1267 if (hw->mac.type == e1000_pchlan)
1268 e1000_configure_k1_ich8lan(hw, false);
1269
1270 if (hw->phy.type == e1000_phy_m88) {
1271 /* Auto-MDI/MDIX Off */
1272 e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1273 /* reset to update Auto-MDI/MDIX */
1274 e1e_wphy(hw, PHY_CONTROL, 0x9140);
1275 /* autoneg off */
1276 e1e_wphy(hw, PHY_CONTROL, 0x8140);
1277 } else if (hw->phy.type == e1000_phy_gg82563)
1278 e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC);
1279
1280 ctrl_reg = er32(CTRL);
1281
1282 switch (hw->phy.type) {
1283 case e1000_phy_ife:
1284 /* force 100, set loopback */ 1270 /* force 100, set loopback */
1285 e1e_wphy(hw, PHY_CONTROL, 0x6100); 1271 e1e_wphy(hw, PHY_CONTROL, 0x6100);
1286 1272
1287 /* Now set up the MAC to the same speed/duplex as the PHY. */ 1273 /* Now set up the MAC to the same speed/duplex as the PHY. */
1274 ctrl_reg = er32(CTRL);
1288 ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ 1275 ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
1289 ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ 1276 ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
1290 E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ 1277 E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
1291 E1000_CTRL_SPD_100 |/* Force Speed to 100 */ 1278 E1000_CTRL_SPD_100 |/* Force Speed to 100 */
1292 E1000_CTRL_FD); /* Force Duplex to FULL */ 1279 E1000_CTRL_FD); /* Force Duplex to FULL */
1280
1281 ew32(CTRL, ctrl_reg);
1282 udelay(500);
1283
1284 return 0;
1285 }
1286
1287 /* Specific PHY configuration for loopback */
1288 switch (hw->phy.type) {
1289 case e1000_phy_m88:
1290 /* Auto-MDI/MDIX Off */
1291 e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1292 /* reset to update Auto-MDI/MDIX */
1293 e1e_wphy(hw, PHY_CONTROL, 0x9140);
1294 /* autoneg off */
1295 e1e_wphy(hw, PHY_CONTROL, 0x8140);
1296 break;
1297 case e1000_phy_gg82563:
1298 e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC);
1293 break; 1299 break;
1294 case e1000_phy_bm: 1300 case e1000_phy_bm:
1295 /* Set Default MAC Interface speed to 1GB */ 1301 /* Set Default MAC Interface speed to 1GB */
@@ -1312,23 +1318,41 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1312 /* Set Early Link Enable */ 1318 /* Set Early Link Enable */
1313 e1e_rphy(hw, PHY_REG(769, 20), &phy_reg); 1319 e1e_rphy(hw, PHY_REG(769, 20), &phy_reg);
1314 e1e_wphy(hw, PHY_REG(769, 20), phy_reg | 0x0400); 1320 e1e_wphy(hw, PHY_REG(769, 20), phy_reg | 0x0400);
1315 /* fall through */ 1321 break;
1322 case e1000_phy_82577:
1323 case e1000_phy_82578:
1324 /* Workaround: K1 must be disabled for stable 1Gbps operation */
1325 e1000_configure_k1_ich8lan(hw, false);
1326 break;
1327 case e1000_phy_82579:
1328 /* Disable PHY energy detect power down */
1329 e1e_rphy(hw, PHY_REG(0, 21), &phy_reg);
1330 e1e_wphy(hw, PHY_REG(0, 21), phy_reg & ~(1 << 3));
1331 /* Disable full chip energy detect */
1332 e1e_rphy(hw, PHY_REG(776, 18), &phy_reg);
1333 e1e_wphy(hw, PHY_REG(776, 18), phy_reg | 1);
1334 /* Enable loopback on the PHY */
1335#define I82577_PHY_LBK_CTRL 19
1336 e1e_wphy(hw, I82577_PHY_LBK_CTRL, 0x8001);
1337 break;
1316 default: 1338 default:
1317 /* force 1000, set loopback */ 1339 break;
1318 e1e_wphy(hw, PHY_CONTROL, 0x4140); 1340 }
1319 mdelay(250);
1320 1341
1321 /* Now set up the MAC to the same speed/duplex as the PHY. */ 1342 /* force 1000, set loopback */
1322 ctrl_reg = er32(CTRL); 1343 e1e_wphy(hw, PHY_CONTROL, 0x4140);
1323 ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ 1344 mdelay(250);
1324 ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
1325 E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
1326 E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
1327 E1000_CTRL_FD); /* Force Duplex to FULL */
1328 1345
1329 if (adapter->flags & FLAG_IS_ICH) 1346 /* Now set up the MAC to the same speed/duplex as the PHY. */
1330 ctrl_reg |= E1000_CTRL_SLU; /* Set Link Up */ 1347 ctrl_reg = er32(CTRL);
1331 } 1348 ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
1349 ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
1350 E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
1351 E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
1352 E1000_CTRL_FD); /* Force Duplex to FULL */
1353
1354 if (adapter->flags & FLAG_IS_ICH)
1355 ctrl_reg |= E1000_CTRL_SLU; /* Set Link Up */
1332 1356
1333 if (hw->phy.media_type == e1000_media_type_copper && 1357 if (hw->phy.media_type == e1000_media_type_copper &&
1334 hw->phy.type == e1000_phy_m88) { 1358 hw->phy.type == e1000_phy_m88) {
@@ -1868,6 +1892,7 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
1868 1892
1869 if ((hw->phy.type == e1000_phy_ife) || 1893 if ((hw->phy.type == e1000_phy_ife) ||
1870 (hw->mac.type == e1000_pchlan) || 1894 (hw->mac.type == e1000_pchlan) ||
1895 (hw->mac.type == e1000_pch2lan) ||
1871 (hw->mac.type == e1000_82583) || 1896 (hw->mac.type == e1000_82583) ||
1872 (hw->mac.type == e1000_82574)) { 1897 (hw->mac.type == e1000_82574)) {
1873 INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); 1898 INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task);
@@ -2026,7 +2051,6 @@ static const struct ethtool_ops e1000_ethtool_ops = {
2026 .get_coalesce = e1000_get_coalesce, 2051 .get_coalesce = e1000_get_coalesce,
2027 .set_coalesce = e1000_set_coalesce, 2052 .set_coalesce = e1000_set_coalesce,
2028 .get_flags = ethtool_op_get_flags, 2053 .get_flags = ethtool_op_get_flags,
2029 .set_flags = ethtool_op_set_flags,
2030}; 2054};
2031 2055
2032void e1000e_set_ethtool_ops(struct net_device *netdev) 2056void e1000e_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 5d1220d188d4..66ed08f726fb 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -217,7 +217,10 @@ enum e1e_registers {
217 E1000_SWSM = 0x05B50, /* SW Semaphore */ 217 E1000_SWSM = 0x05B50, /* SW Semaphore */
218 E1000_FWSM = 0x05B54, /* FW Semaphore */ 218 E1000_FWSM = 0x05B54, /* FW Semaphore */
219 E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ 219 E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */
220 E1000_CRC_OFFSET = 0x05F50, /* CRC Offset register */ 220 E1000_FFLT_DBG = 0x05F04, /* Debug Register */
221 E1000_PCH_RAICC_BASE = 0x05F50, /* Receive Address Initial CRC */
222#define E1000_PCH_RAICC(_n) (E1000_PCH_RAICC_BASE + ((_n) * 4))
223#define E1000_CRC_OFFSET E1000_PCH_RAICC_BASE
221 E1000_HICR = 0x08F00, /* Host Interface Control */ 224 E1000_HICR = 0x08F00, /* Host Interface Control */
222}; 225};
223 226
@@ -303,13 +306,14 @@ enum e1e_registers {
303#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000 306#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000
304#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16 307#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16
305#define E1000_KMRNCTRLSTA_REN 0x00200000 308#define E1000_KMRNCTRLSTA_REN 0x00200000
309#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */
306#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ 310#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */
307#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */ 311#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */
308#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */ 312#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */
309#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ 313#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */
310#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 314#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7
311#define E1000_KMRNCTRLSTA_K1_ENABLE 0x140E 315#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002
312#define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400 316#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */
313 317
314#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 318#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
315#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ 319#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */
@@ -387,6 +391,8 @@ enum e1e_registers {
387#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB 391#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
388#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF 392#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
389#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 393#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0
394#define E1000_DEV_ID_PCH2_LV_LM 0x1502
395#define E1000_DEV_ID_PCH2_LV_V 0x1503
390 396
391#define E1000_REVISION_4 4 397#define E1000_REVISION_4 4
392 398
@@ -406,6 +412,7 @@ enum e1000_mac_type {
406 e1000_ich9lan, 412 e1000_ich9lan,
407 e1000_ich10lan, 413 e1000_ich10lan,
408 e1000_pchlan, 414 e1000_pchlan,
415 e1000_pch2lan,
409}; 416};
410 417
411enum e1000_media_type { 418enum e1000_media_type {
@@ -442,6 +449,7 @@ enum e1000_phy_type {
442 e1000_phy_bm, 449 e1000_phy_bm,
443 e1000_phy_82578, 450 e1000_phy_82578,
444 e1000_phy_82577, 451 e1000_phy_82577,
452 e1000_phy_82579,
445}; 453};
446 454
447enum e1000_bus_width { 455enum e1000_bus_width {
@@ -929,6 +937,7 @@ struct e1000_dev_spec_ich8lan {
929 bool kmrn_lock_loss_workaround_enabled; 937 bool kmrn_lock_loss_workaround_enabled;
930 struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; 938 struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS];
931 bool nvm_k1_enabled; 939 bool nvm_k1_enabled;
940 bool eee_disable;
932}; 941};
933 942
934struct e1000_hw { 943struct e1000_hw {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index b2507d93de99..63930d12711c 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -52,6 +52,8 @@
52 * 82577LC Gigabit Network Connection 52 * 82577LC Gigabit Network Connection
53 * 82578DM Gigabit Network Connection 53 * 82578DM Gigabit Network Connection
54 * 82578DC Gigabit Network Connection 54 * 82578DC Gigabit Network Connection
55 * 82579LM Gigabit Network Connection
56 * 82579V Gigabit Network Connection
55 */ 57 */
56 58
57#include "e1000.h" 59#include "e1000.h"
@@ -126,6 +128,13 @@
126#define HV_SMB_ADDR_PEC_EN 0x0200 128#define HV_SMB_ADDR_PEC_EN 0x0200
127#define HV_SMB_ADDR_VALID 0x0080 129#define HV_SMB_ADDR_VALID 0x0080
128 130
131/* PHY Power Management Control */
132#define HV_PM_CTRL PHY_REG(770, 17)
133
134/* PHY Low Power Idle Control */
135#define I82579_LPI_CTRL PHY_REG(772, 20)
136#define I82579_LPI_CTRL_ENABLE_MASK 0x6000
137
129/* Strapping Option Register - RO */ 138/* Strapping Option Register - RO */
130#define E1000_STRAP 0x0000C 139#define E1000_STRAP 0x0000C
131#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 140#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
@@ -226,6 +235,8 @@ static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw);
226static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); 235static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
227static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); 236static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
228static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); 237static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
238static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw);
239static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw);
229 240
230static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) 241static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
231{ 242{
@@ -277,13 +288,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
277 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; 288 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
278 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 289 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
279 290
291 /*
292 * The MAC-PHY interconnect may still be in SMBus mode
293 * after Sx->S0. If the manageability engine (ME) is
294 * disabled, then toggle the LANPHYPC Value bit to force
295 * the interconnect to PCIe mode.
296 */
280 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 297 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
281 /*
282 * The MAC-PHY interconnect may still be in SMBus mode
283 * after Sx->S0. Toggle the LANPHYPC Value bit to force
284 * the interconnect to PCIe mode, but only if there is no
285 * firmware present otherwise firmware will have done it.
286 */
287 ctrl = er32(CTRL); 298 ctrl = er32(CTRL);
288 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 299 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
289 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 300 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
@@ -324,6 +335,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
324 335
325 switch (phy->type) { 336 switch (phy->type) {
326 case e1000_phy_82577: 337 case e1000_phy_82577:
338 case e1000_phy_82579:
327 phy->ops.check_polarity = e1000_check_polarity_82577; 339 phy->ops.check_polarity = e1000_check_polarity_82577;
328 phy->ops.force_speed_duplex = 340 phy->ops.force_speed_duplex =
329 e1000_phy_force_speed_duplex_82577; 341 e1000_phy_force_speed_duplex_82577;
@@ -515,6 +527,8 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
515 case e1000_ich8lan: 527 case e1000_ich8lan:
516 case e1000_ich9lan: 528 case e1000_ich9lan:
517 case e1000_ich10lan: 529 case e1000_ich10lan:
530 /* check management mode */
531 mac->ops.check_mng_mode = e1000_check_mng_mode_ich8lan;
518 /* ID LED init */ 532 /* ID LED init */
519 mac->ops.id_led_init = e1000e_id_led_init; 533 mac->ops.id_led_init = e1000e_id_led_init;
520 /* setup LED */ 534 /* setup LED */
@@ -526,6 +540,9 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
526 mac->ops.led_off = e1000_led_off_ich8lan; 540 mac->ops.led_off = e1000_led_off_ich8lan;
527 break; 541 break;
528 case e1000_pchlan: 542 case e1000_pchlan:
543 case e1000_pch2lan:
544 /* check management mode */
545 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
529 /* ID LED init */ 546 /* ID LED init */
530 mac->ops.id_led_init = e1000_id_led_init_pchlan; 547 mac->ops.id_led_init = e1000_id_led_init_pchlan;
531 /* setup LED */ 548 /* setup LED */
@@ -544,10 +561,47 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
544 if (mac->type == e1000_ich8lan) 561 if (mac->type == e1000_ich8lan)
545 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); 562 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true);
546 563
564 /* Disable PHY configuration by hardware, config by software */
565 if (mac->type == e1000_pch2lan) {
566 u32 extcnf_ctrl = er32(EXTCNF_CTRL);
567
568 extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG;
569 ew32(EXTCNF_CTRL, extcnf_ctrl);
570 }
571
547 return 0; 572 return 0;
548} 573}
549 574
550/** 575/**
576 * e1000_set_eee_pchlan - Enable/disable EEE support
577 * @hw: pointer to the HW structure
578 *
579 * Enable/disable EEE based on setting in dev_spec structure. The bits in
580 * the LPI Control register will remain set only if/when link is up.
581 **/
582static s32 e1000_set_eee_pchlan(struct e1000_hw *hw)
583{
584 s32 ret_val = 0;
585 u16 phy_reg;
586
587 if (hw->phy.type != e1000_phy_82579)
588 goto out;
589
590 ret_val = e1e_rphy(hw, I82579_LPI_CTRL, &phy_reg);
591 if (ret_val)
592 goto out;
593
594 if (hw->dev_spec.ich8lan.eee_disable)
595 phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK;
596 else
597 phy_reg |= I82579_LPI_CTRL_ENABLE_MASK;
598
599 ret_val = e1e_wphy(hw, I82579_LPI_CTRL, phy_reg);
600out:
601 return ret_val;
602}
603
604/**
551 * e1000_check_for_copper_link_ich8lan - Check for link (Copper) 605 * e1000_check_for_copper_link_ich8lan - Check for link (Copper)
552 * @hw: pointer to the HW structure 606 * @hw: pointer to the HW structure
553 * 607 *
@@ -604,6 +658,11 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
604 */ 658 */
605 e1000e_check_downshift(hw); 659 e1000e_check_downshift(hw);
606 660
661 /* Enable/Disable EEE after link up */
662 ret_val = e1000_set_eee_pchlan(hw);
663 if (ret_val)
664 goto out;
665
607 /* 666 /*
608 * If we are forcing speed/duplex, then we simply return since 667 * If we are forcing speed/duplex, then we simply return since
609 * we have already determined whether we have link or not. 668 * we have already determined whether we have link or not.
@@ -647,10 +706,19 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
647 if (rc) 706 if (rc)
648 return rc; 707 return rc;
649 708
650 if (hw->mac.type == e1000_pchlan) 709 switch (hw->mac.type) {
651 rc = e1000_init_phy_params_pchlan(hw); 710 case e1000_ich8lan:
652 else 711 case e1000_ich9lan:
712 case e1000_ich10lan:
653 rc = e1000_init_phy_params_ich8lan(hw); 713 rc = e1000_init_phy_params_ich8lan(hw);
714 break;
715 case e1000_pchlan:
716 case e1000_pch2lan:
717 rc = e1000_init_phy_params_pchlan(hw);
718 break;
719 default:
720 break;
721 }
654 if (rc) 722 if (rc)
655 return rc; 723 return rc;
656 724
@@ -663,6 +731,10 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
663 (adapter->hw.phy.type == e1000_phy_igp_3)) 731 (adapter->hw.phy.type == e1000_phy_igp_3))
664 adapter->flags |= FLAG_LSC_GIG_SPEED_DROP; 732 adapter->flags |= FLAG_LSC_GIG_SPEED_DROP;
665 733
734 /* Disable EEE by default until IEEE802.3az spec is finalized */
735 if (adapter->flags2 & FLAG2_HAS_EEE)
736 adapter->hw.dev_spec.ich8lan.eee_disable = true;
737
666 return 0; 738 return 0;
667} 739}
668 740
@@ -774,7 +846,7 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
774 * e1000_check_mng_mode_ich8lan - Checks management mode 846 * e1000_check_mng_mode_ich8lan - Checks management mode
775 * @hw: pointer to the HW structure 847 * @hw: pointer to the HW structure
776 * 848 *
777 * This checks if the adapter has manageability enabled. 849 * This checks if the adapter has any manageability enabled.
778 * This is a function pointer entry point only called by read/write 850 * This is a function pointer entry point only called by read/write
779 * routines for the PHY and NVM parts. 851 * routines for the PHY and NVM parts.
780 **/ 852 **/
@@ -783,9 +855,26 @@ static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
783 u32 fwsm; 855 u32 fwsm;
784 856
785 fwsm = er32(FWSM); 857 fwsm = er32(FWSM);
858 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
859 ((fwsm & E1000_FWSM_MODE_MASK) ==
860 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
861}
862
863/**
864 * e1000_check_mng_mode_pchlan - Checks management mode
865 * @hw: pointer to the HW structure
866 *
867 * This checks if the adapter has iAMT enabled.
868 * This is a function pointer entry point only called by read/write
869 * routines for the PHY and NVM parts.
870 **/
871static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw)
872{
873 u32 fwsm;
786 874
787 return (fwsm & E1000_FWSM_MODE_MASK) == 875 fwsm = er32(FWSM);
788 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); 876 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
877 (fwsm & (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT));
789} 878}
790 879
791/** 880/**
@@ -820,14 +909,6 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
820 s32 ret_val = 0; 909 s32 ret_val = 0;
821 u16 word_addr, reg_data, reg_addr, phy_page = 0; 910 u16 word_addr, reg_data, reg_addr, phy_page = 0;
822 911
823 if (!(hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) &&
824 !(hw->mac.type == e1000_pchlan))
825 return ret_val;
826
827 ret_val = hw->phy.ops.acquire(hw);
828 if (ret_val)
829 return ret_val;
830
831 /* 912 /*
832 * Initialize the PHY from the NVM on ICH platforms. This 913 * Initialize the PHY from the NVM on ICH platforms. This
833 * is needed due to an issue where the NVM configuration is 914 * is needed due to an issue where the NVM configuration is
@@ -835,12 +916,27 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
835 * Therefore, after each PHY reset, we will load the 916 * Therefore, after each PHY reset, we will load the
836 * configuration data out of the NVM manually. 917 * configuration data out of the NVM manually.
837 */ 918 */
838 if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || 919 switch (hw->mac.type) {
839 (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) || 920 case e1000_ich8lan:
840 (hw->mac.type == e1000_pchlan)) 921 if (phy->type != e1000_phy_igp_3)
922 return ret_val;
923
924 if (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) {
925 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
926 break;
927 }
928 /* Fall-thru */
929 case e1000_pchlan:
930 case e1000_pch2lan:
841 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; 931 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
842 else 932 break;
843 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; 933 default:
934 return ret_val;
935 }
936
937 ret_val = hw->phy.ops.acquire(hw);
938 if (ret_val)
939 return ret_val;
844 940
845 data = er32(FEXTNVM); 941 data = er32(FEXTNVM);
846 if (!(data & sw_cfg_mask)) 942 if (!(data & sw_cfg_mask))
@@ -851,8 +947,10 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
851 * extended configuration before SW configuration 947 * extended configuration before SW configuration
852 */ 948 */
853 data = er32(EXTCNF_CTRL); 949 data = er32(EXTCNF_CTRL);
854 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) 950 if (!(hw->mac.type == e1000_pch2lan)) {
855 goto out; 951 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
952 goto out;
953 }
856 954
857 cnf_size = er32(EXTCNF_SIZE); 955 cnf_size = er32(EXTCNF_SIZE);
858 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; 956 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
@@ -864,7 +962,8 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
864 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; 962 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
865 963
866 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && 964 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
867 (hw->mac.type == e1000_pchlan)) { 965 ((hw->mac.type == e1000_pchlan) ||
966 (hw->mac.type == e1000_pch2lan))) {
868 /* 967 /*
869 * HW configures the SMBus address and LEDs when the 968 * HW configures the SMBus address and LEDs when the
870 * OEM and LCD Write Enable bits are set in the NVM. 969 * OEM and LCD Write Enable bits are set in the NVM.
@@ -1071,16 +1170,18 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1071 u32 mac_reg; 1170 u32 mac_reg;
1072 u16 oem_reg; 1171 u16 oem_reg;
1073 1172
1074 if (hw->mac.type != e1000_pchlan) 1173 if ((hw->mac.type != e1000_pch2lan) && (hw->mac.type != e1000_pchlan))
1075 return ret_val; 1174 return ret_val;
1076 1175
1077 ret_val = hw->phy.ops.acquire(hw); 1176 ret_val = hw->phy.ops.acquire(hw);
1078 if (ret_val) 1177 if (ret_val)
1079 return ret_val; 1178 return ret_val;
1080 1179
1081 mac_reg = er32(EXTCNF_CTRL); 1180 if (!(hw->mac.type == e1000_pch2lan)) {
1082 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) 1181 mac_reg = er32(EXTCNF_CTRL);
1083 goto out; 1182 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
1183 goto out;
1184 }
1084 1185
1085 mac_reg = er32(FEXTNVM); 1186 mac_reg = er32(FEXTNVM);
1086 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M)) 1187 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
@@ -1221,6 +1322,243 @@ out:
1221} 1322}
1222 1323
1223/** 1324/**
1325 * e1000_copy_rx_addrs_to_phy_ich8lan - Copy Rx addresses from MAC to PHY
1326 * @hw: pointer to the HW structure
1327 **/
1328void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw)
1329{
1330 u32 mac_reg;
1331 u16 i;
1332
1333 /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */
1334 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1335 mac_reg = er32(RAL(i));
1336 e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
1337 e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
1338 mac_reg = er32(RAH(i));
1339 e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
1340 e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0x8000));
1341 }
1342}
1343
1344static u32 e1000_calc_rx_da_crc(u8 mac[])
1345{
1346 u32 poly = 0xEDB88320; /* Polynomial for 802.3 CRC calculation */
1347 u32 i, j, mask, crc;
1348
1349 crc = 0xffffffff;
1350 for (i = 0; i < 6; i++) {
1351 crc = crc ^ mac[i];
1352 for (j = 8; j > 0; j--) {
1353 mask = (crc & 1) * (-1);
1354 crc = (crc >> 1) ^ (poly & mask);
1355 }
1356 }
1357 return ~crc;
1358}
1359
1360/**
1361 * e1000_lv_jumbo_workaround_ich8lan - required for jumbo frame operation
1362 * with 82579 PHY
1363 * @hw: pointer to the HW structure
1364 * @enable: flag to enable/disable workaround when enabling/disabling jumbos
1365 **/
1366s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1367{
1368 s32 ret_val = 0;
1369 u16 phy_reg, data;
1370 u32 mac_reg;
1371 u16 i;
1372
1373 if (hw->mac.type != e1000_pch2lan)
1374 goto out;
1375
1376 /* disable Rx path while enabling/disabling workaround */
1377 e1e_rphy(hw, PHY_REG(769, 20), &phy_reg);
1378 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg | (1 << 14));
1379 if (ret_val)
1380 goto out;
1381
1382 if (enable) {
1383 /*
1384 * Write Rx addresses (rar_entry_count for RAL/H, +4 for
1385 * SHRAL/H) and initial CRC values to the MAC
1386 */
1387 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1388 u8 mac_addr[ETH_ALEN] = {0};
1389 u32 addr_high, addr_low;
1390
1391 addr_high = er32(RAH(i));
1392 if (!(addr_high & E1000_RAH_AV))
1393 continue;
1394 addr_low = er32(RAL(i));
1395 mac_addr[0] = (addr_low & 0xFF);
1396 mac_addr[1] = ((addr_low >> 8) & 0xFF);
1397 mac_addr[2] = ((addr_low >> 16) & 0xFF);
1398 mac_addr[3] = ((addr_low >> 24) & 0xFF);
1399 mac_addr[4] = (addr_high & 0xFF);
1400 mac_addr[5] = ((addr_high >> 8) & 0xFF);
1401
1402 ew32(PCH_RAICC(i),
1403 e1000_calc_rx_da_crc(mac_addr));
1404 }
1405
1406 /* Write Rx addresses to the PHY */
1407 e1000_copy_rx_addrs_to_phy_ich8lan(hw);
1408
1409 /* Enable jumbo frame workaround in the MAC */
1410 mac_reg = er32(FFLT_DBG);
1411 mac_reg &= ~(1 << 14);
1412 mac_reg |= (7 << 15);
1413 ew32(FFLT_DBG, mac_reg);
1414
1415 mac_reg = er32(RCTL);
1416 mac_reg |= E1000_RCTL_SECRC;
1417 ew32(RCTL, mac_reg);
1418
1419 ret_val = e1000e_read_kmrn_reg(hw,
1420 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1421 &data);
1422 if (ret_val)
1423 goto out;
1424 ret_val = e1000e_write_kmrn_reg(hw,
1425 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1426 data | (1 << 0));
1427 if (ret_val)
1428 goto out;
1429 ret_val = e1000e_read_kmrn_reg(hw,
1430 E1000_KMRNCTRLSTA_HD_CTRL,
1431 &data);
1432 if (ret_val)
1433 goto out;
1434 data &= ~(0xF << 8);
1435 data |= (0xB << 8);
1436 ret_val = e1000e_write_kmrn_reg(hw,
1437 E1000_KMRNCTRLSTA_HD_CTRL,
1438 data);
1439 if (ret_val)
1440 goto out;
1441
1442 /* Enable jumbo frame workaround in the PHY */
1443 e1e_rphy(hw, PHY_REG(769, 20), &data);
1444 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1445 if (ret_val)
1446 goto out;
1447 e1e_rphy(hw, PHY_REG(769, 23), &data);
1448 data &= ~(0x7F << 5);
1449 data |= (0x37 << 5);
1450 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1451 if (ret_val)
1452 goto out;
1453 e1e_rphy(hw, PHY_REG(769, 16), &data);
1454 data &= ~(1 << 13);
1455 data |= (1 << 12);
1456 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1457 if (ret_val)
1458 goto out;
1459 e1e_rphy(hw, PHY_REG(776, 20), &data);
1460 data &= ~(0x3FF << 2);
1461 data |= (0x1A << 2);
1462 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1463 if (ret_val)
1464 goto out;
1465 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0xFE00);
1466 if (ret_val)
1467 goto out;
1468 e1e_rphy(hw, HV_PM_CTRL, &data);
1469 ret_val = e1e_wphy(hw, HV_PM_CTRL, data | (1 << 10));
1470 if (ret_val)
1471 goto out;
1472 } else {
1473 /* Write MAC register values back to h/w defaults */
1474 mac_reg = er32(FFLT_DBG);
1475 mac_reg &= ~(0xF << 14);
1476 ew32(FFLT_DBG, mac_reg);
1477
1478 mac_reg = er32(RCTL);
1479 mac_reg &= ~E1000_RCTL_SECRC;
1480 ew32(FFLT_DBG, mac_reg);
1481
1482 ret_val = e1000e_read_kmrn_reg(hw,
1483 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1484 &data);
1485 if (ret_val)
1486 goto out;
1487 ret_val = e1000e_write_kmrn_reg(hw,
1488 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1489 data & ~(1 << 0));
1490 if (ret_val)
1491 goto out;
1492 ret_val = e1000e_read_kmrn_reg(hw,
1493 E1000_KMRNCTRLSTA_HD_CTRL,
1494 &data);
1495 if (ret_val)
1496 goto out;
1497 data &= ~(0xF << 8);
1498 data |= (0xB << 8);
1499 ret_val = e1000e_write_kmrn_reg(hw,
1500 E1000_KMRNCTRLSTA_HD_CTRL,
1501 data);
1502 if (ret_val)
1503 goto out;
1504
1505 /* Write PHY register values back to h/w defaults */
1506 e1e_rphy(hw, PHY_REG(769, 20), &data);
1507 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1508 if (ret_val)
1509 goto out;
1510 e1e_rphy(hw, PHY_REG(769, 23), &data);
1511 data &= ~(0x7F << 5);
1512 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1513 if (ret_val)
1514 goto out;
1515 e1e_rphy(hw, PHY_REG(769, 16), &data);
1516 data &= ~(1 << 12);
1517 data |= (1 << 13);
1518 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1519 if (ret_val)
1520 goto out;
1521 e1e_rphy(hw, PHY_REG(776, 20), &data);
1522 data &= ~(0x3FF << 2);
1523 data |= (0x8 << 2);
1524 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1525 if (ret_val)
1526 goto out;
1527 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0x7E00);
1528 if (ret_val)
1529 goto out;
1530 e1e_rphy(hw, HV_PM_CTRL, &data);
1531 ret_val = e1e_wphy(hw, HV_PM_CTRL, data & ~(1 << 10));
1532 if (ret_val)
1533 goto out;
1534 }
1535
1536 /* re-enable Rx path after enabling/disabling workaround */
1537 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14));
1538
1539out:
1540 return ret_val;
1541}
1542
1543/**
1544 * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be
1545 * done after every PHY reset.
1546 **/
1547static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1548{
1549 s32 ret_val = 0;
1550
1551 if (hw->mac.type != e1000_pch2lan)
1552 goto out;
1553
1554 /* Set MDIO slow mode before any other MDIO access */
1555 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1556
1557out:
1558 return ret_val;
1559}
1560
1561/**
1224 * e1000_lan_init_done_ich8lan - Check for PHY config completion 1562 * e1000_lan_init_done_ich8lan - Check for PHY config completion
1225 * @hw: pointer to the HW structure 1563 * @hw: pointer to the HW structure
1226 * 1564 *
@@ -1271,12 +1609,17 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1271 if (ret_val) 1609 if (ret_val)
1272 goto out; 1610 goto out;
1273 break; 1611 break;
1612 case e1000_pch2lan:
1613 ret_val = e1000_lv_phy_workarounds_ich8lan(hw);
1614 if (ret_val)
1615 goto out;
1616 break;
1274 default: 1617 default:
1275 break; 1618 break;
1276 } 1619 }
1277 1620
1278 /* Dummy read to clear the phy wakeup bit after lcd reset */ 1621 /* Dummy read to clear the phy wakeup bit after lcd reset */
1279 if (hw->mac.type == e1000_pchlan) 1622 if (hw->mac.type >= e1000_pchlan)
1280 e1e_rphy(hw, BM_WUC, &reg); 1623 e1e_rphy(hw, BM_WUC, &reg);
1281 1624
1282 /* Configure the LCD with the extended configuration region in NVM */ 1625 /* Configure the LCD with the extended configuration region in NVM */
@@ -2800,6 +3143,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2800 3143
2801 ew32(FCTTV, hw->fc.pause_time); 3144 ew32(FCTTV, hw->fc.pause_time);
2802 if ((hw->phy.type == e1000_phy_82578) || 3145 if ((hw->phy.type == e1000_phy_82578) ||
3146 (hw->phy.type == e1000_phy_82579) ||
2803 (hw->phy.type == e1000_phy_82577)) { 3147 (hw->phy.type == e1000_phy_82577)) {
2804 ew32(FCRTV_PCH, hw->fc.refresh_time); 3148 ew32(FCRTV_PCH, hw->fc.refresh_time);
2805 3149
@@ -2863,6 +3207,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2863 return ret_val; 3207 return ret_val;
2864 break; 3208 break;
2865 case e1000_phy_82577: 3209 case e1000_phy_82577:
3210 case e1000_phy_82579:
2866 ret_val = e1000_copper_link_setup_82577(hw); 3211 ret_val = e1000_copper_link_setup_82577(hw);
2867 if (ret_val) 3212 if (ret_val)
2868 return ret_val; 3213 return ret_val;
@@ -3116,21 +3461,12 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
3116{ 3461{
3117 u32 phy_ctrl; 3462 u32 phy_ctrl;
3118 3463
3119 switch (hw->mac.type) { 3464 phy_ctrl = er32(PHY_CTRL);
3120 case e1000_ich8lan: 3465 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE;
3121 case e1000_ich9lan: 3466 ew32(PHY_CTRL, phy_ctrl);
3122 case e1000_ich10lan:
3123 case e1000_pchlan:
3124 phy_ctrl = er32(PHY_CTRL);
3125 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU |
3126 E1000_PHY_CTRL_GBE_DISABLE;
3127 ew32(PHY_CTRL, phy_ctrl);
3128 3467
3129 if (hw->mac.type == e1000_pchlan) 3468 if (hw->mac.type >= e1000_pchlan)
3130 e1000_phy_hw_reset_ich8lan(hw); 3469 e1000_phy_hw_reset_ich8lan(hw);
3131 default:
3132 break;
3133 }
3134} 3470}
3135 3471
3136/** 3472/**
@@ -3370,6 +3706,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
3370 3706
3371 /* Clear PHY statistics registers */ 3707 /* Clear PHY statistics registers */
3372 if ((hw->phy.type == e1000_phy_82578) || 3708 if ((hw->phy.type == e1000_phy_82578) ||
3709 (hw->phy.type == e1000_phy_82579) ||
3373 (hw->phy.type == e1000_phy_82577)) { 3710 (hw->phy.type == e1000_phy_82577)) {
3374 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data); 3711 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data);
3375 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data); 3712 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data);
@@ -3390,7 +3727,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
3390 3727
3391static struct e1000_mac_operations ich8_mac_ops = { 3728static struct e1000_mac_operations ich8_mac_ops = {
3392 .id_led_init = e1000e_id_led_init, 3729 .id_led_init = e1000e_id_led_init,
3393 .check_mng_mode = e1000_check_mng_mode_ich8lan, 3730 /* check_mng_mode dependent on mac type */
3394 .check_for_link = e1000_check_for_copper_link_ich8lan, 3731 .check_for_link = e1000_check_for_copper_link_ich8lan,
3395 /* cleanup_led dependent on mac type */ 3732 /* cleanup_led dependent on mac type */
3396 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, 3733 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
@@ -3497,6 +3834,7 @@ struct e1000_info e1000_pch_info = {
3497 | FLAG_HAS_JUMBO_FRAMES 3834 | FLAG_HAS_JUMBO_FRAMES
3498 | FLAG_DISABLE_FC_PAUSE_TIME /* errata */ 3835 | FLAG_DISABLE_FC_PAUSE_TIME /* errata */
3499 | FLAG_APME_IN_WUC, 3836 | FLAG_APME_IN_WUC,
3837 .flags2 = FLAG2_HAS_PHY_STATS,
3500 .pba = 26, 3838 .pba = 26,
3501 .max_hw_frame_size = 4096, 3839 .max_hw_frame_size = 4096,
3502 .get_variants = e1000_get_variants_ich8lan, 3840 .get_variants = e1000_get_variants_ich8lan,
@@ -3504,3 +3842,23 @@ struct e1000_info e1000_pch_info = {
3504 .phy_ops = &ich8_phy_ops, 3842 .phy_ops = &ich8_phy_ops,
3505 .nvm_ops = &ich8_nvm_ops, 3843 .nvm_ops = &ich8_nvm_ops,
3506}; 3844};
3845
3846struct e1000_info e1000_pch2_info = {
3847 .mac = e1000_pch2lan,
3848 .flags = FLAG_IS_ICH
3849 | FLAG_HAS_WOL
3850 | FLAG_RX_CSUM_ENABLED
3851 | FLAG_HAS_CTRLEXT_ON_LOAD
3852 | FLAG_HAS_AMT
3853 | FLAG_HAS_FLASH
3854 | FLAG_HAS_JUMBO_FRAMES
3855 | FLAG_APME_IN_WUC,
3856 .flags2 = FLAG2_HAS_PHY_STATS
3857 | FLAG2_HAS_EEE,
3858 .pba = 18,
3859 .max_hw_frame_size = DEFAULT_JUMBO,
3860 .get_variants = e1000_get_variants_ich8lan,
3861 .mac_ops = &ich8_mac_ops,
3862 .phy_ops = &ich8_phy_ops,
3863 .nvm_ops = &ich8_nvm_ops,
3864};
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index a968e3a416ac..df4a27922931 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 9f13b660b801..36d31a416320 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -52,7 +52,9 @@
52 52
53#include "e1000.h" 53#include "e1000.h"
54 54
55#define DRV_VERSION "1.0.2-k4" 55#define DRV_EXTRAVERSION "-k2"
56
57#define DRV_VERSION "1.2.7" DRV_EXTRAVERSION
56char e1000e_driver_name[] = "e1000e"; 58char e1000e_driver_name[] = "e1000e";
57const char e1000e_driver_version[] = DRV_VERSION; 59const char e1000e_driver_version[] = DRV_VERSION;
58 60
@@ -67,6 +69,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
67 [board_ich9lan] = &e1000_ich9_info, 69 [board_ich9lan] = &e1000_ich9_info,
68 [board_ich10lan] = &e1000_ich10_info, 70 [board_ich10lan] = &e1000_ich10_info,
69 [board_pchlan] = &e1000_pch_info, 71 [board_pchlan] = &e1000_pch_info,
72 [board_pch2lan] = &e1000_pch2_info,
70}; 73};
71 74
72struct e1000_reg_info { 75struct e1000_reg_info {
@@ -221,10 +224,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
221 buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; 224 buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean];
222 printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", 225 printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n",
223 0, tx_ring->next_to_use, tx_ring->next_to_clean, 226 0, tx_ring->next_to_use, tx_ring->next_to_clean,
224 (u64)buffer_info->dma, 227 (unsigned long long)buffer_info->dma,
225 buffer_info->length, 228 buffer_info->length,
226 buffer_info->next_to_watch, 229 buffer_info->next_to_watch,
227 (u64)buffer_info->time_stamp); 230 (unsigned long long)buffer_info->time_stamp);
228 231
229 /* Print TX Rings */ 232 /* Print TX Rings */
230 if (!netif_msg_tx_done(adapter)) 233 if (!netif_msg_tx_done(adapter))
@@ -276,9 +279,11 @@ static void e1000e_dump(struct e1000_adapter *adapter)
276 "%04X %3X %016llX %p", 279 "%04X %3X %016llX %p",
277 (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' : 280 (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' :
278 ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i, 281 ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i,
279 le64_to_cpu(u0->a), le64_to_cpu(u0->b), 282 (unsigned long long)le64_to_cpu(u0->a),
280 (u64)buffer_info->dma, buffer_info->length, 283 (unsigned long long)le64_to_cpu(u0->b),
281 buffer_info->next_to_watch, (u64)buffer_info->time_stamp, 284 (unsigned long long)buffer_info->dma,
285 buffer_info->length, buffer_info->next_to_watch,
286 (unsigned long long)buffer_info->time_stamp,
282 buffer_info->skb); 287 buffer_info->skb);
283 if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean) 288 if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean)
284 printk(KERN_CONT " NTC/U\n"); 289 printk(KERN_CONT " NTC/U\n");
@@ -353,19 +358,19 @@ rx_ring_summary:
353 printk(KERN_INFO "RWB[0x%03X] %016llX " 358 printk(KERN_INFO "RWB[0x%03X] %016llX "
354 "%016llX %016llX %016llX " 359 "%016llX %016llX %016llX "
355 "---------------- %p", i, 360 "---------------- %p", i,
356 le64_to_cpu(u1->a), 361 (unsigned long long)le64_to_cpu(u1->a),
357 le64_to_cpu(u1->b), 362 (unsigned long long)le64_to_cpu(u1->b),
358 le64_to_cpu(u1->c), 363 (unsigned long long)le64_to_cpu(u1->c),
359 le64_to_cpu(u1->d), 364 (unsigned long long)le64_to_cpu(u1->d),
360 buffer_info->skb); 365 buffer_info->skb);
361 } else { 366 } else {
362 printk(KERN_INFO "R [0x%03X] %016llX " 367 printk(KERN_INFO "R [0x%03X] %016llX "
363 "%016llX %016llX %016llX %016llX %p", i, 368 "%016llX %016llX %016llX %016llX %p", i,
364 le64_to_cpu(u1->a), 369 (unsigned long long)le64_to_cpu(u1->a),
365 le64_to_cpu(u1->b), 370 (unsigned long long)le64_to_cpu(u1->b),
366 le64_to_cpu(u1->c), 371 (unsigned long long)le64_to_cpu(u1->c),
367 le64_to_cpu(u1->d), 372 (unsigned long long)le64_to_cpu(u1->d),
368 (u64)buffer_info->dma, 373 (unsigned long long)buffer_info->dma,
369 buffer_info->skb); 374 buffer_info->skb);
370 375
371 if (netif_msg_pktdata(adapter)) 376 if (netif_msg_pktdata(adapter))
@@ -402,9 +407,11 @@ rx_ring_summary:
402 buffer_info = &rx_ring->buffer_info[i]; 407 buffer_info = &rx_ring->buffer_info[i];
403 u0 = (struct my_u0 *)rx_desc; 408 u0 = (struct my_u0 *)rx_desc;
404 printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " 409 printk(KERN_INFO "Rl[0x%03X] %016llX %016llX "
405 "%016llX %p", 410 "%016llX %p", i,
406 i, le64_to_cpu(u0->a), le64_to_cpu(u0->b), 411 (unsigned long long)le64_to_cpu(u0->a),
407 (u64)buffer_info->dma, buffer_info->skb); 412 (unsigned long long)le64_to_cpu(u0->b),
413 (unsigned long long)buffer_info->dma,
414 buffer_info->skb);
408 if (i == rx_ring->next_to_use) 415 if (i == rx_ring->next_to_use)
409 printk(KERN_CONT " NTU\n"); 416 printk(KERN_CONT " NTU\n");
410 else if (i == rx_ring->next_to_clean) 417 else if (i == rx_ring->next_to_clean)
@@ -1778,25 +1785,25 @@ void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter)
1778void e1000e_set_interrupt_capability(struct e1000_adapter *adapter) 1785void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
1779{ 1786{
1780 int err; 1787 int err;
1781 int numvecs, i; 1788 int i;
1782
1783 1789
1784 switch (adapter->int_mode) { 1790 switch (adapter->int_mode) {
1785 case E1000E_INT_MODE_MSIX: 1791 case E1000E_INT_MODE_MSIX:
1786 if (adapter->flags & FLAG_HAS_MSIX) { 1792 if (adapter->flags & FLAG_HAS_MSIX) {
1787 numvecs = 3; /* RxQ0, TxQ0 and other */ 1793 adapter->num_vectors = 3; /* RxQ0, TxQ0 and other */
1788 adapter->msix_entries = kcalloc(numvecs, 1794 adapter->msix_entries = kcalloc(adapter->num_vectors,
1789 sizeof(struct msix_entry), 1795 sizeof(struct msix_entry),
1790 GFP_KERNEL); 1796 GFP_KERNEL);
1791 if (adapter->msix_entries) { 1797 if (adapter->msix_entries) {
1792 for (i = 0; i < numvecs; i++) 1798 for (i = 0; i < adapter->num_vectors; i++)
1793 adapter->msix_entries[i].entry = i; 1799 adapter->msix_entries[i].entry = i;
1794 1800
1795 err = pci_enable_msix(adapter->pdev, 1801 err = pci_enable_msix(adapter->pdev,
1796 adapter->msix_entries, 1802 adapter->msix_entries,
1797 numvecs); 1803 adapter->num_vectors);
1798 if (err == 0) 1804 if (err == 0) {
1799 return; 1805 return;
1806 }
1800 } 1807 }
1801 /* MSI-X failed, so fall through and try MSI */ 1808 /* MSI-X failed, so fall through and try MSI */
1802 e_err("Failed to initialize MSI-X interrupts. " 1809 e_err("Failed to initialize MSI-X interrupts. "
@@ -1818,6 +1825,9 @@ void e1000e_set_interrupt_capability(struct e1000_adapter *adapter)
1818 /* Don't do anything; this is the system default */ 1825 /* Don't do anything; this is the system default */
1819 break; 1826 break;
1820 } 1827 }
1828
1829 /* store the number of vectors being used */
1830 adapter->num_vectors = 1;
1821} 1831}
1822 1832
1823/** 1833/**
@@ -1939,7 +1949,14 @@ static void e1000_irq_disable(struct e1000_adapter *adapter)
1939 if (adapter->msix_entries) 1949 if (adapter->msix_entries)
1940 ew32(EIAC_82574, 0); 1950 ew32(EIAC_82574, 0);
1941 e1e_flush(); 1951 e1e_flush();
1942 synchronize_irq(adapter->pdev->irq); 1952
1953 if (adapter->msix_entries) {
1954 int i;
1955 for (i = 0; i < adapter->num_vectors; i++)
1956 synchronize_irq(adapter->msix_entries[i].vector);
1957 } else {
1958 synchronize_irq(adapter->pdev->irq);
1959 }
1943} 1960}
1944 1961
1945/** 1962/**
@@ -2723,6 +2740,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2723 e1e_wphy(hw, 22, phy_data); 2740 e1e_wphy(hw, 22, phy_data);
2724 } 2741 }
2725 2742
2743 /* Workaround Si errata on 82579 - configure jumbo frame flow */
2744 if (hw->mac.type == e1000_pch2lan) {
2745 s32 ret_val;
2746
2747 if (rctl & E1000_RCTL_LPE)
2748 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
2749 else
2750 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
2751 }
2752
2726 /* Setup buffer sizes */ 2753 /* Setup buffer sizes */
2727 rctl &= ~E1000_RCTL_SZ_4096; 2754 rctl &= ~E1000_RCTL_SZ_4096;
2728 rctl |= E1000_RCTL_BSEX; 2755 rctl |= E1000_RCTL_BSEX;
@@ -2759,7 +2786,7 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2759 * per packet. 2786 * per packet.
2760 */ 2787 */
2761 pages = PAGE_USE_COUNT(adapter->netdev->mtu); 2788 pages = PAGE_USE_COUNT(adapter->netdev->mtu);
2762 if (!(adapter->flags & FLAG_IS_ICH) && (pages <= 3) && 2789 if (!(adapter->flags & FLAG_HAS_ERT) && (pages <= 3) &&
2763 (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE)) 2790 (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE))
2764 adapter->rx_ps_pages = pages; 2791 adapter->rx_ps_pages = pages;
2765 else 2792 else
@@ -3118,7 +3145,27 @@ void e1000e_reset(struct e1000_adapter *adapter)
3118 * with ERT support assuming ERT set to E1000_ERT_2048), or 3145 * with ERT support assuming ERT set to E1000_ERT_2048), or
3119 * - the full Rx FIFO size minus one full frame 3146 * - the full Rx FIFO size minus one full frame
3120 */ 3147 */
3121 if (hw->mac.type == e1000_pchlan) { 3148 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
3149 fc->pause_time = 0xFFFF;
3150 else
3151 fc->pause_time = E1000_FC_PAUSE_TIME;
3152 fc->send_xon = 1;
3153 fc->current_mode = fc->requested_mode;
3154
3155 switch (hw->mac.type) {
3156 default:
3157 if ((adapter->flags & FLAG_HAS_ERT) &&
3158 (adapter->netdev->mtu > ETH_DATA_LEN))
3159 hwm = min(((pba << 10) * 9 / 10),
3160 ((pba << 10) - (E1000_ERT_2048 << 3)));
3161 else
3162 hwm = min(((pba << 10) * 9 / 10),
3163 ((pba << 10) - adapter->max_frame_size));
3164
3165 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
3166 fc->low_water = fc->high_water - 8;
3167 break;
3168 case e1000_pchlan:
3122 /* 3169 /*
3123 * Workaround PCH LOM adapter hangs with certain network 3170 * Workaround PCH LOM adapter hangs with certain network
3124 * loads. If hangs persist, try disabling Tx flow control. 3171 * loads. If hangs persist, try disabling Tx flow control.
@@ -3131,26 +3178,15 @@ void e1000e_reset(struct e1000_adapter *adapter)
3131 fc->low_water = 0x3000; 3178 fc->low_water = 0x3000;
3132 } 3179 }
3133 fc->refresh_time = 0x1000; 3180 fc->refresh_time = 0x1000;
3134 } else { 3181 break;
3135 if ((adapter->flags & FLAG_HAS_ERT) && 3182 case e1000_pch2lan:
3136 (adapter->netdev->mtu > ETH_DATA_LEN)) 3183 fc->high_water = 0x05C20;
3137 hwm = min(((pba << 10) * 9 / 10), 3184 fc->low_water = 0x05048;
3138 ((pba << 10) - (E1000_ERT_2048 << 3))); 3185 fc->pause_time = 0x0650;
3139 else 3186 fc->refresh_time = 0x0400;
3140 hwm = min(((pba << 10) * 9 / 10), 3187 break;
3141 ((pba << 10) - adapter->max_frame_size));
3142
3143 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
3144 fc->low_water = fc->high_water - 8;
3145 } 3188 }
3146 3189
3147 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
3148 fc->pause_time = 0xFFFF;
3149 else
3150 fc->pause_time = E1000_FC_PAUSE_TIME;
3151 fc->send_xon = 1;
3152 fc->current_mode = fc->requested_mode;
3153
3154 /* Allow time for pending master requests to run */ 3190 /* Allow time for pending master requests to run */
3155 mac->ops.reset_hw(hw); 3191 mac->ops.reset_hw(hw);
3156 3192
@@ -3162,8 +3198,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
3162 e1000_get_hw_control(adapter); 3198 e1000_get_hw_control(adapter);
3163 3199
3164 ew32(WUC, 0); 3200 ew32(WUC, 0);
3165 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP)
3166 e1e_wphy(&adapter->hw, BM_WUC, 0);
3167 3201
3168 if (mac->ops.init_hw(hw)) 3202 if (mac->ops.init_hw(hw))
3169 e_err("Hardware Error\n"); 3203 e_err("Hardware Error\n");
@@ -3194,12 +3228,6 @@ int e1000e_up(struct e1000_adapter *adapter)
3194{ 3228{
3195 struct e1000_hw *hw = &adapter->hw; 3229 struct e1000_hw *hw = &adapter->hw;
3196 3230
3197 /* DMA latency requirement to workaround early-receive/jumbo issue */
3198 if (adapter->flags & FLAG_HAS_ERT)
3199 pm_qos_add_request(&adapter->netdev->pm_qos_req,
3200 PM_QOS_CPU_DMA_LATENCY,
3201 PM_QOS_DEFAULT_VALUE);
3202
3203 /* hardware has been reset, we need to reload some things */ 3231 /* hardware has been reset, we need to reload some things */
3204 e1000_configure(adapter); 3232 e1000_configure(adapter);
3205 3233
@@ -3263,9 +3291,6 @@ void e1000e_down(struct e1000_adapter *adapter)
3263 e1000_clean_tx_ring(adapter); 3291 e1000_clean_tx_ring(adapter);
3264 e1000_clean_rx_ring(adapter); 3292 e1000_clean_rx_ring(adapter);
3265 3293
3266 if (adapter->flags & FLAG_HAS_ERT)
3267 pm_qos_remove_request(&adapter->netdev->pm_qos_req);
3268
3269 /* 3294 /*
3270 * TODO: for power management, we could drop the link and 3295 * TODO: for power management, we could drop the link and
3271 * pci_disable_device here. 3296 * pci_disable_device here.
@@ -3416,13 +3441,18 @@ static int e1000_test_msi(struct e1000_adapter *adapter)
3416 3441
3417 /* disable SERR in case the MSI write causes a master abort */ 3442 /* disable SERR in case the MSI write causes a master abort */
3418 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); 3443 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
3419 pci_write_config_word(adapter->pdev, PCI_COMMAND, 3444 if (pci_cmd & PCI_COMMAND_SERR)
3420 pci_cmd & ~PCI_COMMAND_SERR); 3445 pci_write_config_word(adapter->pdev, PCI_COMMAND,
3446 pci_cmd & ~PCI_COMMAND_SERR);
3421 3447
3422 err = e1000_test_msi_interrupt(adapter); 3448 err = e1000_test_msi_interrupt(adapter);
3423 3449
3424 /* restore previous setting of command word */ 3450 /* re-enable SERR */
3425 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd); 3451 if (pci_cmd & PCI_COMMAND_SERR) {
3452 pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
3453 pci_cmd |= PCI_COMMAND_SERR;
3454 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);
3455 }
3426 3456
3427 /* success ! */ 3457 /* success ! */
3428 if (!err) 3458 if (!err)
@@ -3495,6 +3525,12 @@ static int e1000_open(struct net_device *netdev)
3495 E1000_MNG_DHCP_COOKIE_STATUS_VLAN)) 3525 E1000_MNG_DHCP_COOKIE_STATUS_VLAN))
3496 e1000_update_mng_vlan(adapter); 3526 e1000_update_mng_vlan(adapter);
3497 3527
3528 /* DMA latency requirement to workaround early-receive/jumbo issue */
3529 if (adapter->flags & FLAG_HAS_ERT)
3530 pm_qos_add_request(&adapter->netdev->pm_qos_req,
3531 PM_QOS_CPU_DMA_LATENCY,
3532 PM_QOS_DEFAULT_VALUE);
3533
3498 /* 3534 /*
3499 * before we allocate an interrupt, we must be ready to handle it. 3535 * before we allocate an interrupt, we must be ready to handle it.
3500 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt 3536 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
@@ -3599,6 +3635,9 @@ static int e1000_close(struct net_device *netdev)
3599 if (adapter->flags & FLAG_HAS_AMT) 3635 if (adapter->flags & FLAG_HAS_AMT)
3600 e1000_release_hw_control(adapter); 3636 e1000_release_hw_control(adapter);
3601 3637
3638 if (adapter->flags & FLAG_HAS_ERT)
3639 pm_qos_remove_request(&adapter->netdev->pm_qos_req);
3640
3602 pm_runtime_put_sync(&pdev->dev); 3641 pm_runtime_put_sync(&pdev->dev);
3603 3642
3604 return 0; 3643 return 0;
@@ -3669,6 +3708,110 @@ static void e1000_update_phy_info(unsigned long data)
3669} 3708}
3670 3709
3671/** 3710/**
3711 * e1000e_update_phy_stats - Update the PHY statistics counters
3712 * @adapter: board private structure
3713 **/
3714static void e1000e_update_phy_stats(struct e1000_adapter *adapter)
3715{
3716 struct e1000_hw *hw = &adapter->hw;
3717 s32 ret_val;
3718 u16 phy_data;
3719
3720 ret_val = hw->phy.ops.acquire(hw);
3721 if (ret_val)
3722 return;
3723
3724 hw->phy.addr = 1;
3725
3726#define HV_PHY_STATS_PAGE 778
3727 /*
3728 * A page set is expensive so check if already on desired page.
3729 * If not, set to the page with the PHY status registers.
3730 */
3731 ret_val = e1000e_read_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
3732 &phy_data);
3733 if (ret_val)
3734 goto release;
3735 if (phy_data != (HV_PHY_STATS_PAGE << IGP_PAGE_SHIFT)) {
3736 ret_val = e1000e_write_phy_reg_mdic(hw,
3737 IGP01E1000_PHY_PAGE_SELECT,
3738 (HV_PHY_STATS_PAGE <<
3739 IGP_PAGE_SHIFT));
3740 if (ret_val)
3741 goto release;
3742 }
3743
3744 /* Read/clear the upper 16-bit registers and read/accumulate lower */
3745
3746 /* Single Collision Count */
3747 e1000e_read_phy_reg_mdic(hw, HV_SCC_UPPER & MAX_PHY_REG_ADDRESS,
3748 &phy_data);
3749 ret_val = e1000e_read_phy_reg_mdic(hw,
3750 HV_SCC_LOWER & MAX_PHY_REG_ADDRESS,
3751 &phy_data);
3752 if (!ret_val)
3753 adapter->stats.scc += phy_data;
3754
3755 /* Excessive Collision Count */
3756 e1000e_read_phy_reg_mdic(hw, HV_ECOL_UPPER & MAX_PHY_REG_ADDRESS,
3757 &phy_data);
3758 ret_val = e1000e_read_phy_reg_mdic(hw,
3759 HV_ECOL_LOWER & MAX_PHY_REG_ADDRESS,
3760 &phy_data);
3761 if (!ret_val)
3762 adapter->stats.ecol += phy_data;
3763
3764 /* Multiple Collision Count */
3765 e1000e_read_phy_reg_mdic(hw, HV_MCC_UPPER & MAX_PHY_REG_ADDRESS,
3766 &phy_data);
3767 ret_val = e1000e_read_phy_reg_mdic(hw,
3768 HV_MCC_LOWER & MAX_PHY_REG_ADDRESS,
3769 &phy_data);
3770 if (!ret_val)
3771 adapter->stats.mcc += phy_data;
3772
3773 /* Late Collision Count */
3774 e1000e_read_phy_reg_mdic(hw, HV_LATECOL_UPPER & MAX_PHY_REG_ADDRESS,
3775 &phy_data);
3776 ret_val = e1000e_read_phy_reg_mdic(hw,
3777 HV_LATECOL_LOWER &
3778 MAX_PHY_REG_ADDRESS,
3779 &phy_data);
3780 if (!ret_val)
3781 adapter->stats.latecol += phy_data;
3782
3783 /* Collision Count - also used for adaptive IFS */
3784 e1000e_read_phy_reg_mdic(hw, HV_COLC_UPPER & MAX_PHY_REG_ADDRESS,
3785 &phy_data);
3786 ret_val = e1000e_read_phy_reg_mdic(hw,
3787 HV_COLC_LOWER & MAX_PHY_REG_ADDRESS,
3788 &phy_data);
3789 if (!ret_val)
3790 hw->mac.collision_delta = phy_data;
3791
3792 /* Defer Count */
3793 e1000e_read_phy_reg_mdic(hw, HV_DC_UPPER & MAX_PHY_REG_ADDRESS,
3794 &phy_data);
3795 ret_val = e1000e_read_phy_reg_mdic(hw,
3796 HV_DC_LOWER & MAX_PHY_REG_ADDRESS,
3797 &phy_data);
3798 if (!ret_val)
3799 adapter->stats.dc += phy_data;
3800
3801 /* Transmit with no CRS */
3802 e1000e_read_phy_reg_mdic(hw, HV_TNCRS_UPPER & MAX_PHY_REG_ADDRESS,
3803 &phy_data);
3804 ret_val = e1000e_read_phy_reg_mdic(hw,
3805 HV_TNCRS_LOWER & MAX_PHY_REG_ADDRESS,
3806 &phy_data);
3807 if (!ret_val)
3808 adapter->stats.tncrs += phy_data;
3809
3810release:
3811 hw->phy.ops.release(hw);
3812}
3813
3814/**
3672 * e1000e_update_stats - Update the board statistics counters 3815 * e1000e_update_stats - Update the board statistics counters
3673 * @adapter: board private structure 3816 * @adapter: board private structure
3674 **/ 3817 **/
@@ -3677,7 +3820,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3677 struct net_device *netdev = adapter->netdev; 3820 struct net_device *netdev = adapter->netdev;
3678 struct e1000_hw *hw = &adapter->hw; 3821 struct e1000_hw *hw = &adapter->hw;
3679 struct pci_dev *pdev = adapter->pdev; 3822 struct pci_dev *pdev = adapter->pdev;
3680 u16 phy_data;
3681 3823
3682 /* 3824 /*
3683 * Prevent stats update while adapter is being reset, or if the pci 3825 * Prevent stats update while adapter is being reset, or if the pci
@@ -3697,34 +3839,27 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3697 adapter->stats.roc += er32(ROC); 3839 adapter->stats.roc += er32(ROC);
3698 3840
3699 adapter->stats.mpc += er32(MPC); 3841 adapter->stats.mpc += er32(MPC);
3700 if ((hw->phy.type == e1000_phy_82578) || 3842
3701 (hw->phy.type == e1000_phy_82577)) { 3843 /* Half-duplex statistics */
3702 e1e_rphy(hw, HV_SCC_UPPER, &phy_data); 3844 if (adapter->link_duplex == HALF_DUPLEX) {
3703 if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data)) 3845 if (adapter->flags2 & FLAG2_HAS_PHY_STATS) {
3704 adapter->stats.scc += phy_data; 3846 e1000e_update_phy_stats(adapter);
3705 3847 } else {
3706 e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); 3848 adapter->stats.scc += er32(SCC);
3707 if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data)) 3849 adapter->stats.ecol += er32(ECOL);
3708 adapter->stats.ecol += phy_data; 3850 adapter->stats.mcc += er32(MCC);
3709 3851 adapter->stats.latecol += er32(LATECOL);
3710 e1e_rphy(hw, HV_MCC_UPPER, &phy_data); 3852 adapter->stats.dc += er32(DC);
3711 if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data)) 3853
3712 adapter->stats.mcc += phy_data; 3854 hw->mac.collision_delta = er32(COLC);
3713 3855
3714 e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); 3856 if ((hw->mac.type != e1000_82574) &&
3715 if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data)) 3857 (hw->mac.type != e1000_82583))
3716 adapter->stats.latecol += phy_data; 3858 adapter->stats.tncrs += er32(TNCRS);
3717 3859 }
3718 e1e_rphy(hw, HV_DC_UPPER, &phy_data); 3860 adapter->stats.colc += hw->mac.collision_delta;
3719 if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data))
3720 adapter->stats.dc += phy_data;
3721 } else {
3722 adapter->stats.scc += er32(SCC);
3723 adapter->stats.ecol += er32(ECOL);
3724 adapter->stats.mcc += er32(MCC);
3725 adapter->stats.latecol += er32(LATECOL);
3726 adapter->stats.dc += er32(DC);
3727 } 3861 }
3862
3728 adapter->stats.xonrxc += er32(XONRXC); 3863 adapter->stats.xonrxc += er32(XONRXC);
3729 adapter->stats.xontxc += er32(XONTXC); 3864 adapter->stats.xontxc += er32(XONTXC);
3730 adapter->stats.xoffrxc += er32(XOFFRXC); 3865 adapter->stats.xoffrxc += er32(XOFFRXC);
@@ -3742,28 +3877,9 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3742 3877
3743 hw->mac.tx_packet_delta = er32(TPT); 3878 hw->mac.tx_packet_delta = er32(TPT);
3744 adapter->stats.tpt += hw->mac.tx_packet_delta; 3879 adapter->stats.tpt += hw->mac.tx_packet_delta;
3745 if ((hw->phy.type == e1000_phy_82578) ||
3746 (hw->phy.type == e1000_phy_82577)) {
3747 e1e_rphy(hw, HV_COLC_UPPER, &phy_data);
3748 if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data))
3749 hw->mac.collision_delta = phy_data;
3750 } else {
3751 hw->mac.collision_delta = er32(COLC);
3752 }
3753 adapter->stats.colc += hw->mac.collision_delta;
3754 3880
3755 adapter->stats.algnerrc += er32(ALGNERRC); 3881 adapter->stats.algnerrc += er32(ALGNERRC);
3756 adapter->stats.rxerrc += er32(RXERRC); 3882 adapter->stats.rxerrc += er32(RXERRC);
3757 if ((hw->phy.type == e1000_phy_82578) ||
3758 (hw->phy.type == e1000_phy_82577)) {
3759 e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data);
3760 if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data))
3761 adapter->stats.tncrs += phy_data;
3762 } else {
3763 if ((hw->mac.type != e1000_82574) &&
3764 (hw->mac.type != e1000_82583))
3765 adapter->stats.tncrs += er32(TNCRS);
3766 }
3767 adapter->stats.cexterr += er32(CEXTERR); 3883 adapter->stats.cexterr += er32(CEXTERR);
3768 adapter->stats.tsctc += er32(TSCTC); 3884 adapter->stats.tsctc += er32(TSCTC);
3769 adapter->stats.tsctfc += er32(TSCTFC); 3885 adapter->stats.tsctfc += er32(TSCTFC);
@@ -3862,7 +3978,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
3862 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); 3978 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
3863} 3979}
3864 3980
3865bool e1000e_has_link(struct e1000_adapter *adapter) 3981static bool e1000e_has_link(struct e1000_adapter *adapter)
3866{ 3982{
3867 struct e1000_hw *hw = &adapter->hw; 3983 struct e1000_hw *hw = &adapter->hw;
3868 bool link_active = 0; 3984 bool link_active = 0;
@@ -4838,14 +4954,7 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
4838 int retval = 0; 4954 int retval = 0;
4839 4955
4840 /* copy MAC RARs to PHY RARs */ 4956 /* copy MAC RARs to PHY RARs */
4841 for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) { 4957 e1000_copy_rx_addrs_to_phy_ich8lan(hw);
4842 mac_reg = er32(RAL(i));
4843 e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
4844 e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
4845 mac_reg = er32(RAH(i));
4846 e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
4847 e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0xFFFF));
4848 }
4849 4958
4850 /* copy MAC MTA to PHY MTA */ 4959 /* copy MAC MTA to PHY MTA */
4851 for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { 4960 for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) {
@@ -5548,8 +5657,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
5548 if (err) 5657 if (err)
5549 goto err_sw_init; 5658 goto err_sw_init;
5550 5659
5551 err = -EIO;
5552
5553 memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops)); 5660 memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops));
5554 memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops)); 5661 memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops));
5555 memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops)); 5662 memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops));
@@ -5896,6 +6003,9 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
5896 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan }, 6003 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan },
5897 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan }, 6004 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan },
5898 6005
6006 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_LM), board_pch2lan },
6007 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_V), board_pch2lan },
6008
5899 { } /* terminate list */ 6009 { } /* terminate list */
5900}; 6010};
5901MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); 6011MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
@@ -5932,7 +6042,7 @@ static int __init e1000_init_module(void)
5932 int ret; 6042 int ret;
5933 pr_info("Intel(R) PRO/1000 Network Driver - %s\n", 6043 pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
5934 e1000e_driver_version); 6044 e1000e_driver_version);
5935 pr_info("Copyright (c) 1999 - 2009 Intel Corporation.\n"); 6045 pr_info("Copyright (c) 1999 - 2010 Intel Corporation.\n");
5936 ret = pci_register_driver(&e1000_driver); 6046 ret = pci_register_driver(&e1000_driver);
5937 6047
5938 return ret; 6048 return ret;
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index a150e48a117f..34aeec13bb16 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index b4ac82d51b20..3d3dc0c82355 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2009 Intel Corporation. 4 Copyright(c) 1999 - 2010 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -2319,6 +2319,9 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id)
2319 case I82577_E_PHY_ID: 2319 case I82577_E_PHY_ID:
2320 phy_type = e1000_phy_82577; 2320 phy_type = e1000_phy_82577;
2321 break; 2321 break;
2322 case I82579_E_PHY_ID:
2323 phy_type = e1000_phy_82579;
2324 break;
2322 default: 2325 default:
2323 phy_type = e1000_phy_unknown; 2326 phy_type = e1000_phy_unknown;
2324 break; 2327 break;