diff options
Diffstat (limited to 'drivers/net/e1000e/phy.c')
-rw-r--r-- | drivers/net/e1000e/phy.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 1781efeb55e3..a640f1c369ae 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -637,12 +637,11 @@ s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data) | |||
637 | **/ | 637 | **/ |
638 | s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) | 638 | s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) |
639 | { | 639 | { |
640 | struct e1000_phy_info *phy = &hw->phy; | ||
641 | s32 ret_val; | 640 | s32 ret_val; |
642 | u16 phy_data; | 641 | u16 phy_data; |
643 | 642 | ||
644 | /* Enable CRS on TX. This must be set for half-duplex operation. */ | 643 | /* Enable CRS on TX. This must be set for half-duplex operation. */ |
645 | ret_val = phy->ops.read_reg(hw, I82577_CFG_REG, &phy_data); | 644 | ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); |
646 | if (ret_val) | 645 | if (ret_val) |
647 | goto out; | 646 | goto out; |
648 | 647 | ||
@@ -651,7 +650,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) | |||
651 | /* Enable downshift */ | 650 | /* Enable downshift */ |
652 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; | 651 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; |
653 | 652 | ||
654 | ret_val = phy->ops.write_reg(hw, I82577_CFG_REG, phy_data); | 653 | ret_val = e1e_wphy(hw, I82577_CFG_REG, phy_data); |
655 | 654 | ||
656 | out: | 655 | out: |
657 | return ret_val; | 656 | return ret_val; |
@@ -774,16 +773,14 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) | |||
774 | } | 773 | } |
775 | 774 | ||
776 | if (phy->type == e1000_phy_82578) { | 775 | if (phy->type == e1000_phy_82578) { |
777 | ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, | 776 | ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
778 | &phy_data); | ||
779 | if (ret_val) | 777 | if (ret_val) |
780 | return ret_val; | 778 | return ret_val; |
781 | 779 | ||
782 | /* 82578 PHY - set the downshift count to 1x. */ | 780 | /* 82578 PHY - set the downshift count to 1x. */ |
783 | phy_data |= I82578_EPSCR_DOWNSHIFT_ENABLE; | 781 | phy_data |= I82578_EPSCR_DOWNSHIFT_ENABLE; |
784 | phy_data &= ~I82578_EPSCR_DOWNSHIFT_COUNTER_MASK; | 782 | phy_data &= ~I82578_EPSCR_DOWNSHIFT_COUNTER_MASK; |
785 | ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, | 783 | ret_val = e1e_wphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
786 | phy_data); | ||
787 | if (ret_val) | 784 | if (ret_val) |
788 | return ret_val; | 785 | return ret_val; |
789 | } | 786 | } |
@@ -1319,9 +1316,8 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
1319 | * We didn't get link. | 1316 | * We didn't get link. |
1320 | * Reset the DSP and cross our fingers. | 1317 | * Reset the DSP and cross our fingers. |
1321 | */ | 1318 | */ |
1322 | ret_val = e1e_wphy(hw, | 1319 | ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, |
1323 | M88E1000_PHY_PAGE_SELECT, | 1320 | 0x001d); |
1324 | 0x001d); | ||
1325 | if (ret_val) | 1321 | if (ret_val) |
1326 | return ret_val; | 1322 | return ret_val; |
1327 | ret_val = e1000e_phy_reset_dsp(hw); | 1323 | ret_val = e1000e_phy_reset_dsp(hw); |
@@ -3071,12 +3067,12 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) | |||
3071 | goto out; | 3067 | goto out; |
3072 | 3068 | ||
3073 | /* Do not apply workaround if in PHY loopback bit 14 set */ | 3069 | /* Do not apply workaround if in PHY loopback bit 14 set */ |
3074 | hw->phy.ops.read_reg(hw, PHY_CONTROL, &data); | 3070 | e1e_rphy(hw, PHY_CONTROL, &data); |
3075 | if (data & PHY_CONTROL_LB) | 3071 | if (data & PHY_CONTROL_LB) |
3076 | goto out; | 3072 | goto out; |
3077 | 3073 | ||
3078 | /* check if link is up and at 1Gbps */ | 3074 | /* check if link is up and at 1Gbps */ |
3079 | ret_val = hw->phy.ops.read_reg(hw, BM_CS_STATUS, &data); | 3075 | ret_val = e1e_rphy(hw, BM_CS_STATUS, &data); |
3080 | if (ret_val) | 3076 | if (ret_val) |
3081 | goto out; | 3077 | goto out; |
3082 | 3078 | ||
@@ -3092,14 +3088,12 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) | |||
3092 | mdelay(200); | 3088 | mdelay(200); |
3093 | 3089 | ||
3094 | /* flush the packets in the fifo buffer */ | 3090 | /* flush the packets in the fifo buffer */ |
3095 | ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, | 3091 | ret_val = e1e_wphy(hw, HV_MUX_DATA_CTRL, HV_MUX_DATA_CTRL_GEN_TO_MAC | |
3096 | HV_MUX_DATA_CTRL_GEN_TO_MAC | | 3092 | HV_MUX_DATA_CTRL_FORCE_SPEED); |
3097 | HV_MUX_DATA_CTRL_FORCE_SPEED); | ||
3098 | if (ret_val) | 3093 | if (ret_val) |
3099 | goto out; | 3094 | goto out; |
3100 | 3095 | ||
3101 | ret_val = hw->phy.ops.write_reg(hw, HV_MUX_DATA_CTRL, | 3096 | ret_val = e1e_wphy(hw, HV_MUX_DATA_CTRL, HV_MUX_DATA_CTRL_GEN_TO_MAC); |
3102 | HV_MUX_DATA_CTRL_GEN_TO_MAC); | ||
3103 | 3097 | ||
3104 | out: | 3098 | out: |
3105 | return ret_val; | 3099 | return ret_val; |
@@ -3119,7 +3113,7 @@ s32 e1000_check_polarity_82577(struct e1000_hw *hw) | |||
3119 | s32 ret_val; | 3113 | s32 ret_val; |
3120 | u16 data; | 3114 | u16 data; |
3121 | 3115 | ||
3122 | ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); | 3116 | ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); |
3123 | 3117 | ||
3124 | if (!ret_val) | 3118 | if (!ret_val) |
3125 | phy->cable_polarity = (data & I82577_PHY_STATUS2_REV_POLARITY) | 3119 | phy->cable_polarity = (data & I82577_PHY_STATUS2_REV_POLARITY) |
@@ -3142,13 +3136,13 @@ s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw) | |||
3142 | u16 phy_data; | 3136 | u16 phy_data; |
3143 | bool link; | 3137 | bool link; |
3144 | 3138 | ||
3145 | ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); | 3139 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data); |
3146 | if (ret_val) | 3140 | if (ret_val) |
3147 | goto out; | 3141 | goto out; |
3148 | 3142 | ||
3149 | e1000e_phy_force_speed_duplex_setup(hw, &phy_data); | 3143 | e1000e_phy_force_speed_duplex_setup(hw, &phy_data); |
3150 | 3144 | ||
3151 | ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); | 3145 | ret_val = e1e_wphy(hw, PHY_CONTROL, phy_data); |
3152 | if (ret_val) | 3146 | if (ret_val) |
3153 | goto out; | 3147 | goto out; |
3154 | 3148 | ||
@@ -3212,7 +3206,7 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw) | |||
3212 | if (ret_val) | 3206 | if (ret_val) |
3213 | goto out; | 3207 | goto out; |
3214 | 3208 | ||
3215 | ret_val = phy->ops.read_reg(hw, I82577_PHY_STATUS_2, &data); | 3209 | ret_val = e1e_rphy(hw, I82577_PHY_STATUS_2, &data); |
3216 | if (ret_val) | 3210 | if (ret_val) |
3217 | goto out; | 3211 | goto out; |
3218 | 3212 | ||
@@ -3224,7 +3218,7 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw) | |||
3224 | if (ret_val) | 3218 | if (ret_val) |
3225 | goto out; | 3219 | goto out; |
3226 | 3220 | ||
3227 | ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); | 3221 | ret_val = e1e_rphy(hw, PHY_1000T_STATUS, &data); |
3228 | if (ret_val) | 3222 | if (ret_val) |
3229 | goto out; | 3223 | goto out; |
3230 | 3224 | ||
@@ -3258,7 +3252,7 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw) | |||
3258 | s32 ret_val; | 3252 | s32 ret_val; |
3259 | u16 phy_data, length; | 3253 | u16 phy_data, length; |
3260 | 3254 | ||
3261 | ret_val = phy->ops.read_reg(hw, I82577_PHY_DIAG_STATUS, &phy_data); | 3255 | ret_val = e1e_rphy(hw, I82577_PHY_DIAG_STATUS, &phy_data); |
3262 | if (ret_val) | 3256 | if (ret_val) |
3263 | goto out; | 3257 | goto out; |
3264 | 3258 | ||