1 /*******************************************************************************
3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2007 Intel Corporation.
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,
8 version 2, as published by the Free Software Foundation.
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *******************************************************************************/
30 * 82562G-2 10/100 Network Connection
31 * 82562GT 10/100 Network Connection
32 * 82562GT-2 10/100 Network Connection
33 * 82562V 10/100 Network Connection
34 * 82562V-2 10/100 Network Connection
35 * 82566DC-2 Gigabit Network Connection
36 * 82566DC Gigabit Network Connection
37 * 82566DM-2 Gigabit Network Connection
38 * 82566DM Gigabit Network Connection
39 * 82566MC Gigabit Network Connection
40 * 82566MM Gigabit Network Connection
43 #include <linux/netdevice.h>
44 #include <linux/ethtool.h>
45 #include <linux/delay.h>
46 #include <linux/pci.h>
50 #define ICH_FLASH_GFPREG 0x0000
51 #define ICH_FLASH_HSFSTS 0x0004
52 #define ICH_FLASH_HSFCTL 0x0006
53 #define ICH_FLASH_FADDR 0x0008
54 #define ICH_FLASH_FDATA0 0x0010
56 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500
57 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500
58 #define ICH_FLASH_ERASE_COMMAND_TIMEOUT 3000000
59 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
60 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10
62 #define ICH_CYCLE_READ 0
63 #define ICH_CYCLE_WRITE 2
64 #define ICH_CYCLE_ERASE 3
66 #define FLASH_GFPREG_BASE_MASK 0x1FFF
67 #define FLASH_SECTOR_ADDR_SHIFT 12
69 #define ICH_FLASH_SEG_SIZE_256 256
70 #define ICH_FLASH_SEG_SIZE_4K 4096
71 #define ICH_FLASH_SEG_SIZE_8K 8192
72 #define ICH_FLASH_SEG_SIZE_64K 65536
75 #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */
77 #define E1000_ICH_MNG_IAMT_MODE 0x2
79 #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
80 (ID_LED_DEF1_OFF2 << 8) | \
81 (ID_LED_DEF1_ON2 << 4) | \
84 #define E1000_ICH_NVM_SIG_WORD 0x13
85 #define E1000_ICH_NVM_SIG_MASK 0xC000
87 #define E1000_ICH8_LAN_INIT_TIMEOUT 1500
89 #define E1000_FEXTNVM_SW_CONFIG 1
90 #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */
92 #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
94 #define E1000_ICH_RAR_ENTRIES 7
96 #define PHY_PAGE_SHIFT 5
97 #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
98 ((reg) & MAX_PHY_REG_ADDRESS))
99 #define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */
100 #define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */
102 #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002
103 #define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
104 #define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
106 /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
107 /* Offset 04h HSFSTS */
108 union ich8_hws_flash_status
{
110 u16 flcdone
:1; /* bit 0 Flash Cycle Done */
111 u16 flcerr
:1; /* bit 1 Flash Cycle Error */
112 u16 dael
:1; /* bit 2 Direct Access error Log */
113 u16 berasesz
:2; /* bit 4:3 Sector Erase Size */
114 u16 flcinprog
:1; /* bit 5 flash cycle in Progress */
115 u16 reserved1
:2; /* bit 13:6 Reserved */
116 u16 reserved2
:6; /* bit 13:6 Reserved */
117 u16 fldesvalid
:1; /* bit 14 Flash Descriptor Valid */
118 u16 flockdn
:1; /* bit 15 Flash Config Lock-Down */
123 /* ICH GbE Flash Hardware Sequencing Flash control Register bit breakdown */
124 /* Offset 06h FLCTL */
125 union ich8_hws_flash_ctrl
{
126 struct ich8_hsflctl
{
127 u16 flcgo
:1; /* 0 Flash Cycle Go */
128 u16 flcycle
:2; /* 2:1 Flash Cycle */
129 u16 reserved
:5; /* 7:3 Reserved */
130 u16 fldbcount
:2; /* 9:8 Flash Data Byte Count */
131 u16 flockdn
:6; /* 15:10 Reserved */
136 /* ICH Flash Region Access Permissions */
137 union ich8_hws_flash_regacc
{
139 u32 grra
:8; /* 0:7 GbE region Read Access */
140 u32 grwa
:8; /* 8:15 GbE region Write Access */
141 u32 gmrag
:8; /* 23:16 GbE Master Read Access Grant */
142 u32 gmwag
:8; /* 31:24 GbE Master Write Access Grant */
147 static s32
e1000_setup_link_ich8lan(struct e1000_hw
*hw
);
148 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw
*hw
);
149 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw
*hw
);
150 static s32
e1000_check_polarity_ife_ich8lan(struct e1000_hw
*hw
);
151 static s32
e1000_erase_flash_bank_ich8lan(struct e1000_hw
*hw
, u32 bank
);
152 static s32
e1000_retry_write_flash_byte_ich8lan(struct e1000_hw
*hw
,
153 u32 offset
, u8 byte
);
154 static s32
e1000_read_flash_word_ich8lan(struct e1000_hw
*hw
, u32 offset
,
156 static s32
e1000_read_flash_data_ich8lan(struct e1000_hw
*hw
, u32 offset
,
158 static s32
e1000_setup_copper_link_ich8lan(struct e1000_hw
*hw
);
159 static s32
e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw
*hw
);
161 static inline u16
__er16flash(struct e1000_hw
*hw
, unsigned long reg
)
163 return readw(hw
->flash_address
+ reg
);
166 static inline u32
__er32flash(struct e1000_hw
*hw
, unsigned long reg
)
168 return readl(hw
->flash_address
+ reg
);
171 static inline void __ew16flash(struct e1000_hw
*hw
, unsigned long reg
, u16 val
)
173 writew(val
, hw
->flash_address
+ reg
);
176 static inline void __ew32flash(struct e1000_hw
*hw
, unsigned long reg
, u32 val
)
178 writel(val
, hw
->flash_address
+ reg
);
181 #define er16flash(reg) __er16flash(hw, (reg))
182 #define er32flash(reg) __er32flash(hw, (reg))
183 #define ew16flash(reg,val) __ew16flash(hw, (reg), (val))
184 #define ew32flash(reg,val) __ew32flash(hw, (reg), (val))
187 * e1000_init_phy_params_ich8lan - Initialize PHY function pointers
188 * @hw: pointer to the HW structure
190 * Initialize family-specific PHY parameters and function pointers.
192 static s32
e1000_init_phy_params_ich8lan(struct e1000_hw
*hw
)
194 struct e1000_phy_info
*phy
= &hw
->phy
;
199 phy
->reset_delay_us
= 100;
202 while ((e1000_phy_unknown
== e1000e_get_phy_type_from_id(phy
->id
)) &&
205 ret_val
= e1000e_get_phy_id(hw
);
212 case IGP03E1000_E_PHY_ID
:
213 phy
->type
= e1000_phy_igp_3
;
214 phy
->autoneg_mask
= AUTONEG_ADVERTISE_SPEED_DEFAULT
;
217 case IFE_PLUS_E_PHY_ID
:
219 phy
->type
= e1000_phy_ife
;
220 phy
->autoneg_mask
= E1000_ALL_NOT_GIG
;
223 return -E1000_ERR_PHY
;
231 * e1000_init_nvm_params_ich8lan - Initialize NVM function pointers
232 * @hw: pointer to the HW structure
234 * Initialize family-specific NVM parameters and function
237 static s32
e1000_init_nvm_params_ich8lan(struct e1000_hw
*hw
)
239 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
240 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
242 u32 sector_base_addr
;
246 /* Can't read flash registers if the register set isn't mapped.
248 if (!hw
->flash_address
) {
249 hw_dbg(hw
, "ERROR: Flash registers not mapped\n");
250 return -E1000_ERR_CONFIG
;
253 nvm
->type
= e1000_nvm_flash_sw
;
255 gfpreg
= er32flash(ICH_FLASH_GFPREG
);
257 /* sector_X_addr is a "sector"-aligned address (4096 bytes)
258 * Add 1 to sector_end_addr since this sector is included in
259 * the overall size. */
260 sector_base_addr
= gfpreg
& FLASH_GFPREG_BASE_MASK
;
261 sector_end_addr
= ((gfpreg
>> 16) & FLASH_GFPREG_BASE_MASK
) + 1;
263 /* flash_base_addr is byte-aligned */
264 nvm
->flash_base_addr
= sector_base_addr
<< FLASH_SECTOR_ADDR_SHIFT
;
266 /* find total size of the NVM, then cut in half since the total
267 * size represents two separate NVM banks. */
268 nvm
->flash_bank_size
= (sector_end_addr
- sector_base_addr
)
269 << FLASH_SECTOR_ADDR_SHIFT
;
270 nvm
->flash_bank_size
/= 2;
271 /* Adjust to word count */
272 nvm
->flash_bank_size
/= sizeof(u16
);
274 nvm
->word_size
= E1000_ICH8_SHADOW_RAM_WORDS
;
276 /* Clear shadow ram */
277 for (i
= 0; i
< nvm
->word_size
; i
++) {
278 dev_spec
->shadow_ram
[i
].modified
= 0;
279 dev_spec
->shadow_ram
[i
].value
= 0xFFFF;
286 * e1000_init_mac_params_ich8lan - Initialize MAC function pointers
287 * @hw: pointer to the HW structure
289 * Initialize family-specific MAC parameters and function
292 static s32
e1000_init_mac_params_ich8lan(struct e1000_adapter
*adapter
)
294 struct e1000_hw
*hw
= &adapter
->hw
;
295 struct e1000_mac_info
*mac
= &hw
->mac
;
297 /* Set media type function pointer */
298 hw
->media_type
= e1000_media_type_copper
;
300 /* Set mta register count */
301 mac
->mta_reg_count
= 32;
302 /* Set rar entry count */
303 mac
->rar_entry_count
= E1000_ICH_RAR_ENTRIES
;
304 if (mac
->type
== e1000_ich8lan
)
305 mac
->rar_entry_count
--;
306 /* Set if manageability features are enabled. */
307 mac
->arc_subsystem_valid
= 1;
309 /* Enable PCS Lock-loss workaround for ICH8 */
310 if (mac
->type
== e1000_ich8lan
)
311 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw
, 1);
316 static s32
e1000_get_invariants_ich8lan(struct e1000_adapter
*adapter
)
318 struct e1000_hw
*hw
= &adapter
->hw
;
321 rc
= e1000_init_mac_params_ich8lan(adapter
);
325 rc
= e1000_init_nvm_params_ich8lan(hw
);
329 rc
= e1000_init_phy_params_ich8lan(hw
);
333 if ((adapter
->hw
.mac
.type
== e1000_ich8lan
) &&
334 (adapter
->hw
.phy
.type
== e1000_phy_igp_3
))
335 adapter
->flags
|= FLAG_LSC_GIG_SPEED_DROP
;
341 * e1000_acquire_swflag_ich8lan - Acquire software control flag
342 * @hw: pointer to the HW structure
344 * Acquires the software control flag for performing NVM and PHY
345 * operations. This is a function pointer entry point only called by
346 * read/write routines for the PHY and NVM parts.
348 static s32
e1000_acquire_swflag_ich8lan(struct e1000_hw
*hw
)
351 u32 timeout
= PHY_CFG_TIMEOUT
;
354 extcnf_ctrl
= er32(EXTCNF_CTRL
);
355 extcnf_ctrl
|= E1000_EXTCNF_CTRL_SWFLAG
;
356 ew32(EXTCNF_CTRL
, extcnf_ctrl
);
358 extcnf_ctrl
= er32(EXTCNF_CTRL
);
359 if (extcnf_ctrl
& E1000_EXTCNF_CTRL_SWFLAG
)
366 hw_dbg(hw
, "FW or HW has locked the resource for too long.\n");
367 return -E1000_ERR_CONFIG
;
374 * e1000_release_swflag_ich8lan - Release software control flag
375 * @hw: pointer to the HW structure
377 * Releases the software control flag for performing NVM and PHY operations.
378 * This is a function pointer entry point only called by read/write
379 * routines for the PHY and NVM parts.
381 static void e1000_release_swflag_ich8lan(struct e1000_hw
*hw
)
385 extcnf_ctrl
= er32(EXTCNF_CTRL
);
386 extcnf_ctrl
&= ~E1000_EXTCNF_CTRL_SWFLAG
;
387 ew32(EXTCNF_CTRL
, extcnf_ctrl
);
391 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked
392 * @hw: pointer to the HW structure
394 * Checks if firmware is blocking the reset of the PHY.
395 * This is a function pointer entry point only called by
398 static s32
e1000_check_reset_block_ich8lan(struct e1000_hw
*hw
)
404 return (fwsm
& E1000_ICH_FWSM_RSPCIPHY
) ? 0 : E1000_BLK_PHY_RESET
;
408 * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex
409 * @hw: pointer to the HW structure
411 * Forces the speed and duplex settings of the PHY.
412 * This is a function pointer entry point only called by
413 * PHY setup routines.
415 static s32
e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw
*hw
)
417 struct e1000_phy_info
*phy
= &hw
->phy
;
422 if (phy
->type
!= e1000_phy_ife
) {
423 ret_val
= e1000e_phy_force_speed_duplex_igp(hw
);
427 ret_val
= e1e_rphy(hw
, PHY_CONTROL
, &data
);
431 e1000e_phy_force_speed_duplex_setup(hw
, &data
);
433 ret_val
= e1e_wphy(hw
, PHY_CONTROL
, data
);
437 /* Disable MDI-X support for 10/100 */
438 ret_val
= e1e_rphy(hw
, IFE_PHY_MDIX_CONTROL
, &data
);
442 data
&= ~IFE_PMC_AUTO_MDIX
;
443 data
&= ~IFE_PMC_FORCE_MDIX
;
445 ret_val
= e1e_wphy(hw
, IFE_PHY_MDIX_CONTROL
, data
);
449 hw_dbg(hw
, "IFE PMC: %X\n", data
);
453 if (phy
->wait_for_link
) {
454 hw_dbg(hw
, "Waiting for forced speed/duplex link on IFE phy.\n");
456 ret_val
= e1000e_phy_has_link_generic(hw
,
464 hw_dbg(hw
, "Link taking longer than expected.\n");
467 ret_val
= e1000e_phy_has_link_generic(hw
,
479 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset
480 * @hw: pointer to the HW structure
483 * This is a function pointer entry point called by drivers
484 * or other shared routines.
486 static s32
e1000_phy_hw_reset_ich8lan(struct e1000_hw
*hw
)
488 struct e1000_phy_info
*phy
= &hw
->phy
;
490 u32 data
, cnf_size
, cnf_base_addr
, sw_cfg_mask
;
492 u16 loop
= E1000_ICH8_LAN_INIT_TIMEOUT
;
493 u16 word_addr
, reg_data
, reg_addr
, phy_page
= 0;
495 ret_val
= e1000e_phy_hw_reset_generic(hw
);
499 /* Initialize the PHY from the NVM on ICH platforms. This
500 * is needed due to an issue where the NVM configuration is
501 * not properly autoloaded after power transitions.
502 * Therefore, after each PHY reset, we will load the
503 * configuration data out of the NVM manually.
505 if (hw
->mac
.type
== e1000_ich8lan
&& phy
->type
== e1000_phy_igp_3
) {
506 struct e1000_adapter
*adapter
= hw
->adapter
;
508 /* Check if SW needs configure the PHY */
509 if ((adapter
->pdev
->device
== E1000_DEV_ID_ICH8_IGP_M_AMT
) ||
510 (adapter
->pdev
->device
== E1000_DEV_ID_ICH8_IGP_M
))
511 sw_cfg_mask
= E1000_FEXTNVM_SW_CONFIG_ICH8M
;
513 sw_cfg_mask
= E1000_FEXTNVM_SW_CONFIG
;
515 data
= er32(FEXTNVM
);
516 if (!(data
& sw_cfg_mask
))
519 /* Wait for basic configuration completes before proceeding*/
522 data
&= E1000_STATUS_LAN_INIT_DONE
;
524 } while ((!data
) && --loop
);
526 /* If basic configuration is incomplete before the above loop
527 * count reaches 0, loading the configuration from NVM will
528 * leave the PHY in a bad state possibly resulting in no link.
531 hw_dbg(hw
, "LAN_INIT_DONE not set, increase timeout\n");
534 /* Clear the Init Done bit for the next init event */
536 data
&= ~E1000_STATUS_LAN_INIT_DONE
;
539 /* Make sure HW does not configure LCD from PHY
540 * extended configuration before SW configuration */
541 data
= er32(EXTCNF_CTRL
);
542 if (data
& E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE
)
545 cnf_size
= er32(EXTCNF_SIZE
);
546 cnf_size
&= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK
;
547 cnf_size
>>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT
;
551 cnf_base_addr
= data
& E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK
;
552 cnf_base_addr
>>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT
;
554 /* Configure LCD from extended configuration
557 /* cnf_base_addr is in DWORD */
558 word_addr
= (u16
)(cnf_base_addr
<< 1);
560 for (i
= 0; i
< cnf_size
; i
++) {
561 ret_val
= e1000_read_nvm(hw
,
568 ret_val
= e1000_read_nvm(hw
,
569 (word_addr
+ i
* 2 + 1),
575 /* Save off the PHY page for future writes. */
576 if (reg_addr
== IGP01E1000_PHY_PAGE_SELECT
) {
581 reg_addr
|= phy_page
;
583 ret_val
= e1e_wphy(hw
, (u32
)reg_addr
, reg_data
);
593 * e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states
594 * @hw: pointer to the HW structure
596 * Populates "phy" structure with various feature states.
597 * This function is only called by other family-specific
600 static s32
e1000_get_phy_info_ife_ich8lan(struct e1000_hw
*hw
)
602 struct e1000_phy_info
*phy
= &hw
->phy
;
607 ret_val
= e1000e_phy_has_link_generic(hw
, 1, 0, &link
);
612 hw_dbg(hw
, "Phy info is only valid if link is up\n");
613 return -E1000_ERR_CONFIG
;
616 ret_val
= e1e_rphy(hw
, IFE_PHY_SPECIAL_CONTROL
, &data
);
619 phy
->polarity_correction
= (!(data
& IFE_PSC_AUTO_POLARITY_DISABLE
));
621 if (phy
->polarity_correction
) {
622 ret_val
= e1000_check_polarity_ife_ich8lan(hw
);
626 /* Polarity is forced */
627 phy
->cable_polarity
= (data
& IFE_PSC_FORCE_POLARITY
)
628 ? e1000_rev_polarity_reversed
629 : e1000_rev_polarity_normal
;
632 ret_val
= e1e_rphy(hw
, IFE_PHY_MDIX_CONTROL
, &data
);
636 phy
->is_mdix
= (data
& IFE_PMC_MDIX_STATUS
);
638 /* The following parameters are undefined for 10/100 operation. */
639 phy
->cable_length
= E1000_CABLE_LENGTH_UNDEFINED
;
640 phy
->local_rx
= e1000_1000t_rx_status_undefined
;
641 phy
->remote_rx
= e1000_1000t_rx_status_undefined
;
647 * e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info
648 * @hw: pointer to the HW structure
650 * Wrapper for calling the get_phy_info routines for the appropriate phy type.
651 * This is a function pointer entry point called by drivers
652 * or other shared routines.
654 static s32
e1000_get_phy_info_ich8lan(struct e1000_hw
*hw
)
656 switch (hw
->phy
.type
) {
658 return e1000_get_phy_info_ife_ich8lan(hw
);
660 case e1000_phy_igp_3
:
661 return e1000e_get_phy_info_igp(hw
);
667 return -E1000_ERR_PHY_TYPE
;
671 * e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY
672 * @hw: pointer to the HW structure
674 * Polarity is determined on the polarity reveral feature being enabled.
675 * This function is only called by other family-specific
678 static s32
e1000_check_polarity_ife_ich8lan(struct e1000_hw
*hw
)
680 struct e1000_phy_info
*phy
= &hw
->phy
;
682 u16 phy_data
, offset
, mask
;
684 /* Polarity is determined based on the reversal feature
687 if (phy
->polarity_correction
) {
688 offset
= IFE_PHY_EXTENDED_STATUS_CONTROL
;
689 mask
= IFE_PESC_POLARITY_REVERSED
;
691 offset
= IFE_PHY_SPECIAL_CONTROL
;
692 mask
= IFE_PSC_FORCE_POLARITY
;
695 ret_val
= e1e_rphy(hw
, offset
, &phy_data
);
698 phy
->cable_polarity
= (phy_data
& mask
)
699 ? e1000_rev_polarity_reversed
700 : e1000_rev_polarity_normal
;
706 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
707 * @hw: pointer to the HW structure
708 * @active: TRUE to enable LPLU, FALSE to disable
710 * Sets the LPLU D0 state according to the active flag. When
711 * activating LPLU this function also disables smart speed
712 * and vice versa. LPLU will not be activated unless the
713 * device autonegotiation advertisement meets standards of
714 * either 10 or 10/100 or 10/100/1000 at all duplexes.
715 * This is a function pointer entry point only called by
716 * PHY setup routines.
718 static s32
e1000_set_d0_lplu_state_ich8lan(struct e1000_hw
*hw
, bool active
)
720 struct e1000_phy_info
*phy
= &hw
->phy
;
725 if (phy
->type
!= e1000_phy_igp_3
)
728 phy_ctrl
= er32(PHY_CTRL
);
731 phy_ctrl
|= E1000_PHY_CTRL_D0A_LPLU
;
732 ew32(PHY_CTRL
, phy_ctrl
);
734 /* Call gig speed drop workaround on LPLU before accessing
735 * any PHY registers */
736 if ((hw
->mac
.type
== e1000_ich8lan
) &&
737 (hw
->phy
.type
== e1000_phy_igp_3
))
738 e1000e_gig_downshift_workaround_ich8lan(hw
);
740 /* When LPLU is enabled, we should disable SmartSpeed */
741 ret_val
= e1e_rphy(hw
, IGP01E1000_PHY_PORT_CONFIG
, &data
);
742 data
&= ~IGP01E1000_PSCFR_SMART_SPEED
;
743 ret_val
= e1e_wphy(hw
, IGP01E1000_PHY_PORT_CONFIG
, data
);
747 phy_ctrl
&= ~E1000_PHY_CTRL_D0A_LPLU
;
748 ew32(PHY_CTRL
, phy_ctrl
);
750 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
751 * during Dx states where the power conservation is most
752 * important. During driver activity we should enable
753 * SmartSpeed, so performance is maintained. */
754 if (phy
->smart_speed
== e1000_smart_speed_on
) {
755 ret_val
= e1e_rphy(hw
, IGP01E1000_PHY_PORT_CONFIG
,
760 data
|= IGP01E1000_PSCFR_SMART_SPEED
;
761 ret_val
= e1e_wphy(hw
, IGP01E1000_PHY_PORT_CONFIG
,
765 } else if (phy
->smart_speed
== e1000_smart_speed_off
) {
766 ret_val
= e1e_rphy(hw
, IGP01E1000_PHY_PORT_CONFIG
,
771 data
&= ~IGP01E1000_PSCFR_SMART_SPEED
;
772 ret_val
= e1e_wphy(hw
, IGP01E1000_PHY_PORT_CONFIG
,
783 * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state
784 * @hw: pointer to the HW structure
785 * @active: TRUE to enable LPLU, FALSE to disable
787 * Sets the LPLU D3 state according to the active flag. When
788 * activating LPLU this function also disables smart speed
789 * and vice versa. LPLU will not be activated unless the
790 * device autonegotiation advertisement meets standards of
791 * either 10 or 10/100 or 10/100/1000 at all duplexes.
792 * This is a function pointer entry point only called by
793 * PHY setup routines.
795 static s32
e1000_set_d3_lplu_state_ich8lan(struct e1000_hw
*hw
, bool active
)
797 struct e1000_phy_info
*phy
= &hw
->phy
;
802 phy_ctrl
= er32(PHY_CTRL
);
805 phy_ctrl
&= ~E1000_PHY_CTRL_NOND0A_LPLU
;
806 ew32(PHY_CTRL
, phy_ctrl
);
807 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
808 * during Dx states where the power conservation is most
809 * important. During driver activity we should enable
810 * SmartSpeed, so performance is maintained. */
811 if (phy
->smart_speed
== e1000_smart_speed_on
) {
812 ret_val
= e1e_rphy(hw
,
813 IGP01E1000_PHY_PORT_CONFIG
,
818 data
|= IGP01E1000_PSCFR_SMART_SPEED
;
819 ret_val
= e1e_wphy(hw
,
820 IGP01E1000_PHY_PORT_CONFIG
,
824 } else if (phy
->smart_speed
== e1000_smart_speed_off
) {
825 ret_val
= e1e_rphy(hw
,
826 IGP01E1000_PHY_PORT_CONFIG
,
831 data
&= ~IGP01E1000_PSCFR_SMART_SPEED
;
832 ret_val
= e1e_wphy(hw
,
833 IGP01E1000_PHY_PORT_CONFIG
,
838 } else if ((phy
->autoneg_advertised
== E1000_ALL_SPEED_DUPLEX
) ||
839 (phy
->autoneg_advertised
== E1000_ALL_NOT_GIG
) ||
840 (phy
->autoneg_advertised
== E1000_ALL_10_SPEED
)) {
841 phy_ctrl
|= E1000_PHY_CTRL_NOND0A_LPLU
;
842 ew32(PHY_CTRL
, phy_ctrl
);
844 /* Call gig speed drop workaround on LPLU before accessing
845 * any PHY registers */
846 if ((hw
->mac
.type
== e1000_ich8lan
) &&
847 (hw
->phy
.type
== e1000_phy_igp_3
))
848 e1000e_gig_downshift_workaround_ich8lan(hw
);
850 /* When LPLU is enabled, we should disable SmartSpeed */
851 ret_val
= e1e_rphy(hw
,
852 IGP01E1000_PHY_PORT_CONFIG
,
857 data
&= ~IGP01E1000_PSCFR_SMART_SPEED
;
858 ret_val
= e1e_wphy(hw
,
859 IGP01E1000_PHY_PORT_CONFIG
,
867 * e1000_read_nvm_ich8lan - Read word(s) from the NVM
868 * @hw: pointer to the HW structure
869 * @offset: The offset (in bytes) of the word(s) to read.
870 * @words: Size of data to read in words
871 * @data: Pointer to the word(s) to read at offset.
873 * Reads a word(s) from the NVM using the flash access registers.
875 static s32
e1000_read_nvm_ich8lan(struct e1000_hw
*hw
, u16 offset
, u16 words
,
878 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
879 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
884 if ((offset
>= nvm
->word_size
) || (words
> nvm
->word_size
- offset
) ||
886 hw_dbg(hw
, "nvm parameter(s) out of bounds\n");
887 return -E1000_ERR_NVM
;
890 ret_val
= e1000_acquire_swflag_ich8lan(hw
);
894 /* Start with the bank offset, then add the relative offset. */
895 act_offset
= (er32(EECD
) & E1000_EECD_SEC1VAL
)
896 ? nvm
->flash_bank_size
898 act_offset
+= offset
;
900 for (i
= 0; i
< words
; i
++) {
901 if ((dev_spec
->shadow_ram
) &&
902 (dev_spec
->shadow_ram
[offset
+i
].modified
)) {
903 data
[i
] = dev_spec
->shadow_ram
[offset
+i
].value
;
905 ret_val
= e1000_read_flash_word_ich8lan(hw
,
914 e1000_release_swflag_ich8lan(hw
);
920 * e1000_flash_cycle_init_ich8lan - Initialize flash
921 * @hw: pointer to the HW structure
923 * This function does initial flash setup so that a new read/write/erase cycle
926 static s32
e1000_flash_cycle_init_ich8lan(struct e1000_hw
*hw
)
928 union ich8_hws_flash_status hsfsts
;
929 s32 ret_val
= -E1000_ERR_NVM
;
932 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
934 /* Check if the flash descriptor is valid */
935 if (hsfsts
.hsf_status
.fldesvalid
== 0) {
936 hw_dbg(hw
, "Flash descriptor invalid. "
937 "SW Sequencing must be used.");
938 return -E1000_ERR_NVM
;
941 /* Clear FCERR and DAEL in hw status by writing 1 */
942 hsfsts
.hsf_status
.flcerr
= 1;
943 hsfsts
.hsf_status
.dael
= 1;
945 ew16flash(ICH_FLASH_HSFSTS
, hsfsts
.regval
);
947 /* Either we should have a hardware SPI cycle in progress
948 * bit to check against, in order to start a new cycle or
949 * FDONE bit should be changed in the hardware so that it
950 * is 1 after harware reset, which can then be used as an
951 * indication whether a cycle is in progress or has been
955 if (hsfsts
.hsf_status
.flcinprog
== 0) {
956 /* There is no cycle running at present,
957 * so we can start a cycle */
958 /* Begin by setting Flash Cycle Done. */
959 hsfsts
.hsf_status
.flcdone
= 1;
960 ew16flash(ICH_FLASH_HSFSTS
, hsfsts
.regval
);
963 /* otherwise poll for sometime so the current
964 * cycle has a chance to end before giving up. */
965 for (i
= 0; i
< ICH_FLASH_READ_COMMAND_TIMEOUT
; i
++) {
966 hsfsts
.regval
= __er16flash(hw
, ICH_FLASH_HSFSTS
);
967 if (hsfsts
.hsf_status
.flcinprog
== 0) {
974 /* Successful in waiting for previous cycle to timeout,
975 * now set the Flash Cycle Done. */
976 hsfsts
.hsf_status
.flcdone
= 1;
977 ew16flash(ICH_FLASH_HSFSTS
, hsfsts
.regval
);
979 hw_dbg(hw
, "Flash controller busy, cannot get access");
987 * e1000_flash_cycle_ich8lan - Starts flash cycle (read/write/erase)
988 * @hw: pointer to the HW structure
989 * @timeout: maximum time to wait for completion
991 * This function starts a flash cycle and waits for its completion.
993 static s32
e1000_flash_cycle_ich8lan(struct e1000_hw
*hw
, u32 timeout
)
995 union ich8_hws_flash_ctrl hsflctl
;
996 union ich8_hws_flash_status hsfsts
;
997 s32 ret_val
= -E1000_ERR_NVM
;
1000 /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
1001 hsflctl
.regval
= er16flash(ICH_FLASH_HSFCTL
);
1002 hsflctl
.hsf_ctrl
.flcgo
= 1;
1003 ew16flash(ICH_FLASH_HSFCTL
, hsflctl
.regval
);
1005 /* wait till FDONE bit is set to 1 */
1007 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
1008 if (hsfsts
.hsf_status
.flcdone
== 1)
1011 } while (i
++ < timeout
);
1013 if (hsfsts
.hsf_status
.flcdone
== 1 && hsfsts
.hsf_status
.flcerr
== 0)
1020 * e1000_read_flash_word_ich8lan - Read word from flash
1021 * @hw: pointer to the HW structure
1022 * @offset: offset to data location
1023 * @data: pointer to the location for storing the data
1025 * Reads the flash word at offset into data. Offset is converted
1026 * to bytes before read.
1028 static s32
e1000_read_flash_word_ich8lan(struct e1000_hw
*hw
, u32 offset
,
1031 /* Must convert offset into bytes. */
1034 return e1000_read_flash_data_ich8lan(hw
, offset
, 2, data
);
1038 * e1000_read_flash_data_ich8lan - Read byte or word from NVM
1039 * @hw: pointer to the HW structure
1040 * @offset: The offset (in bytes) of the byte or word to read.
1041 * @size: Size of data to read, 1=byte 2=word
1042 * @data: Pointer to the word to store the value read.
1044 * Reads a byte or word from the NVM using the flash access registers.
1046 static s32
e1000_read_flash_data_ich8lan(struct e1000_hw
*hw
, u32 offset
,
1049 union ich8_hws_flash_status hsfsts
;
1050 union ich8_hws_flash_ctrl hsflctl
;
1051 u32 flash_linear_addr
;
1053 s32 ret_val
= -E1000_ERR_NVM
;
1056 if (size
< 1 || size
> 2 || offset
> ICH_FLASH_LINEAR_ADDR_MASK
)
1057 return -E1000_ERR_NVM
;
1059 flash_linear_addr
= (ICH_FLASH_LINEAR_ADDR_MASK
& offset
) +
1060 hw
->nvm
.flash_base_addr
;
1065 ret_val
= e1000_flash_cycle_init_ich8lan(hw
);
1069 hsflctl
.regval
= er16flash(ICH_FLASH_HSFCTL
);
1070 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
1071 hsflctl
.hsf_ctrl
.fldbcount
= size
- 1;
1072 hsflctl
.hsf_ctrl
.flcycle
= ICH_CYCLE_READ
;
1073 ew16flash(ICH_FLASH_HSFCTL
, hsflctl
.regval
);
1075 ew32flash(ICH_FLASH_FADDR
, flash_linear_addr
);
1077 ret_val
= e1000_flash_cycle_ich8lan(hw
,
1078 ICH_FLASH_READ_COMMAND_TIMEOUT
);
1080 /* Check if FCERR is set to 1, if set to 1, clear it
1081 * and try the whole sequence a few more times, else
1082 * read in (shift in) the Flash Data0, the order is
1083 * least significant byte first msb to lsb */
1085 flash_data
= er32flash(ICH_FLASH_FDATA0
);
1087 *data
= (u8
)(flash_data
& 0x000000FF);
1088 } else if (size
== 2) {
1089 *data
= (u16
)(flash_data
& 0x0000FFFF);
1093 /* If we've gotten here, then things are probably
1094 * completely hosed, but if the error condition is
1095 * detected, it won't hurt to give it another try...
1096 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
1098 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
1099 if (hsfsts
.hsf_status
.flcerr
== 1) {
1100 /* Repeat for some time before giving up. */
1102 } else if (hsfsts
.hsf_status
.flcdone
== 0) {
1103 hw_dbg(hw
, "Timeout error - flash cycle "
1104 "did not complete.");
1108 } while (count
++ < ICH_FLASH_CYCLE_REPEAT_COUNT
);
1114 * e1000_write_nvm_ich8lan - Write word(s) to the NVM
1115 * @hw: pointer to the HW structure
1116 * @offset: The offset (in bytes) of the word(s) to write.
1117 * @words: Size of data to write in words
1118 * @data: Pointer to the word(s) to write at offset.
1120 * Writes a byte or word to the NVM using the flash access registers.
1122 static s32
e1000_write_nvm_ich8lan(struct e1000_hw
*hw
, u16 offset
, u16 words
,
1125 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
1126 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
1130 if ((offset
>= nvm
->word_size
) || (words
> nvm
->word_size
- offset
) ||
1132 hw_dbg(hw
, "nvm parameter(s) out of bounds\n");
1133 return -E1000_ERR_NVM
;
1136 ret_val
= e1000_acquire_swflag_ich8lan(hw
);
1140 for (i
= 0; i
< words
; i
++) {
1141 dev_spec
->shadow_ram
[offset
+i
].modified
= 1;
1142 dev_spec
->shadow_ram
[offset
+i
].value
= data
[i
];
1145 e1000_release_swflag_ich8lan(hw
);
1151 * e1000_update_nvm_checksum_ich8lan - Update the checksum for NVM
1152 * @hw: pointer to the HW structure
1154 * The NVM checksum is updated by calling the generic update_nvm_checksum,
1155 * which writes the checksum to the shadow ram. The changes in the shadow
1156 * ram are then committed to the EEPROM by processing each bank at a time
1157 * checking for the modified bit and writing only the pending changes.
1158 * After a succesful commit, the shadow ram is cleared and is ready for
1161 static s32
e1000_update_nvm_checksum_ich8lan(struct e1000_hw
*hw
)
1163 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
1164 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
1165 u32 i
, act_offset
, new_bank_offset
, old_bank_offset
;
1169 ret_val
= e1000e_update_nvm_checksum_generic(hw
);
1173 if (nvm
->type
!= e1000_nvm_flash_sw
)
1176 ret_val
= e1000_acquire_swflag_ich8lan(hw
);
1180 /* We're writing to the opposite bank so if we're on bank 1,
1181 * write to bank 0 etc. We also need to erase the segment that
1182 * is going to be written */
1183 if (!(er32(EECD
) & E1000_EECD_SEC1VAL
)) {
1184 new_bank_offset
= nvm
->flash_bank_size
;
1185 old_bank_offset
= 0;
1186 e1000_erase_flash_bank_ich8lan(hw
, 1);
1188 old_bank_offset
= nvm
->flash_bank_size
;
1189 new_bank_offset
= 0;
1190 e1000_erase_flash_bank_ich8lan(hw
, 0);
1193 for (i
= 0; i
< E1000_ICH8_SHADOW_RAM_WORDS
; i
++) {
1194 /* Determine whether to write the value stored
1195 * in the other NVM bank or a modified value stored
1196 * in the shadow RAM */
1197 if (dev_spec
->shadow_ram
[i
].modified
) {
1198 data
= dev_spec
->shadow_ram
[i
].value
;
1200 e1000_read_flash_word_ich8lan(hw
,
1201 i
+ old_bank_offset
,
1205 /* If the word is 0x13, then make sure the signature bits
1206 * (15:14) are 11b until the commit has completed.
1207 * This will allow us to write 10b which indicates the
1208 * signature is valid. We want to do this after the write
1209 * has completed so that we don't mark the segment valid
1210 * while the write is still in progress */
1211 if (i
== E1000_ICH_NVM_SIG_WORD
)
1212 data
|= E1000_ICH_NVM_SIG_MASK
;
1214 /* Convert offset to bytes. */
1215 act_offset
= (i
+ new_bank_offset
) << 1;
1218 /* Write the bytes to the new bank. */
1219 ret_val
= e1000_retry_write_flash_byte_ich8lan(hw
,
1226 ret_val
= e1000_retry_write_flash_byte_ich8lan(hw
,
1233 /* Don't bother writing the segment valid bits if sector
1234 * programming failed. */
1236 hw_dbg(hw
, "Flash commit failed.\n");
1237 e1000_release_swflag_ich8lan(hw
);
1241 /* Finally validate the new segment by setting bit 15:14
1242 * to 10b in word 0x13 , this can be done without an
1243 * erase as well since these bits are 11 to start with
1244 * and we need to change bit 14 to 0b */
1245 act_offset
= new_bank_offset
+ E1000_ICH_NVM_SIG_WORD
;
1246 e1000_read_flash_word_ich8lan(hw
, act_offset
, &data
);
1248 ret_val
= e1000_retry_write_flash_byte_ich8lan(hw
,
1252 e1000_release_swflag_ich8lan(hw
);
1256 /* And invalidate the previously valid segment by setting
1257 * its signature word (0x13) high_byte to 0b. This can be
1258 * done without an erase because flash erase sets all bits
1259 * to 1's. We can write 1's to 0's without an erase */
1260 act_offset
= (old_bank_offset
+ E1000_ICH_NVM_SIG_WORD
) * 2 + 1;
1261 ret_val
= e1000_retry_write_flash_byte_ich8lan(hw
, act_offset
, 0);
1263 e1000_release_swflag_ich8lan(hw
);
1267 /* Great! Everything worked, we can now clear the cached entries. */
1268 for (i
= 0; i
< E1000_ICH8_SHADOW_RAM_WORDS
; i
++) {
1269 dev_spec
->shadow_ram
[i
].modified
= 0;
1270 dev_spec
->shadow_ram
[i
].value
= 0xFFFF;
1273 e1000_release_swflag_ich8lan(hw
);
1275 /* Reload the EEPROM, or else modifications will not appear
1276 * until after the next adapter reset.
1278 e1000e_reload_nvm(hw
);
1285 * e1000_validate_nvm_checksum_ich8lan - Validate EEPROM checksum
1286 * @hw: pointer to the HW structure
1288 * Check to see if checksum needs to be fixed by reading bit 6 in word 0x19.
1289 * If the bit is 0, that the EEPROM had been modified, but the checksum was not
1290 * calculated, in which case we need to calculate the checksum and set bit 6.
1292 static s32
e1000_validate_nvm_checksum_ich8lan(struct e1000_hw
*hw
)
1297 /* Read 0x19 and check bit 6. If this bit is 0, the checksum
1298 * needs to be fixed. This bit is an indication that the NVM
1299 * was prepared by OEM software and did not calculate the
1300 * checksum...a likely scenario.
1302 ret_val
= e1000_read_nvm(hw
, 0x19, 1, &data
);
1306 if ((data
& 0x40) == 0) {
1308 ret_val
= e1000_write_nvm(hw
, 0x19, 1, &data
);
1311 ret_val
= e1000e_update_nvm_checksum(hw
);
1316 return e1000e_validate_nvm_checksum_generic(hw
);
1320 * e1000_write_flash_data_ich8lan - Writes bytes to the NVM
1321 * @hw: pointer to the HW structure
1322 * @offset: The offset (in bytes) of the byte/word to read.
1323 * @size: Size of data to read, 1=byte 2=word
1324 * @data: The byte(s) to write to the NVM.
1326 * Writes one/two bytes to the NVM using the flash access registers.
1328 static s32
e1000_write_flash_data_ich8lan(struct e1000_hw
*hw
, u32 offset
,
1331 union ich8_hws_flash_status hsfsts
;
1332 union ich8_hws_flash_ctrl hsflctl
;
1333 u32 flash_linear_addr
;
1338 if (size
< 1 || size
> 2 || data
> size
* 0xff ||
1339 offset
> ICH_FLASH_LINEAR_ADDR_MASK
)
1340 return -E1000_ERR_NVM
;
1342 flash_linear_addr
= (ICH_FLASH_LINEAR_ADDR_MASK
& offset
) +
1343 hw
->nvm
.flash_base_addr
;
1348 ret_val
= e1000_flash_cycle_init_ich8lan(hw
);
1352 hsflctl
.regval
= er16flash(ICH_FLASH_HSFCTL
);
1353 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
1354 hsflctl
.hsf_ctrl
.fldbcount
= size
-1;
1355 hsflctl
.hsf_ctrl
.flcycle
= ICH_CYCLE_WRITE
;
1356 ew16flash(ICH_FLASH_HSFCTL
, hsflctl
.regval
);
1358 ew32flash(ICH_FLASH_FADDR
, flash_linear_addr
);
1361 flash_data
= (u32
)data
& 0x00FF;
1363 flash_data
= (u32
)data
;
1365 ew32flash(ICH_FLASH_FDATA0
, flash_data
);
1367 /* check if FCERR is set to 1 , if set to 1, clear it
1368 * and try the whole sequence a few more times else done */
1369 ret_val
= e1000_flash_cycle_ich8lan(hw
,
1370 ICH_FLASH_WRITE_COMMAND_TIMEOUT
);
1374 /* If we're here, then things are most likely
1375 * completely hosed, but if the error condition
1376 * is detected, it won't hurt to give it another
1377 * try...ICH_FLASH_CYCLE_REPEAT_COUNT times.
1379 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
1380 if (hsfsts
.hsf_status
.flcerr
== 1)
1381 /* Repeat for some time before giving up. */
1383 if (hsfsts
.hsf_status
.flcdone
== 0) {
1384 hw_dbg(hw
, "Timeout error - flash cycle "
1385 "did not complete.");
1388 } while (count
++ < ICH_FLASH_CYCLE_REPEAT_COUNT
);
1394 * e1000_write_flash_byte_ich8lan - Write a single byte to NVM
1395 * @hw: pointer to the HW structure
1396 * @offset: The index of the byte to read.
1397 * @data: The byte to write to the NVM.
1399 * Writes a single byte to the NVM using the flash access registers.
1401 static s32
e1000_write_flash_byte_ich8lan(struct e1000_hw
*hw
, u32 offset
,
1404 u16 word
= (u16
)data
;
1406 return e1000_write_flash_data_ich8lan(hw
, offset
, 1, word
);
1410 * e1000_retry_write_flash_byte_ich8lan - Writes a single byte to NVM
1411 * @hw: pointer to the HW structure
1412 * @offset: The offset of the byte to write.
1413 * @byte: The byte to write to the NVM.
1415 * Writes a single byte to the NVM using the flash access registers.
1416 * Goes through a retry algorithm before giving up.
1418 static s32
e1000_retry_write_flash_byte_ich8lan(struct e1000_hw
*hw
,
1419 u32 offset
, u8 byte
)
1422 u16 program_retries
;
1424 ret_val
= e1000_write_flash_byte_ich8lan(hw
, offset
, byte
);
1428 for (program_retries
= 0; program_retries
< 100; program_retries
++) {
1429 hw_dbg(hw
, "Retrying Byte %2.2X at offset %u\n", byte
, offset
);
1431 ret_val
= e1000_write_flash_byte_ich8lan(hw
, offset
, byte
);
1435 if (program_retries
== 100)
1436 return -E1000_ERR_NVM
;
1442 * e1000_erase_flash_bank_ich8lan - Erase a bank (4k) from NVM
1443 * @hw: pointer to the HW structure
1444 * @bank: 0 for first bank, 1 for second bank, etc.
1446 * Erases the bank specified. Each bank is a 4k block. Banks are 0 based.
1447 * bank N is 4096 * N + flash_reg_addr.
1449 static s32
e1000_erase_flash_bank_ich8lan(struct e1000_hw
*hw
, u32 bank
)
1451 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
1452 union ich8_hws_flash_status hsfsts
;
1453 union ich8_hws_flash_ctrl hsflctl
;
1454 u32 flash_linear_addr
;
1455 /* bank size is in 16bit words - adjust to bytes */
1456 u32 flash_bank_size
= nvm
->flash_bank_size
* 2;
1463 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
1465 /* Determine HW Sector size: Read BERASE bits of hw flash status
1467 /* 00: The Hw sector is 256 bytes, hence we need to erase 16
1468 * consecutive sectors. The start index for the nth Hw sector
1469 * can be calculated as = bank * 4096 + n * 256
1470 * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector.
1471 * The start index for the nth Hw sector can be calculated
1473 * 10: The Hw sector is 8K bytes, nth sector = bank * 8192
1474 * (ich9 only, otherwise error condition)
1475 * 11: The Hw sector is 64K bytes, nth sector = bank * 65536
1477 switch (hsfsts
.hsf_status
.berasesz
) {
1479 /* Hw sector size 256 */
1480 sector_size
= ICH_FLASH_SEG_SIZE_256
;
1481 iteration
= flash_bank_size
/ ICH_FLASH_SEG_SIZE_256
;
1484 sector_size
= ICH_FLASH_SEG_SIZE_4K
;
1485 iteration
= flash_bank_size
/ ICH_FLASH_SEG_SIZE_4K
;
1488 if (hw
->mac
.type
== e1000_ich9lan
) {
1489 sector_size
= ICH_FLASH_SEG_SIZE_8K
;
1490 iteration
= flash_bank_size
/ ICH_FLASH_SEG_SIZE_8K
;
1492 return -E1000_ERR_NVM
;
1496 sector_size
= ICH_FLASH_SEG_SIZE_64K
;
1497 iteration
= flash_bank_size
/ ICH_FLASH_SEG_SIZE_64K
;
1500 return -E1000_ERR_NVM
;
1503 /* Start with the base address, then add the sector offset. */
1504 flash_linear_addr
= hw
->nvm
.flash_base_addr
;
1505 flash_linear_addr
+= (bank
) ? (sector_size
* iteration
) : 0;
1507 for (j
= 0; j
< iteration
; j
++) {
1510 ret_val
= e1000_flash_cycle_init_ich8lan(hw
);
1514 /* Write a value 11 (block Erase) in Flash
1515 * Cycle field in hw flash control */
1516 hsflctl
.regval
= er16flash(ICH_FLASH_HSFCTL
);
1517 hsflctl
.hsf_ctrl
.flcycle
= ICH_CYCLE_ERASE
;
1518 ew16flash(ICH_FLASH_HSFCTL
, hsflctl
.regval
);
1520 /* Write the last 24 bits of an index within the
1521 * block into Flash Linear address field in Flash
1524 flash_linear_addr
+= (j
* sector_size
);
1525 ew32flash(ICH_FLASH_FADDR
, flash_linear_addr
);
1527 ret_val
= e1000_flash_cycle_ich8lan(hw
,
1528 ICH_FLASH_ERASE_COMMAND_TIMEOUT
);
1532 /* Check if FCERR is set to 1. If 1,
1533 * clear it and try the whole sequence
1534 * a few more times else Done */
1535 hsfsts
.regval
= er16flash(ICH_FLASH_HSFSTS
);
1536 if (hsfsts
.hsf_status
.flcerr
== 1)
1537 /* repeat for some time before
1540 else if (hsfsts
.hsf_status
.flcdone
== 0)
1542 } while (++count
< ICH_FLASH_CYCLE_REPEAT_COUNT
);
1549 * e1000_valid_led_default_ich8lan - Set the default LED settings
1550 * @hw: pointer to the HW structure
1551 * @data: Pointer to the LED settings
1553 * Reads the LED default settings from the NVM to data. If the NVM LED
1554 * settings is all 0's or F's, set the LED default to a valid LED default
1557 static s32
e1000_valid_led_default_ich8lan(struct e1000_hw
*hw
, u16
*data
)
1561 ret_val
= e1000_read_nvm(hw
, NVM_ID_LED_SETTINGS
, 1, data
);
1563 hw_dbg(hw
, "NVM Read Error\n");
1567 if (*data
== ID_LED_RESERVED_0000
||
1568 *data
== ID_LED_RESERVED_FFFF
)
1569 *data
= ID_LED_DEFAULT_ICH8LAN
;
1575 * e1000_get_bus_info_ich8lan - Get/Set the bus type and width
1576 * @hw: pointer to the HW structure
1578 * ICH8 use the PCI Express bus, but does not contain a PCI Express Capability
1579 * register, so the the bus width is hard coded.
1581 static s32
e1000_get_bus_info_ich8lan(struct e1000_hw
*hw
)
1583 struct e1000_bus_info
*bus
= &hw
->bus
;
1586 ret_val
= e1000e_get_bus_info_pcie(hw
);
1588 /* ICH devices are "PCI Express"-ish. They have
1589 * a configuration space, but do not contain
1590 * PCI Express Capability registers, so bus width
1591 * must be hardcoded.
1593 if (bus
->width
== e1000_bus_width_unknown
)
1594 bus
->width
= e1000_bus_width_pcie_x1
;
1600 * e1000_reset_hw_ich8lan - Reset the hardware
1601 * @hw: pointer to the HW structure
1603 * Does a full reset of the hardware which includes a reset of the PHY and
1606 static s32
e1000_reset_hw_ich8lan(struct e1000_hw
*hw
)
1611 /* Prevent the PCI-E bus from sticking if there is no TLP connection
1612 * on the last TLP read/write transaction when MAC is reset.
1614 ret_val
= e1000e_disable_pcie_master(hw
);
1616 hw_dbg(hw
, "PCI-E Master disable polling has failed.\n");
1619 hw_dbg(hw
, "Masking off all interrupts\n");
1620 ew32(IMC
, 0xffffffff);
1622 /* Disable the Transmit and Receive units. Then delay to allow
1623 * any pending transactions to complete before we hit the MAC
1624 * with the global reset.
1627 ew32(TCTL
, E1000_TCTL_PSP
);
1632 /* Workaround for ICH8 bit corruption issue in FIFO memory */
1633 if (hw
->mac
.type
== e1000_ich8lan
) {
1634 /* Set Tx and Rx buffer allocation to 8k apiece. */
1635 ew32(PBA
, E1000_PBA_8K
);
1636 /* Set Packet Buffer Size to 16k. */
1637 ew32(PBS
, E1000_PBS_16K
);
1642 if (!e1000_check_reset_block(hw
)) {
1643 /* PHY HW reset requires MAC CORE reset at the same
1644 * time to make sure the interface between MAC and the
1645 * external PHY is reset.
1647 ctrl
|= E1000_CTRL_PHY_RST
;
1649 ret_val
= e1000_acquire_swflag_ich8lan(hw
);
1650 hw_dbg(hw
, "Issuing a global reset to ich8lan");
1651 ew32(CTRL
, (ctrl
| E1000_CTRL_RST
));
1654 ret_val
= e1000e_get_auto_rd_done(hw
);
1657 * When auto config read does not complete, do not
1658 * return with an error. This can happen in situations
1659 * where there is no eeprom and prevents getting link.
1661 hw_dbg(hw
, "Auto Read Done did not complete\n");
1664 ew32(IMC
, 0xffffffff);
1667 kab
= er32(KABGTXD
);
1668 kab
|= E1000_KABGTXD_BGSQLBIAS
;
1675 * e1000_init_hw_ich8lan - Initialize the hardware
1676 * @hw: pointer to the HW structure
1678 * Prepares the hardware for transmit and receive by doing the following:
1679 * - initialize hardware bits
1680 * - initialize LED identification
1681 * - setup receive address registers
1682 * - setup flow control
1683 * - setup transmit discriptors
1684 * - clear statistics
1686 static s32
e1000_init_hw_ich8lan(struct e1000_hw
*hw
)
1688 struct e1000_mac_info
*mac
= &hw
->mac
;
1689 u32 ctrl_ext
, txdctl
, snoop
;
1693 e1000_initialize_hw_bits_ich8lan(hw
);
1695 /* Initialize identification LED */
1696 ret_val
= e1000e_id_led_init(hw
);
1698 hw_dbg(hw
, "Error initializing identification LED\n");
1702 /* Setup the receive address. */
1703 e1000e_init_rx_addrs(hw
, mac
->rar_entry_count
);
1705 /* Zero out the Multicast HASH table */
1706 hw_dbg(hw
, "Zeroing the MTA\n");
1707 for (i
= 0; i
< mac
->mta_reg_count
; i
++)
1708 E1000_WRITE_REG_ARRAY(hw
, E1000_MTA
, i
, 0);
1710 /* Setup link and flow control */
1711 ret_val
= e1000_setup_link_ich8lan(hw
);
1713 /* Set the transmit descriptor write-back policy for both queues */
1714 txdctl
= er32(TXDCTL
);
1715 txdctl
= (txdctl
& ~E1000_TXDCTL_WTHRESH
) |
1716 E1000_TXDCTL_FULL_TX_DESC_WB
;
1717 txdctl
= (txdctl
& ~E1000_TXDCTL_PTHRESH
) |
1718 E1000_TXDCTL_MAX_TX_DESC_PREFETCH
;
1719 ew32(TXDCTL
, txdctl
);
1720 txdctl
= er32(TXDCTL1
);
1721 txdctl
= (txdctl
& ~E1000_TXDCTL_WTHRESH
) |
1722 E1000_TXDCTL_FULL_TX_DESC_WB
;
1723 txdctl
= (txdctl
& ~E1000_TXDCTL_PTHRESH
) |
1724 E1000_TXDCTL_MAX_TX_DESC_PREFETCH
;
1725 ew32(TXDCTL1
, txdctl
);
1727 /* ICH8 has opposite polarity of no_snoop bits.
1728 * By default, we should use snoop behavior. */
1729 if (mac
->type
== e1000_ich8lan
)
1730 snoop
= PCIE_ICH8_SNOOP_ALL
;
1732 snoop
= (u32
) ~(PCIE_NO_SNOOP_ALL
);
1733 e1000e_set_pcie_no_snoop(hw
, snoop
);
1735 ctrl_ext
= er32(CTRL_EXT
);
1736 ctrl_ext
|= E1000_CTRL_EXT_RO_DIS
;
1737 ew32(CTRL_EXT
, ctrl_ext
);
1739 /* Clear all of the statistics registers (clear on read). It is
1740 * important that we do this after we have tried to establish link
1741 * because the symbol error count will increment wildly if there
1744 e1000_clear_hw_cntrs_ich8lan(hw
);
1749 * e1000_initialize_hw_bits_ich8lan - Initialize required hardware bits
1750 * @hw: pointer to the HW structure
1752 * Sets/Clears required hardware bits necessary for correctly setting up the
1753 * hardware for transmit and receive.
1755 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw
*hw
)
1759 /* Extended Device Control */
1760 reg
= er32(CTRL_EXT
);
1762 ew32(CTRL_EXT
, reg
);
1764 /* Transmit Descriptor Control 0 */
1769 /* Transmit Descriptor Control 1 */
1770 reg
= er32(TXDCTL1
);
1774 /* Transmit Arbitration Control 0 */
1776 if (hw
->mac
.type
== e1000_ich8lan
)
1777 reg
|= (1 << 28) | (1 << 29);
1778 reg
|= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27);
1781 /* Transmit Arbitration Control 1 */
1783 if (er32(TCTL
) & E1000_TCTL_MULR
)
1787 reg
|= (1 << 24) | (1 << 26) | (1 << 30);
1791 if (hw
->mac
.type
== e1000_ich8lan
) {
1799 * e1000_setup_link_ich8lan - Setup flow control and link settings
1800 * @hw: pointer to the HW structure
1802 * Determines which flow control settings to use, then configures flow
1803 * control. Calls the appropriate media-specific link configuration
1804 * function. Assuming the adapter has a valid link partner, a valid link
1805 * should be established. Assumes the hardware has previously been reset
1806 * and the transmitter and receiver are not enabled.
1808 static s32
e1000_setup_link_ich8lan(struct e1000_hw
*hw
)
1810 struct e1000_mac_info
*mac
= &hw
->mac
;
1813 if (e1000_check_reset_block(hw
))
1816 /* ICH parts do not have a word in the NVM to determine
1817 * the default flow control setting, so we explicitly
1820 if (mac
->fc
== e1000_fc_default
)
1821 mac
->fc
= e1000_fc_full
;
1823 mac
->original_fc
= mac
->fc
;
1825 hw_dbg(hw
, "After fix-ups FlowControl is now = %x\n", mac
->fc
);
1827 /* Continue to configure the copper link. */
1828 ret_val
= e1000_setup_copper_link_ich8lan(hw
);
1832 ew32(FCTTV
, mac
->fc_pause_time
);
1834 return e1000e_set_fc_watermarks(hw
);
1838 * e1000_setup_copper_link_ich8lan - Configure MAC/PHY interface
1839 * @hw: pointer to the HW structure
1841 * Configures the kumeran interface to the PHY to wait the appropriate time
1842 * when polling the PHY, then call the generic setup_copper_link to finish
1843 * configuring the copper link.
1845 static s32
e1000_setup_copper_link_ich8lan(struct e1000_hw
*hw
)
1852 ctrl
|= E1000_CTRL_SLU
;
1853 ctrl
&= ~(E1000_CTRL_FRCSPD
| E1000_CTRL_FRCDPX
);
1856 /* Set the mac to wait the maximum time between each iteration
1857 * and increase the max iterations when polling the phy;
1858 * this fixes erroneous timeouts at 10Mbps. */
1859 ret_val
= e1000e_write_kmrn_reg(hw
, GG82563_REG(0x34, 4), 0xFFFF);
1862 ret_val
= e1000e_read_kmrn_reg(hw
, GG82563_REG(0x34, 9), ®_data
);
1866 ret_val
= e1000e_write_kmrn_reg(hw
, GG82563_REG(0x34, 9), reg_data
);
1870 if (hw
->phy
.type
== e1000_phy_igp_3
) {
1871 ret_val
= e1000e_copper_link_setup_igp(hw
);
1876 return e1000e_setup_copper_link(hw
);
1880 * e1000_get_link_up_info_ich8lan - Get current link speed and duplex
1881 * @hw: pointer to the HW structure
1882 * @speed: pointer to store current link speed
1883 * @duplex: pointer to store the current link duplex
1885 * Calls the generic get_speed_and_duplex to retreive the current link
1886 * information and then calls the Kumeran lock loss workaround for links at
1889 static s32
e1000_get_link_up_info_ich8lan(struct e1000_hw
*hw
, u16
*speed
,
1894 ret_val
= e1000e_get_speed_and_duplex_copper(hw
, speed
, duplex
);
1898 if ((hw
->mac
.type
== e1000_ich8lan
) &&
1899 (hw
->phy
.type
== e1000_phy_igp_3
) &&
1900 (*speed
== SPEED_1000
)) {
1901 ret_val
= e1000_kmrn_lock_loss_workaround_ich8lan(hw
);
1908 * e1000_kmrn_lock_loss_workaround_ich8lan - Kumeran workaround
1909 * @hw: pointer to the HW structure
1911 * Work-around for 82566 Kumeran PCS lock loss:
1912 * On link status change (i.e. PCI reset, speed change) and link is up and
1914 * 0) if workaround is optionally disabled do nothing
1915 * 1) wait 1ms for Kumeran link to come up
1916 * 2) check Kumeran Diagnostic register PCS lock loss bit
1917 * 3) if not set the link is locked (all is good), otherwise...
1919 * 5) repeat up to 10 times
1920 * Note: this is only called for IGP3 copper when speed is 1gb.
1922 static s32
e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw
*hw
)
1924 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
1930 if (!dev_spec
->kmrn_lock_loss_workaround_enabled
)
1933 /* Make sure link is up before proceeding. If not just return.
1934 * Attempting this while link is negotiating fouled up link
1936 ret_val
= e1000e_phy_has_link_generic(hw
, 1, 0, &link
);
1940 for (i
= 0; i
< 10; i
++) {
1941 /* read once to clear */
1942 ret_val
= e1e_rphy(hw
, IGP3_KMRN_DIAG
, &data
);
1945 /* and again to get new status */
1946 ret_val
= e1e_rphy(hw
, IGP3_KMRN_DIAG
, &data
);
1950 /* check for PCS lock */
1951 if (!(data
& IGP3_KMRN_DIAG_PCS_LOCK_LOSS
))
1954 /* Issue PHY reset */
1955 e1000_phy_hw_reset(hw
);
1958 /* Disable GigE link negotiation */
1959 phy_ctrl
= er32(PHY_CTRL
);
1960 phy_ctrl
|= (E1000_PHY_CTRL_GBE_DISABLE
|
1961 E1000_PHY_CTRL_NOND0A_GBE_DISABLE
);
1962 ew32(PHY_CTRL
, phy_ctrl
);
1964 /* Call gig speed drop workaround on Giga disable before accessing
1965 * any PHY registers */
1966 e1000e_gig_downshift_workaround_ich8lan(hw
);
1968 /* unable to acquire PCS lock */
1969 return -E1000_ERR_PHY
;
1973 * e1000_set_kmrn_lock_loss_workaound_ich8lan - Set Kumeran workaround state
1974 * @hw: pointer to the HW structure
1975 * @state: boolean value used to set the current Kumaran workaround state
1977 * If ICH8, set the current Kumeran workaround state (enabled - TRUE
1978 * /disabled - FALSE).
1980 void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw
*hw
,
1983 struct e1000_dev_spec_ich8lan
*dev_spec
= &hw
->dev_spec
.ich8lan
;
1985 if (hw
->mac
.type
!= e1000_ich8lan
) {
1986 hw_dbg(hw
, "Workaround applies to ICH8 only.\n");
1990 dev_spec
->kmrn_lock_loss_workaround_enabled
= state
;
1994 * e1000_ipg3_phy_powerdown_workaround_ich8lan - Power down workaround on D3
1995 * @hw: pointer to the HW structure
1997 * Workaround for 82566 power-down on D3 entry:
1998 * 1) disable gigabit link
1999 * 2) write VR power-down enable
2001 * Continue if successful, else issue LCD reset and repeat
2003 void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw
*hw
)
2009 if (hw
->phy
.type
!= e1000_phy_igp_3
)
2012 /* Try the workaround twice (if needed) */
2015 reg
= er32(PHY_CTRL
);
2016 reg
|= (E1000_PHY_CTRL_GBE_DISABLE
|
2017 E1000_PHY_CTRL_NOND0A_GBE_DISABLE
);
2018 ew32(PHY_CTRL
, reg
);
2020 /* Call gig speed drop workaround on Giga disable before
2021 * accessing any PHY registers */
2022 if (hw
->mac
.type
== e1000_ich8lan
)
2023 e1000e_gig_downshift_workaround_ich8lan(hw
);
2025 /* Write VR power-down enable */
2026 e1e_rphy(hw
, IGP3_VR_CTRL
, &data
);
2027 data
&= ~IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK
;
2028 e1e_wphy(hw
, IGP3_VR_CTRL
, data
| IGP3_VR_CTRL_MODE_SHUTDOWN
);
2030 /* Read it back and test */
2031 e1e_rphy(hw
, IGP3_VR_CTRL
, &data
);
2032 data
&= IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK
;
2033 if ((data
== IGP3_VR_CTRL_MODE_SHUTDOWN
) || retry
)
2036 /* Issue PHY reset and repeat at most one more time */
2038 ew32(CTRL
, reg
| E1000_CTRL_PHY_RST
);
2044 * e1000e_gig_downshift_workaround_ich8lan - WoL from S5 stops working
2045 * @hw: pointer to the HW structure
2047 * Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC),
2048 * LPLU, Giga disable, MDIC PHY reset):
2049 * 1) Set Kumeran Near-end loopback
2050 * 2) Clear Kumeran Near-end loopback
2051 * Should only be called for ICH8[m] devices with IGP_3 Phy.
2053 void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw
*hw
)
2058 if ((hw
->mac
.type
!= e1000_ich8lan
) ||
2059 (hw
->phy
.type
!= e1000_phy_igp_3
))
2062 ret_val
= e1000e_read_kmrn_reg(hw
, E1000_KMRNCTRLSTA_DIAG_OFFSET
,
2066 reg_data
|= E1000_KMRNCTRLSTA_DIAG_NELPBK
;
2067 ret_val
= e1000e_write_kmrn_reg(hw
, E1000_KMRNCTRLSTA_DIAG_OFFSET
,
2071 reg_data
&= ~E1000_KMRNCTRLSTA_DIAG_NELPBK
;
2072 ret_val
= e1000e_write_kmrn_reg(hw
, E1000_KMRNCTRLSTA_DIAG_OFFSET
,
2077 * e1000_cleanup_led_ich8lan - Restore the default LED operation
2078 * @hw: pointer to the HW structure
2080 * Return the LED back to the default configuration.
2082 static s32
e1000_cleanup_led_ich8lan(struct e1000_hw
*hw
)
2084 if (hw
->phy
.type
== e1000_phy_ife
)
2085 return e1e_wphy(hw
, IFE_PHY_SPECIAL_CONTROL_LED
, 0);
2087 ew32(LEDCTL
, hw
->mac
.ledctl_default
);
2092 * e1000_led_on_ich8lan - Turn LED's on
2093 * @hw: pointer to the HW structure
2095 * Turn on the LED's.
2097 static s32
e1000_led_on_ich8lan(struct e1000_hw
*hw
)
2099 if (hw
->phy
.type
== e1000_phy_ife
)
2100 return e1e_wphy(hw
, IFE_PHY_SPECIAL_CONTROL_LED
,
2101 (IFE_PSCL_PROBE_MODE
| IFE_PSCL_PROBE_LEDS_ON
));
2103 ew32(LEDCTL
, hw
->mac
.ledctl_mode2
);
2108 * e1000_led_off_ich8lan - Turn LED's off
2109 * @hw: pointer to the HW structure
2111 * Turn off the LED's.
2113 static s32
e1000_led_off_ich8lan(struct e1000_hw
*hw
)
2115 if (hw
->phy
.type
== e1000_phy_ife
)
2116 return e1e_wphy(hw
, IFE_PHY_SPECIAL_CONTROL_LED
,
2117 (IFE_PSCL_PROBE_MODE
| IFE_PSCL_PROBE_LEDS_OFF
));
2119 ew32(LEDCTL
, hw
->mac
.ledctl_mode1
);
2124 * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters
2125 * @hw: pointer to the HW structure
2127 * Clears hardware counters specific to the silicon family and calls
2128 * clear_hw_cntrs_generic to clear all general purpose counters.
2130 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw
*hw
)
2134 e1000e_clear_hw_cntrs_base(hw
);
2136 temp
= er32(ALGNERRC
);
2137 temp
= er32(RXERRC
);
2139 temp
= er32(CEXTERR
);
2141 temp
= er32(TSCTFC
);
2143 temp
= er32(MGTPRC
);
2144 temp
= er32(MGTPDC
);
2145 temp
= er32(MGTPTC
);
2148 temp
= er32(ICRXOC
);
2152 static struct e1000_mac_operations ich8_mac_ops
= {
2153 .mng_mode_enab
= E1000_ICH_MNG_IAMT_MODE
<< E1000_FWSM_MODE_SHIFT
,
2154 .check_for_link
= e1000e_check_for_copper_link
,
2155 .cleanup_led
= e1000_cleanup_led_ich8lan
,
2156 .clear_hw_cntrs
= e1000_clear_hw_cntrs_ich8lan
,
2157 .get_bus_info
= e1000_get_bus_info_ich8lan
,
2158 .get_link_up_info
= e1000_get_link_up_info_ich8lan
,
2159 .led_on
= e1000_led_on_ich8lan
,
2160 .led_off
= e1000_led_off_ich8lan
,
2161 .mc_addr_list_update
= e1000e_mc_addr_list_update_generic
,
2162 .reset_hw
= e1000_reset_hw_ich8lan
,
2163 .init_hw
= e1000_init_hw_ich8lan
,
2164 .setup_link
= e1000_setup_link_ich8lan
,
2165 .setup_physical_interface
= e1000_setup_copper_link_ich8lan
,
2168 static struct e1000_phy_operations ich8_phy_ops
= {
2169 .acquire_phy
= e1000_acquire_swflag_ich8lan
,
2170 .check_reset_block
= e1000_check_reset_block_ich8lan
,
2172 .force_speed_duplex
= e1000_phy_force_speed_duplex_ich8lan
,
2173 .get_cfg_done
= e1000e_get_cfg_done
,
2174 .get_cable_length
= e1000e_get_cable_length_igp_2
,
2175 .get_phy_info
= e1000_get_phy_info_ich8lan
,
2176 .read_phy_reg
= e1000e_read_phy_reg_igp
,
2177 .release_phy
= e1000_release_swflag_ich8lan
,
2178 .reset_phy
= e1000_phy_hw_reset_ich8lan
,
2179 .set_d0_lplu_state
= e1000_set_d0_lplu_state_ich8lan
,
2180 .set_d3_lplu_state
= e1000_set_d3_lplu_state_ich8lan
,
2181 .write_phy_reg
= e1000e_write_phy_reg_igp
,
2184 static struct e1000_nvm_operations ich8_nvm_ops
= {
2185 .acquire_nvm
= e1000_acquire_swflag_ich8lan
,
2186 .read_nvm
= e1000_read_nvm_ich8lan
,
2187 .release_nvm
= e1000_release_swflag_ich8lan
,
2188 .update_nvm
= e1000_update_nvm_checksum_ich8lan
,
2189 .valid_led_default
= e1000_valid_led_default_ich8lan
,
2190 .validate_nvm
= e1000_validate_nvm_checksum_ich8lan
,
2191 .write_nvm
= e1000_write_nvm_ich8lan
,
2194 struct e1000_info e1000_ich8_info
= {
2195 .mac
= e1000_ich8lan
,
2196 .flags
= FLAG_HAS_WOL
2197 | FLAG_RX_CSUM_ENABLED
2198 | FLAG_HAS_CTRLEXT_ON_LOAD
2203 .get_invariants
= e1000_get_invariants_ich8lan
,
2204 .mac_ops
= &ich8_mac_ops
,
2205 .phy_ops
= &ich8_phy_ops
,
2206 .nvm_ops
= &ich8_nvm_ops
,
2209 struct e1000_info e1000_ich9_info
= {
2210 .mac
= e1000_ich9lan
,
2211 .flags
= FLAG_HAS_JUMBO_FRAMES
2213 | FLAG_RX_CSUM_ENABLED
2214 | FLAG_HAS_CTRLEXT_ON_LOAD
2220 .get_invariants
= e1000_get_invariants_ich8lan
,
2221 .mac_ops
= &ich8_mac_ops
,
2222 .phy_ops
= &ich8_phy_ops
,
2223 .nvm_ops
= &ich8_nvm_ops
,