aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/phy.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2008-03-28 12:15:03 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-28 22:14:56 -0400
commitad68076e07fa01bd0c98278a959d0fd2bb26f1ac (patch)
treef0b664ecdb38478f9b995aff10dcb39a09221fb6 /drivers/net/e1000e/phy.c
parent652f093fdf14c7ca1e13c052da429ae385e4dc21 (diff)
e1000e: reformat comment blocks, cosmetic changes only
Adjusting the comment blocks here to be code-style compliant. no code changes. Changed some copyright dates to 2008. Indentation fixes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/e1000e/phy.c')
-rw-r--r--drivers/net/e1000e/phy.c152
1 files changed, 97 insertions, 55 deletions
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index dab3c468a768..a2da1c422354 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2007 Intel Corporation. 4 Copyright(c) 1999 - 2008 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -134,7 +134,8 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
134 return -E1000_ERR_PARAM; 134 return -E1000_ERR_PARAM;
135 } 135 }
136 136
137 /* Set up Op-code, Phy Address, and register offset in the MDI 137 /*
138 * Set up Op-code, Phy Address, and register offset in the MDI
138 * Control register. The MAC will take care of interfacing with the 139 * Control register. The MAC will take care of interfacing with the
139 * PHY to retrieve the desired data. 140 * PHY to retrieve the desired data.
140 */ 141 */
@@ -144,7 +145,11 @@ static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
144 145
145 ew32(MDIC, mdic); 146 ew32(MDIC, mdic);
146 147
147 /* Poll the ready bit to see if the MDI read completed */ 148 /*
149 * Poll the ready bit to see if the MDI read completed
150 * Increasing the time out as testing showed failures with
151 * the lower time out
152 */
148 for (i = 0; i < 64; i++) { 153 for (i = 0; i < 64; i++) {
149 udelay(50); 154 udelay(50);
150 mdic = er32(MDIC); 155 mdic = er32(MDIC);
@@ -182,7 +187,8 @@ static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
182 return -E1000_ERR_PARAM; 187 return -E1000_ERR_PARAM;
183 } 188 }
184 189
185 /* Set up Op-code, Phy Address, and register offset in the MDI 190 /*
191 * Set up Op-code, Phy Address, and register offset in the MDI
186 * Control register. The MAC will take care of interfacing with the 192 * Control register. The MAC will take care of interfacing with the
187 * PHY to retrieve the desired data. 193 * PHY to retrieve the desired data.
188 */ 194 */
@@ -409,14 +415,15 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
409 s32 ret_val; 415 s32 ret_val;
410 u16 phy_data; 416 u16 phy_data;
411 417
412 /* Enable CRS on TX. This must be set for half-duplex operation. */ 418 /* Enable CRS on Tx. This must be set for half-duplex operation. */
413 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 419 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
414 if (ret_val) 420 if (ret_val)
415 return ret_val; 421 return ret_val;
416 422
417 phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; 423 phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
418 424
419 /* Options: 425 /*
426 * Options:
420 * MDI/MDI-X = 0 (default) 427 * MDI/MDI-X = 0 (default)
421 * 0 - Auto for all speeds 428 * 0 - Auto for all speeds
422 * 1 - MDI mode 429 * 1 - MDI mode
@@ -441,7 +448,8 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
441 break; 448 break;
442 } 449 }
443 450
444 /* Options: 451 /*
452 * Options:
445 * disable_polarity_correction = 0 (default) 453 * disable_polarity_correction = 0 (default)
446 * Automatic Correction for Reversed Cable Polarity 454 * Automatic Correction for Reversed Cable Polarity
447 * 0 - Disabled 455 * 0 - Disabled
@@ -456,7 +464,8 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
456 return ret_val; 464 return ret_val;
457 465
458 if (phy->revision < 4) { 466 if (phy->revision < 4) {
459 /* Force TX_CLK in the Extended PHY Specific Control Register 467 /*
468 * Force TX_CLK in the Extended PHY Specific Control Register
460 * to 25MHz clock. 469 * to 25MHz clock.
461 */ 470 */
462 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); 471 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
@@ -543,19 +552,21 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
543 552
544 /* set auto-master slave resolution settings */ 553 /* set auto-master slave resolution settings */
545 if (hw->mac.autoneg) { 554 if (hw->mac.autoneg) {
546 /* when autonegotiation advertisement is only 1000Mbps then we 555 /*
556 * when autonegotiation advertisement is only 1000Mbps then we
547 * should disable SmartSpeed and enable Auto MasterSlave 557 * should disable SmartSpeed and enable Auto MasterSlave
548 * resolution as hardware default. */ 558 * resolution as hardware default.
559 */
549 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { 560 if (phy->autoneg_advertised == ADVERTISE_1000_FULL) {
550 /* Disable SmartSpeed */ 561 /* Disable SmartSpeed */
551 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, 562 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
552 &data); 563 &data);
553 if (ret_val) 564 if (ret_val)
554 return ret_val; 565 return ret_val;
555 566
556 data &= ~IGP01E1000_PSCFR_SMART_SPEED; 567 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
557 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, 568 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
558 data); 569 data);
559 if (ret_val) 570 if (ret_val)
560 return ret_val; 571 return ret_val;
561 572
@@ -630,14 +641,16 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
630 return ret_val; 641 return ret_val;
631 } 642 }
632 643
633 /* Need to parse both autoneg_advertised and fc and set up 644 /*
645 * Need to parse both autoneg_advertised and fc and set up
634 * the appropriate PHY registers. First we will parse for 646 * the appropriate PHY registers. First we will parse for
635 * autoneg_advertised software override. Since we can advertise 647 * autoneg_advertised software override. Since we can advertise
636 * a plethora of combinations, we need to check each bit 648 * a plethora of combinations, we need to check each bit
637 * individually. 649 * individually.
638 */ 650 */
639 651
640 /* First we clear all the 10/100 mb speed bits in the Auto-Neg 652 /*
653 * First we clear all the 10/100 mb speed bits in the Auto-Neg
641 * Advertisement Register (Address 4) and the 1000 mb speed bits in 654 * Advertisement Register (Address 4) and the 1000 mb speed bits in
642 * the 1000Base-T Control Register (Address 9). 655 * the 1000Base-T Control Register (Address 9).
643 */ 656 */
@@ -683,7 +696,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
683 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; 696 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
684 } 697 }
685 698
686 /* Check for a software override of the flow control settings, and 699 /*
700 * Check for a software override of the flow control settings, and
687 * setup the PHY advertisement registers accordingly. If 701 * setup the PHY advertisement registers accordingly. If
688 * auto-negotiation is enabled, then software will have to set the 702 * auto-negotiation is enabled, then software will have to set the
689 * "PAUSE" bits to the correct value in the Auto-Negotiation 703 * "PAUSE" bits to the correct value in the Auto-Negotiation
@@ -696,38 +710,42 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
696 * but not send pause frames). 710 * but not send pause frames).
697 * 2: Tx flow control is enabled (we can send pause frames 711 * 2: Tx flow control is enabled (we can send pause frames
698 * but we do not support receiving pause frames). 712 * but we do not support receiving pause frames).
699 * 3: Both Rx and TX flow control (symmetric) are enabled. 713 * 3: Both Rx and Tx flow control (symmetric) are enabled.
700 * other: No software override. The flow control configuration 714 * other: No software override. The flow control configuration
701 * in the EEPROM is used. 715 * in the EEPROM is used.
702 */ 716 */
703 switch (hw->mac.fc) { 717 switch (hw->mac.fc) {
704 case e1000_fc_none: 718 case e1000_fc_none:
705 /* Flow control (RX & TX) is completely disabled by a 719 /*
720 * Flow control (Rx & Tx) is completely disabled by a
706 * software over-ride. 721 * software over-ride.
707 */ 722 */
708 mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 723 mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
709 break; 724 break;
710 case e1000_fc_rx_pause: 725 case e1000_fc_rx_pause:
711 /* RX Flow control is enabled, and TX Flow control is 726 /*
727 * Rx Flow control is enabled, and Tx Flow control is
712 * disabled, by a software over-ride. 728 * disabled, by a software over-ride.
713 */ 729 *
714 /* Since there really isn't a way to advertise that we are 730 * Since there really isn't a way to advertise that we are
715 * capable of RX Pause ONLY, we will advertise that we 731 * capable of Rx Pause ONLY, we will advertise that we
716 * support both symmetric and asymmetric RX PAUSE. Later 732 * support both symmetric and asymmetric Rx PAUSE. Later
717 * (in e1000e_config_fc_after_link_up) we will disable the 733 * (in e1000e_config_fc_after_link_up) we will disable the
718 * hw's ability to send PAUSE frames. 734 * hw's ability to send PAUSE frames.
719 */ 735 */
720 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 736 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
721 break; 737 break;
722 case e1000_fc_tx_pause: 738 case e1000_fc_tx_pause:
723 /* TX Flow control is enabled, and RX Flow control is 739 /*
740 * Tx Flow control is enabled, and Rx Flow control is
724 * disabled, by a software over-ride. 741 * disabled, by a software over-ride.
725 */ 742 */
726 mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; 743 mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
727 mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; 744 mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
728 break; 745 break;
729 case e1000_fc_full: 746 case e1000_fc_full:
730 /* Flow control (both RX and TX) is enabled by a software 747 /*
748 * Flow control (both Rx and Tx) is enabled by a software
731 * over-ride. 749 * over-ride.
732 */ 750 */
733 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 751 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
@@ -758,7 +776,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
758 * Performs initial bounds checking on autoneg advertisement parameter, then 776 * Performs initial bounds checking on autoneg advertisement parameter, then
759 * configure to advertise the full capability. Setup the PHY to autoneg 777 * configure to advertise the full capability. Setup the PHY to autoneg
760 * and restart the negotiation process between the link partner. If 778 * and restart the negotiation process between the link partner. If
761 * wait_for_link, then wait for autoneg to complete before exiting. 779 * autoneg_wait_to_complete, then wait for autoneg to complete before exiting.
762 **/ 780 **/
763static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) 781static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
764{ 782{
@@ -766,12 +784,14 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
766 s32 ret_val; 784 s32 ret_val;
767 u16 phy_ctrl; 785 u16 phy_ctrl;
768 786
769 /* Perform some bounds checking on the autoneg advertisement 787 /*
788 * Perform some bounds checking on the autoneg advertisement
770 * parameter. 789 * parameter.
771 */ 790 */
772 phy->autoneg_advertised &= phy->autoneg_mask; 791 phy->autoneg_advertised &= phy->autoneg_mask;
773 792
774 /* If autoneg_advertised is zero, we assume it was not defaulted 793 /*
794 * If autoneg_advertised is zero, we assume it was not defaulted
775 * by the calling code so we set to advertise full capability. 795 * by the calling code so we set to advertise full capability.
776 */ 796 */
777 if (phy->autoneg_advertised == 0) 797 if (phy->autoneg_advertised == 0)
@@ -785,7 +805,8 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
785 } 805 }
786 hw_dbg(hw, "Restarting Auto-Neg\n"); 806 hw_dbg(hw, "Restarting Auto-Neg\n");
787 807
788 /* Restart auto-negotiation by setting the Auto Neg Enable bit and 808 /*
809 * Restart auto-negotiation by setting the Auto Neg Enable bit and
789 * the Auto Neg Restart bit in the PHY control register. 810 * the Auto Neg Restart bit in the PHY control register.
790 */ 811 */
791 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl); 812 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl);
@@ -797,7 +818,8 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
797 if (ret_val) 818 if (ret_val)
798 return ret_val; 819 return ret_val;
799 820
800 /* Does the user want to wait for Auto-Neg to complete here, or 821 /*
822 * Does the user want to wait for Auto-Neg to complete here, or
801 * check at a later time (for example, callback routine). 823 * check at a later time (for example, callback routine).
802 */ 824 */
803 if (phy->wait_for_link) { 825 if (phy->wait_for_link) {
@@ -829,14 +851,18 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
829 bool link; 851 bool link;
830 852
831 if (hw->mac.autoneg) { 853 if (hw->mac.autoneg) {
832 /* Setup autoneg and flow control advertisement and perform 854 /*
833 * autonegotiation. */ 855 * Setup autoneg and flow control advertisement and perform
856 * autonegotiation.
857 */
834 ret_val = e1000_copper_link_autoneg(hw); 858 ret_val = e1000_copper_link_autoneg(hw);
835 if (ret_val) 859 if (ret_val)
836 return ret_val; 860 return ret_val;
837 } else { 861 } else {
838 /* PHY will be set to 10H, 10F, 100H or 100F 862 /*
839 * depending on user settings. */ 863 * PHY will be set to 10H, 10F, 100H or 100F
864 * depending on user settings.
865 */
840 hw_dbg(hw, "Forcing Speed and Duplex\n"); 866 hw_dbg(hw, "Forcing Speed and Duplex\n");
841 ret_val = e1000_phy_force_speed_duplex(hw); 867 ret_val = e1000_phy_force_speed_duplex(hw);
842 if (ret_val) { 868 if (ret_val) {
@@ -845,7 +871,8 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
845 } 871 }
846 } 872 }
847 873
848 /* Check link status. Wait up to 100 microseconds for link to become 874 /*
875 * Check link status. Wait up to 100 microseconds for link to become
849 * valid. 876 * valid.
850 */ 877 */
851 ret_val = e1000e_phy_has_link_generic(hw, 878 ret_val = e1000e_phy_has_link_generic(hw,
@@ -891,7 +918,8 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
891 if (ret_val) 918 if (ret_val)
892 return ret_val; 919 return ret_val;
893 920
894 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI 921 /*
922 * Clear Auto-Crossover to force MDI manually. IGP requires MDI
895 * forced whenever speed and duplex are forced. 923 * forced whenever speed and duplex are forced.
896 */ 924 */
897 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); 925 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
@@ -941,7 +969,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
941 * Calls the PHY setup function to force speed and duplex. Clears the 969 * Calls the PHY setup function to force speed and duplex. Clears the
942 * auto-crossover to force MDI manually. Resets the PHY to commit the 970 * auto-crossover to force MDI manually. Resets the PHY to commit the
943 * changes. If time expires while waiting for link up, we reset the DSP. 971 * changes. If time expires while waiting for link up, we reset the DSP.
944 * After reset, TX_CLK and CRS on TX must be set. Return successful upon 972 * After reset, TX_CLK and CRS on Tx must be set. Return successful upon
945 * successful completion, else return corresponding error code. 973 * successful completion, else return corresponding error code.
946 **/ 974 **/
947s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) 975s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
@@ -951,7 +979,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
951 u16 phy_data; 979 u16 phy_data;
952 bool link; 980 bool link;
953 981
954 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI 982 /*
983 * Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
955 * forced whenever speed and duplex are forced. 984 * forced whenever speed and duplex are forced.
956 */ 985 */
957 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 986 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
@@ -989,10 +1018,12 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
989 return ret_val; 1018 return ret_val;
990 1019
991 if (!link) { 1020 if (!link) {
992 /* We didn't get link. 1021 /*
1022 * We didn't get link.
993 * Reset the DSP and cross our fingers. 1023 * Reset the DSP and cross our fingers.
994 */ 1024 */
995 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, 0x001d); 1025 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT,
1026 0x001d);
996 if (ret_val) 1027 if (ret_val)
997 return ret_val; 1028 return ret_val;
998 ret_val = e1000e_phy_reset_dsp(hw); 1029 ret_val = e1000e_phy_reset_dsp(hw);
@@ -1011,7 +1042,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1011 if (ret_val) 1042 if (ret_val)
1012 return ret_val; 1043 return ret_val;
1013 1044
1014 /* Resetting the phy means we need to re-force TX_CLK in the 1045 /*
1046 * Resetting the phy means we need to re-force TX_CLK in the
1015 * Extended PHY Specific Control Register to 25MHz clock from 1047 * Extended PHY Specific Control Register to 25MHz clock from
1016 * the reset value of 2.5MHz. 1048 * the reset value of 2.5MHz.
1017 */ 1049 */
@@ -1020,7 +1052,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1020 if (ret_val) 1052 if (ret_val)
1021 return ret_val; 1053 return ret_val;
1022 1054
1023 /* In addition, we must re-enable CRS on Tx for both half and full 1055 /*
1056 * In addition, we must re-enable CRS on Tx for both half and full
1024 * duplex. 1057 * duplex.
1025 */ 1058 */
1026 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 1059 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
@@ -1124,30 +1157,32 @@ s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active)
1124 data); 1157 data);
1125 if (ret_val) 1158 if (ret_val)
1126 return ret_val; 1159 return ret_val;
1127 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used 1160 /*
1161 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
1128 * during Dx states where the power conservation is most 1162 * during Dx states where the power conservation is most
1129 * important. During driver activity we should enable 1163 * important. During driver activity we should enable
1130 * SmartSpeed, so performance is maintained. */ 1164 * SmartSpeed, so performance is maintained.
1165 */
1131 if (phy->smart_speed == e1000_smart_speed_on) { 1166 if (phy->smart_speed == e1000_smart_speed_on) {
1132 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, 1167 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1133 &data); 1168 &data);
1134 if (ret_val) 1169 if (ret_val)
1135 return ret_val; 1170 return ret_val;
1136 1171
1137 data |= IGP01E1000_PSCFR_SMART_SPEED; 1172 data |= IGP01E1000_PSCFR_SMART_SPEED;
1138 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, 1173 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1139 data); 1174 data);
1140 if (ret_val) 1175 if (ret_val)
1141 return ret_val; 1176 return ret_val;
1142 } else if (phy->smart_speed == e1000_smart_speed_off) { 1177 } else if (phy->smart_speed == e1000_smart_speed_off) {
1143 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, 1178 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1144 &data); 1179 &data);
1145 if (ret_val) 1180 if (ret_val)
1146 return ret_val; 1181 return ret_val;
1147 1182
1148 data &= ~IGP01E1000_PSCFR_SMART_SPEED; 1183 data &= ~IGP01E1000_PSCFR_SMART_SPEED;
1149 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, 1184 ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
1150 data); 1185 data);
1151 if (ret_val) 1186 if (ret_val)
1152 return ret_val; 1187 return ret_val;
1153 } 1188 }
@@ -1249,8 +1284,10 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw)
1249 s32 ret_val; 1284 s32 ret_val;
1250 u16 data, offset, mask; 1285 u16 data, offset, mask;
1251 1286
1252 /* Polarity is determined based on the speed of 1287 /*
1253 * our connection. */ 1288 * Polarity is determined based on the speed of
1289 * our connection.
1290 */
1254 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); 1291 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data);
1255 if (ret_val) 1292 if (ret_val)
1256 return ret_val; 1293 return ret_val;
@@ -1260,7 +1297,8 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw)
1260 offset = IGP01E1000_PHY_PCS_INIT_REG; 1297 offset = IGP01E1000_PHY_PCS_INIT_REG;
1261 mask = IGP01E1000_PHY_POLARITY_MASK; 1298 mask = IGP01E1000_PHY_POLARITY_MASK;
1262 } else { 1299 } else {
1263 /* This really only applies to 10Mbps since 1300 /*
1301 * This really only applies to 10Mbps since
1264 * there is no polarity for 100Mbps (always 0). 1302 * there is no polarity for 100Mbps (always 0).
1265 */ 1303 */
1266 offset = IGP01E1000_PHY_PORT_STATUS; 1304 offset = IGP01E1000_PHY_PORT_STATUS;
@@ -1278,7 +1316,7 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw)
1278} 1316}
1279 1317
1280/** 1318/**
1281 * e1000_wait_autoneg - Wait for auto-neg compeletion 1319 * e1000_wait_autoneg - Wait for auto-neg completion
1282 * @hw: pointer to the HW structure 1320 * @hw: pointer to the HW structure
1283 * 1321 *
1284 * Waits for auto-negotiation to complete or for the auto-negotiation time 1322 * Waits for auto-negotiation to complete or for the auto-negotiation time
@@ -1302,7 +1340,8 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
1302 msleep(100); 1340 msleep(100);
1303 } 1341 }
1304 1342
1305 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation 1343 /*
1344 * PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
1306 * has completed. 1345 * has completed.
1307 */ 1346 */
1308 return ret_val; 1347 return ret_val;
@@ -1324,7 +1363,8 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
1324 u16 i, phy_status; 1363 u16 i, phy_status;
1325 1364
1326 for (i = 0; i < iterations; i++) { 1365 for (i = 0; i < iterations; i++) {
1327 /* Some PHYs require the PHY_STATUS register to be read 1366 /*
1367 * Some PHYs require the PHY_STATUS register to be read
1328 * twice due to the link bit being sticky. No harm doing 1368 * twice due to the link bit being sticky. No harm doing
1329 * it across the board. 1369 * it across the board.
1330 */ 1370 */
@@ -1412,10 +1452,12 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
1412 if (ret_val) 1452 if (ret_val)
1413 return ret_val; 1453 return ret_val;
1414 1454
1415 /* Getting bits 15:9, which represent the combination of 1455 /*
1456 * Getting bits 15:9, which represent the combination of
1416 * course and fine gain values. The result is a number 1457 * course and fine gain values. The result is a number
1417 * that can be put into the lookup table to obtain the 1458 * that can be put into the lookup table to obtain the
1418 * approximate cable length. */ 1459 * approximate cable length.
1460 */
1419 cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & 1461 cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
1420 IGP02E1000_AGC_LENGTH_MASK; 1462 IGP02E1000_AGC_LENGTH_MASK;
1421 1463