aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/ich8lan.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2009-06-02 07:29:18 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:46:34 -0400
commita4f58f5455ba0efda36fb33c37074922d1527a10 (patch)
tree98aa6d14824b7c1b7907e703abedd80219e0abda /drivers/net/e1000e/ich8lan.c
parent2adc55c959940fc680074392eddbd5585a76f3d9 (diff)
e1000e: add support for 82577/82578 GbE LOM parts
This patch provides support for the next generation Intel desktop and mobile gigabit ethernet LOM adapters. These adapters are the follow-on parts to the LOMs tied to the prior ICH chipsets and are comprised of a MAC in the PCH chipset and an external PHY (82577 for mobile and 82578 for desktop versions). New features consist of PHY wakeup to save power by completely turning off the MAC while in Sx state, and 4K jumbo frames. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e/ich8lan.c')
-rw-r--r--drivers/net/e1000e/ich8lan.c431
1 files changed, 408 insertions, 23 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index b63d9878b0ac..b69c8190da30 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -48,6 +48,10 @@
48 * 82567LF-3 Gigabit Network Connection 48 * 82567LF-3 Gigabit Network Connection
49 * 82567LM-3 Gigabit Network Connection 49 * 82567LM-3 Gigabit Network Connection
50 * 82567LM-4 Gigabit Network Connection 50 * 82567LM-4 Gigabit Network Connection
51 * 82577LM Gigabit Network Connection
52 * 82577LC Gigabit Network Connection
53 * 82578DM Gigabit Network Connection
54 * 82578DC Gigabit Network Connection
51 */ 55 */
52 56
53#include <linux/netdevice.h> 57#include <linux/netdevice.h>
@@ -116,6 +120,8 @@
116#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300 120#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
117#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200 121#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
118 122
123#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
124
119/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ 125/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
120/* Offset 04h HSFSTS */ 126/* Offset 04h HSFSTS */
121union ich8_hws_flash_status { 127union ich8_hws_flash_status {
@@ -186,6 +192,14 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
186static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw); 192static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw);
187static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw); 193static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw);
188static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw); 194static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw);
195static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw);
196static s32 e1000_led_on_ich8lan(struct e1000_hw *hw);
197static s32 e1000_led_off_ich8lan(struct e1000_hw *hw);
198static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw);
199static s32 e1000_setup_led_pchlan(struct e1000_hw *hw);
200static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
201static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
202static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
189 203
190static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) 204static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
191{ 205{
@@ -213,6 +227,41 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
213#define ew32flash(reg,val) __ew32flash(hw, (reg), (val)) 227#define ew32flash(reg,val) __ew32flash(hw, (reg), (val))
214 228
215/** 229/**
230 * e1000_init_phy_params_pchlan - Initialize PHY function pointers
231 * @hw: pointer to the HW structure
232 *
233 * Initialize family-specific PHY parameters and function pointers.
234 **/
235static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
236{
237 struct e1000_phy_info *phy = &hw->phy;
238 s32 ret_val = 0;
239
240 phy->addr = 1;
241 phy->reset_delay_us = 100;
242
243 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
244 phy->ops.read_phy_reg = e1000_read_phy_reg_hv;
245 phy->ops.write_phy_reg = e1000_write_phy_reg_hv;
246 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
247
248 phy->id = e1000_phy_unknown;
249 e1000e_get_phy_id(hw);
250 phy->type = e1000e_get_phy_type_from_id(phy->id);
251
252 if (phy->type == e1000_phy_82577) {
253 phy->ops.check_polarity = e1000_check_polarity_82577;
254 phy->ops.force_speed_duplex =
255 e1000_phy_force_speed_duplex_82577;
256 phy->ops.get_cable_length = e1000_get_cable_length_82577;
257 phy->ops.get_phy_info = e1000_get_phy_info_82577;
258 phy->ops.commit_phy = e1000e_phy_sw_reset;
259 }
260
261 return ret_val;
262}
263
264/**
216 * e1000_init_phy_params_ich8lan - Initialize PHY function pointers 265 * e1000_init_phy_params_ich8lan - Initialize PHY function pointers
217 * @hw: pointer to the HW structure 266 * @hw: pointer to the HW structure
218 * 267 *
@@ -273,6 +322,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
273 break; 322 break;
274 } 323 }
275 324
325 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
326
276 return 0; 327 return 0;
277} 328}
278 329
@@ -358,6 +409,36 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
358 /* Set if manageability features are enabled. */ 409 /* Set if manageability features are enabled. */
359 mac->arc_subsystem_valid = 1; 410 mac->arc_subsystem_valid = 1;
360 411
412 /* LED operations */
413 switch (mac->type) {
414 case e1000_ich8lan:
415 case e1000_ich9lan:
416 case e1000_ich10lan:
417 /* ID LED init */
418 mac->ops.id_led_init = e1000e_id_led_init;
419 /* setup LED */
420 mac->ops.setup_led = e1000e_setup_led_generic;
421 /* cleanup LED */
422 mac->ops.cleanup_led = e1000_cleanup_led_ich8lan;
423 /* turn on/off LED */
424 mac->ops.led_on = e1000_led_on_ich8lan;
425 mac->ops.led_off = e1000_led_off_ich8lan;
426 break;
427 case e1000_pchlan:
428 /* ID LED init */
429 mac->ops.id_led_init = e1000_id_led_init_pchlan;
430 /* setup LED */
431 mac->ops.setup_led = e1000_setup_led_pchlan;
432 /* cleanup LED */
433 mac->ops.cleanup_led = e1000_cleanup_led_pchlan;
434 /* turn on/off LED */
435 mac->ops.led_on = e1000_led_on_pchlan;
436 mac->ops.led_off = e1000_led_off_pchlan;
437 break;
438 default:
439 break;
440 }
441
361 /* Enable PCS Lock-loss workaround for ICH8 */ 442 /* Enable PCS Lock-loss workaround for ICH8 */
362 if (mac->type == e1000_ich8lan) 443 if (mac->type == e1000_ich8lan)
363 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1); 444 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1);
@@ -378,7 +459,10 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
378 if (rc) 459 if (rc)
379 return rc; 460 return rc;
380 461
381 rc = e1000_init_phy_params_ich8lan(hw); 462 if (hw->mac.type == e1000_pchlan)
463 rc = e1000_init_phy_params_pchlan(hw);
464 else
465 rc = e1000_init_phy_params_ich8lan(hw);
382 if (rc) 466 if (rc)
383 return rc; 467 return rc;
384 468
@@ -415,12 +499,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
415 499
416 while (timeout) { 500 while (timeout) {
417 extcnf_ctrl = er32(EXTCNF_CTRL); 501 extcnf_ctrl = er32(EXTCNF_CTRL);
418 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
419 ew32(EXTCNF_CTRL, extcnf_ctrl);
420 502
421 extcnf_ctrl = er32(EXTCNF_CTRL); 503 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) {
422 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) 504 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
423 break; 505 ew32(EXTCNF_CTRL, extcnf_ctrl);
506
507 extcnf_ctrl = er32(EXTCNF_CTRL);
508 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
509 break;
510 }
424 mdelay(1); 511 mdelay(1);
425 timeout--; 512 timeout--;
426 } 513 }
@@ -560,6 +647,53 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
560} 647}
561 648
562/** 649/**
650 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
651 * done after every PHY reset.
652 **/
653static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
654{
655 s32 ret_val = 0;
656
657 if (hw->mac.type != e1000_pchlan)
658 return ret_val;
659
660 if (((hw->phy.type == e1000_phy_82577) &&
661 ((hw->phy.revision == 1) || (hw->phy.revision == 2))) ||
662 ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) {
663 /* Disable generation of early preamble */
664 ret_val = e1e_wphy(hw, PHY_REG(769, 25), 0x4431);
665 if (ret_val)
666 return ret_val;
667
668 /* Preamble tuning for SSC */
669 ret_val = e1e_wphy(hw, PHY_REG(770, 16), 0xA204);
670 if (ret_val)
671 return ret_val;
672 }
673
674 if (hw->phy.type == e1000_phy_82578) {
675 /*
676 * Return registers to default by doing a soft reset then
677 * writing 0x3140 to the control register.
678 */
679 if (hw->phy.revision < 2) {
680 e1000e_phy_sw_reset(hw);
681 ret_val = e1e_wphy(hw, PHY_CONTROL, 0x3140);
682 }
683 }
684
685 /* Select page 0 */
686 ret_val = hw->phy.ops.acquire_phy(hw);
687 if (ret_val)
688 return ret_val;
689 hw->phy.addr = 1;
690 e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
691 hw->phy.ops.release_phy(hw);
692
693 return ret_val;
694}
695
696/**
563 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset 697 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset
564 * @hw: pointer to the HW structure 698 * @hw: pointer to the HW structure
565 * 699 *
@@ -580,6 +714,12 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
580 if (ret_val) 714 if (ret_val)
581 return ret_val; 715 return ret_val;
582 716
717 if (hw->mac.type == e1000_pchlan) {
718 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
719 if (ret_val)
720 return ret_val;
721 }
722
583 /* 723 /*
584 * Initialize the PHY from the NVM on ICH platforms. This 724 * Initialize the PHY from the NVM on ICH platforms. This
585 * is needed due to an issue where the NVM configuration is 725 * is needed due to an issue where the NVM configuration is
@@ -706,7 +846,7 @@ static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw)
706 phy->polarity_correction = (!(data & IFE_PSC_AUTO_POLARITY_DISABLE)); 846 phy->polarity_correction = (!(data & IFE_PSC_AUTO_POLARITY_DISABLE));
707 847
708 if (phy->polarity_correction) { 848 if (phy->polarity_correction) {
709 ret_val = e1000_check_polarity_ife_ich8lan(hw); 849 ret_val = phy->ops.check_polarity(hw);
710 if (ret_val) 850 if (ret_val)
711 return ret_val; 851 return ret_val;
712 } else { 852 } else {
@@ -746,6 +886,8 @@ static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw)
746 break; 886 break;
747 case e1000_phy_igp_3: 887 case e1000_phy_igp_3:
748 case e1000_phy_bm: 888 case e1000_phy_bm:
889 case e1000_phy_82578:
890 case e1000_phy_82577:
749 return e1000e_get_phy_info_igp(hw); 891 return e1000e_get_phy_info_igp(hw);
750 break; 892 break;
751 default: 893 default:
@@ -1857,6 +1999,79 @@ static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data)
1857} 1999}
1858 2000
1859/** 2001/**
2002 * e1000_id_led_init_pchlan - store LED configurations
2003 * @hw: pointer to the HW structure
2004 *
2005 * PCH does not control LEDs via the LEDCTL register, rather it uses
2006 * the PHY LED configuration register.
2007 *
2008 * PCH also does not have an "always on" or "always off" mode which
2009 * complicates the ID feature. Instead of using the "on" mode to indicate
2010 * in ledctl_mode2 the LEDs to use for ID (see e1000e_id_led_init()),
2011 * use "link_up" mode. The LEDs will still ID on request if there is no
2012 * link based on logic in e1000_led_[on|off]_pchlan().
2013 **/
2014static s32 e1000_id_led_init_pchlan(struct e1000_hw *hw)
2015{
2016 struct e1000_mac_info *mac = &hw->mac;
2017 s32 ret_val;
2018 const u32 ledctl_on = E1000_LEDCTL_MODE_LINK_UP;
2019 const u32 ledctl_off = E1000_LEDCTL_MODE_LINK_UP | E1000_PHY_LED0_IVRT;
2020 u16 data, i, temp, shift;
2021
2022 /* Get default ID LED modes */
2023 ret_val = hw->nvm.ops.valid_led_default(hw, &data);
2024 if (ret_val)
2025 goto out;
2026
2027 mac->ledctl_default = er32(LEDCTL);
2028 mac->ledctl_mode1 = mac->ledctl_default;
2029 mac->ledctl_mode2 = mac->ledctl_default;
2030
2031 for (i = 0; i < 4; i++) {
2032 temp = (data >> (i << 2)) & E1000_LEDCTL_LED0_MODE_MASK;
2033 shift = (i * 5);
2034 switch (temp) {
2035 case ID_LED_ON1_DEF2:
2036 case ID_LED_ON1_ON2:
2037 case ID_LED_ON1_OFF2:
2038 mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2039 mac->ledctl_mode1 |= (ledctl_on << shift);
2040 break;
2041 case ID_LED_OFF1_DEF2:
2042 case ID_LED_OFF1_ON2:
2043 case ID_LED_OFF1_OFF2:
2044 mac->ledctl_mode1 &= ~(E1000_PHY_LED0_MASK << shift);
2045 mac->ledctl_mode1 |= (ledctl_off << shift);
2046 break;
2047 default:
2048 /* Do nothing */
2049 break;
2050 }
2051 switch (temp) {
2052 case ID_LED_DEF1_ON2:
2053 case ID_LED_ON1_ON2:
2054 case ID_LED_OFF1_ON2:
2055 mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2056 mac->ledctl_mode2 |= (ledctl_on << shift);
2057 break;
2058 case ID_LED_DEF1_OFF2:
2059 case ID_LED_ON1_OFF2:
2060 case ID_LED_OFF1_OFF2:
2061 mac->ledctl_mode2 &= ~(E1000_PHY_LED0_MASK << shift);
2062 mac->ledctl_mode2 |= (ledctl_off << shift);
2063 break;
2064 default:
2065 /* Do nothing */
2066 break;
2067 }
2068 }
2069
2070out:
2071 return ret_val;
2072}
2073
2074/**
1860 * e1000_get_bus_info_ich8lan - Get/Set the bus type and width 2075 * e1000_get_bus_info_ich8lan - Get/Set the bus type and width
1861 * @hw: pointer to the HW structure 2076 * @hw: pointer to the HW structure
1862 * 2077 *
@@ -1965,6 +2180,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
1965 kab |= E1000_KABGTXD_BGSQLBIAS; 2180 kab |= E1000_KABGTXD_BGSQLBIAS;
1966 ew32(KABGTXD, kab); 2181 ew32(KABGTXD, kab);
1967 2182
2183 if (hw->mac.type == e1000_pchlan)
2184 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2185
1968 return ret_val; 2186 return ret_val;
1969} 2187}
1970 2188
@@ -1990,7 +2208,7 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
1990 e1000_initialize_hw_bits_ich8lan(hw); 2208 e1000_initialize_hw_bits_ich8lan(hw);
1991 2209
1992 /* Initialize identification LED */ 2210 /* Initialize identification LED */
1993 ret_val = e1000e_id_led_init(hw); 2211 ret_val = mac->ops.id_led_init(hw);
1994 if (ret_val) { 2212 if (ret_val) {
1995 hw_dbg(hw, "Error initializing identification LED\n"); 2213 hw_dbg(hw, "Error initializing identification LED\n");
1996 return ret_val; 2214 return ret_val;
@@ -2036,6 +2254,16 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2036 ew32(CTRL_EXT, ctrl_ext); 2254 ew32(CTRL_EXT, ctrl_ext);
2037 2255
2038 /* 2256 /*
2257 * The 82578 Rx buffer will stall if wakeup is enabled in host and
2258 * the ME. Reading the BM_WUC register will clear the host wakeup bit.
2259 * Reset the phy after disabling host wakeup to reset the Rx buffer.
2260 */
2261 if (hw->phy.type == e1000_phy_82578) {
2262 e1e_rphy(hw, BM_WUC, &i);
2263 e1000e_phy_hw_reset_generic(hw);
2264 }
2265
2266 /*
2039 * Clear all of the statistics registers (clear on read). It is 2267 * Clear all of the statistics registers (clear on read). It is
2040 * important that we do this after we have tried to establish link 2268 * important that we do this after we have tried to establish link
2041 * because the symbol error count will increment wildly if there 2269 * because the symbol error count will increment wildly if there
@@ -2059,6 +2287,9 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
2059 /* Extended Device Control */ 2287 /* Extended Device Control */
2060 reg = er32(CTRL_EXT); 2288 reg = er32(CTRL_EXT);
2061 reg |= (1 << 22); 2289 reg |= (1 << 22);
2290 /* Enable PHY low-power state when MAC is at D3 w/o WoL */
2291 if (hw->mac.type >= e1000_pchlan)
2292 reg |= E1000_CTRL_EXT_PHYPDEN;
2062 ew32(CTRL_EXT, reg); 2293 ew32(CTRL_EXT, reg);
2063 2294
2064 /* Transmit Descriptor Control 0 */ 2295 /* Transmit Descriptor Control 0 */
@@ -2135,6 +2366,14 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2135 return ret_val; 2366 return ret_val;
2136 2367
2137 ew32(FCTTV, hw->fc.pause_time); 2368 ew32(FCTTV, hw->fc.pause_time);
2369 if ((hw->phy.type == e1000_phy_82578) ||
2370 (hw->phy.type == e1000_phy_82577)) {
2371 ret_val = hw->phy.ops.write_phy_reg(hw,
2372 PHY_REG(BM_PORT_CTRL_PAGE, 27),
2373 hw->fc.pause_time);
2374 if (ret_val)
2375 return ret_val;
2376 }
2138 2377
2139 return e1000e_set_fc_watermarks(hw); 2378 return e1000e_set_fc_watermarks(hw);
2140} 2379}
@@ -2174,18 +2413,26 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2174 if (ret_val) 2413 if (ret_val)
2175 return ret_val; 2414 return ret_val;
2176 2415
2177 if (hw->phy.type == e1000_phy_igp_3) { 2416 switch (hw->phy.type) {
2417 case e1000_phy_igp_3:
2178 ret_val = e1000e_copper_link_setup_igp(hw); 2418 ret_val = e1000e_copper_link_setup_igp(hw);
2179 if (ret_val) 2419 if (ret_val)
2180 return ret_val; 2420 return ret_val;
2181 } else if (hw->phy.type == e1000_phy_bm) { 2421 break;
2422 case e1000_phy_bm:
2423 case e1000_phy_82578:
2182 ret_val = e1000e_copper_link_setup_m88(hw); 2424 ret_val = e1000e_copper_link_setup_m88(hw);
2183 if (ret_val) 2425 if (ret_val)
2184 return ret_val; 2426 return ret_val;
2185 } 2427 break;
2186 2428 case e1000_phy_82577:
2187 if (hw->phy.type == e1000_phy_ife) { 2429 ret_val = e1000_copper_link_setup_82577(hw);
2188 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &reg_data); 2430 if (ret_val)
2431 return ret_val;
2432 break;
2433 case e1000_phy_ife:
2434 ret_val = hw->phy.ops.read_phy_reg(hw, IFE_PHY_MDIX_CONTROL,
2435 &reg_data);
2189 if (ret_val) 2436 if (ret_val)
2190 return ret_val; 2437 return ret_val;
2191 2438
@@ -2203,9 +2450,13 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2203 reg_data |= IFE_PMC_AUTO_MDIX; 2450 reg_data |= IFE_PMC_AUTO_MDIX;
2204 break; 2451 break;
2205 } 2452 }
2206 ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, reg_data); 2453 ret_val = hw->phy.ops.write_phy_reg(hw, IFE_PHY_MDIX_CONTROL,
2454 reg_data);
2207 if (ret_val) 2455 if (ret_val)
2208 return ret_val; 2456 return ret_val;
2457 break;
2458 default:
2459 break;
2209 } 2460 }
2210 return e1000e_setup_copper_link(hw); 2461 return e1000e_setup_copper_link(hw);
2211} 2462}
@@ -2422,18 +2673,26 @@ void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw)
2422 * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation 2673 * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation
2423 * to a lower speed. 2674 * to a lower speed.
2424 * 2675 *
2425 * Should only be called for ICH9 and ICH10 devices. 2676 * Should only be called for applicable parts.
2426 **/ 2677 **/
2427void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) 2678void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
2428{ 2679{
2429 u32 phy_ctrl; 2680 u32 phy_ctrl;
2430 2681
2431 if ((hw->mac.type == e1000_ich10lan) || 2682 switch (hw->mac.type) {
2432 (hw->mac.type == e1000_ich9lan)) { 2683 case e1000_ich9lan:
2684 case e1000_ich10lan:
2685 case e1000_pchlan:
2433 phy_ctrl = er32(PHY_CTRL); 2686 phy_ctrl = er32(PHY_CTRL);
2434 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | 2687 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU |
2435 E1000_PHY_CTRL_GBE_DISABLE; 2688 E1000_PHY_CTRL_GBE_DISABLE;
2436 ew32(PHY_CTRL, phy_ctrl); 2689 ew32(PHY_CTRL, phy_ctrl);
2690
2691 /* Workaround SWFLAG unexpectedly set during S0->Sx */
2692 if (hw->mac.type == e1000_pchlan)
2693 udelay(500);
2694 default:
2695 break;
2437 } 2696 }
2438 2697
2439 return; 2698 return;
@@ -2487,13 +2746,99 @@ static s32 e1000_led_off_ich8lan(struct e1000_hw *hw)
2487} 2746}
2488 2747
2489/** 2748/**
2749 * e1000_setup_led_pchlan - Configures SW controllable LED
2750 * @hw: pointer to the HW structure
2751 *
2752 * This prepares the SW controllable LED for use.
2753 **/
2754static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
2755{
2756 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG,
2757 (u16)hw->mac.ledctl_mode1);
2758}
2759
2760/**
2761 * e1000_cleanup_led_pchlan - Restore the default LED operation
2762 * @hw: pointer to the HW structure
2763 *
2764 * Return the LED back to the default configuration.
2765 **/
2766static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw)
2767{
2768 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG,
2769 (u16)hw->mac.ledctl_default);
2770}
2771
2772/**
2773 * e1000_led_on_pchlan - Turn LEDs on
2774 * @hw: pointer to the HW structure
2775 *
2776 * Turn on the LEDs.
2777 **/
2778static s32 e1000_led_on_pchlan(struct e1000_hw *hw)
2779{
2780 u16 data = (u16)hw->mac.ledctl_mode2;
2781 u32 i, led;
2782
2783 /*
2784 * If no link, then turn LED on by setting the invert bit
2785 * for each LED that's mode is "link_up" in ledctl_mode2.
2786 */
2787 if (!(er32(STATUS) & E1000_STATUS_LU)) {
2788 for (i = 0; i < 3; i++) {
2789 led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
2790 if ((led & E1000_PHY_LED0_MODE_MASK) !=
2791 E1000_LEDCTL_MODE_LINK_UP)
2792 continue;
2793 if (led & E1000_PHY_LED0_IVRT)
2794 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
2795 else
2796 data |= (E1000_PHY_LED0_IVRT << (i * 5));
2797 }
2798 }
2799
2800 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data);
2801}
2802
2803/**
2804 * e1000_led_off_pchlan - Turn LEDs off
2805 * @hw: pointer to the HW structure
2806 *
2807 * Turn off the LEDs.
2808 **/
2809static s32 e1000_led_off_pchlan(struct e1000_hw *hw)
2810{
2811 u16 data = (u16)hw->mac.ledctl_mode1;
2812 u32 i, led;
2813
2814 /*
2815 * If no link, then turn LED off by clearing the invert bit
2816 * for each LED that's mode is "link_up" in ledctl_mode1.
2817 */
2818 if (!(er32(STATUS) & E1000_STATUS_LU)) {
2819 for (i = 0; i < 3; i++) {
2820 led = (data >> (i * 5)) & E1000_PHY_LED0_MASK;
2821 if ((led & E1000_PHY_LED0_MODE_MASK) !=
2822 E1000_LEDCTL_MODE_LINK_UP)
2823 continue;
2824 if (led & E1000_PHY_LED0_IVRT)
2825 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
2826 else
2827 data |= (E1000_PHY_LED0_IVRT << (i * 5));
2828 }
2829 }
2830
2831 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data);
2832}
2833
2834/**
2490 * e1000_get_cfg_done_ich8lan - Read config done bit 2835 * e1000_get_cfg_done_ich8lan - Read config done bit
2491 * @hw: pointer to the HW structure 2836 * @hw: pointer to the HW structure
2492 * 2837 *
2493 * Read the management control register for the config done bit for 2838 * Read the management control register for the config done bit for
2494 * completion status. NOTE: silicon which is EEPROM-less will fail trying 2839 * completion status. NOTE: silicon which is EEPROM-less will fail trying
2495 * to read the config done bit, so an error is *ONLY* logged and returns 2840 * to read the config done bit, so an error is *ONLY* logged and returns
2496 * E1000_SUCCESS. If we were to return with error, EEPROM-less silicon 2841 * 0. If we were to return with error, EEPROM-less silicon
2497 * would not be able to be reset or change link. 2842 * would not be able to be reset or change link.
2498 **/ 2843 **/
2499static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) 2844static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
@@ -2503,7 +2848,8 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
2503 e1000e_get_cfg_done(hw); 2848 e1000e_get_cfg_done(hw);
2504 2849
2505 /* If EEPROM is not marked present, init the IGP 3 PHY manually */ 2850 /* If EEPROM is not marked present, init the IGP 3 PHY manually */
2506 if (hw->mac.type != e1000_ich10lan) { 2851 if ((hw->mac.type != e1000_ich10lan) &&
2852 (hw->mac.type != e1000_pchlan)) {
2507 if (((er32(EECD) & E1000_EECD_PRES) == 0) && 2853 if (((er32(EECD) & E1000_EECD_PRES) == 0) &&
2508 (hw->phy.type == e1000_phy_igp_3)) { 2854 (hw->phy.type == e1000_phy_igp_3)) {
2509 e1000e_phy_init_script_igp3(hw); 2855 e1000e_phy_init_script_igp3(hw);
@@ -2529,6 +2875,7 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
2529static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) 2875static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
2530{ 2876{
2531 u32 temp; 2877 u32 temp;
2878 u16 phy_data;
2532 2879
2533 e1000e_clear_hw_cntrs_base(hw); 2880 e1000e_clear_hw_cntrs_base(hw);
2534 2881
@@ -2546,22 +2893,42 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
2546 temp = er32(IAC); 2893 temp = er32(IAC);
2547 temp = er32(ICRXOC); 2894 temp = er32(ICRXOC);
2548 2895
2896 /* Clear PHY statistics registers */
2897 if ((hw->phy.type == e1000_phy_82578) ||
2898 (hw->phy.type == e1000_phy_82577)) {
2899 hw->phy.ops.read_phy_reg(hw, HV_SCC_UPPER, &phy_data);
2900 hw->phy.ops.read_phy_reg(hw, HV_SCC_LOWER, &phy_data);
2901 hw->phy.ops.read_phy_reg(hw, HV_ECOL_UPPER, &phy_data);
2902 hw->phy.ops.read_phy_reg(hw, HV_ECOL_LOWER, &phy_data);
2903 hw->phy.ops.read_phy_reg(hw, HV_MCC_UPPER, &phy_data);
2904 hw->phy.ops.read_phy_reg(hw, HV_MCC_LOWER, &phy_data);
2905 hw->phy.ops.read_phy_reg(hw, HV_LATECOL_UPPER, &phy_data);
2906 hw->phy.ops.read_phy_reg(hw, HV_LATECOL_LOWER, &phy_data);
2907 hw->phy.ops.read_phy_reg(hw, HV_COLC_UPPER, &phy_data);
2908 hw->phy.ops.read_phy_reg(hw, HV_COLC_LOWER, &phy_data);
2909 hw->phy.ops.read_phy_reg(hw, HV_DC_UPPER, &phy_data);
2910 hw->phy.ops.read_phy_reg(hw, HV_DC_LOWER, &phy_data);
2911 hw->phy.ops.read_phy_reg(hw, HV_TNCRS_UPPER, &phy_data);
2912 hw->phy.ops.read_phy_reg(hw, HV_TNCRS_LOWER, &phy_data);
2913 }
2549} 2914}
2550 2915
2551static struct e1000_mac_operations ich8_mac_ops = { 2916static struct e1000_mac_operations ich8_mac_ops = {
2917 .id_led_init = e1000e_id_led_init,
2552 .check_mng_mode = e1000_check_mng_mode_ich8lan, 2918 .check_mng_mode = e1000_check_mng_mode_ich8lan,
2553 .check_for_link = e1000e_check_for_copper_link, 2919 .check_for_link = e1000e_check_for_copper_link,
2554 .cleanup_led = e1000_cleanup_led_ich8lan, 2920 /* cleanup_led dependent on mac type */
2555 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, 2921 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
2556 .get_bus_info = e1000_get_bus_info_ich8lan, 2922 .get_bus_info = e1000_get_bus_info_ich8lan,
2557 .get_link_up_info = e1000_get_link_up_info_ich8lan, 2923 .get_link_up_info = e1000_get_link_up_info_ich8lan,
2558 .led_on = e1000_led_on_ich8lan, 2924 /* led_on dependent on mac type */
2559 .led_off = e1000_led_off_ich8lan, 2925 /* led_off dependent on mac type */
2560 .update_mc_addr_list = e1000e_update_mc_addr_list_generic, 2926 .update_mc_addr_list = e1000e_update_mc_addr_list_generic,
2561 .reset_hw = e1000_reset_hw_ich8lan, 2927 .reset_hw = e1000_reset_hw_ich8lan,
2562 .init_hw = e1000_init_hw_ich8lan, 2928 .init_hw = e1000_init_hw_ich8lan,
2563 .setup_link = e1000_setup_link_ich8lan, 2929 .setup_link = e1000_setup_link_ich8lan,
2564 .setup_physical_interface= e1000_setup_copper_link_ich8lan, 2930 .setup_physical_interface= e1000_setup_copper_link_ich8lan,
2931 /* id_led_init dependent on mac type */
2565}; 2932};
2566 2933
2567static struct e1000_phy_operations ich8_phy_ops = { 2934static struct e1000_phy_operations ich8_phy_ops = {
@@ -2644,3 +3011,21 @@ struct e1000_info e1000_ich10_info = {
2644 .phy_ops = &ich8_phy_ops, 3011 .phy_ops = &ich8_phy_ops,
2645 .nvm_ops = &ich8_nvm_ops, 3012 .nvm_ops = &ich8_nvm_ops,
2646}; 3013};
3014
3015struct e1000_info e1000_pch_info = {
3016 .mac = e1000_pchlan,
3017 .flags = FLAG_IS_ICH
3018 | FLAG_HAS_WOL
3019 | FLAG_RX_CSUM_ENABLED
3020 | FLAG_HAS_CTRLEXT_ON_LOAD
3021 | FLAG_HAS_AMT
3022 | FLAG_HAS_FLASH
3023 | FLAG_HAS_JUMBO_FRAMES
3024 | FLAG_APME_IN_WUC,
3025 .pba = 26,
3026 .max_hw_frame_size = 4096,
3027 .get_variants = e1000_get_variants_ich8lan,
3028 .mac_ops = &ich8_mac_ops,
3029 .phy_ops = &ich8_phy_ops,
3030 .nvm_ops = &ich8_nvm_ops,
3031};