aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000e/phy.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2012-11-28 04:28:37 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-12-01 06:37:22 -0500
commite921eb1ac411a32b98fa1a9ccbba1b24fae8de2d (patch)
tree9a3e5a63a4fec7eef24fd3e4929cf2b97ed1a9ed /drivers/net/ethernet/intel/e1000e/phy.c
parentdaf56e406a94675d454f996cab56c3d0b0a0d8a6 (diff)
e1000e: cosmetic cleanup of comments
Update comments to conform to the preferred style for networking code as described in ./Documentation/CodingStyle and checked for in the recently added checkpatch NETWORKING_BLOCK_COMMENT_STYLE test. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/phy.c')
-rw-r--r--drivers/net/ethernet/intel/e1000e/phy.c141
1 files changed, 47 insertions, 94 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index fc62a3f3a5be..28b38ff37e84 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -193,8 +193,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
193 return -E1000_ERR_PARAM; 193 return -E1000_ERR_PARAM;
194 } 194 }
195 195
196 /* 196 /* Set up Op-code, Phy Address, and register offset in the MDI
197 * Set up Op-code, Phy Address, and register offset in the MDI
198 * Control register. The MAC will take care of interfacing with the 197 * Control register. The MAC will take care of interfacing with the
199 * PHY to retrieve the desired data. 198 * PHY to retrieve the desired data.
200 */ 199 */
@@ -204,8 +203,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
204 203
205 ew32(MDIC, mdic); 204 ew32(MDIC, mdic);
206 205
207 /* 206 /* Poll the ready bit to see if the MDI read completed
208 * Poll the ready bit to see if the MDI read completed
209 * Increasing the time out as testing showed failures with 207 * Increasing the time out as testing showed failures with
210 * the lower time out 208 * the lower time out
211 */ 209 */
@@ -225,8 +223,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
225 } 223 }
226 *data = (u16) mdic; 224 *data = (u16) mdic;
227 225
228 /* 226 /* Allow some time after each MDIC transaction to avoid
229 * Allow some time after each MDIC transaction to avoid
230 * reading duplicate data in the next MDIC transaction. 227 * reading duplicate data in the next MDIC transaction.
231 */ 228 */
232 if (hw->mac.type == e1000_pch2lan) 229 if (hw->mac.type == e1000_pch2lan)
@@ -253,8 +250,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
253 return -E1000_ERR_PARAM; 250 return -E1000_ERR_PARAM;
254 } 251 }
255 252
256 /* 253 /* Set up Op-code, Phy Address, and register offset in the MDI
257 * Set up Op-code, Phy Address, and register offset in the MDI
258 * Control register. The MAC will take care of interfacing with the 254 * Control register. The MAC will take care of interfacing with the
259 * PHY to retrieve the desired data. 255 * PHY to retrieve the desired data.
260 */ 256 */
@@ -265,8 +261,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
265 261
266 ew32(MDIC, mdic); 262 ew32(MDIC, mdic);
267 263
268 /* 264 /* Poll the ready bit to see if the MDI read completed
269 * Poll the ready bit to see if the MDI read completed
270 * Increasing the time out as testing showed failures with 265 * Increasing the time out as testing showed failures with
271 * the lower time out 266 * the lower time out
272 */ 267 */
@@ -285,8 +280,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
285 return -E1000_ERR_PHY; 280 return -E1000_ERR_PHY;
286 } 281 }
287 282
288 /* 283 /* Allow some time after each MDIC transaction to avoid
289 * Allow some time after each MDIC transaction to avoid
290 * reading duplicate data in the next MDIC transaction. 284 * reading duplicate data in the next MDIC transaction.
291 */ 285 */
292 if (hw->mac.type == e1000_pch2lan) 286 if (hw->mac.type == e1000_pch2lan)
@@ -708,8 +702,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw)
708 if (ret_val) 702 if (ret_val)
709 return ret_val; 703 return ret_val;
710 phy_data &= ~I82577_PHY_CTRL2_MDIX_CFG_MASK; 704 phy_data &= ~I82577_PHY_CTRL2_MDIX_CFG_MASK;
711 /* 705 /* Options:
712 * Options:
713 * 0 - Auto (default) 706 * 0 - Auto (default)
714 * 1 - MDI mode 707 * 1 - MDI mode
715 * 2 - MDI-X mode 708 * 2 - MDI-X mode
@@ -754,8 +747,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
754 if (phy->type != e1000_phy_bm) 747 if (phy->type != e1000_phy_bm)
755 phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; 748 phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
756 749
757 /* 750 /* Options:
758 * Options:
759 * MDI/MDI-X = 0 (default) 751 * MDI/MDI-X = 0 (default)
760 * 0 - Auto for all speeds 752 * 0 - Auto for all speeds
761 * 1 - MDI mode 753 * 1 - MDI mode
@@ -780,8 +772,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
780 break; 772 break;
781 } 773 }
782 774
783 /* 775 /* Options:
784 * Options:
785 * disable_polarity_correction = 0 (default) 776 * disable_polarity_correction = 0 (default)
786 * Automatic Correction for Reversed Cable Polarity 777 * Automatic Correction for Reversed Cable Polarity
787 * 0 - Disabled 778 * 0 - Disabled
@@ -818,8 +809,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
818 if ((phy->type == e1000_phy_m88) && 809 if ((phy->type == e1000_phy_m88) &&
819 (phy->revision < E1000_REVISION_4) && 810 (phy->revision < E1000_REVISION_4) &&
820 (phy->id != BME1000_E_PHY_ID_R2)) { 811 (phy->id != BME1000_E_PHY_ID_R2)) {
821 /* 812 /* Force TX_CLK in the Extended PHY Specific Control Register
822 * Force TX_CLK in the Extended PHY Specific Control Register
823 * to 25MHz clock. 813 * to 25MHz clock.
824 */ 814 */
825 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); 815 ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
@@ -899,8 +889,7 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
899 return ret_val; 889 return ret_val;
900 } 890 }
901 891
902 /* 892 /* Wait 100ms for MAC to configure PHY from NVM settings, to avoid
903 * Wait 100ms for MAC to configure PHY from NVM settings, to avoid
904 * timeout issues when LFS is enabled. 893 * timeout issues when LFS is enabled.
905 */ 894 */
906 msleep(100); 895 msleep(100);
@@ -936,8 +925,7 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
936 925
937 /* set auto-master slave resolution settings */ 926 /* set auto-master slave resolution settings */
938 if (hw->mac.autoneg) { 927 if (hw->mac.autoneg) {
939 /* 928 /* when autonegotiation advertisement is only 1000Mbps then we
940 * when autonegotiation advertisement is only 1000Mbps then we
941 * should disable SmartSpeed and enable Auto MasterSlave 929 * should disable SmartSpeed and enable Auto MasterSlave
942 * resolution as hardware default. 930 * resolution as hardware default.
943 */ 931 */
@@ -1001,16 +989,14 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
1001 return ret_val; 989 return ret_val;
1002 } 990 }
1003 991
1004 /* 992 /* Need to parse both autoneg_advertised and fc and set up
1005 * Need to parse both autoneg_advertised and fc and set up
1006 * the appropriate PHY registers. First we will parse for 993 * the appropriate PHY registers. First we will parse for
1007 * autoneg_advertised software override. Since we can advertise 994 * autoneg_advertised software override. Since we can advertise
1008 * a plethora of combinations, we need to check each bit 995 * a plethora of combinations, we need to check each bit
1009 * individually. 996 * individually.
1010 */ 997 */
1011 998
1012 /* 999 /* First we clear all the 10/100 mb speed bits in the Auto-Neg
1013 * First we clear all the 10/100 mb speed bits in the Auto-Neg
1014 * Advertisement Register (Address 4) and the 1000 mb speed bits in 1000 * Advertisement Register (Address 4) and the 1000 mb speed bits in
1015 * the 1000Base-T Control Register (Address 9). 1001 * the 1000Base-T Control Register (Address 9).
1016 */ 1002 */
@@ -1056,8 +1042,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
1056 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; 1042 mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
1057 } 1043 }
1058 1044
1059 /* 1045 /* Check for a software override of the flow control settings, and
1060 * Check for a software override of the flow control settings, and
1061 * setup the PHY advertisement registers accordingly. If 1046 * setup the PHY advertisement registers accordingly. If
1062 * auto-negotiation is enabled, then software will have to set the 1047 * auto-negotiation is enabled, then software will have to set the
1063 * "PAUSE" bits to the correct value in the Auto-Negotiation 1048 * "PAUSE" bits to the correct value in the Auto-Negotiation
@@ -1076,15 +1061,13 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
1076 */ 1061 */
1077 switch (hw->fc.current_mode) { 1062 switch (hw->fc.current_mode) {
1078 case e1000_fc_none: 1063 case e1000_fc_none:
1079 /* 1064 /* Flow control (Rx & Tx) is completely disabled by a
1080 * Flow control (Rx & Tx) is completely disabled by a
1081 * software over-ride. 1065 * software over-ride.
1082 */ 1066 */
1083 mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 1067 mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
1084 break; 1068 break;
1085 case e1000_fc_rx_pause: 1069 case e1000_fc_rx_pause:
1086 /* 1070 /* Rx Flow control is enabled, and Tx Flow control is
1087 * Rx Flow control is enabled, and Tx Flow control is
1088 * disabled, by a software over-ride. 1071 * disabled, by a software over-ride.
1089 * 1072 *
1090 * Since there really isn't a way to advertise that we are 1073 * Since there really isn't a way to advertise that we are
@@ -1096,16 +1079,14 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
1096 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 1079 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
1097 break; 1080 break;
1098 case e1000_fc_tx_pause: 1081 case e1000_fc_tx_pause:
1099 /* 1082 /* Tx Flow control is enabled, and Rx Flow control is
1100 * Tx Flow control is enabled, and Rx Flow control is
1101 * disabled, by a software over-ride. 1083 * disabled, by a software over-ride.
1102 */ 1084 */
1103 mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; 1085 mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
1104 mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; 1086 mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
1105 break; 1087 break;
1106 case e1000_fc_full: 1088 case e1000_fc_full:
1107 /* 1089 /* Flow control (both Rx and Tx) is enabled by a software
1108 * Flow control (both Rx and Tx) is enabled by a software
1109 * over-ride. 1090 * over-ride.
1110 */ 1091 */
1111 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); 1092 mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
@@ -1142,14 +1123,12 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
1142 s32 ret_val; 1123 s32 ret_val;
1143 u16 phy_ctrl; 1124 u16 phy_ctrl;
1144 1125
1145 /* 1126 /* Perform some bounds checking on the autoneg advertisement
1146 * Perform some bounds checking on the autoneg advertisement
1147 * parameter. 1127 * parameter.
1148 */ 1128 */
1149 phy->autoneg_advertised &= phy->autoneg_mask; 1129 phy->autoneg_advertised &= phy->autoneg_mask;
1150 1130
1151 /* 1131 /* If autoneg_advertised is zero, we assume it was not defaulted
1152 * If autoneg_advertised is zero, we assume it was not defaulted
1153 * by the calling code so we set to advertise full capability. 1132 * by the calling code so we set to advertise full capability.
1154 */ 1133 */
1155 if (!phy->autoneg_advertised) 1134 if (!phy->autoneg_advertised)
@@ -1163,8 +1142,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
1163 } 1142 }
1164 e_dbg("Restarting Auto-Neg\n"); 1143 e_dbg("Restarting Auto-Neg\n");
1165 1144
1166 /* 1145 /* Restart auto-negotiation by setting the Auto Neg Enable bit and
1167 * Restart auto-negotiation by setting the Auto Neg Enable bit and
1168 * the Auto Neg Restart bit in the PHY control register. 1146 * the Auto Neg Restart bit in the PHY control register.
1169 */ 1147 */
1170 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl); 1148 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_ctrl);
@@ -1176,8 +1154,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
1176 if (ret_val) 1154 if (ret_val)
1177 return ret_val; 1155 return ret_val;
1178 1156
1179 /* 1157 /* Does the user want to wait for Auto-Neg to complete here, or
1180 * Does the user want to wait for Auto-Neg to complete here, or
1181 * check at a later time (for example, callback routine). 1158 * check at a later time (for example, callback routine).
1182 */ 1159 */
1183 if (phy->autoneg_wait_to_complete) { 1160 if (phy->autoneg_wait_to_complete) {
@@ -1208,16 +1185,14 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
1208 bool link; 1185 bool link;
1209 1186
1210 if (hw->mac.autoneg) { 1187 if (hw->mac.autoneg) {
1211 /* 1188 /* Setup autoneg and flow control advertisement and perform
1212 * Setup autoneg and flow control advertisement and perform
1213 * autonegotiation. 1189 * autonegotiation.
1214 */ 1190 */
1215 ret_val = e1000_copper_link_autoneg(hw); 1191 ret_val = e1000_copper_link_autoneg(hw);
1216 if (ret_val) 1192 if (ret_val)
1217 return ret_val; 1193 return ret_val;
1218 } else { 1194 } else {
1219 /* 1195 /* PHY will be set to 10H, 10F, 100H or 100F
1220 * PHY will be set to 10H, 10F, 100H or 100F
1221 * depending on user settings. 1196 * depending on user settings.
1222 */ 1197 */
1223 e_dbg("Forcing Speed and Duplex\n"); 1198 e_dbg("Forcing Speed and Duplex\n");
@@ -1228,8 +1203,7 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
1228 } 1203 }
1229 } 1204 }
1230 1205
1231 /* 1206 /* Check link status. Wait up to 100 microseconds for link to become
1232 * Check link status. Wait up to 100 microseconds for link to become
1233 * valid. 1207 * valid.
1234 */ 1208 */
1235 ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10, 1209 ret_val = e1000e_phy_has_link_generic(hw, COPPER_LINK_UP_LIMIT, 10,
@@ -1273,8 +1247,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw)
1273 if (ret_val) 1247 if (ret_val)
1274 return ret_val; 1248 return ret_val;
1275 1249
1276 /* 1250 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI
1277 * Clear Auto-Crossover to force MDI manually. IGP requires MDI
1278 * forced whenever speed and duplex are forced. 1251 * forced whenever speed and duplex are forced.
1279 */ 1252 */
1280 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); 1253 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
@@ -1328,8 +1301,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1328 u16 phy_data; 1301 u16 phy_data;
1329 bool link; 1302 bool link;
1330 1303
1331 /* 1304 /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
1332 * Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI
1333 * forced whenever speed and duplex are forced. 1305 * forced whenever speed and duplex are forced.
1334 */ 1306 */
1335 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 1307 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
@@ -1370,8 +1342,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1370 if (hw->phy.type != e1000_phy_m88) { 1342 if (hw->phy.type != e1000_phy_m88) {
1371 e_dbg("Link taking longer than expected.\n"); 1343 e_dbg("Link taking longer than expected.\n");
1372 } else { 1344 } else {
1373 /* 1345 /* We didn't get link.
1374 * We didn't get link.
1375 * Reset the DSP and cross our fingers. 1346 * Reset the DSP and cross our fingers.
1376 */ 1347 */
1377 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, 1348 ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT,
@@ -1398,8 +1369,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1398 if (ret_val) 1369 if (ret_val)
1399 return ret_val; 1370 return ret_val;
1400 1371
1401 /* 1372 /* Resetting the phy means we need to re-force TX_CLK in the
1402 * Resetting the phy means we need to re-force TX_CLK in the
1403 * Extended PHY Specific Control Register to 25MHz clock from 1373 * Extended PHY Specific Control Register to 25MHz clock from
1404 * the reset value of 2.5MHz. 1374 * the reset value of 2.5MHz.
1405 */ 1375 */
@@ -1408,8 +1378,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
1408 if (ret_val) 1378 if (ret_val)
1409 return ret_val; 1379 return ret_val;
1410 1380
1411 /* 1381 /* In addition, we must re-enable CRS on Tx for both half and full
1412 * In addition, we must re-enable CRS on Tx for both half and full
1413 * duplex. 1382 * duplex.
1414 */ 1383 */
1415 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); 1384 ret_val = e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
@@ -1573,8 +1542,7 @@ s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active)
1573 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); 1542 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
1574 if (ret_val) 1543 if (ret_val)
1575 return ret_val; 1544 return ret_val;
1576 /* 1545 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
1577 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
1578 * during Dx states where the power conservation is most 1546 * during Dx states where the power conservation is most
1579 * important. During driver activity we should enable 1547 * important. During driver activity we should enable
1580 * SmartSpeed, so performance is maintained. 1548 * SmartSpeed, so performance is maintained.
@@ -1702,8 +1670,7 @@ s32 e1000_check_polarity_igp(struct e1000_hw *hw)
1702 s32 ret_val; 1670 s32 ret_val;
1703 u16 data, offset, mask; 1671 u16 data, offset, mask;
1704 1672
1705 /* 1673 /* Polarity is determined based on the speed of
1706 * Polarity is determined based on the speed of
1707 * our connection. 1674 * our connection.
1708 */ 1675 */
1709 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data); 1676 ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_STATUS, &data);
@@ -1715,8 +1682,7 @@ s32 e1000_check_polarity_igp(struct e1000_hw *hw)
1715 offset = IGP01E1000_PHY_PCS_INIT_REG; 1682 offset = IGP01E1000_PHY_PCS_INIT_REG;
1716 mask = IGP01E1000_PHY_POLARITY_MASK; 1683 mask = IGP01E1000_PHY_POLARITY_MASK;
1717 } else { 1684 } else {
1718 /* 1685 /* This really only applies to 10Mbps since
1719 * This really only applies to 10Mbps since
1720 * there is no polarity for 100Mbps (always 0). 1686 * there is no polarity for 100Mbps (always 0).
1721 */ 1687 */
1722 offset = IGP01E1000_PHY_PORT_STATUS; 1688 offset = IGP01E1000_PHY_PORT_STATUS;
@@ -1745,8 +1711,7 @@ s32 e1000_check_polarity_ife(struct e1000_hw *hw)
1745 s32 ret_val; 1711 s32 ret_val;
1746 u16 phy_data, offset, mask; 1712 u16 phy_data, offset, mask;
1747 1713
1748 /* 1714 /* Polarity is determined based on the reversal feature being enabled.
1749 * Polarity is determined based on the reversal feature being enabled.
1750 */ 1715 */
1751 if (phy->polarity_correction) { 1716 if (phy->polarity_correction) {
1752 offset = IFE_PHY_EXTENDED_STATUS_CONTROL; 1717 offset = IFE_PHY_EXTENDED_STATUS_CONTROL;
@@ -1791,8 +1756,7 @@ static s32 e1000_wait_autoneg(struct e1000_hw *hw)
1791 msleep(100); 1756 msleep(100);
1792 } 1757 }
1793 1758
1794 /* 1759 /* PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
1795 * PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
1796 * has completed. 1760 * has completed.
1797 */ 1761 */
1798 return ret_val; 1762 return ret_val;
@@ -1814,15 +1778,13 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
1814 u16 i, phy_status; 1778 u16 i, phy_status;
1815 1779
1816 for (i = 0; i < iterations; i++) { 1780 for (i = 0; i < iterations; i++) {
1817 /* 1781 /* Some PHYs require the PHY_STATUS register to be read
1818 * Some PHYs require the PHY_STATUS register to be read
1819 * twice due to the link bit being sticky. No harm doing 1782 * twice due to the link bit being sticky. No harm doing
1820 * it across the board. 1783 * it across the board.
1821 */ 1784 */
1822 ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); 1785 ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
1823 if (ret_val) 1786 if (ret_val)
1824 /* 1787 /* If the first read fails, another entity may have
1825 * If the first read fails, another entity may have
1826 * ownership of the resources, wait and try again to 1788 * ownership of the resources, wait and try again to
1827 * see if they have relinquished the resources yet. 1789 * see if they have relinquished the resources yet.
1828 */ 1790 */
@@ -1913,8 +1875,7 @@ s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw)
1913 if (ret_val) 1875 if (ret_val)
1914 return ret_val; 1876 return ret_val;
1915 1877
1916 /* 1878 /* Getting bits 15:9, which represent the combination of
1917 * Getting bits 15:9, which represent the combination of
1918 * coarse and fine gain values. The result is a number 1879 * coarse and fine gain values. The result is a number
1919 * that can be put into the lookup table to obtain the 1880 * that can be put into the lookup table to obtain the
1920 * approximate cable length. 1881 * approximate cable length.
@@ -2285,15 +2246,13 @@ s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw)
2285 e1e_wphy(hw, 0x1796, 0x0008); 2246 e1e_wphy(hw, 0x1796, 0x0008);
2286 /* Change cg_icount + enable integbp for channels BCD */ 2247 /* Change cg_icount + enable integbp for channels BCD */
2287 e1e_wphy(hw, 0x1798, 0xD008); 2248 e1e_wphy(hw, 0x1798, 0xD008);
2288 /* 2249 /* Change cg_icount + enable integbp + change prop_factor_master
2289 * Change cg_icount + enable integbp + change prop_factor_master
2290 * to 8 for channel A 2250 * to 8 for channel A
2291 */ 2251 */
2292 e1e_wphy(hw, 0x1898, 0xD918); 2252 e1e_wphy(hw, 0x1898, 0xD918);
2293 /* Disable AHT in Slave mode on channel A */ 2253 /* Disable AHT in Slave mode on channel A */
2294 e1e_wphy(hw, 0x187A, 0x0800); 2254 e1e_wphy(hw, 0x187A, 0x0800);
2295 /* 2255 /* Enable LPLU and disable AN to 1000 in non-D0a states,
2296 * Enable LPLU and disable AN to 1000 in non-D0a states,
2297 * Enable SPD+B2B 2256 * Enable SPD+B2B
2298 */ 2257 */
2299 e1e_wphy(hw, 0x0019, 0x008D); 2258 e1e_wphy(hw, 0x0019, 0x008D);
@@ -2417,8 +2376,7 @@ s32 e1000e_determine_phy_address(struct e1000_hw *hw)
2417 e1000e_get_phy_id(hw); 2376 e1000e_get_phy_id(hw);
2418 phy_type = e1000e_get_phy_type_from_id(hw->phy.id); 2377 phy_type = e1000e_get_phy_type_from_id(hw->phy.id);
2419 2378
2420 /* 2379 /* If phy_type is valid, break - we found our
2421 * If phy_type is valid, break - we found our
2422 * PHY address 2380 * PHY address
2423 */ 2381 */
2424 if (phy_type != e1000_phy_unknown) 2382 if (phy_type != e1000_phy_unknown)
@@ -2478,8 +2436,7 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
2478 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2436 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2479 u32 page_shift, page_select; 2437 u32 page_shift, page_select;
2480 2438
2481 /* 2439 /* Page select is register 31 for phy address 1 and 22 for
2482 * Page select is register 31 for phy address 1 and 22 for
2483 * phy address 2 and 3. Page select is shifted only for 2440 * phy address 2 and 3. Page select is shifted only for
2484 * phy address 1. 2441 * phy address 1.
2485 */ 2442 */
@@ -2537,8 +2494,7 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
2537 if (offset > MAX_PHY_MULTI_PAGE_REG) { 2494 if (offset > MAX_PHY_MULTI_PAGE_REG) {
2538 u32 page_shift, page_select; 2495 u32 page_shift, page_select;
2539 2496
2540 /* 2497 /* Page select is register 31 for phy address 1 and 22 for
2541 * Page select is register 31 for phy address 1 and 22 for
2542 * phy address 2 and 3. Page select is shifted only for 2498 * phy address 2 and 3. Page select is shifted only for
2543 * phy address 1. 2499 * phy address 1.
2544 */ 2500 */
@@ -2683,8 +2639,7 @@ s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg)
2683 return ret_val; 2639 return ret_val;
2684 } 2640 }
2685 2641
2686 /* 2642 /* Enable both PHY wakeup mode and Wakeup register page writes.
2687 * Enable both PHY wakeup mode and Wakeup register page writes.
2688 * Prevent a power state change by disabling ME and Host PHY wakeup. 2643 * Prevent a power state change by disabling ME and Host PHY wakeup.
2689 */ 2644 */
2690 temp = *phy_reg; 2645 temp = *phy_reg;
@@ -2698,8 +2653,7 @@ s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg)
2698 return ret_val; 2653 return ret_val;
2699 } 2654 }
2700 2655
2701 /* 2656 /* Select Host Wakeup Registers page - caller now able to write
2702 * Select Host Wakeup Registers page - caller now able to write
2703 * registers on the Wakeup registers page 2657 * registers on the Wakeup registers page
2704 */ 2658 */
2705 return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT)); 2659 return e1000_set_page_igp(hw, (BM_WUC_PAGE << IGP_PAGE_SHIFT));
@@ -3038,8 +2992,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
3038 if (page == HV_INTC_FC_PAGE_START) 2992 if (page == HV_INTC_FC_PAGE_START)
3039 page = 0; 2993 page = 0;
3040 2994
3041 /* 2995 /* Workaround MDIO accesses being disabled after entering IEEE
3042 * Workaround MDIO accesses being disabled after entering IEEE
3043 * Power Down (when bit 11 of the PHY Control register is set) 2996 * Power Down (when bit 11 of the PHY Control register is set)
3044 */ 2997 */
3045 if ((hw->phy.type == e1000_phy_82578) && 2998 if ((hw->phy.type == e1000_phy_82578) &&