aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2010-06-16 09:27:28 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-19 01:12:16 -0400
commitd3738bb8203acf8552c3ec8b3447133fc0938ddd (patch)
treec466411e6dce52ca422ad524ace68301c6b0d169
parenteb7700dc0344564b0b9857d1f5e331a0dd629e92 (diff)
e1000e: initial support for 82579 LOMs
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/e1000e/defines.h2
-rw-r--r--drivers/net/e1000e/e1000.h4
-rw-r--r--drivers/net/e1000e/ethtool.c13
-rw-r--r--drivers/net/e1000e/hw.h12
-rw-r--r--drivers/net/e1000e/ich8lan.c328
-rw-r--r--drivers/net/e1000e/netdev.c70
-rw-r--r--drivers/net/e1000e/phy.c3
7 files changed, 386 insertions, 46 deletions
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 4dc02c71ffd..5a6de3419d3 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -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 79e7c4c1871..0e59f15be11 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -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 {
@@ -477,6 +478,7 @@ extern struct e1000_info e1000_ich8_info;
477extern struct e1000_info e1000_ich9_info; 478extern struct e1000_info e1000_ich9_info;
478extern struct e1000_info e1000_ich10_info; 479extern struct e1000_info e1000_ich10_info;
479extern struct e1000_info e1000_pch_info; 480extern struct e1000_info e1000_pch_info;
481extern struct e1000_info e1000_pch2_info;
480extern struct e1000_info e1000_es2_info; 482extern struct e1000_info e1000_es2_info;
481 483
482extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num); 484extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
@@ -495,6 +497,8 @@ extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
495extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); 497extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
496extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw); 498extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
497extern s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); 499extern s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
500extern s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable);
501extern void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw);
498 502
499extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw); 503extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
500extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw); 504extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 86c6a26c0a3..312c704aec3 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -880,6 +880,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
880 switch (mac->type) { 880 switch (mac->type) {
881 case e1000_ich10lan: 881 case e1000_ich10lan:
882 case e1000_pchlan: 882 case e1000_pchlan:
883 case e1000_pch2lan:
883 mask |= (1 << 18); 884 mask |= (1 << 18);
884 break; 885 break;
885 default: 886 default:
@@ -1321,6 +1322,17 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1321 /* Workaround: K1 must be disabled for stable 1Gbps operation */ 1322 /* Workaround: K1 must be disabled for stable 1Gbps operation */
1322 e1000_configure_k1_ich8lan(hw, false); 1323 e1000_configure_k1_ich8lan(hw, false);
1323 break; 1324 break;
1325 case e1000_phy_82579:
1326 /* Disable PHY energy detect power down */
1327 e1e_rphy(hw, PHY_REG(0, 21), &phy_reg);
1328 e1e_wphy(hw, PHY_REG(0, 21), phy_reg & ~(1 << 3));
1329 /* Disable full chip energy detect */
1330 e1e_rphy(hw, PHY_REG(776, 18), &phy_reg);
1331 e1e_wphy(hw, PHY_REG(776, 18), phy_reg | 1);
1332 /* Enable loopback on the PHY */
1333#define I82577_PHY_LBK_CTRL 19
1334 e1e_wphy(hw, I82577_PHY_LBK_CTRL, 0x8001);
1335 break;
1324 default: 1336 default:
1325 break; 1337 break;
1326 } 1338 }
@@ -1878,6 +1890,7 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
1878 1890
1879 if ((hw->phy.type == e1000_phy_ife) || 1891 if ((hw->phy.type == e1000_phy_ife) ||
1880 (hw->mac.type == e1000_pchlan) || 1892 (hw->mac.type == e1000_pchlan) ||
1893 (hw->mac.type == e1000_pch2lan) ||
1881 (hw->mac.type == e1000_82583) || 1894 (hw->mac.type == e1000_82583) ||
1882 (hw->mac.type == e1000_82574)) { 1895 (hw->mac.type == e1000_82574)) {
1883 INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); 1896 INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task);
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 5d1220d188d..96116ce5e5c 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -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 0x140E
312#define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400 316#define E1000_KMRNCTRLSTA_HD_CTRL 0x0002
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 {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 7e2f98c24f9..8274499b7df 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -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,9 @@
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
129/* Strapping Option Register - RO */ 134/* Strapping Option Register - RO */
130#define E1000_STRAP 0x0000C 135#define E1000_STRAP 0x0000C
131#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 136#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
@@ -279,13 +284,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
279 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; 284 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
280 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 285 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
281 286
287 /*
288 * The MAC-PHY interconnect may still be in SMBus mode
289 * after Sx->S0. If the manageability engine (ME) is
290 * disabled, then toggle the LANPHYPC Value bit to force
291 * the interconnect to PCIe mode.
292 */
282 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 293 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
283 /*
284 * The MAC-PHY interconnect may still be in SMBus mode
285 * after Sx->S0. Toggle the LANPHYPC Value bit to force
286 * the interconnect to PCIe mode, but only if there is no
287 * firmware present otherwise firmware will have done it.
288 */
289 ctrl = er32(CTRL); 294 ctrl = er32(CTRL);
290 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 295 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
291 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 296 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
@@ -326,6 +331,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
326 331
327 switch (phy->type) { 332 switch (phy->type) {
328 case e1000_phy_82577: 333 case e1000_phy_82577:
334 case e1000_phy_82579:
329 phy->ops.check_polarity = e1000_check_polarity_82577; 335 phy->ops.check_polarity = e1000_check_polarity_82577;
330 phy->ops.force_speed_duplex = 336 phy->ops.force_speed_duplex =
331 e1000_phy_force_speed_duplex_82577; 337 e1000_phy_force_speed_duplex_82577;
@@ -530,6 +536,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
530 mac->ops.led_off = e1000_led_off_ich8lan; 536 mac->ops.led_off = e1000_led_off_ich8lan;
531 break; 537 break;
532 case e1000_pchlan: 538 case e1000_pchlan:
539 case e1000_pch2lan:
533 /* check management mode */ 540 /* check management mode */
534 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; 541 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
535 /* ID LED init */ 542 /* ID LED init */
@@ -550,6 +557,14 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
550 if (mac->type == e1000_ich8lan) 557 if (mac->type == e1000_ich8lan)
551 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); 558 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true);
552 559
560 /* Disable PHY configuration by hardware, config by software */
561 if (mac->type == e1000_pch2lan) {
562 u32 extcnf_ctrl = er32(EXTCNF_CTRL);
563
564 extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG;
565 ew32(EXTCNF_CTRL, extcnf_ctrl);
566 }
567
553 return 0; 568 return 0;
554} 569}
555 570
@@ -653,10 +668,19 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
653 if (rc) 668 if (rc)
654 return rc; 669 return rc;
655 670
656 if (hw->mac.type == e1000_pchlan) 671 switch (hw->mac.type) {
657 rc = e1000_init_phy_params_pchlan(hw); 672 case e1000_ich8lan:
658 else 673 case e1000_ich9lan:
674 case e1000_ich10lan:
659 rc = e1000_init_phy_params_ich8lan(hw); 675 rc = e1000_init_phy_params_ich8lan(hw);
676 break;
677 case e1000_pchlan:
678 case e1000_pch2lan:
679 rc = e1000_init_phy_params_pchlan(hw);
680 break;
681 default:
682 break;
683 }
660 if (rc) 684 if (rc)
661 return rc; 685 return rc;
662 686
@@ -861,6 +885,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
861 } 885 }
862 /* Fall-thru */ 886 /* Fall-thru */
863 case e1000_pchlan: 887 case e1000_pchlan:
888 case e1000_pch2lan:
864 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; 889 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
865 break; 890 break;
866 default: 891 default:
@@ -880,8 +905,10 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
880 * extended configuration before SW configuration 905 * extended configuration before SW configuration
881 */ 906 */
882 data = er32(EXTCNF_CTRL); 907 data = er32(EXTCNF_CTRL);
883 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) 908 if (!(hw->mac.type == e1000_pch2lan)) {
884 goto out; 909 if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
910 goto out;
911 }
885 912
886 cnf_size = er32(EXTCNF_SIZE); 913 cnf_size = er32(EXTCNF_SIZE);
887 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; 914 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
@@ -893,7 +920,8 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
893 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; 920 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
894 921
895 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && 922 if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
896 (hw->mac.type == e1000_pchlan)) { 923 ((hw->mac.type == e1000_pchlan) ||
924 (hw->mac.type == e1000_pch2lan))) {
897 /* 925 /*
898 * HW configures the SMBus address and LEDs when the 926 * HW configures the SMBus address and LEDs when the
899 * OEM and LCD Write Enable bits are set in the NVM. 927 * OEM and LCD Write Enable bits are set in the NVM.
@@ -1100,16 +1128,18 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1100 u32 mac_reg; 1128 u32 mac_reg;
1101 u16 oem_reg; 1129 u16 oem_reg;
1102 1130
1103 if (hw->mac.type != e1000_pchlan) 1131 if ((hw->mac.type != e1000_pch2lan) && (hw->mac.type != e1000_pchlan))
1104 return ret_val; 1132 return ret_val;
1105 1133
1106 ret_val = hw->phy.ops.acquire(hw); 1134 ret_val = hw->phy.ops.acquire(hw);
1107 if (ret_val) 1135 if (ret_val)
1108 return ret_val; 1136 return ret_val;
1109 1137
1110 mac_reg = er32(EXTCNF_CTRL); 1138 if (!(hw->mac.type == e1000_pch2lan)) {
1111 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) 1139 mac_reg = er32(EXTCNF_CTRL);
1112 goto out; 1140 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
1141 goto out;
1142 }
1113 1143
1114 mac_reg = er32(FEXTNVM); 1144 mac_reg = er32(FEXTNVM);
1115 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M)) 1145 if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
@@ -1250,6 +1280,243 @@ out:
1250} 1280}
1251 1281
1252/** 1282/**
1283 * e1000_copy_rx_addrs_to_phy_ich8lan - Copy Rx addresses from MAC to PHY
1284 * @hw: pointer to the HW structure
1285 **/
1286void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw)
1287{
1288 u32 mac_reg;
1289 u16 i;
1290
1291 /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */
1292 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1293 mac_reg = er32(RAL(i));
1294 e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
1295 e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
1296 mac_reg = er32(RAH(i));
1297 e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
1298 e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0x8000));
1299 }
1300}
1301
1302static u32 e1000_calc_rx_da_crc(u8 mac[])
1303{
1304 u32 poly = 0xEDB88320; /* Polynomial for 802.3 CRC calculation */
1305 u32 i, j, mask, crc;
1306
1307 crc = 0xffffffff;
1308 for (i = 0; i < 6; i++) {
1309 crc = crc ^ mac[i];
1310 for (j = 8; j > 0; j--) {
1311 mask = (crc & 1) * (-1);
1312 crc = (crc >> 1) ^ (poly & mask);
1313 }
1314 }
1315 return ~crc;
1316}
1317
1318/**
1319 * e1000_lv_jumbo_workaround_ich8lan - required for jumbo frame operation
1320 * with 82579 PHY
1321 * @hw: pointer to the HW structure
1322 * @enable: flag to enable/disable workaround when enabling/disabling jumbos
1323 **/
1324s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
1325{
1326 s32 ret_val = 0;
1327 u16 phy_reg, data;
1328 u32 mac_reg;
1329 u16 i;
1330
1331 if (hw->mac.type != e1000_pch2lan)
1332 goto out;
1333
1334 /* disable Rx path while enabling/disabling workaround */
1335 e1e_rphy(hw, PHY_REG(769, 20), &phy_reg);
1336 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg | (1 << 14));
1337 if (ret_val)
1338 goto out;
1339
1340 if (enable) {
1341 /*
1342 * Write Rx addresses (rar_entry_count for RAL/H, +4 for
1343 * SHRAL/H) and initial CRC values to the MAC
1344 */
1345 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) {
1346 u8 mac_addr[ETH_ALEN] = {0};
1347 u32 addr_high, addr_low;
1348
1349 addr_high = er32(RAH(i));
1350 if (!(addr_high & E1000_RAH_AV))
1351 continue;
1352 addr_low = er32(RAL(i));
1353 mac_addr[0] = (addr_low & 0xFF);
1354 mac_addr[1] = ((addr_low >> 8) & 0xFF);
1355 mac_addr[2] = ((addr_low >> 16) & 0xFF);
1356 mac_addr[3] = ((addr_low >> 24) & 0xFF);
1357 mac_addr[4] = (addr_high & 0xFF);
1358 mac_addr[5] = ((addr_high >> 8) & 0xFF);
1359
1360 ew32(PCH_RAICC(i),
1361 e1000_calc_rx_da_crc(mac_addr));
1362 }
1363
1364 /* Write Rx addresses to the PHY */
1365 e1000_copy_rx_addrs_to_phy_ich8lan(hw);
1366
1367 /* Enable jumbo frame workaround in the MAC */
1368 mac_reg = er32(FFLT_DBG);
1369 mac_reg &= ~(1 << 14);
1370 mac_reg |= (7 << 15);
1371 ew32(FFLT_DBG, mac_reg);
1372
1373 mac_reg = er32(RCTL);
1374 mac_reg |= E1000_RCTL_SECRC;
1375 ew32(RCTL, mac_reg);
1376
1377 ret_val = e1000e_read_kmrn_reg(hw,
1378 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1379 &data);
1380 if (ret_val)
1381 goto out;
1382 ret_val = e1000e_write_kmrn_reg(hw,
1383 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1384 data | (1 << 0));
1385 if (ret_val)
1386 goto out;
1387 ret_val = e1000e_read_kmrn_reg(hw,
1388 E1000_KMRNCTRLSTA_HD_CTRL,
1389 &data);
1390 if (ret_val)
1391 goto out;
1392 data &= ~(0xF << 8);
1393 data |= (0xB << 8);
1394 ret_val = e1000e_write_kmrn_reg(hw,
1395 E1000_KMRNCTRLSTA_HD_CTRL,
1396 data);
1397 if (ret_val)
1398 goto out;
1399
1400 /* Enable jumbo frame workaround in the PHY */
1401 e1e_rphy(hw, PHY_REG(769, 20), &data);
1402 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1403 if (ret_val)
1404 goto out;
1405 e1e_rphy(hw, PHY_REG(769, 23), &data);
1406 data &= ~(0x7F << 5);
1407 data |= (0x37 << 5);
1408 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1409 if (ret_val)
1410 goto out;
1411 e1e_rphy(hw, PHY_REG(769, 16), &data);
1412 data &= ~(1 << 13);
1413 data |= (1 << 12);
1414 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1415 if (ret_val)
1416 goto out;
1417 e1e_rphy(hw, PHY_REG(776, 20), &data);
1418 data &= ~(0x3FF << 2);
1419 data |= (0x1A << 2);
1420 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1421 if (ret_val)
1422 goto out;
1423 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0xFE00);
1424 if (ret_val)
1425 goto out;
1426 e1e_rphy(hw, HV_PM_CTRL, &data);
1427 ret_val = e1e_wphy(hw, HV_PM_CTRL, data | (1 << 10));
1428 if (ret_val)
1429 goto out;
1430 } else {
1431 /* Write MAC register values back to h/w defaults */
1432 mac_reg = er32(FFLT_DBG);
1433 mac_reg &= ~(0xF << 14);
1434 ew32(FFLT_DBG, mac_reg);
1435
1436 mac_reg = er32(RCTL);
1437 mac_reg &= ~E1000_RCTL_SECRC;
1438 ew32(FFLT_DBG, mac_reg);
1439
1440 ret_val = e1000e_read_kmrn_reg(hw,
1441 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1442 &data);
1443 if (ret_val)
1444 goto out;
1445 ret_val = e1000e_write_kmrn_reg(hw,
1446 E1000_KMRNCTRLSTA_CTRL_OFFSET,
1447 data & ~(1 << 0));
1448 if (ret_val)
1449 goto out;
1450 ret_val = e1000e_read_kmrn_reg(hw,
1451 E1000_KMRNCTRLSTA_HD_CTRL,
1452 &data);
1453 if (ret_val)
1454 goto out;
1455 data &= ~(0xF << 8);
1456 data |= (0xB << 8);
1457 ret_val = e1000e_write_kmrn_reg(hw,
1458 E1000_KMRNCTRLSTA_HD_CTRL,
1459 data);
1460 if (ret_val)
1461 goto out;
1462
1463 /* Write PHY register values back to h/w defaults */
1464 e1e_rphy(hw, PHY_REG(769, 20), &data);
1465 ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14));
1466 if (ret_val)
1467 goto out;
1468 e1e_rphy(hw, PHY_REG(769, 23), &data);
1469 data &= ~(0x7F << 5);
1470 ret_val = e1e_wphy(hw, PHY_REG(769, 23), data);
1471 if (ret_val)
1472 goto out;
1473 e1e_rphy(hw, PHY_REG(769, 16), &data);
1474 data &= ~(1 << 12);
1475 data |= (1 << 13);
1476 ret_val = e1e_wphy(hw, PHY_REG(769, 16), data);
1477 if (ret_val)
1478 goto out;
1479 e1e_rphy(hw, PHY_REG(776, 20), &data);
1480 data &= ~(0x3FF << 2);
1481 data |= (0x8 << 2);
1482 ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
1483 if (ret_val)
1484 goto out;
1485 ret_val = e1e_wphy(hw, PHY_REG(776, 23), 0x7E00);
1486 if (ret_val)
1487 goto out;
1488 e1e_rphy(hw, HV_PM_CTRL, &data);
1489 ret_val = e1e_wphy(hw, HV_PM_CTRL, data & ~(1 << 10));
1490 if (ret_val)
1491 goto out;
1492 }
1493
1494 /* re-enable Rx path after enabling/disabling workaround */
1495 ret_val = e1e_wphy(hw, PHY_REG(769, 20), phy_reg & ~(1 << 14));
1496
1497out:
1498 return ret_val;
1499}
1500
1501/**
1502 * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be
1503 * done after every PHY reset.
1504 **/
1505static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1506{
1507 s32 ret_val = 0;
1508
1509 if (hw->mac.type != e1000_pch2lan)
1510 goto out;
1511
1512 /* Set MDIO slow mode before any other MDIO access */
1513 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1514
1515out:
1516 return ret_val;
1517}
1518
1519/**
1253 * e1000_lan_init_done_ich8lan - Check for PHY config completion 1520 * e1000_lan_init_done_ich8lan - Check for PHY config completion
1254 * @hw: pointer to the HW structure 1521 * @hw: pointer to the HW structure
1255 * 1522 *
@@ -1300,12 +1567,17 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1300 if (ret_val) 1567 if (ret_val)
1301 goto out; 1568 goto out;
1302 break; 1569 break;
1570 case e1000_pch2lan:
1571 ret_val = e1000_lv_phy_workarounds_ich8lan(hw);
1572 if (ret_val)
1573 goto out;
1574 break;
1303 default: 1575 default:
1304 break; 1576 break;
1305 } 1577 }
1306 1578
1307 /* Dummy read to clear the phy wakeup bit after lcd reset */ 1579 /* Dummy read to clear the phy wakeup bit after lcd reset */
1308 if (hw->mac.type == e1000_pchlan) 1580 if (hw->mac.type >= e1000_pchlan)
1309 e1e_rphy(hw, BM_WUC, &reg); 1581 e1e_rphy(hw, BM_WUC, &reg);
1310 1582
1311 /* Configure the LCD with the extended configuration region in NVM */ 1583 /* Configure the LCD with the extended configuration region in NVM */
@@ -2829,6 +3101,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2829 3101
2830 ew32(FCTTV, hw->fc.pause_time); 3102 ew32(FCTTV, hw->fc.pause_time);
2831 if ((hw->phy.type == e1000_phy_82578) || 3103 if ((hw->phy.type == e1000_phy_82578) ||
3104 (hw->phy.type == e1000_phy_82579) ||
2832 (hw->phy.type == e1000_phy_82577)) { 3105 (hw->phy.type == e1000_phy_82577)) {
2833 ew32(FCRTV_PCH, hw->fc.refresh_time); 3106 ew32(FCRTV_PCH, hw->fc.refresh_time);
2834 3107
@@ -2892,6 +3165,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2892 return ret_val; 3165 return ret_val;
2893 break; 3166 break;
2894 case e1000_phy_82577: 3167 case e1000_phy_82577:
3168 case e1000_phy_82579:
2895 ret_val = e1000_copper_link_setup_82577(hw); 3169 ret_val = e1000_copper_link_setup_82577(hw);
2896 if (ret_val) 3170 if (ret_val)
2897 return ret_val; 3171 return ret_val;
@@ -3399,6 +3673,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
3399 3673
3400 /* Clear PHY statistics registers */ 3674 /* Clear PHY statistics registers */
3401 if ((hw->phy.type == e1000_phy_82578) || 3675 if ((hw->phy.type == e1000_phy_82578) ||
3676 (hw->phy.type == e1000_phy_82579) ||
3402 (hw->phy.type == e1000_phy_82577)) { 3677 (hw->phy.type == e1000_phy_82577)) {
3403 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data); 3678 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data);
3404 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data); 3679 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data);
@@ -3534,3 +3809,22 @@ struct e1000_info e1000_pch_info = {
3534 .phy_ops = &ich8_phy_ops, 3809 .phy_ops = &ich8_phy_ops,
3535 .nvm_ops = &ich8_nvm_ops, 3810 .nvm_ops = &ich8_nvm_ops,
3536}; 3811};
3812
3813struct e1000_info e1000_pch2_info = {
3814 .mac = e1000_pch2lan,
3815 .flags = FLAG_IS_ICH
3816 | FLAG_HAS_WOL
3817 | FLAG_RX_CSUM_ENABLED
3818 | FLAG_HAS_CTRLEXT_ON_LOAD
3819 | FLAG_HAS_AMT
3820 | FLAG_HAS_FLASH
3821 | FLAG_HAS_JUMBO_FRAMES
3822 | FLAG_APME_IN_WUC,
3823 .flags2 = FLAG2_HAS_PHY_STATS,
3824 .pba = 18,
3825 .max_hw_frame_size = DEFAULT_JUMBO,
3826 .get_variants = e1000_get_variants_ich8lan,
3827 .mac_ops = &ich8_mac_ops,
3828 .phy_ops = &ich8_phy_ops,
3829 .nvm_ops = &ich8_nvm_ops,
3830};
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index b4c431d8451..f296f6f32a3 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -67,6 +67,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
67 [board_ich9lan] = &e1000_ich9_info, 67 [board_ich9lan] = &e1000_ich9_info,
68 [board_ich10lan] = &e1000_ich10_info, 68 [board_ich10lan] = &e1000_ich10_info,
69 [board_pchlan] = &e1000_pch_info, 69 [board_pchlan] = &e1000_pch_info,
70 [board_pch2lan] = &e1000_pch2_info,
70}; 71};
71 72
72struct e1000_reg_info { 73struct e1000_reg_info {
@@ -2723,6 +2724,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
2723 e1e_wphy(hw, 22, phy_data); 2724 e1e_wphy(hw, 22, phy_data);
2724 } 2725 }
2725 2726
2727 /* Workaround Si errata on 82579 - configure jumbo frame flow */
2728 if (hw->mac.type == e1000_pch2lan) {
2729 s32 ret_val;
2730
2731 if (rctl & E1000_RCTL_LPE)
2732 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true);
2733 else
2734 ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false);
2735 }
2736
2726 /* Setup buffer sizes */ 2737 /* Setup buffer sizes */
2727 rctl &= ~E1000_RCTL_SZ_4096; 2738 rctl &= ~E1000_RCTL_SZ_4096;
2728 rctl |= E1000_RCTL_BSEX; 2739 rctl |= E1000_RCTL_BSEX;
@@ -3118,7 +3129,27 @@ void e1000e_reset(struct e1000_adapter *adapter)
3118 * with ERT support assuming ERT set to E1000_ERT_2048), or 3129 * with ERT support assuming ERT set to E1000_ERT_2048), or
3119 * - the full Rx FIFO size minus one full frame 3130 * - the full Rx FIFO size minus one full frame
3120 */ 3131 */
3121 if (hw->mac.type == e1000_pchlan) { 3132 if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME)
3133 fc->pause_time = 0xFFFF;
3134 else
3135 fc->pause_time = E1000_FC_PAUSE_TIME;
3136 fc->send_xon = 1;
3137 fc->current_mode = fc->requested_mode;
3138
3139 switch (hw->mac.type) {
3140 default:
3141 if ((adapter->flags & FLAG_HAS_ERT) &&
3142 (adapter->netdev->mtu > ETH_DATA_LEN))
3143 hwm = min(((pba << 10) * 9 / 10),
3144 ((pba << 10) - (E1000_ERT_2048 << 3)));
3145 else
3146 hwm = min(((pba << 10) * 9 / 10),
3147 ((pba << 10) - adapter->max_frame_size));
3148
3149 fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */
3150 fc->low_water = fc->high_water - 8;
3151 break;
3152 case e1000_pchlan:
3122 /* 3153 /*
3123 * Workaround PCH LOM adapter hangs with certain network 3154 * Workaround PCH LOM adapter hangs with certain network
3124 * loads. If hangs persist, try disabling Tx flow control. 3155 * loads. If hangs persist, try disabling Tx flow control.
@@ -3131,26 +3162,15 @@ void e1000e_reset(struct e1000_adapter *adapter)
3131 fc->low_water = 0x3000; 3162 fc->low_water = 0x3000;
3132 } 3163 }
3133 fc->refresh_time = 0x1000; 3164 fc->refresh_time = 0x1000;
3134 } else { 3165 break;
3135 if ((adapter->flags & FLAG_HAS_ERT) && 3166 case e1000_pch2lan:
3136 (adapter->netdev->mtu > ETH_DATA_LEN)) 3167 fc->high_water = 0x05C20;
3137 hwm = min(((pba << 10) * 9 / 10), 3168 fc->low_water = 0x05048;
3138 ((pba << 10) - (E1000_ERT_2048 << 3))); 3169 fc->pause_time = 0x0650;
3139 else 3170 fc->refresh_time = 0x0400;
3140 hwm = min(((pba << 10) * 9 / 10), 3171 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 } 3172 }
3146 3173
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 */ 3174 /* Allow time for pending master requests to run */
3155 mac->ops.reset_hw(hw); 3175 mac->ops.reset_hw(hw);
3156 3176
@@ -4918,14 +4938,7 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
4918 int retval = 0; 4938 int retval = 0;
4919 4939
4920 /* copy MAC RARs to PHY RARs */ 4940 /* copy MAC RARs to PHY RARs */
4921 for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) { 4941 e1000_copy_rx_addrs_to_phy_ich8lan(hw);
4922 mac_reg = er32(RAL(i));
4923 e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF));
4924 e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF));
4925 mac_reg = er32(RAH(i));
4926 e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF));
4927 e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0xFFFF));
4928 }
4929 4942
4930 /* copy MAC MTA to PHY MTA */ 4943 /* copy MAC MTA to PHY MTA */
4931 for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { 4944 for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) {
@@ -5976,6 +5989,9 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
5976 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan }, 5989 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan },
5977 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan }, 5990 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan },
5978 5991
5992 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_LM), board_pch2lan },
5993 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_V), board_pch2lan },
5994
5979 { } /* terminate list */ 5995 { } /* terminate list */
5980}; 5996};
5981MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); 5997MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index b4ac82d51b2..e471357be30 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -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;