2 * This file is provided under a CDDLv1 license. When using or
3 * redistributing this file, you may do so under this license.
4 * In redistributing this file this license must be included
5 * and no other modification of this header file is permitted.
9 * Copyright(c) 1999 - 2009 Intel Corporation. All rights reserved.
11 * The contents of this file are subject to the terms of Version
12 * 1.0 of the Common Development and Distribution License (the "License").
14 * You should have received a copy of the License with this software.
15 * You can obtain a copy of the License at
16 * http://www.opensolaris.org/os/licensing.
17 * See the License for the specific language governing permissions
18 * and limitations under the License.
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms of the CDDLv1.
27 * IntelVersion: 1.68 v3-1-10-1_2009-9-18_Release14-6
31 * 82543GC Gigabit Ethernet Controller (Fiber)
32 * 82543GC Gigabit Ethernet Controller (Copper)
33 * 82544EI Gigabit Ethernet Controller (Copper)
34 * 82544EI Gigabit Ethernet Controller (Fiber)
35 * 82544GC Gigabit Ethernet Controller (Copper)
36 * 82544GC Gigabit Ethernet Controller (LOM)
39 #include "e1000_api.h"
41 static s32
e1000_init_phy_params_82543(struct e1000_hw
*hw
);
42 static s32
e1000_init_nvm_params_82543(struct e1000_hw
*hw
);
43 static s32
e1000_init_mac_params_82543(struct e1000_hw
*hw
);
44 static s32
e1000_read_phy_reg_82543(struct e1000_hw
*hw
, u32 offset
,
46 static s32
e1000_write_phy_reg_82543(struct e1000_hw
*hw
, u32 offset
,
48 static s32
e1000_phy_force_speed_duplex_82543(struct e1000_hw
*hw
);
49 static s32
e1000_phy_hw_reset_82543(struct e1000_hw
*hw
);
50 static s32
e1000_reset_hw_82543(struct e1000_hw
*hw
);
51 static s32
e1000_init_hw_82543(struct e1000_hw
*hw
);
52 static s32
e1000_setup_link_82543(struct e1000_hw
*hw
);
53 static s32
e1000_setup_copper_link_82543(struct e1000_hw
*hw
);
54 static s32
e1000_setup_fiber_link_82543(struct e1000_hw
*hw
);
55 static s32
e1000_check_for_copper_link_82543(struct e1000_hw
*hw
);
56 static s32
e1000_check_for_fiber_link_82543(struct e1000_hw
*hw
);
57 static s32
e1000_led_on_82543(struct e1000_hw
*hw
);
58 static s32
e1000_led_off_82543(struct e1000_hw
*hw
);
59 static void e1000_write_vfta_82543(struct e1000_hw
*hw
, u32 offset
,
61 static void e1000_mta_set_82543(struct e1000_hw
*hw
, u32 hash_value
);
62 static void e1000_clear_hw_cntrs_82543(struct e1000_hw
*hw
);
63 static s32
e1000_config_mac_to_phy_82543(struct e1000_hw
*hw
);
64 static bool e1000_init_phy_disabled_82543(struct e1000_hw
*hw
);
65 static void e1000_lower_mdi_clk_82543(struct e1000_hw
*hw
, u32
*ctrl
);
66 static s32
e1000_polarity_reversal_workaround_82543(struct e1000_hw
*hw
);
67 static void e1000_raise_mdi_clk_82543(struct e1000_hw
*hw
, u32
*ctrl
);
68 static u16
e1000_shift_in_mdi_bits_82543(struct e1000_hw
*hw
);
69 static void e1000_shift_out_mdi_bits_82543(struct e1000_hw
*hw
, u32 data
,
71 static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw
*hw
);
72 static void e1000_set_tbi_sbp_82543(struct e1000_hw
*hw
, bool state
);
75 * e1000_init_phy_params_82543 - Init PHY func ptrs.
76 * @hw: pointer to the HW structure
79 e1000_init_phy_params_82543(struct e1000_hw
*hw
)
81 struct e1000_phy_info
*phy
= &hw
->phy
;
82 s32 ret_val
= E1000_SUCCESS
;
84 DEBUGFUNC("e1000_init_phy_params_82543");
86 if (hw
->phy
.media_type
!= e1000_media_type_copper
) {
87 phy
->type
= e1000_phy_none
;
90 phy
->ops
.power_up
= e1000_power_up_phy_copper
;
91 phy
->ops
.power_down
= e1000_power_down_phy_copper
;
95 phy
->autoneg_mask
= AUTONEG_ADVERTISE_SPEED_DEFAULT
;
96 phy
->reset_delay_us
= 10000;
97 phy
->type
= e1000_phy_m88
;
99 /* Function Pointers */
100 phy
->ops
.check_polarity
= e1000_check_polarity_m88
;
101 phy
->ops
.commit
= e1000_phy_sw_reset_generic
;
102 phy
->ops
.force_speed_duplex
= e1000_phy_force_speed_duplex_82543
;
103 phy
->ops
.get_cable_length
= e1000_get_cable_length_m88
;
104 phy
->ops
.get_cfg_done
= e1000_get_cfg_done_generic
;
105 phy
->ops
.read_reg
= (hw
->mac
.type
== e1000_82543
)
106 ? e1000_read_phy_reg_82543
107 : e1000_read_phy_reg_m88
;
108 phy
->ops
.reset
= (hw
->mac
.type
== e1000_82543
)
109 ? e1000_phy_hw_reset_82543
110 : e1000_phy_hw_reset_generic
;
111 phy
->ops
.write_reg
= (hw
->mac
.type
== e1000_82543
)
112 ? e1000_write_phy_reg_82543
113 : e1000_write_phy_reg_m88
;
114 phy
->ops
.get_info
= e1000_get_phy_info_m88
;
117 * The external PHY of the 82543 can be in a funky state.
118 * Resetting helps us read the PHY registers for acquiring
121 if (!e1000_init_phy_disabled_82543(hw
)) {
122 ret_val
= phy
->ops
.reset(hw
);
124 DEBUGOUT("Resetting PHY during init failed.\n");
130 ret_val
= e1000_get_phy_id(hw
);
135 switch (hw
->mac
.type
) {
137 if (phy
->id
!= M88E1000_E_PHY_ID
) {
138 ret_val
= -E1000_ERR_PHY
;
143 if (phy
->id
!= M88E1000_I_PHY_ID
) {
144 ret_val
= -E1000_ERR_PHY
;
149 ret_val
= -E1000_ERR_PHY
;
158 * e1000_init_nvm_params_82543 - Init NVM func ptrs.
159 * @hw: pointer to the HW structure
162 e1000_init_nvm_params_82543(struct e1000_hw
*hw
)
164 struct e1000_nvm_info
*nvm
= &hw
->nvm
;
166 DEBUGFUNC("e1000_init_nvm_params_82543");
168 nvm
->type
= e1000_nvm_eeprom_microwire
;
170 nvm
->delay_usec
= 50;
171 nvm
->address_bits
= 6;
172 nvm
->opcode_bits
= 3;
174 /* Function Pointers */
175 nvm
->ops
.read
= e1000_read_nvm_microwire
;
176 nvm
->ops
.update
= e1000_update_nvm_checksum_generic
;
177 nvm
->ops
.valid_led_default
= e1000_valid_led_default_generic
;
178 nvm
->ops
.validate
= e1000_validate_nvm_checksum_generic
;
179 nvm
->ops
.write
= e1000_write_nvm_microwire
;
181 return (E1000_SUCCESS
);
185 * e1000_init_mac_params_82543 - Init MAC func ptrs.
186 * @hw: pointer to the HW structure
189 e1000_init_mac_params_82543(struct e1000_hw
*hw
)
191 struct e1000_mac_info
*mac
= &hw
->mac
;
193 DEBUGFUNC("e1000_init_mac_params_82543");
196 switch (hw
->device_id
) {
197 case E1000_DEV_ID_82543GC_FIBER
:
198 case E1000_DEV_ID_82544EI_FIBER
:
199 hw
->phy
.media_type
= e1000_media_type_fiber
;
202 hw
->phy
.media_type
= e1000_media_type_copper
;
206 /* Set mta register count */
207 mac
->mta_reg_count
= 128;
208 /* Set rar entry count */
209 mac
->rar_entry_count
= E1000_RAR_ENTRIES
;
211 /* Function pointers */
213 /* bus type/speed/width */
214 mac
->ops
.get_bus_info
= e1000_get_bus_info_pci_generic
;
216 mac
->ops
.set_lan_id
= e1000_set_lan_id_multi_port_pci
;
218 mac
->ops
.reset_hw
= e1000_reset_hw_82543
;
219 /* hw initialization */
220 mac
->ops
.init_hw
= e1000_init_hw_82543
;
222 mac
->ops
.setup_link
= e1000_setup_link_82543
;
223 /* physical interface setup */
224 mac
->ops
.setup_physical_interface
=
225 (hw
->phy
.media_type
== e1000_media_type_copper
)
226 ? e1000_setup_copper_link_82543
227 : e1000_setup_fiber_link_82543
;
229 mac
->ops
.check_for_link
=
230 (hw
->phy
.media_type
== e1000_media_type_copper
)
231 ? e1000_check_for_copper_link_82543
232 : e1000_check_for_fiber_link_82543
;
234 mac
->ops
.get_link_up_info
=
235 (hw
->phy
.media_type
== e1000_media_type_copper
)
236 ? e1000_get_speed_and_duplex_copper_generic
237 : e1000_get_speed_and_duplex_fiber_serdes_generic
;
238 /* multicast address update */
239 mac
->ops
.update_mc_addr_list
= e1000_update_mc_addr_list_generic
;
241 mac
->ops
.write_vfta
= e1000_write_vfta_82543
;
243 mac
->ops
.clear_vfta
= e1000_clear_vfta_generic
;
245 mac
->ops
.mta_set
= e1000_mta_set_82543
;
246 /* turn on/off LED */
247 mac
->ops
.led_on
= e1000_led_on_82543
;
248 mac
->ops
.led_off
= e1000_led_off_82543
;
249 /* clear hardware counters */
250 mac
->ops
.clear_hw_cntrs
= e1000_clear_hw_cntrs_82543
;
252 /* Set tbi compatibility */
253 if ((hw
->mac
.type
!= e1000_82543
) ||
254 (hw
->phy
.media_type
== e1000_media_type_fiber
))
255 e1000_set_tbi_compatibility_82543(hw
, false);
257 return (E1000_SUCCESS
);
261 * e1000_init_function_pointers_82543 - Init func ptrs.
262 * @hw: pointer to the HW structure
264 * Called to initialize all function pointers and parameters.
267 e1000_init_function_pointers_82543(struct e1000_hw
*hw
)
269 DEBUGFUNC("e1000_init_function_pointers_82543");
271 hw
->mac
.ops
.init_params
= e1000_init_mac_params_82543
;
272 hw
->nvm
.ops
.init_params
= e1000_init_nvm_params_82543
;
273 hw
->phy
.ops
.init_params
= e1000_init_phy_params_82543
;
277 * e1000_tbi_compatibility_enabled_82543 - Returns TBI compat status
278 * @hw: pointer to the HW structure
280 * Returns the current status of 10-bit Interface (TBI) compatibility
281 * (enabled/disabled).
284 e1000_tbi_compatibility_enabled_82543(struct e1000_hw
*hw
)
286 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
289 DEBUGFUNC("e1000_tbi_compatibility_enabled_82543");
291 if (hw
->mac
.type
!= e1000_82543
) {
292 DEBUGOUT("TBI compatibility workaround for 82543 only.\n");
296 state
= (dev_spec
->tbi_compatibility
& TBI_COMPAT_ENABLED
)
304 * e1000_set_tbi_compatibility_82543 - Set TBI compatibility
305 * @hw: pointer to the HW structure
306 * @state: enable/disable TBI compatibility
308 * Enables or disabled 10-bit Interface (TBI) compatibility.
311 e1000_set_tbi_compatibility_82543(struct e1000_hw
*hw
, bool state
)
313 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
315 DEBUGFUNC("e1000_set_tbi_compatibility_82543");
317 if (hw
->mac
.type
!= e1000_82543
) {
318 DEBUGOUT("TBI compatibility workaround for 82543 only.\n");
323 dev_spec
->tbi_compatibility
|= TBI_COMPAT_ENABLED
;
325 dev_spec
->tbi_compatibility
&= ~TBI_COMPAT_ENABLED
;
329 * e1000_tbi_sbp_enabled_82543 - Returns TBI SBP status
330 * @hw: pointer to the HW structure
332 * Returns the current status of 10-bit Interface (TBI) store bad packet (SBP)
333 * (enabled/disabled).
336 e1000_tbi_sbp_enabled_82543(struct e1000_hw
*hw
)
338 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
341 DEBUGFUNC("e1000_tbi_sbp_enabled_82543");
343 if (hw
->mac
.type
!= e1000_82543
) {
344 DEBUGOUT("TBI compatibility workaround for 82543 only.\n");
348 state
= (dev_spec
->tbi_compatibility
& TBI_SBP_ENABLED
)
356 * e1000_set_tbi_sbp_82543 - Set TBI SBP
357 * @hw: pointer to the HW structure
358 * @state: enable/disable TBI store bad packet
360 * Enables or disabled 10-bit Interface (TBI) store bad packet (SBP).
363 e1000_set_tbi_sbp_82543(struct e1000_hw
*hw
, bool state
)
365 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
367 DEBUGFUNC("e1000_set_tbi_sbp_82543");
369 if (state
&& e1000_tbi_compatibility_enabled_82543(hw
))
370 dev_spec
->tbi_compatibility
|= TBI_SBP_ENABLED
;
372 dev_spec
->tbi_compatibility
&= ~TBI_SBP_ENABLED
;
376 * e1000_init_phy_disabled_82543 - Returns init PHY status
377 * @hw: pointer to the HW structure
379 * Returns the current status of whether PHY initialization is disabled.
380 * True if PHY initialization is disabled else false.
383 e1000_init_phy_disabled_82543(struct e1000_hw
*hw
)
385 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
388 DEBUGFUNC("e1000_init_phy_disabled_82543");
390 if (hw
->mac
.type
!= e1000_82543
) {
395 ret_val
= dev_spec
->init_phy_disabled
;
402 * e1000_tbi_adjust_stats_82543 - Adjust stats when TBI enabled
403 * @hw: pointer to the HW structure
404 * @stats: Struct containing statistic register values
405 * @frame_len: The length of the frame in question
406 * @mac_addr: The Ethernet destination address of the frame in question
407 * @max_frame_size: The maximum frame size
409 * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT
412 e1000_tbi_adjust_stats_82543(struct e1000_hw
*hw
,
413 struct e1000_hw_stats
*stats
, u32 frame_len
,
414 u8
*mac_addr
, u32 max_frame_size
)
416 if (!(e1000_tbi_sbp_enabled_82543(hw
)))
419 /* First adjust the frame length. */
422 * We need to adjust the statistics counters, since the hardware
423 * counters overcount this packet as a CRC error and undercount
424 * the packet as a good packet
426 /* This packet should not be counted as a CRC error. */
428 /* This packet does count as a Good Packet Received. */
431 /* Adjust the Good Octets received counters */
432 stats
->gorc
+= frame_len
;
435 * Is this a broadcast or multicast? Check broadcast first, since
436 * the test for a multicast frame will test positive on a broadcast
439 if ((mac_addr
[0] == 0xff) && (mac_addr
[1] == 0xff))
440 /* Broadcast packet */
442 else if (*mac_addr
& 0x01)
443 /* Multicast packet */
447 * In this case, the hardware has overcounted the number of
450 if ((frame_len
== max_frame_size
) && (stats
->roc
> 0))
454 * Adjust the bin counters when the extra byte put the frame in the
455 * wrong bin. Remember that the frame_len was adjusted above.
457 if (frame_len
== 64) {
460 } else if (frame_len
== 127) {
463 } else if (frame_len
== 255) {
466 } else if (frame_len
== 511) {
469 } else if (frame_len
== 1023) {
472 } else if (frame_len
== 1522) {
478 * e1000_read_phy_reg_82543 - Read PHY register
479 * @hw: pointer to the HW structure
480 * @offset: register offset to be read
481 * @data: pointer to the read data
483 * Reads the PHY at offset and stores the information read to data.
486 e1000_read_phy_reg_82543(struct e1000_hw
*hw
, u32 offset
, u16
* data
)
489 s32 ret_val
= E1000_SUCCESS
;
491 DEBUGFUNC("e1000_read_phy_reg_82543");
493 if (offset
> MAX_PHY_REG_ADDRESS
) {
494 DEBUGOUT1("PHY Address %d is out of range\n", offset
);
495 ret_val
= -E1000_ERR_PARAM
;
500 * We must first send a preamble through the MDIO pin to signal the
501 * beginning of an MII instruction. This is done by sending 32
502 * consecutive "1" bits.
504 e1000_shift_out_mdi_bits_82543(hw
, PHY_PREAMBLE
, PHY_PREAMBLE_SIZE
);
507 * Now combine the next few fields that are required for a read
508 * operation. We use this method instead of calling the
509 * e1000_shift_out_mdi_bits routine five different times. The format
510 * of an MII read instruction consists of a shift out of 14 bits and
511 * is defined as follows:
512 * <Preamble><SOF><Op Code><Phy Addr><Offset>
513 * followed by a shift in of 18 bits. This first two bits shifted in
514 * are TurnAround bits used to avoid contention on the MDIO pin when a
515 * READ operation is performed. These two bits are thrown away
516 * followed by a shift in of 16 bits which contains the desired data.
518 mdic
= (offset
| (hw
->phy
.addr
<< 5) |
519 (PHY_OP_READ
<< 10) | (PHY_SOF
<< 12));
521 e1000_shift_out_mdi_bits_82543(hw
, mdic
, 14);
524 * Now that we've shifted out the read command to the MII, we need to
525 * "shift in" the 16-bit value (18 total bits) of the requested PHY
528 *data
= e1000_shift_in_mdi_bits_82543(hw
);
535 * e1000_write_phy_reg_82543 - Write PHY register
536 * @hw: pointer to the HW structure
537 * @offset: register offset to be written
538 * @data: pointer to the data to be written at offset
540 * Writes data to the PHY at offset.
543 e1000_write_phy_reg_82543(struct e1000_hw
*hw
, u32 offset
, u16 data
)
546 s32 ret_val
= E1000_SUCCESS
;
548 DEBUGFUNC("e1000_write_phy_reg_82543");
550 if (offset
> MAX_PHY_REG_ADDRESS
) {
551 DEBUGOUT1("PHY Address %d is out of range\n", offset
);
552 ret_val
= -E1000_ERR_PARAM
;
557 * We'll need to use the SW defined pins to shift the write command
558 * out to the PHY. We first send a preamble to the PHY to signal the
559 * beginning of the MII instruction. This is done by sending 32
560 * consecutive "1" bits.
562 e1000_shift_out_mdi_bits_82543(hw
, PHY_PREAMBLE
, PHY_PREAMBLE_SIZE
);
565 * Now combine the remaining required fields that will indicate a
566 * write operation. We use this method instead of calling the
567 * e1000_shift_out_mdi_bits routine for each field in the command. The
568 * format of a MII write instruction is as follows:
569 * <Preamble><SOF><Op Code><Phy Addr><Reg Addr><Turnaround><Data>.
571 mdic
= ((PHY_TURNAROUND
) | (offset
<< 2) | (hw
->phy
.addr
<< 7) |
572 (PHY_OP_WRITE
<< 12) | (PHY_SOF
<< 14));
576 e1000_shift_out_mdi_bits_82543(hw
, mdic
, 32);
583 * e1000_raise_mdi_clk_82543 - Raise Management Data Input clock
584 * @hw: pointer to the HW structure
585 * @ctrl: pointer to the control register
587 * Raise the management data input clock by setting the MDC bit in the control
591 e1000_raise_mdi_clk_82543(struct e1000_hw
*hw
, u32
* ctrl
)
594 * Raise the clock input to the Management Data Clock (by setting the
595 * MDC bit), and then delay a sufficient amount of time.
597 E1000_WRITE_REG(hw
, E1000_CTRL
, (*ctrl
| E1000_CTRL_MDC
));
598 E1000_WRITE_FLUSH(hw
);
603 * e1000_lower_mdi_clk_82543 - Lower Management Data Input clock
604 * @hw: pointer to the HW structure
605 * @ctrl: pointer to the control register
607 * Lower the management data input clock by clearing the MDC bit in the control
611 e1000_lower_mdi_clk_82543(struct e1000_hw
*hw
, u32
* ctrl
)
614 * Lower the clock input to the Management Data Clock (by clearing the
615 * MDC bit), and then delay a sufficient amount of time.
617 E1000_WRITE_REG(hw
, E1000_CTRL
, (*ctrl
& ~E1000_CTRL_MDC
));
618 E1000_WRITE_FLUSH(hw
);
623 * e1000_shift_out_mdi_bits_82543 - Shift data bits our to the PHY
624 * @hw: pointer to the HW structure
625 * @data: data to send to the PHY
626 * @count: number of bits to shift out
628 * We need to shift 'count' bits out to the PHY. So, the value in the
629 * "data" parameter will be shifted out to the PHY one bit at a time.
630 * In order to do this, "data" must be broken down into bits.
633 e1000_shift_out_mdi_bits_82543(struct e1000_hw
*hw
, u32 data
,
639 * We need to shift "count" number of bits out to the PHY. So, the
640 * value in the "data" parameter will be shifted out to the PHY one
641 * bit at a time. In order to do this, "data" must be broken down
645 mask
<<= (count
- 1);
647 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
649 /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */
650 ctrl
|= (E1000_CTRL_MDIO_DIR
| E1000_CTRL_MDC_DIR
);
654 * A "1" is shifted out to the PHY by setting the MDIO bit to
655 * "1" and then raising and lowering the Management Data Clock.
656 * A "0" is shifted out to the PHY by setting the MDIO bit to
657 * "0" and then raising and lowering the clock.
660 ctrl
|= E1000_CTRL_MDIO
;
662 ctrl
&= ~E1000_CTRL_MDIO
;
664 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
665 E1000_WRITE_FLUSH(hw
);
669 e1000_raise_mdi_clk_82543(hw
, &ctrl
);
670 e1000_lower_mdi_clk_82543(hw
, &ctrl
);
677 * e1000_shift_in_mdi_bits_82543 - Shift data bits in from the PHY
678 * @hw: pointer to the HW structure
680 * In order to read a register from the PHY, we need to shift 18 bits
681 * in from the PHY. Bits are "shifted in" by raising the clock input to
682 * the PHY (setting the MDC bit), and then reading the value of the data out
686 e1000_shift_in_mdi_bits_82543(struct e1000_hw
*hw
)
693 * In order to read a register from the PHY, we need to shift in a
694 * total of 18 bits from the PHY. The first two bit (turnaround)
695 * times are used to avoid contention on the MDIO pin when a read
696 * operation is performed. These two bits are ignored by us and
697 * thrown away. Bits are "shifted in" by raising the input to the
698 * Management Data Clock (setting the MDC bit) and then reading the
699 * value of the MDIO bit.
701 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
704 * Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as
707 ctrl
&= ~E1000_CTRL_MDIO_DIR
;
708 ctrl
&= ~E1000_CTRL_MDIO
;
710 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
711 E1000_WRITE_FLUSH(hw
);
714 * Raise and lower the clock before reading in the data. This accounts
715 * for the turnaround bits. The first clock occurred when we clocked
716 * out the last bit of the Register Address.
718 e1000_raise_mdi_clk_82543(hw
, &ctrl
);
719 e1000_lower_mdi_clk_82543(hw
, &ctrl
);
721 for (data
= 0, i
= 0; i
< 16; i
++) {
723 e1000_raise_mdi_clk_82543(hw
, &ctrl
);
724 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
725 /* Check to see if we shifted in a "1". */
726 if (ctrl
& E1000_CTRL_MDIO
)
728 e1000_lower_mdi_clk_82543(hw
, &ctrl
);
731 e1000_raise_mdi_clk_82543(hw
, &ctrl
);
732 e1000_lower_mdi_clk_82543(hw
, &ctrl
);
738 * e1000_phy_force_speed_duplex_82543 - Force speed/duplex for PHY
739 * @hw: pointer to the HW structure
741 * Calls the function to force speed and duplex for the m88 PHY, and
742 * if the PHY is not auto-negotiating and the speed is forced to 10Mbit,
743 * then call the function for polarity reversal workaround.
746 e1000_phy_force_speed_duplex_82543(struct e1000_hw
*hw
)
750 DEBUGFUNC("e1000_phy_force_speed_duplex_82543");
752 ret_val
= e1000_phy_force_speed_duplex_m88(hw
);
756 if (!hw
->mac
.autoneg
&&
757 (hw
->mac
.forced_speed_duplex
& E1000_ALL_10_SPEED
))
758 ret_val
= e1000_polarity_reversal_workaround_82543(hw
);
765 * e1000_polarity_reversal_workaround_82543 - Workaround polarity reversal
766 * @hw: pointer to the HW structure
768 * When forcing link to 10 Full or 10 Half, the PHY can reverse the polarity
769 * inadvertently. To workaround the issue, we disable the transmitter on
770 * the PHY until we have established the link partner's link parameters.
773 e1000_polarity_reversal_workaround_82543(struct e1000_hw
*hw
)
775 s32 ret_val
= E1000_SUCCESS
;
780 if (!(hw
->phy
.ops
.write_reg
))
783 /* Polarity reversal workaround for forced 10F/10H links. */
785 /* Disable the transmitter on the PHY */
787 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_PAGE_SELECT
, 0x0019);
790 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_GEN_CONTROL
, 0xFFFF);
794 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_PAGE_SELECT
, 0x0000);
799 * This loop will early-out if the NO link condition has been met.
800 * In other words, DO NOT use e1000_phy_has_link_generic() here.
802 for (i
= PHY_FORCE_TIME
; i
> 0; i
--) {
804 * Read the MII Status Register and wait for Link Status bit
808 ret_val
= hw
->phy
.ops
.read_reg(hw
, PHY_STATUS
, &mii_status_reg
);
812 ret_val
= hw
->phy
.ops
.read_reg(hw
, PHY_STATUS
, &mii_status_reg
);
816 if ((mii_status_reg
& ~MII_SR_LINK_STATUS
) == 0)
821 /* Recommended delay time after link has been lost */
822 msec_delay_irq(1000);
824 /* Now we will re-enable the transmitter on the PHY */
826 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_PAGE_SELECT
, 0x0019);
830 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_GEN_CONTROL
, 0xFFF0);
834 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_GEN_CONTROL
, 0xFF00);
838 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_GEN_CONTROL
, 0x0000);
842 ret_val
= hw
->phy
.ops
.write_reg(hw
, M88E1000_PHY_PAGE_SELECT
, 0x0000);
847 * Read the MII Status Register and wait for Link Status bit
850 ret_val
= e1000_phy_has_link_generic(hw
, PHY_FORCE_TIME
, 100000, &link
);
859 * e1000_phy_hw_reset_82543 - PHY hardware reset
860 * @hw: pointer to the HW structure
862 * Sets the PHY_RESET_DIR bit in the extended device control register
863 * to put the PHY into a reset and waits for completion. Once the reset
864 * has been accomplished, clear the PHY_RESET_DIR bit to take the PHY out
868 e1000_phy_hw_reset_82543(struct e1000_hw
*hw
)
873 DEBUGFUNC("e1000_phy_hw_reset_82543");
876 * Read the Extended Device Control Register, assert the PHY_RESET_DIR
877 * bit to put the PHY into reset...
879 ctrl_ext
= E1000_READ_REG(hw
, E1000_CTRL_EXT
);
880 ctrl_ext
|= E1000_CTRL_EXT_SDP4_DIR
;
881 ctrl_ext
&= ~E1000_CTRL_EXT_SDP4_DATA
;
882 E1000_WRITE_REG(hw
, E1000_CTRL_EXT
, ctrl_ext
);
883 E1000_WRITE_FLUSH(hw
);
887 /* ...then take it out of reset. */
888 ctrl_ext
|= E1000_CTRL_EXT_SDP4_DATA
;
889 E1000_WRITE_REG(hw
, E1000_CTRL_EXT
, ctrl_ext
);
890 E1000_WRITE_FLUSH(hw
);
894 if (!(hw
->phy
.ops
.get_cfg_done
))
895 return (E1000_SUCCESS
);
897 ret_val
= hw
->phy
.ops
.get_cfg_done(hw
);
903 * e1000_reset_hw_82543 - Reset hardware
904 * @hw: pointer to the HW structure
906 * This resets the hardware into a known state.
909 e1000_reset_hw_82543(struct e1000_hw
*hw
)
912 s32 ret_val
= E1000_SUCCESS
;
914 DEBUGFUNC("e1000_reset_hw_82543");
916 DEBUGOUT("Masking off all interrupts\n");
917 E1000_WRITE_REG(hw
, E1000_IMC
, 0xffffffff);
919 E1000_WRITE_REG(hw
, E1000_RCTL
, 0);
920 E1000_WRITE_REG(hw
, E1000_TCTL
, E1000_TCTL_PSP
);
921 E1000_WRITE_FLUSH(hw
);
923 e1000_set_tbi_sbp_82543(hw
, false);
926 * Delay to allow any outstanding PCI transactions to complete before
927 * resetting the device
931 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
933 DEBUGOUT("Issuing a global reset to 82543/82544 MAC\n");
934 if (hw
->mac
.type
== e1000_82543
) {
935 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
| E1000_CTRL_RST
);
938 * The 82544 can't ACK the 64-bit write when issuing the
939 * reset, so use IO-mapping as a workaround.
941 E1000_WRITE_REG_IO(hw
, E1000_CTRL
, ctrl
| E1000_CTRL_RST
);
945 * After MAC reset, force reload of NVM to restore power-on
946 * settings to device.
948 hw
->nvm
.ops
.reload(hw
);
951 /* Masking off and clearing any pending interrupts */
952 E1000_WRITE_REG(hw
, E1000_IMC
, 0xffffffff);
953 (void) E1000_READ_REG(hw
, E1000_ICR
);
959 * e1000_init_hw_82543 - Initialize hardware
960 * @hw: pointer to the HW structure
962 * This inits the hardware readying it for operation.
965 e1000_init_hw_82543(struct e1000_hw
*hw
)
967 struct e1000_mac_info
*mac
= &hw
->mac
;
968 struct e1000_dev_spec_82543
*dev_spec
= &hw
->dev_spec
._82543
;
973 DEBUGFUNC("e1000_init_hw_82543");
975 /* Disabling VLAN filtering */
976 E1000_WRITE_REG(hw
, E1000_VET
, 0);
977 mac
->ops
.clear_vfta(hw
);
979 /* Setup the receive address. */
980 e1000_init_rx_addrs_generic(hw
, mac
->rar_entry_count
);
982 /* Zero out the Multicast HASH table */
983 DEBUGOUT("Zeroing the MTA\n");
984 for (i
= 0; i
< mac
->mta_reg_count
; i
++) {
985 E1000_WRITE_REG_ARRAY(hw
, E1000_MTA
, i
, 0);
986 E1000_WRITE_FLUSH(hw
);
990 * Set the PCI priority bit correctly in the CTRL register. This
991 * determines if the adapter gives priority to receives, or if it
992 * gives equal priority to transmits and receives.
994 if (hw
->mac
.type
== e1000_82543
&& dev_spec
->dma_fairness
) {
995 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
996 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
| E1000_CTRL_PRIOR
);
999 e1000_pcix_mmrbc_workaround_generic(hw
);
1001 /* Setup link and flow control */
1002 ret_val
= mac
->ops
.setup_link(hw
);
1005 * Clear all of the statistics registers (clear on read). It is
1006 * important that we do this after we have tried to establish link
1007 * because the symbol error count will increment wildly if there
1010 e1000_clear_hw_cntrs_82543(hw
);
1016 * e1000_setup_link_82543 - Setup flow control and link settings
1017 * @hw: pointer to the HW structure
1019 * Read the EEPROM to determine the initial polarity value and write the
1020 * extended device control register with the information before calling
1021 * the generic setup link function, which does the following:
1022 * Determines which flow control settings to use, then configures flow
1023 * control. Calls the appropriate media-specific link configuration
1024 * function. Assuming the adapter has a valid link partner, a valid link
1025 * should be established. Assumes the hardware has previously been reset
1026 * and the transmitter and receiver are not enabled.
1029 e1000_setup_link_82543(struct e1000_hw
*hw
)
1035 DEBUGFUNC("e1000_setup_link_82543");
1038 * Take the 4 bits from NVM word 0xF that determine the initial
1039 * polarity value for the SW controlled pins, and setup the
1040 * Extended Device Control reg with that info.
1041 * This is needed because one of the SW controlled pins is used for
1042 * signal detection. So this should be done before phy setup.
1044 if (hw
->mac
.type
== e1000_82543
) {
1045 ret_val
= hw
->nvm
.ops
.read(hw
, NVM_INIT_CONTROL2_REG
, 1, &data
);
1047 DEBUGOUT("NVM Read Error\n");
1048 ret_val
= -E1000_ERR_NVM
;
1051 ctrl_ext
= ((data
& NVM_WORD0F_SWPDIO_EXT_MASK
) <<
1052 NVM_SWDPIO_EXT_SHIFT
);
1053 E1000_WRITE_REG(hw
, E1000_CTRL_EXT
, ctrl_ext
);
1056 ret_val
= e1000_setup_link_generic(hw
);
1063 * e1000_setup_copper_link_82543 - Configure copper link settings
1064 * @hw: pointer to the HW structure
1066 * Configures the link for auto-neg or forced speed and duplex. Then we check
1067 * for link, once link is established calls to configure collision distance
1068 * and flow control are called.
1071 e1000_setup_copper_link_82543(struct e1000_hw
*hw
)
1077 DEBUGFUNC("e1000_setup_copper_link_82543");
1079 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
) | E1000_CTRL_SLU
;
1081 * With 82543, we need to force speed and duplex on the MAC
1082 * equal to what the PHY speed and duplex configuration is.
1083 * In addition, we need to perform a hardware reset on the
1084 * PHY to take it out of reset.
1086 if (hw
->mac
.type
== e1000_82543
) {
1087 ctrl
|= (E1000_CTRL_FRCSPD
| E1000_CTRL_FRCDPX
);
1088 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1089 ret_val
= hw
->phy
.ops
.reset(hw
);
1092 hw
->phy
.reset_disable
= false;
1094 ctrl
&= ~(E1000_CTRL_FRCSPD
| E1000_CTRL_FRCDPX
);
1095 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1098 /* Set MDI/MDI-X, Polarity Reversal, and downshift settings */
1099 ret_val
= e1000_copper_link_setup_m88(hw
);
1103 if (hw
->mac
.autoneg
) {
1105 * Setup autoneg and flow control advertisement and perform
1108 ret_val
= e1000_copper_link_autoneg(hw
);
1113 * PHY will be set to 10H, 10F, 100H or 100F
1114 * depending on user settings.
1116 DEBUGOUT("Forcing Speed and Duplex\n");
1117 ret_val
= e1000_phy_force_speed_duplex_82543(hw
);
1119 DEBUGOUT("Error Forcing Speed and Duplex\n");
1125 * Check link status. Wait up to 100 microseconds for link to become
1128 ret_val
= e1000_phy_has_link_generic(hw
,
1129 COPPER_LINK_UP_LIMIT
,
1137 DEBUGOUT("Valid link established!!!\n");
1138 /* Config the MAC and PHY after link is up */
1139 if (hw
->mac
.type
== e1000_82544
) {
1140 e1000_config_collision_dist_generic(hw
);
1142 ret_val
= e1000_config_mac_to_phy_82543(hw
);
1146 ret_val
= e1000_config_fc_after_link_up_generic(hw
);
1149 DEBUGOUT("Unable to establish link!!!\n");
1157 * e1000_setup_fiber_link_82543 - Setup link for fiber
1158 * @hw: pointer to the HW structure
1160 * Configures collision distance and flow control for fiber links. Upon
1161 * successful setup, poll for link.
1164 e1000_setup_fiber_link_82543(struct e1000_hw
*hw
)
1169 DEBUGFUNC("e1000_setup_fiber_link_82543");
1171 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1173 /* Take the link out of reset */
1174 ctrl
&= ~E1000_CTRL_LRST
;
1176 e1000_config_collision_dist_generic(hw
);
1178 ret_val
= e1000_commit_fc_settings_generic(hw
);
1182 DEBUGOUT("Auto-negotiation enabled\n");
1184 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1185 E1000_WRITE_FLUSH(hw
);
1189 * For these adapters, the SW definable pin 1 is cleared when the
1190 * optics detect a signal. If we have a signal, then poll for a
1191 * "Link-Up" indication.
1193 if (!(E1000_READ_REG(hw
, E1000_CTRL
) & E1000_CTRL_SWDPIN1
)) {
1194 ret_val
= e1000_poll_fiber_serdes_link_generic(hw
);
1197 DEBUGOUT("No signal detected\n");
1205 * e1000_check_for_copper_link_82543 - Check for link (Copper)
1206 * @hw: pointer to the HW structure
1208 * Checks the phy for link, if link exists, do the following:
1209 * - check for downshift
1210 * - do polarity workaround (if necessary)
1211 * - configure collision distance
1212 * - configure flow control after link up
1213 * - configure tbi compatibility
1216 e1000_check_for_copper_link_82543(struct e1000_hw
*hw
)
1218 struct e1000_mac_info
*mac
= &hw
->mac
;
1224 DEBUGFUNC("e1000_check_for_copper_link_82543");
1226 if (!mac
->get_link_status
) {
1227 ret_val
= E1000_SUCCESS
;
1231 ret_val
= e1000_phy_has_link_generic(hw
, 1, 0, &link
);
1236 goto out
; /* No link detected */
1238 mac
->get_link_status
= false;
1240 (void) e1000_check_downshift_generic(hw
);
1243 * If we are forcing speed/duplex, then we can return since
1244 * we have already determined whether we have link or not.
1246 if (!mac
->autoneg
) {
1248 * If speed and duplex are forced to 10H or 10F, then we will
1249 * implement the polarity reversal workaround. We disable
1250 * interrupts first, and upon returning, place the devices
1251 * interrupt state to its previous value except for the link
1252 * status change interrupt which will happened due to the
1253 * execution of this workaround.
1255 if (mac
->forced_speed_duplex
& E1000_ALL_10_SPEED
) {
1256 E1000_WRITE_REG(hw
, E1000_IMC
, 0xFFFFFFFF);
1257 ret_val
= e1000_polarity_reversal_workaround_82543(hw
);
1258 icr
= E1000_READ_REG(hw
, E1000_ICR
);
1259 E1000_WRITE_REG(hw
, E1000_ICS
, (icr
& ~E1000_ICS_LSC
));
1260 E1000_WRITE_REG(hw
, E1000_IMS
, IMS_ENABLE_MASK
);
1263 ret_val
= -E1000_ERR_CONFIG
;
1268 * We have a M88E1000 PHY and Auto-Neg is enabled. If we
1269 * have Si on board that is 82544 or newer, Auto
1270 * Speed Detection takes care of MAC speed/duplex
1271 * configuration. So we only need to configure Collision
1272 * Distance in the MAC. Otherwise, we need to force
1273 * speed/duplex on the MAC to the current PHY speed/duplex
1276 if (mac
->type
== e1000_82544
)
1277 e1000_config_collision_dist_generic(hw
);
1279 ret_val
= e1000_config_mac_to_phy_82543(hw
);
1281 DEBUGOUT("Error configuring MAC to PHY settings\n");
1287 * Configure Flow Control now that Auto-Neg has completed.
1288 * First, we need to restore the desired flow control
1289 * settings because we may have had to re-autoneg with a
1290 * different link partner.
1292 ret_val
= e1000_config_fc_after_link_up_generic(hw
);
1295 DEBUGOUT("Error configuring flow control\n");
1299 * At this point we know that we are on copper and we have
1300 * auto-negotiated link. These are conditions for checking the link
1301 * partner capability register. We use the link speed to determine if
1302 * TBI compatibility needs to be turned on or off. If the link is not
1303 * at gigabit speed, then TBI compatibility is not needed. If we are
1304 * at gigabit speed, we turn on TBI compatibility.
1306 if (e1000_tbi_compatibility_enabled_82543(hw
)) {
1307 ret_val
= mac
->ops
.get_link_up_info(hw
, &speed
, &duplex
);
1309 DEBUGOUT("Error getting link speed and duplex\n");
1312 if (speed
!= SPEED_1000
) {
1314 * If link speed is not set to gigabit speed,
1315 * we do not need to enable TBI compatibility.
1317 if (e1000_tbi_sbp_enabled_82543(hw
)) {
1319 * If we previously were in the mode,
1322 e1000_set_tbi_sbp_82543(hw
, false);
1323 rctl
= E1000_READ_REG(hw
, E1000_RCTL
);
1324 rctl
&= ~E1000_RCTL_SBP
;
1325 E1000_WRITE_REG(hw
, E1000_RCTL
, rctl
);
1329 * If TBI compatibility is was previously off,
1330 * turn it on. For compatibility with a TBI link
1331 * partner, we will store bad packets. Some
1332 * frames have an additional byte on the end and
1333 * will look like CRC errors to to the hardware.
1335 if (!e1000_tbi_sbp_enabled_82543(hw
)) {
1336 e1000_set_tbi_sbp_82543(hw
, true);
1337 rctl
= E1000_READ_REG(hw
, E1000_RCTL
);
1338 rctl
|= E1000_RCTL_SBP
;
1339 E1000_WRITE_REG(hw
, E1000_RCTL
, rctl
);
1348 * e1000_check_for_fiber_link_82543 - Check for link (Fiber)
1349 * @hw: pointer to the HW structure
1351 * Checks for link up on the hardware. If link is not up and we have
1352 * a signal, then we need to force link up.
1355 e1000_check_for_fiber_link_82543(struct e1000_hw
*hw
)
1357 struct e1000_mac_info
*mac
= &hw
->mac
;
1358 u32 rxcw
, ctrl
, status
;
1359 s32 ret_val
= E1000_SUCCESS
;
1361 DEBUGFUNC("e1000_check_for_fiber_link_82543");
1363 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1364 status
= E1000_READ_REG(hw
, E1000_STATUS
);
1365 rxcw
= E1000_READ_REG(hw
, E1000_RXCW
);
1368 * If we don't have link (auto-negotiation failed or link partner
1369 * cannot auto-negotiate), the cable is plugged in (we have signal),
1370 * and our link partner is not trying to auto-negotiate with us (we
1371 * are receiving idles or data), we need to force link up. We also
1372 * need to give auto-negotiation time to complete, in case the cable
1373 * was just plugged in. The autoneg_failed flag does this.
1375 /* (ctrl & E1000_CTRL_SWDPIN1) == 0 == have signal */
1376 if ((!(ctrl
& E1000_CTRL_SWDPIN1
)) &&
1377 (!(status
& E1000_STATUS_LU
)) &&
1378 (!(rxcw
& E1000_RXCW_C
))) {
1379 if (mac
->autoneg_failed
== 0) {
1380 mac
->autoneg_failed
= 1;
1384 DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
1386 /* Disable auto-negotiation in the TXCW register */
1387 E1000_WRITE_REG(hw
, E1000_TXCW
, (mac
->txcw
& ~E1000_TXCW_ANE
));
1389 /* Force link-up and also force full-duplex. */
1390 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1391 ctrl
|= (E1000_CTRL_SLU
| E1000_CTRL_FD
);
1392 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1394 /* Configure Flow Control after forcing link up. */
1395 ret_val
= e1000_config_fc_after_link_up_generic(hw
);
1397 DEBUGOUT("Error configuring flow control\n");
1400 } else if ((ctrl
& E1000_CTRL_SLU
) && (rxcw
& E1000_RXCW_C
)) {
1402 * If we are forcing link and we are receiving /C/ ordered
1403 * sets, re-enable auto-negotiation in the TXCW register
1404 * and disable forced link in the Device Control register
1405 * in an attempt to auto-negotiate with our link partner.
1407 DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
1408 E1000_WRITE_REG(hw
, E1000_TXCW
, mac
->txcw
);
1409 E1000_WRITE_REG(hw
, E1000_CTRL
, (ctrl
& ~E1000_CTRL_SLU
));
1411 mac
->serdes_has_link
= true;
1419 * e1000_config_mac_to_phy_82543 - Configure MAC to PHY settings
1420 * @hw: pointer to the HW structure
1422 * For the 82543 silicon, we need to set the MAC to match the settings
1423 * of the PHY, even if the PHY is auto-negotiating.
1426 e1000_config_mac_to_phy_82543(struct e1000_hw
*hw
)
1429 s32 ret_val
= E1000_SUCCESS
;
1432 DEBUGFUNC("e1000_config_mac_to_phy_82543");
1434 if (!(hw
->phy
.ops
.read_reg
))
1437 /* Set the bits to force speed and duplex */
1438 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1439 ctrl
|= (E1000_CTRL_FRCSPD
| E1000_CTRL_FRCDPX
);
1440 ctrl
&= ~(E1000_CTRL_SPD_SEL
| E1000_CTRL_ILOS
);
1443 * Set up duplex in the Device Control and Transmit Control
1444 * registers depending on negotiated values.
1446 ret_val
= hw
->phy
.ops
.read_reg(hw
, M88E1000_PHY_SPEC_STATUS
, &phy_data
);
1450 ctrl
&= ~E1000_CTRL_FD
;
1451 if (phy_data
& M88E1000_PSSR_DPLX
)
1452 ctrl
|= E1000_CTRL_FD
;
1454 e1000_config_collision_dist_generic(hw
);
1457 * Set up speed in the Device Control register depending on
1458 * negotiated values.
1460 if ((phy_data
& M88E1000_PSSR_SPEED
) == M88E1000_PSSR_1000MBS
)
1461 ctrl
|= E1000_CTRL_SPD_1000
;
1462 else if ((phy_data
& M88E1000_PSSR_SPEED
) == M88E1000_PSSR_100MBS
)
1463 ctrl
|= E1000_CTRL_SPD_100
;
1465 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1472 * e1000_write_vfta_82543 - Write value to VLAN filter table
1473 * @hw: pointer to the HW structure
1474 * @offset: the 32-bit offset in which to write the value to.
1475 * @value: the 32-bit value to write at location offset.
1477 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
1481 e1000_write_vfta_82543(struct e1000_hw
*hw
, u32 offset
, u32 value
)
1485 DEBUGFUNC("e1000_write_vfta_82543");
1487 if ((hw
->mac
.type
== e1000_82544
) && (offset
& 1)) {
1488 temp
= E1000_READ_REG_ARRAY(hw
, E1000_VFTA
, offset
- 1);
1489 E1000_WRITE_REG_ARRAY(hw
, E1000_VFTA
, offset
, value
);
1490 E1000_WRITE_FLUSH(hw
);
1491 E1000_WRITE_REG_ARRAY(hw
, E1000_VFTA
, offset
- 1, temp
);
1492 E1000_WRITE_FLUSH(hw
);
1494 e1000_write_vfta_generic(hw
, offset
, value
);
1499 * e1000_mta_set_82543 - Set multicast filter table address
1500 * @hw: pointer to the HW structure
1501 * @hash_value: determines the MTA register and bit to set
1503 * The multicast table address is a register array of 32-bit registers.
1504 * The hash_value is used to determine what register the bit is in, the
1505 * current value is read, the new bit is OR'd in and the new value is
1506 * written back into the register.
1509 e1000_mta_set_82543(struct e1000_hw
*hw
, u32 hash_value
)
1511 u32 hash_bit
, hash_reg
, mta
, temp
;
1513 DEBUGFUNC("e1000_mta_set_82543");
1515 hash_reg
= (hash_value
>> 5);
1518 * If we are on an 82544 and we are trying to write an odd offset
1519 * in the MTA, save off the previous entry before writing and
1520 * restore the old value after writing.
1522 if ((hw
->mac
.type
== e1000_82544
) && (hash_reg
& 1)) {
1523 hash_reg
&= (hw
->mac
.mta_reg_count
- 1);
1524 hash_bit
= hash_value
& 0x1F;
1525 mta
= E1000_READ_REG_ARRAY(hw
, E1000_MTA
, hash_reg
);
1526 mta
|= (1 << hash_bit
);
1527 temp
= E1000_READ_REG_ARRAY(hw
, E1000_MTA
, hash_reg
- 1);
1529 E1000_WRITE_REG_ARRAY(hw
, E1000_MTA
, hash_reg
, mta
);
1530 E1000_WRITE_FLUSH(hw
);
1531 E1000_WRITE_REG_ARRAY(hw
, E1000_MTA
, hash_reg
- 1, temp
);
1532 E1000_WRITE_FLUSH(hw
);
1534 e1000_mta_set_generic(hw
, hash_value
);
1539 * e1000_led_on_82543 - Turn on SW controllable LED
1540 * @hw: pointer to the HW structure
1542 * Turns the SW defined LED on.
1545 e1000_led_on_82543(struct e1000_hw
*hw
)
1547 u32 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1549 DEBUGFUNC("e1000_led_on_82543");
1551 if (hw
->mac
.type
== e1000_82544
&&
1552 hw
->phy
.media_type
== e1000_media_type_copper
) {
1553 /* Clear SW-definable Pin 0 to turn on the LED */
1554 ctrl
&= ~E1000_CTRL_SWDPIN0
;
1555 ctrl
|= E1000_CTRL_SWDPIO0
;
1557 /* Fiber 82544 and all 82543 use this method */
1558 ctrl
|= E1000_CTRL_SWDPIN0
;
1559 ctrl
|= E1000_CTRL_SWDPIO0
;
1561 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1563 return (E1000_SUCCESS
);
1567 * e1000_led_off_82543 - Turn off SW controllable LED
1568 * @hw: pointer to the HW structure
1570 * Turns the SW defined LED off.
1573 e1000_led_off_82543(struct e1000_hw
*hw
)
1575 u32 ctrl
= E1000_READ_REG(hw
, E1000_CTRL
);
1577 DEBUGFUNC("e1000_led_off_82543");
1579 if (hw
->mac
.type
== e1000_82544
&&
1580 hw
->phy
.media_type
== e1000_media_type_copper
) {
1581 /* Set SW-definable Pin 0 to turn off the LED */
1582 ctrl
|= E1000_CTRL_SWDPIN0
;
1583 ctrl
|= E1000_CTRL_SWDPIO0
;
1585 ctrl
&= ~E1000_CTRL_SWDPIN0
;
1586 ctrl
|= E1000_CTRL_SWDPIO0
;
1588 E1000_WRITE_REG(hw
, E1000_CTRL
, ctrl
);
1590 return (E1000_SUCCESS
);
1594 * e1000_clear_hw_cntrs_82543 - Clear device specific hardware counters
1595 * @hw: pointer to the HW structure
1597 * Clears the hardware counters by reading the counter registers.
1600 e1000_clear_hw_cntrs_82543(struct e1000_hw
*hw
)
1602 DEBUGFUNC("e1000_clear_hw_cntrs_82543");
1604 e1000_clear_hw_cntrs_base_generic(hw
);
1606 (void) E1000_READ_REG(hw
, E1000_PRC64
);
1607 (void) E1000_READ_REG(hw
, E1000_PRC127
);
1608 (void) E1000_READ_REG(hw
, E1000_PRC255
);
1609 (void) E1000_READ_REG(hw
, E1000_PRC511
);
1610 (void) E1000_READ_REG(hw
, E1000_PRC1023
);
1611 (void) E1000_READ_REG(hw
, E1000_PRC1522
);
1612 (void) E1000_READ_REG(hw
, E1000_PTC64
);
1613 (void) E1000_READ_REG(hw
, E1000_PTC127
);
1614 (void) E1000_READ_REG(hw
, E1000_PTC255
);
1615 (void) E1000_READ_REG(hw
, E1000_PTC511
);
1616 (void) E1000_READ_REG(hw
, E1000_PTC1023
);
1617 (void) E1000_READ_REG(hw
, E1000_PTC1522
);
1619 (void) E1000_READ_REG(hw
, E1000_ALGNERRC
);
1620 (void) E1000_READ_REG(hw
, E1000_RXERRC
);
1621 (void) E1000_READ_REG(hw
, E1000_TNCRS
);
1622 (void) E1000_READ_REG(hw
, E1000_CEXTERR
);
1623 (void) E1000_READ_REG(hw
, E1000_TSCTC
);
1624 (void) E1000_READ_REG(hw
, E1000_TSCTFC
);