Merge branch 'upstream-fixes' into upstream
[pandora-kernel.git] / drivers / net / ixgb / ixgb_hw.c
1 /*******************************************************************************
2
3   
4   Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
5   
6   This program is free software; you can redistribute it and/or modify it 
7   under the terms of the GNU General Public License as published by the Free 
8   Software Foundation; either version 2 of the License, or (at your option) 
9   any later version.
10   
11   This program is distributed in the hope that it will be useful, but WITHOUT 
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
14   more details.
15   
16   You should have received a copy of the GNU General Public License along with
17   this program; if not, write to the Free Software Foundation, Inc., 59 
18   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19   
20   The full GNU General Public License is included in this distribution in the
21   file called LICENSE.
22   
23   Contact Information:
24   Linux NICS <linux.nics@intel.com>
25   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27 *******************************************************************************/
28
29 /* ixgb_hw.c
30  * Shared functions for accessing and configuring the adapter
31  */
32
33 #include "ixgb_hw.h"
34 #include "ixgb_ids.h"
35
36 /*  Local function prototypes */
37
38 static uint32_t ixgb_hash_mc_addr(struct ixgb_hw *hw, uint8_t * mc_addr);
39
40 static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value);
41
42 static void ixgb_get_bus_info(struct ixgb_hw *hw);
43
44 static boolean_t ixgb_link_reset(struct ixgb_hw *hw);
45
46 static void ixgb_optics_reset(struct ixgb_hw *hw);
47
48 static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw);
49
50 static void ixgb_clear_hw_cntrs(struct ixgb_hw *hw);
51
52 static void ixgb_clear_vfta(struct ixgb_hw *hw);
53
54 static void ixgb_init_rx_addrs(struct ixgb_hw *hw);
55
56 static uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
57                                   uint32_t reg_address,
58                                   uint32_t phy_address,
59                                   uint32_t device_type);
60
61 static boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
62
63 static boolean_t mac_addr_valid(uint8_t *mac_addr);
64
65 static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
66 {
67         uint32_t ctrl_reg;
68
69         ctrl_reg =  IXGB_CTRL0_RST |
70                                 IXGB_CTRL0_SDP3_DIR |   /* All pins are Output=1 */
71                                 IXGB_CTRL0_SDP2_DIR |
72                                 IXGB_CTRL0_SDP1_DIR |
73                                 IXGB_CTRL0_SDP0_DIR |
74                                 IXGB_CTRL0_SDP3  |   /* Initial value 1101   */
75                                 IXGB_CTRL0_SDP2  |
76                                 IXGB_CTRL0_SDP0;
77
78 #ifdef HP_ZX1
79         /* Workaround for 82597EX reset errata */
80         IXGB_WRITE_REG_IO(hw, CTRL0, ctrl_reg);
81 #else
82         IXGB_WRITE_REG(hw, CTRL0, ctrl_reg);
83 #endif
84
85         /* Delay a few ms just to allow the reset to complete */
86         msec_delay(IXGB_DELAY_AFTER_RESET);
87         ctrl_reg = IXGB_READ_REG(hw, CTRL0);
88 #ifdef DBG
89         /* Make sure the self-clearing global reset bit did self clear */
90         ASSERT(!(ctrl_reg & IXGB_CTRL0_RST));
91 #endif
92
93         if (hw->phy_type == ixgb_phy_type_txn17401) {
94                 ixgb_optics_reset(hw);
95         }
96
97         return ctrl_reg;
98 }
99
100 /******************************************************************************
101  * Reset the transmit and receive units; mask and clear all interrupts.
102  *
103  * hw - Struct containing variables accessed by shared code
104  *****************************************************************************/
105 boolean_t
106 ixgb_adapter_stop(struct ixgb_hw *hw)
107 {
108         uint32_t ctrl_reg;
109         uint32_t icr_reg;
110
111         DEBUGFUNC("ixgb_adapter_stop");
112
113         /* If we are stopped or resetting exit gracefully and wait to be
114          * started again before accessing the hardware.
115          */
116         if(hw->adapter_stopped) {
117                 DEBUGOUT("Exiting because the adapter is already stopped!!!\n");
118                 return FALSE;
119         }
120
121         /* Set the Adapter Stopped flag so other driver functions stop
122          * touching the Hardware.
123          */
124         hw->adapter_stopped = TRUE;
125
126         /* Clear interrupt mask to stop board from generating interrupts */
127         DEBUGOUT("Masking off all interrupts\n");
128         IXGB_WRITE_REG(hw, IMC, 0xFFFFFFFF);
129
130         /* Disable the Transmit and Receive units.  Then delay to allow
131          * any pending transactions to complete before we hit the MAC with
132          * the global reset.
133          */
134         IXGB_WRITE_REG(hw, RCTL, IXGB_READ_REG(hw, RCTL) & ~IXGB_RCTL_RXEN);
135         IXGB_WRITE_REG(hw, TCTL, IXGB_READ_REG(hw, TCTL) & ~IXGB_TCTL_TXEN);
136         msec_delay(IXGB_DELAY_BEFORE_RESET);
137
138         /* Issue a global reset to the MAC.  This will reset the chip's
139          * transmit, receive, DMA, and link units.  It will not effect
140          * the current PCI configuration.  The global reset bit is self-
141          * clearing, and should clear within a microsecond.
142          */
143         DEBUGOUT("Issuing a global reset to MAC\n");
144
145         ctrl_reg = ixgb_mac_reset(hw);
146
147         /* Clear interrupt mask to stop board from generating interrupts */
148         DEBUGOUT("Masking off all interrupts\n");
149         IXGB_WRITE_REG(hw, IMC, 0xffffffff);
150
151         /* Clear any pending interrupt events. */
152         icr_reg = IXGB_READ_REG(hw, ICR);
153
154         return (ctrl_reg & IXGB_CTRL0_RST);
155 }
156
157
158 /******************************************************************************
159  * Identifies the vendor of the optics module on the adapter.  The SR adapters
160  * support two different types of XPAK optics, so it is necessary to determine
161  * which optics are present before applying any optics-specific workarounds.
162  *
163  * hw - Struct containing variables accessed by shared code.
164  *
165  * Returns: the vendor of the XPAK optics module.
166  *****************************************************************************/
167 static ixgb_xpak_vendor
168 ixgb_identify_xpak_vendor(struct ixgb_hw *hw)
169 {
170         uint32_t i;
171         uint16_t vendor_name[5];
172         ixgb_xpak_vendor xpak_vendor;
173
174         DEBUGFUNC("ixgb_identify_xpak_vendor");
175
176         /* Read the first few bytes of the vendor string from the XPAK NVR
177          * registers.  These are standard XENPAK/XPAK registers, so all XPAK
178          * devices should implement them. */
179         for (i = 0; i < 5; i++) {
180                 vendor_name[i] = ixgb_read_phy_reg(hw,
181                                                    MDIO_PMA_PMD_XPAK_VENDOR_NAME
182                                                    + i, IXGB_PHY_ADDRESS,
183                                                    MDIO_PMA_PMD_DID);
184         }
185
186         /* Determine the actual vendor */
187         if (vendor_name[0] == 'I' &&
188             vendor_name[1] == 'N' &&
189             vendor_name[2] == 'T' &&
190             vendor_name[3] == 'E' && vendor_name[4] == 'L') {
191                 xpak_vendor = ixgb_xpak_vendor_intel;
192         } else {
193                 xpak_vendor = ixgb_xpak_vendor_infineon;
194         }
195
196         return (xpak_vendor);
197 }
198
199 /******************************************************************************
200  * Determine the physical layer module on the adapter.
201  *
202  * hw - Struct containing variables accessed by shared code.  The device_id
203  *      field must be (correctly) populated before calling this routine.
204  *
205  * Returns: the phy type of the adapter.
206  *****************************************************************************/
207 static ixgb_phy_type
208 ixgb_identify_phy(struct ixgb_hw *hw)
209 {
210         ixgb_phy_type phy_type;
211         ixgb_xpak_vendor xpak_vendor;
212
213         DEBUGFUNC("ixgb_identify_phy");
214
215         /* Infer the transceiver/phy type from the device id */
216         switch (hw->device_id) {
217         case IXGB_DEVICE_ID_82597EX:
218                 DEBUGOUT("Identified TXN17401 optics\n");
219                 phy_type = ixgb_phy_type_txn17401;
220                 break;
221
222         case IXGB_DEVICE_ID_82597EX_SR:
223                 /* The SR adapters carry two different types of XPAK optics
224                  * modules; read the vendor identifier to determine the exact
225                  * type of optics. */
226                 xpak_vendor = ixgb_identify_xpak_vendor(hw);
227                 if (xpak_vendor == ixgb_xpak_vendor_intel) {
228                         DEBUGOUT("Identified TXN17201 optics\n");
229                         phy_type = ixgb_phy_type_txn17201;
230                 } else {
231                         DEBUGOUT("Identified G6005 optics\n");
232                         phy_type = ixgb_phy_type_g6005;
233                 }
234                 break;
235         case IXGB_DEVICE_ID_82597EX_LR:
236                 DEBUGOUT("Identified G6104 optics\n");
237                 phy_type = ixgb_phy_type_g6104;
238                 break;
239         default:
240                 DEBUGOUT("Unknown physical layer module\n");
241                 phy_type = ixgb_phy_type_unknown;
242                 break;
243         }
244
245         return (phy_type);
246 }
247
248 /******************************************************************************
249  * Performs basic configuration of the adapter.
250  *
251  * hw - Struct containing variables accessed by shared code
252  *
253  * Resets the controller.
254  * Reads and validates the EEPROM.
255  * Initializes the receive address registers.
256  * Initializes the multicast table.
257  * Clears all on-chip counters.
258  * Calls routine to setup flow control settings.
259  * Leaves the transmit and receive units disabled and uninitialized.
260  *
261  * Returns:
262  *      TRUE if successful,
263  *      FALSE if unrecoverable problems were encountered.
264  *****************************************************************************/
265 boolean_t
266 ixgb_init_hw(struct ixgb_hw *hw)
267 {
268         uint32_t i;
269         uint32_t ctrl_reg;
270         boolean_t status;
271
272         DEBUGFUNC("ixgb_init_hw");
273
274         /* Issue a global reset to the MAC.  This will reset the chip's
275          * transmit, receive, DMA, and link units.  It will not effect
276          * the current PCI configuration.  The global reset bit is self-
277          * clearing, and should clear within a microsecond.
278          */
279         DEBUGOUT("Issuing a global reset to MAC\n");
280
281         ctrl_reg = ixgb_mac_reset(hw);
282
283         DEBUGOUT("Issuing an EE reset to MAC\n");
284 #ifdef HP_ZX1
285         /* Workaround for 82597EX reset errata */
286         IXGB_WRITE_REG_IO(hw, CTRL1, IXGB_CTRL1_EE_RST);
287 #else
288         IXGB_WRITE_REG(hw, CTRL1, IXGB_CTRL1_EE_RST);
289 #endif
290
291         /* Delay a few ms just to allow the reset to complete */
292         msec_delay(IXGB_DELAY_AFTER_EE_RESET);
293
294         if (ixgb_get_eeprom_data(hw) == FALSE) {
295                 return(FALSE);
296         }
297
298         /* Use the device id to determine the type of phy/transceiver. */
299         hw->device_id = ixgb_get_ee_device_id(hw);
300         hw->phy_type = ixgb_identify_phy(hw);
301
302         /* Setup the receive addresses.
303          * Receive Address Registers (RARs 0 - 15).
304          */
305         ixgb_init_rx_addrs(hw);
306
307         /*
308          * Check that a valid MAC address has been set.
309          * If it is not valid, we fail hardware init.
310          */
311         if (!mac_addr_valid(hw->curr_mac_addr)) {
312                 DEBUGOUT("MAC address invalid after ixgb_init_rx_addrs\n");
313                 return(FALSE);
314         }
315
316         /* tell the routines in this file they can access hardware again */
317         hw->adapter_stopped = FALSE;
318
319         /* Fill in the bus_info structure */
320         ixgb_get_bus_info(hw);
321
322         /* Zero out the Multicast HASH table */
323         DEBUGOUT("Zeroing the MTA\n");
324         for(i = 0; i < IXGB_MC_TBL_SIZE; i++)
325                 IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0);
326
327         /* Zero out the VLAN Filter Table Array */
328         ixgb_clear_vfta(hw);
329
330         /* Zero all of the hardware counters */
331         ixgb_clear_hw_cntrs(hw);
332
333         /* Call a subroutine to setup flow control. */
334         status = ixgb_setup_fc(hw);
335
336         /* 82597EX errata: Call check-for-link in case lane deskew is locked */
337         ixgb_check_for_link(hw);
338
339         return (status);
340 }
341
342 /******************************************************************************
343  * Initializes receive address filters.
344  *
345  * hw - Struct containing variables accessed by shared code
346  *
347  * Places the MAC address in receive address register 0 and clears the rest
348  * of the receive addresss registers. Clears the multicast table. Assumes
349  * the receiver is in reset when the routine is called.
350  *****************************************************************************/
351 static void
352 ixgb_init_rx_addrs(struct ixgb_hw *hw)
353 {
354         uint32_t i;
355
356         DEBUGFUNC("ixgb_init_rx_addrs");
357
358         /*
359          * If the current mac address is valid, assume it is a software override
360          * to the permanent address.
361          * Otherwise, use the permanent address from the eeprom.
362          */
363         if (!mac_addr_valid(hw->curr_mac_addr)) {
364
365                 /* Get the MAC address from the eeprom for later reference */
366                 ixgb_get_ee_mac_addr(hw, hw->curr_mac_addr);
367
368                 DEBUGOUT3(" Keeping Permanent MAC Addr =%.2X %.2X %.2X ",
369                           hw->curr_mac_addr[0],
370                           hw->curr_mac_addr[1], hw->curr_mac_addr[2]);
371                 DEBUGOUT3("%.2X %.2X %.2X\n",
372                           hw->curr_mac_addr[3],
373                           hw->curr_mac_addr[4], hw->curr_mac_addr[5]);
374         } else {
375
376                 /* Setup the receive address. */
377                 DEBUGOUT("Overriding MAC Address in RAR[0]\n");
378                 DEBUGOUT3(" New MAC Addr =%.2X %.2X %.2X ",
379                           hw->curr_mac_addr[0],
380                           hw->curr_mac_addr[1], hw->curr_mac_addr[2]);
381                 DEBUGOUT3("%.2X %.2X %.2X\n",
382                           hw->curr_mac_addr[3],
383                           hw->curr_mac_addr[4], hw->curr_mac_addr[5]);
384
385                 ixgb_rar_set(hw, hw->curr_mac_addr, 0);
386         }
387
388         /* Zero out the other 15 receive addresses. */
389         DEBUGOUT("Clearing RAR[1-15]\n");
390         for(i = 1; i < IXGB_RAR_ENTRIES; i++) {
391                 IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
392                 IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
393         }
394
395         return;
396 }
397
398 /******************************************************************************
399  * Updates the MAC's list of multicast addresses.
400  *
401  * hw - Struct containing variables accessed by shared code
402  * mc_addr_list - the list of new multicast addresses
403  * mc_addr_count - number of addresses
404  * pad - number of bytes between addresses in the list
405  *
406  * The given list replaces any existing list. Clears the last 15 receive
407  * address registers and the multicast table. Uses receive address registers
408  * for the first 15 multicast addresses, and hashes the rest into the
409  * multicast table.
410  *****************************************************************************/
411 void
412 ixgb_mc_addr_list_update(struct ixgb_hw *hw,
413                           uint8_t *mc_addr_list,
414                           uint32_t mc_addr_count,
415                           uint32_t pad)
416 {
417         uint32_t hash_value;
418         uint32_t i;
419         uint32_t rar_used_count = 1;            /* RAR[0] is used for our MAC address */
420
421         DEBUGFUNC("ixgb_mc_addr_list_update");
422
423         /* Set the new number of MC addresses that we are being requested to use. */
424         hw->num_mc_addrs = mc_addr_count;
425
426         /* Clear RAR[1-15] */
427         DEBUGOUT(" Clearing RAR[1-15]\n");
428         for(i = rar_used_count; i < IXGB_RAR_ENTRIES; i++) {
429                 IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
430                 IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
431         }
432
433         /* Clear the MTA */
434         DEBUGOUT(" Clearing MTA\n");
435         for(i = 0; i < IXGB_MC_TBL_SIZE; i++) {
436                 IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0);
437         }
438
439         /* Add the new addresses */
440         for(i = 0; i < mc_addr_count; i++) {
441                 DEBUGOUT(" Adding the multicast addresses:\n");
442                 DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i,
443                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)],
444                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
445                                        1],
446                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
447                                        2],
448                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
449                                        3],
450                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
451                                        4],
452                           mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad) +
453                                        5]);
454
455                 /* Place this multicast address in the RAR if there is room, *
456                  * else put it in the MTA
457                  */
458                 if(rar_used_count < IXGB_RAR_ENTRIES) {
459                         ixgb_rar_set(hw,
460                                      mc_addr_list +
461                                      (i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)),
462                                      rar_used_count);
463                         DEBUGOUT1("Added a multicast address to RAR[%d]\n", i);
464                         rar_used_count++;
465                 } else {
466                         hash_value = ixgb_hash_mc_addr(hw,
467                                                        mc_addr_list +
468                                                        (i *
469                                                         (IXGB_ETH_LENGTH_OF_ADDRESS
470                                                          + pad)));
471
472                         DEBUGOUT1(" Hash value = 0x%03X\n", hash_value);
473
474                         ixgb_mta_set(hw, hash_value);
475                 }
476         }
477
478         DEBUGOUT("MC Update Complete\n");
479         return;
480 }
481
482 /******************************************************************************
483  * Hashes an address to determine its location in the multicast table
484  *
485  * hw - Struct containing variables accessed by shared code
486  * mc_addr - the multicast address to hash
487  *
488  * Returns:
489  *      The hash value
490  *****************************************************************************/
491 static uint32_t
492 ixgb_hash_mc_addr(struct ixgb_hw *hw,
493                    uint8_t *mc_addr)
494 {
495         uint32_t hash_value = 0;
496
497         DEBUGFUNC("ixgb_hash_mc_addr");
498
499         /* The portion of the address that is used for the hash table is
500          * determined by the mc_filter_type setting.
501          */
502         switch (hw->mc_filter_type) {
503                 /* [0] [1] [2] [3] [4] [5]
504                  * 01  AA  00  12  34  56
505                  * LSB                 MSB - According to H/W docs */
506         case 0:
507                 /* [47:36] i.e. 0x563 for above example address */
508                 hash_value =
509                     ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4));
510                 break;
511         case 1:         /* [46:35] i.e. 0xAC6 for above example address */
512                 hash_value =
513                     ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5));
514                 break;
515         case 2:         /* [45:34] i.e. 0x5D8 for above example address */
516                 hash_value =
517                     ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6));
518                 break;
519         case 3:         /* [43:32] i.e. 0x634 for above example address */
520                 hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8));
521                 break;
522         default:
523                 /* Invalid mc_filter_type, what should we do? */
524                 DEBUGOUT("MC filter type param set incorrectly\n");
525                 ASSERT(0);
526                 break;
527         }
528
529         hash_value &= 0xFFF;
530         return (hash_value);
531 }
532
533 /******************************************************************************
534  * Sets the bit in the multicast table corresponding to the hash value.
535  *
536  * hw - Struct containing variables accessed by shared code
537  * hash_value - Multicast address hash value
538  *****************************************************************************/
539 static void
540 ixgb_mta_set(struct ixgb_hw *hw,
541                   uint32_t hash_value)
542 {
543         uint32_t hash_bit, hash_reg;
544         uint32_t mta_reg;
545
546         /* The MTA is a register array of 128 32-bit registers.
547          * It is treated like an array of 4096 bits.  We want to set
548          * bit BitArray[hash_value]. So we figure out what register
549          * the bit is in, read it, OR in the new bit, then write
550          * back the new value.  The register is determined by the
551          * upper 7 bits of the hash value and the bit within that
552          * register are determined by the lower 5 bits of the value.
553          */
554         hash_reg = (hash_value >> 5) & 0x7F;
555         hash_bit = hash_value & 0x1F;
556
557         mta_reg = IXGB_READ_REG_ARRAY(hw, MTA, hash_reg);
558
559         mta_reg |= (1 << hash_bit);
560
561         IXGB_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta_reg);
562
563         return;
564 }
565
566 /******************************************************************************
567  * Puts an ethernet address into a receive address register.
568  *
569  * hw - Struct containing variables accessed by shared code
570  * addr - Address to put into receive address register
571  * index - Receive address register to write
572  *****************************************************************************/
573 void
574 ixgb_rar_set(struct ixgb_hw *hw,
575                   uint8_t *addr,
576                   uint32_t index)
577 {
578         uint32_t rar_low, rar_high;
579
580         DEBUGFUNC("ixgb_rar_set");
581
582         /* HW expects these in little endian so we reverse the byte order
583          * from network order (big endian) to little endian
584          */
585         rar_low = ((uint32_t) addr[0] |
586                    ((uint32_t)addr[1] << 8) |
587                    ((uint32_t)addr[2] << 16) |
588                    ((uint32_t)addr[3] << 24));
589
590         rar_high = ((uint32_t) addr[4] |
591                         ((uint32_t)addr[5] << 8) |
592                         IXGB_RAH_AV);
593
594         IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
595         IXGB_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high);
596         return;
597 }
598
599 /******************************************************************************
600  * Writes a value to the specified offset in the VLAN filter table.
601  *
602  * hw - Struct containing variables accessed by shared code
603  * offset - Offset in VLAN filer table to write
604  * value - Value to write into VLAN filter table
605  *****************************************************************************/
606 void
607 ixgb_write_vfta(struct ixgb_hw *hw,
608                  uint32_t offset,
609                  uint32_t value)
610 {
611         IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value);
612         return;
613 }
614
615 /******************************************************************************
616  * Clears the VLAN filer table
617  *
618  * hw - Struct containing variables accessed by shared code
619  *****************************************************************************/
620 static void
621 ixgb_clear_vfta(struct ixgb_hw *hw)
622 {
623         uint32_t offset;
624
625         for(offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++)
626                 IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
627         return;
628 }
629
630 /******************************************************************************
631  * Configures the flow control settings based on SW configuration.
632  *
633  * hw - Struct containing variables accessed by shared code
634  *****************************************************************************/
635
636 static boolean_t
637 ixgb_setup_fc(struct ixgb_hw *hw)
638 {
639         uint32_t ctrl_reg;
640         uint32_t pap_reg = 0;   /* by default, assume no pause time */
641         boolean_t status = TRUE;
642
643         DEBUGFUNC("ixgb_setup_fc");
644
645         /* Get the current control reg 0 settings */
646         ctrl_reg = IXGB_READ_REG(hw, CTRL0);
647
648         /* Clear the Receive Pause Enable and Transmit Pause Enable bits */
649         ctrl_reg &= ~(IXGB_CTRL0_RPE | IXGB_CTRL0_TPE);
650
651         /* The possible values of the "flow_control" parameter are:
652          *      0:  Flow control is completely disabled
653          *      1:  Rx flow control is enabled (we can receive pause frames
654          *          but not send pause frames).
655          *      2:  Tx flow control is enabled (we can send pause frames
656          *          but we do not support receiving pause frames).
657          *      3:  Both Rx and TX flow control (symmetric) are enabled.
658          *  other:  Invalid.
659          */
660         switch (hw->fc.type) {
661         case ixgb_fc_none:      /* 0 */
662                 /* Set CMDC bit to disable Rx Flow control */
663                 ctrl_reg |= (IXGB_CTRL0_CMDC);
664                 break;
665         case ixgb_fc_rx_pause:  /* 1 */
666                 /* RX Flow control is enabled, and TX Flow control is
667                  * disabled.
668                  */
669                 ctrl_reg |= (IXGB_CTRL0_RPE);
670                 break;
671         case ixgb_fc_tx_pause:  /* 2 */
672                 /* TX Flow control is enabled, and RX Flow control is
673                  * disabled, by a software over-ride.
674                  */
675                 ctrl_reg |= (IXGB_CTRL0_TPE);
676                 pap_reg = hw->fc.pause_time;
677                 break;
678         case ixgb_fc_full:      /* 3 */
679                 /* Flow control (both RX and TX) is enabled by a software
680                  * over-ride.
681                  */
682                 ctrl_reg |= (IXGB_CTRL0_RPE | IXGB_CTRL0_TPE);
683                 pap_reg = hw->fc.pause_time;
684                 break;
685         default:
686                 /* We should never get here.  The value should be 0-3. */
687                 DEBUGOUT("Flow control param set incorrectly\n");
688                 ASSERT(0);
689                 break;
690         }
691
692         /* Write the new settings */
693         IXGB_WRITE_REG(hw, CTRL0, ctrl_reg);
694
695         if (pap_reg != 0) {
696                 IXGB_WRITE_REG(hw, PAP, pap_reg);
697         }
698
699         /* Set the flow control receive threshold registers.  Normally,
700          * these registers will be set to a default threshold that may be
701          * adjusted later by the driver's runtime code.  However, if the
702          * ability to transmit pause frames in not enabled, then these
703          * registers will be set to 0.
704          */
705         if(!(hw->fc.type & ixgb_fc_tx_pause)) {
706                 IXGB_WRITE_REG(hw, FCRTL, 0);
707                 IXGB_WRITE_REG(hw, FCRTH, 0);
708         } else {
709            /* We need to set up the Receive Threshold high and low water
710             * marks as well as (optionally) enabling the transmission of XON
711             * frames. */
712                 if(hw->fc.send_xon) {
713                         IXGB_WRITE_REG(hw, FCRTL,
714                                 (hw->fc.low_water | IXGB_FCRTL_XONE));
715                 } else {
716                         IXGB_WRITE_REG(hw, FCRTL, hw->fc.low_water);
717                 }
718                 IXGB_WRITE_REG(hw, FCRTH, hw->fc.high_water);
719         }
720         return (status);
721 }
722
723 /******************************************************************************
724  * Reads a word from a device over the Management Data Interface (MDI) bus.
725  * This interface is used to manage Physical layer devices.
726  *
727  * hw          - Struct containing variables accessed by hw code
728  * reg_address - Offset of device register being read.
729  * phy_address - Address of device on MDI.
730  *
731  * Returns:  Data word (16 bits) from MDI device.
732  *
733  * The 82597EX has support for several MDI access methods.  This routine
734  * uses the new protocol MDI Single Command and Address Operation.
735  * This requires that first an address cycle command is sent, followed by a
736  * read command.
737  *****************************************************************************/
738 static uint16_t
739 ixgb_read_phy_reg(struct ixgb_hw *hw,
740                 uint32_t reg_address,
741                 uint32_t phy_address,
742                 uint32_t device_type)
743 {
744         uint32_t i;
745         uint32_t data;
746         uint32_t command = 0;
747
748         ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
749         ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
750         ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE);
751
752         /* Setup and write the address cycle command */
753         command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) |
754                    (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) |
755                    (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) |
756                    (IXGB_MSCA_ADDR_CYCLE | IXGB_MSCA_MDI_COMMAND));
757
758         IXGB_WRITE_REG(hw, MSCA, command);
759
760     /**************************************************************
761     ** Check every 10 usec to see if the address cycle completed
762     ** The COMMAND bit will clear when the operation is complete.
763     ** This may take as long as 64 usecs (we'll wait 100 usecs max)
764     ** from the CPU Write to the Ready bit assertion.
765     **************************************************************/
766
767         for(i = 0; i < 10; i++)
768         {
769                 udelay(10);
770
771                 command = IXGB_READ_REG(hw, MSCA);
772
773                 if ((command & IXGB_MSCA_MDI_COMMAND) == 0)
774                         break;
775         }
776
777         ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0);
778
779         /* Address cycle complete, setup and write the read command */
780         command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) |
781                    (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) |
782                    (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) |
783                    (IXGB_MSCA_READ | IXGB_MSCA_MDI_COMMAND));
784
785         IXGB_WRITE_REG(hw, MSCA, command);
786
787     /**************************************************************
788     ** Check every 10 usec to see if the read command completed
789     ** The COMMAND bit will clear when the operation is complete.
790     ** The read may take as long as 64 usecs (we'll wait 100 usecs max)
791     ** from the CPU Write to the Ready bit assertion.
792     **************************************************************/
793
794         for(i = 0; i < 10; i++)
795         {
796                 udelay(10);
797
798                 command = IXGB_READ_REG(hw, MSCA);
799
800                 if ((command & IXGB_MSCA_MDI_COMMAND) == 0)
801                         break;
802         }
803
804         ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0);
805
806         /* Operation is complete, get the data from the MDIO Read/Write Data
807          * register and return.
808          */
809         data = IXGB_READ_REG(hw, MSRWD);
810         data >>= IXGB_MSRWD_READ_DATA_SHIFT;
811         return((uint16_t) data);
812 }
813
814 /******************************************************************************
815  * Writes a word to a device over the Management Data Interface (MDI) bus.
816  * This interface is used to manage Physical layer devices.
817  *
818  * hw          - Struct containing variables accessed by hw code
819  * reg_address - Offset of device register being read.
820  * phy_address - Address of device on MDI.
821  * device_type - Also known as the Device ID or DID.
822  * data        - 16-bit value to be written
823  *
824  * Returns:  void.
825  *
826  * The 82597EX has support for several MDI access methods.  This routine
827  * uses the new protocol MDI Single Command and Address Operation.
828  * This requires that first an address cycle command is sent, followed by a
829  * write command.
830  *****************************************************************************/
831 static void
832 ixgb_write_phy_reg(struct ixgb_hw *hw,
833                         uint32_t reg_address,
834                         uint32_t phy_address,
835                         uint32_t device_type,
836                         uint16_t data)
837 {
838         uint32_t i;
839         uint32_t command = 0;
840
841         ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
842         ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
843         ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE);
844
845         /* Put the data in the MDIO Read/Write Data register */
846         IXGB_WRITE_REG(hw, MSRWD, (uint32_t)data);
847
848         /* Setup and write the address cycle command */
849         command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT)  |
850                            (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) |
851                            (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) |
852                            (IXGB_MSCA_ADDR_CYCLE | IXGB_MSCA_MDI_COMMAND));
853
854         IXGB_WRITE_REG(hw, MSCA, command);
855
856         /**************************************************************
857         ** Check every 10 usec to see if the address cycle completed
858         ** The COMMAND bit will clear when the operation is complete.
859         ** This may take as long as 64 usecs (we'll wait 100 usecs max)
860         ** from the CPU Write to the Ready bit assertion.
861         **************************************************************/
862
863         for(i = 0; i < 10; i++)
864         {
865                 udelay(10);
866
867                 command = IXGB_READ_REG(hw, MSCA);
868
869                 if ((command & IXGB_MSCA_MDI_COMMAND) == 0)
870                         break;
871         }
872
873         ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0);
874
875         /* Address cycle complete, setup and write the write command */
876         command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT)  |
877                            (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) |
878                            (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) |
879                            (IXGB_MSCA_WRITE | IXGB_MSCA_MDI_COMMAND));
880
881         IXGB_WRITE_REG(hw, MSCA, command);
882
883         /**************************************************************
884         ** Check every 10 usec to see if the read command completed
885         ** The COMMAND bit will clear when the operation is complete.
886         ** The write may take as long as 64 usecs (we'll wait 100 usecs max)
887         ** from the CPU Write to the Ready bit assertion.
888         **************************************************************/
889
890         for(i = 0; i < 10; i++)
891         {
892                 udelay(10);
893
894                 command = IXGB_READ_REG(hw, MSCA);
895
896                 if ((command & IXGB_MSCA_MDI_COMMAND) == 0)
897                         break;
898         }
899
900         ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0);
901
902         /* Operation is complete, return. */
903 }
904
905 /******************************************************************************
906  * Checks to see if the link status of the hardware has changed.
907  *
908  * hw - Struct containing variables accessed by hw code
909  *
910  * Called by any function that needs to check the link status of the adapter.
911  *****************************************************************************/
912 void
913 ixgb_check_for_link(struct ixgb_hw *hw)
914 {
915         uint32_t status_reg;
916         uint32_t xpcss_reg;
917
918         DEBUGFUNC("ixgb_check_for_link");
919
920         xpcss_reg = IXGB_READ_REG(hw, XPCSS);
921         status_reg = IXGB_READ_REG(hw, STATUS);
922
923         if ((xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
924             (status_reg & IXGB_STATUS_LU)) {
925                 hw->link_up = TRUE;
926         } else if (!(xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
927                    (status_reg & IXGB_STATUS_LU)) {
928                 DEBUGOUT("XPCSS Not Aligned while Status:LU is set.\n");
929                 hw->link_up = ixgb_link_reset(hw);
930         } else {
931                 /*
932                  * 82597EX errata.  Since the lane deskew problem may prevent
933                  * link, reset the link before reporting link down.
934                  */
935                 hw->link_up = ixgb_link_reset(hw);
936         }
937         /*  Anything else for 10 Gig?? */
938 }
939
940 /******************************************************************************
941  * Check for a bad link condition that may have occured.
942  * The indication is that the RFC / LFC registers may be incrementing
943  * continually.  A full adapter reset is required to recover.
944  *
945  * hw - Struct containing variables accessed by hw code
946  *
947  * Called by any function that needs to check the link status of the adapter.
948  *****************************************************************************/
949 boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
950 {
951         uint32_t newLFC, newRFC;
952         boolean_t bad_link_returncode = FALSE;
953
954         if (hw->phy_type == ixgb_phy_type_txn17401) {
955                 newLFC = IXGB_READ_REG(hw, LFC);
956                 newRFC = IXGB_READ_REG(hw, RFC);
957                 if ((hw->lastLFC + 250 < newLFC)
958                     || (hw->lastRFC + 250 < newRFC)) {
959                         DEBUGOUT
960                             ("BAD LINK! too many LFC/RFC since last check\n");
961                         bad_link_returncode = TRUE;
962                 }
963                 hw->lastLFC = newLFC;
964                 hw->lastRFC = newRFC;
965         }
966
967         return bad_link_returncode;
968 }
969
970 /******************************************************************************
971  * Clears all hardware statistics counters.
972  *
973  * hw - Struct containing variables accessed by shared code
974  *****************************************************************************/
975 static void
976 ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
977 {
978         volatile uint32_t temp_reg;
979
980         DEBUGFUNC("ixgb_clear_hw_cntrs");
981
982         /* if we are stopped or resetting exit gracefully */
983         if(hw->adapter_stopped) {
984                 DEBUGOUT("Exiting because the adapter is stopped!!!\n");
985                 return;
986         }
987
988         temp_reg = IXGB_READ_REG(hw, TPRL);
989         temp_reg = IXGB_READ_REG(hw, TPRH);
990         temp_reg = IXGB_READ_REG(hw, GPRCL);
991         temp_reg = IXGB_READ_REG(hw, GPRCH);
992         temp_reg = IXGB_READ_REG(hw, BPRCL);
993         temp_reg = IXGB_READ_REG(hw, BPRCH);
994         temp_reg = IXGB_READ_REG(hw, MPRCL);
995         temp_reg = IXGB_READ_REG(hw, MPRCH);
996         temp_reg = IXGB_READ_REG(hw, UPRCL);
997         temp_reg = IXGB_READ_REG(hw, UPRCH);
998         temp_reg = IXGB_READ_REG(hw, VPRCL);
999         temp_reg = IXGB_READ_REG(hw, VPRCH);
1000         temp_reg = IXGB_READ_REG(hw, JPRCL);
1001         temp_reg = IXGB_READ_REG(hw, JPRCH);
1002         temp_reg = IXGB_READ_REG(hw, GORCL);
1003         temp_reg = IXGB_READ_REG(hw, GORCH);
1004         temp_reg = IXGB_READ_REG(hw, TORL);
1005         temp_reg = IXGB_READ_REG(hw, TORH);
1006         temp_reg = IXGB_READ_REG(hw, RNBC);
1007         temp_reg = IXGB_READ_REG(hw, RUC);
1008         temp_reg = IXGB_READ_REG(hw, ROC);
1009         temp_reg = IXGB_READ_REG(hw, RLEC);
1010         temp_reg = IXGB_READ_REG(hw, CRCERRS);
1011         temp_reg = IXGB_READ_REG(hw, ICBC);
1012         temp_reg = IXGB_READ_REG(hw, ECBC);
1013         temp_reg = IXGB_READ_REG(hw, MPC);
1014         temp_reg = IXGB_READ_REG(hw, TPTL);
1015         temp_reg = IXGB_READ_REG(hw, TPTH);
1016         temp_reg = IXGB_READ_REG(hw, GPTCL);
1017         temp_reg = IXGB_READ_REG(hw, GPTCH);
1018         temp_reg = IXGB_READ_REG(hw, BPTCL);
1019         temp_reg = IXGB_READ_REG(hw, BPTCH);
1020         temp_reg = IXGB_READ_REG(hw, MPTCL);
1021         temp_reg = IXGB_READ_REG(hw, MPTCH);
1022         temp_reg = IXGB_READ_REG(hw, UPTCL);
1023         temp_reg = IXGB_READ_REG(hw, UPTCH);
1024         temp_reg = IXGB_READ_REG(hw, VPTCL);
1025         temp_reg = IXGB_READ_REG(hw, VPTCH);
1026         temp_reg = IXGB_READ_REG(hw, JPTCL);
1027         temp_reg = IXGB_READ_REG(hw, JPTCH);
1028         temp_reg = IXGB_READ_REG(hw, GOTCL);
1029         temp_reg = IXGB_READ_REG(hw, GOTCH);
1030         temp_reg = IXGB_READ_REG(hw, TOTL);
1031         temp_reg = IXGB_READ_REG(hw, TOTH);
1032         temp_reg = IXGB_READ_REG(hw, DC);
1033         temp_reg = IXGB_READ_REG(hw, PLT64C);
1034         temp_reg = IXGB_READ_REG(hw, TSCTC);
1035         temp_reg = IXGB_READ_REG(hw, TSCTFC);
1036         temp_reg = IXGB_READ_REG(hw, IBIC);
1037         temp_reg = IXGB_READ_REG(hw, RFC);
1038         temp_reg = IXGB_READ_REG(hw, LFC);
1039         temp_reg = IXGB_READ_REG(hw, PFRC);
1040         temp_reg = IXGB_READ_REG(hw, PFTC);
1041         temp_reg = IXGB_READ_REG(hw, MCFRC);
1042         temp_reg = IXGB_READ_REG(hw, MCFTC);
1043         temp_reg = IXGB_READ_REG(hw, XONRXC);
1044         temp_reg = IXGB_READ_REG(hw, XONTXC);
1045         temp_reg = IXGB_READ_REG(hw, XOFFRXC);
1046         temp_reg = IXGB_READ_REG(hw, XOFFTXC);
1047         temp_reg = IXGB_READ_REG(hw, RJC);
1048         return;
1049 }
1050
1051 /******************************************************************************
1052  * Turns on the software controllable LED
1053  *
1054  * hw - Struct containing variables accessed by shared code
1055  *****************************************************************************/
1056 void
1057 ixgb_led_on(struct ixgb_hw *hw)
1058 {
1059         uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
1060
1061         /* To turn on the LED, clear software-definable pin 0 (SDP0). */
1062         ctrl0_reg &= ~IXGB_CTRL0_SDP0;
1063         IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg);
1064         return;
1065 }
1066
1067 /******************************************************************************
1068  * Turns off the software controllable LED
1069  *
1070  * hw - Struct containing variables accessed by shared code
1071  *****************************************************************************/
1072 void
1073 ixgb_led_off(struct ixgb_hw *hw)
1074 {
1075         uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
1076
1077         /* To turn off the LED, set software-definable pin 0 (SDP0). */
1078         ctrl0_reg |= IXGB_CTRL0_SDP0;
1079         IXGB_WRITE_REG(hw, CTRL0, ctrl0_reg);
1080         return;
1081 }
1082
1083 /******************************************************************************
1084  * Gets the current PCI bus type, speed, and width of the hardware
1085  *
1086  * hw - Struct containing variables accessed by shared code
1087  *****************************************************************************/
1088 static void
1089 ixgb_get_bus_info(struct ixgb_hw *hw)
1090 {
1091         uint32_t status_reg;
1092
1093         status_reg = IXGB_READ_REG(hw, STATUS);
1094
1095         hw->bus.type = (status_reg & IXGB_STATUS_PCIX_MODE) ?
1096                 ixgb_bus_type_pcix : ixgb_bus_type_pci;
1097
1098         if (hw->bus.type == ixgb_bus_type_pci) {
1099                 hw->bus.speed = (status_reg & IXGB_STATUS_PCI_SPD) ?
1100                         ixgb_bus_speed_66 : ixgb_bus_speed_33;
1101         } else {
1102                 switch (status_reg & IXGB_STATUS_PCIX_SPD_MASK) {
1103                 case IXGB_STATUS_PCIX_SPD_66:
1104                         hw->bus.speed = ixgb_bus_speed_66;
1105                         break;
1106                 case IXGB_STATUS_PCIX_SPD_100:
1107                         hw->bus.speed = ixgb_bus_speed_100;
1108                         break;
1109                 case IXGB_STATUS_PCIX_SPD_133:
1110                         hw->bus.speed = ixgb_bus_speed_133;
1111                         break;
1112                 default:
1113                         hw->bus.speed = ixgb_bus_speed_reserved;
1114                         break;
1115                 }
1116         }
1117
1118         hw->bus.width = (status_reg & IXGB_STATUS_BUS64) ?
1119                 ixgb_bus_width_64 : ixgb_bus_width_32;
1120
1121         return;
1122 }
1123
1124 /******************************************************************************
1125  * Tests a MAC address to ensure it is a valid Individual Address
1126  *
1127  * mac_addr - pointer to MAC address.
1128  *
1129  *****************************************************************************/
1130 static boolean_t
1131 mac_addr_valid(uint8_t *mac_addr)
1132 {
1133         boolean_t is_valid = TRUE;
1134         DEBUGFUNC("mac_addr_valid");
1135
1136         /* Make sure it is not a multicast address */
1137         if (IS_MULTICAST(mac_addr)) {
1138                 DEBUGOUT("MAC address is multicast\n");
1139                 is_valid = FALSE;
1140         }
1141         /* Not a broadcast address */
1142         else if (IS_BROADCAST(mac_addr)) {
1143                 DEBUGOUT("MAC address is broadcast\n");
1144                 is_valid = FALSE;
1145         }
1146         /* Reject the zero address */
1147         else if (mac_addr[0] == 0 &&
1148                          mac_addr[1] == 0 &&
1149                          mac_addr[2] == 0 &&
1150                          mac_addr[3] == 0 &&
1151                          mac_addr[4] == 0 &&
1152                          mac_addr[5] == 0) {
1153                 DEBUGOUT("MAC address is all zeros\n");
1154                 is_valid = FALSE;
1155         }
1156         return (is_valid);
1157 }
1158
1159 /******************************************************************************
1160  * Resets the 10GbE link.  Waits the settle time and returns the state of
1161  * the link.
1162  *
1163  * hw - Struct containing variables accessed by shared code
1164  *****************************************************************************/
1165 boolean_t
1166 ixgb_link_reset(struct ixgb_hw *hw)
1167 {
1168         boolean_t link_status = FALSE;
1169         uint8_t wait_retries = MAX_RESET_ITERATIONS;
1170         uint8_t lrst_retries = MAX_RESET_ITERATIONS;
1171
1172         do {
1173                 /* Reset the link */
1174                 IXGB_WRITE_REG(hw, CTRL0,
1175                                IXGB_READ_REG(hw, CTRL0) | IXGB_CTRL0_LRST);
1176
1177                 /* Wait for link-up and lane re-alignment */
1178                 do {
1179                         udelay(IXGB_DELAY_USECS_AFTER_LINK_RESET);
1180                         link_status =
1181                             ((IXGB_READ_REG(hw, STATUS) & IXGB_STATUS_LU)
1182                              && (IXGB_READ_REG(hw, XPCSS) &
1183                                  IXGB_XPCSS_ALIGN_STATUS)) ? TRUE : FALSE;
1184                 } while (!link_status && --wait_retries);
1185
1186         } while (!link_status && --lrst_retries);
1187
1188         return link_status;
1189 }
1190
1191 /******************************************************************************
1192  * Resets the 10GbE optics module.
1193  *
1194  * hw - Struct containing variables accessed by shared code
1195  *****************************************************************************/
1196 void
1197 ixgb_optics_reset(struct ixgb_hw *hw)
1198 {
1199         if (hw->phy_type == ixgb_phy_type_txn17401) {
1200                 uint16_t mdio_reg;
1201
1202                 ixgb_write_phy_reg(hw,
1203                                         MDIO_PMA_PMD_CR1,
1204                                         IXGB_PHY_ADDRESS,
1205                                         MDIO_PMA_PMD_DID,
1206                                         MDIO_PMA_PMD_CR1_RESET);
1207
1208                 mdio_reg = ixgb_read_phy_reg( hw,
1209                                                 MDIO_PMA_PMD_CR1,
1210                                                 IXGB_PHY_ADDRESS,
1211                                                 MDIO_PMA_PMD_DID);
1212         }
1213
1214         return;
1215 }