diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2006-09-27 15:53:31 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-09-27 15:53:31 -0400 |
commit | 70c6f30a5e5d616321669acfc853f7851741fd4e (patch) | |
tree | b5ca4c7ab645359691b53e99944eec79ce7241da | |
parent | 11241b106937ec470e0220ae5ce98c8ea27fd700 (diff) |
e1000: add enums for several link properties
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index b3e95c1a1dab..8a7d7da4cd61 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -71,7 +71,7 @@ static int32_t e1000_host_if_read_cookie(struct e1000_hw *hw, uint8_t *buffer); | |||
71 | static uint8_t e1000_calculate_mng_checksum(char *buffer, uint32_t length); | 71 | static uint8_t e1000_calculate_mng_checksum(char *buffer, uint32_t length); |
72 | static uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw); | 72 | static uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw); |
73 | static int32_t e1000_check_downshift(struct e1000_hw *hw); | 73 | static int32_t e1000_check_downshift(struct e1000_hw *hw); |
74 | static int32_t e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity); | 74 | static int32_t e1000_check_polarity(struct e1000_hw *hw, e1000_rev_polarity *polarity); |
75 | static void e1000_clear_hw_cntrs(struct e1000_hw *hw); | 75 | static void e1000_clear_hw_cntrs(struct e1000_hw *hw); |
76 | static void e1000_clear_vfta(struct e1000_hw *hw); | 76 | static void e1000_clear_vfta(struct e1000_hw *hw); |
77 | static int32_t e1000_commit_shadow_ram(struct e1000_hw *hw); | 77 | static int32_t e1000_commit_shadow_ram(struct e1000_hw *hw); |
@@ -4060,7 +4060,8 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4060 | struct e1000_phy_info *phy_info) | 4060 | struct e1000_phy_info *phy_info) |
4061 | { | 4061 | { |
4062 | int32_t ret_val; | 4062 | int32_t ret_val; |
4063 | uint16_t phy_data, polarity, min_length, max_length, average; | 4063 | uint16_t phy_data, min_length, max_length, average; |
4064 | e1000_rev_polarity polarity; | ||
4064 | 4065 | ||
4065 | DEBUGFUNC("e1000_phy_igp_get_info"); | 4066 | DEBUGFUNC("e1000_phy_igp_get_info"); |
4066 | 4067 | ||
@@ -4085,8 +4086,8 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4085 | if (ret_val) | 4086 | if (ret_val) |
4086 | return ret_val; | 4087 | return ret_val; |
4087 | 4088 | ||
4088 | phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >> | 4089 | phy_info->mdix_mode = (e1000_auto_x_mode)((phy_data & IGP01E1000_PSSR_MDIX) >> |
4089 | IGP01E1000_PSSR_MDIX_SHIFT; | 4090 | IGP01E1000_PSSR_MDIX_SHIFT); |
4090 | 4091 | ||
4091 | if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == | 4092 | if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
4092 | IGP01E1000_PSSR_SPEED_1000MBPS) { | 4093 | IGP01E1000_PSSR_SPEED_1000MBPS) { |
@@ -4095,10 +4096,12 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4095 | if (ret_val) | 4096 | if (ret_val) |
4096 | return ret_val; | 4097 | return ret_val; |
4097 | 4098 | ||
4098 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> | 4099 | phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
4099 | SR_1000T_LOCAL_RX_STATUS_SHIFT; | 4100 | SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
4100 | phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) >> | 4101 | e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
4101 | SR_1000T_REMOTE_RX_STATUS_SHIFT; | 4102 | phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
4103 | SR_1000T_REMOTE_RX_STATUS_SHIFT) ? | ||
4104 | e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; | ||
4102 | 4105 | ||
4103 | /* Get cable length */ | 4106 | /* Get cable length */ |
4104 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); | 4107 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
@@ -4134,7 +4137,8 @@ e1000_phy_ife_get_info(struct e1000_hw *hw, | |||
4134 | struct e1000_phy_info *phy_info) | 4137 | struct e1000_phy_info *phy_info) |
4135 | { | 4138 | { |
4136 | int32_t ret_val; | 4139 | int32_t ret_val; |
4137 | uint16_t phy_data, polarity; | 4140 | uint16_t phy_data; |
4141 | e1000_rev_polarity polarity; | ||
4138 | 4142 | ||
4139 | DEBUGFUNC("e1000_phy_ife_get_info"); | 4143 | DEBUGFUNC("e1000_phy_ife_get_info"); |
4140 | 4144 | ||
@@ -4145,8 +4149,9 @@ e1000_phy_ife_get_info(struct e1000_hw *hw, | |||
4145 | if (ret_val) | 4149 | if (ret_val) |
4146 | return ret_val; | 4150 | return ret_val; |
4147 | phy_info->polarity_correction = | 4151 | phy_info->polarity_correction = |
4148 | (phy_data & IFE_PSC_AUTO_POLARITY_DISABLE) >> | 4152 | ((phy_data & IFE_PSC_AUTO_POLARITY_DISABLE) >> |
4149 | IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT; | 4153 | IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT) ? |
4154 | e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled; | ||
4150 | 4155 | ||
4151 | if (phy_info->polarity_correction == e1000_polarity_reversal_enabled) { | 4156 | if (phy_info->polarity_correction == e1000_polarity_reversal_enabled) { |
4152 | ret_val = e1000_check_polarity(hw, &polarity); | 4157 | ret_val = e1000_check_polarity(hw, &polarity); |
@@ -4154,8 +4159,9 @@ e1000_phy_ife_get_info(struct e1000_hw *hw, | |||
4154 | return ret_val; | 4159 | return ret_val; |
4155 | } else { | 4160 | } else { |
4156 | /* Polarity is forced. */ | 4161 | /* Polarity is forced. */ |
4157 | polarity = (phy_data & IFE_PSC_FORCE_POLARITY) >> | 4162 | polarity = ((phy_data & IFE_PSC_FORCE_POLARITY) >> |
4158 | IFE_PSC_FORCE_POLARITY_SHIFT; | 4163 | IFE_PSC_FORCE_POLARITY_SHIFT) ? |
4164 | e1000_rev_polarity_reversed : e1000_rev_polarity_normal; | ||
4159 | } | 4165 | } |
4160 | phy_info->cable_polarity = polarity; | 4166 | phy_info->cable_polarity = polarity; |
4161 | 4167 | ||
@@ -4163,9 +4169,9 @@ e1000_phy_ife_get_info(struct e1000_hw *hw, | |||
4163 | if (ret_val) | 4169 | if (ret_val) |
4164 | return ret_val; | 4170 | return ret_val; |
4165 | 4171 | ||
4166 | phy_info->mdix_mode = | 4172 | phy_info->mdix_mode = (e1000_auto_x_mode) |
4167 | (phy_data & (IFE_PMC_AUTO_MDIX | IFE_PMC_FORCE_MDIX)) >> | 4173 | ((phy_data & (IFE_PMC_AUTO_MDIX | IFE_PMC_FORCE_MDIX)) >> |
4168 | IFE_PMC_MDIX_MODE_SHIFT; | 4174 | IFE_PMC_MDIX_MODE_SHIFT); |
4169 | 4175 | ||
4170 | return E1000_SUCCESS; | 4176 | return E1000_SUCCESS; |
4171 | } | 4177 | } |
@@ -4181,7 +4187,8 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4181 | struct e1000_phy_info *phy_info) | 4187 | struct e1000_phy_info *phy_info) |
4182 | { | 4188 | { |
4183 | int32_t ret_val; | 4189 | int32_t ret_val; |
4184 | uint16_t phy_data, polarity; | 4190 | uint16_t phy_data; |
4191 | e1000_rev_polarity polarity; | ||
4185 | 4192 | ||
4186 | DEBUGFUNC("e1000_phy_m88_get_info"); | 4193 | DEBUGFUNC("e1000_phy_m88_get_info"); |
4187 | 4194 | ||
@@ -4194,11 +4201,14 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4194 | return ret_val; | 4201 | return ret_val; |
4195 | 4202 | ||
4196 | phy_info->extended_10bt_distance = | 4203 | phy_info->extended_10bt_distance = |
4197 | (phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> | 4204 | ((phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> |
4198 | M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT; | 4205 | M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT) ? |
4206 | e1000_10bt_ext_dist_enable_lower : e1000_10bt_ext_dist_enable_normal; | ||
4207 | |||
4199 | phy_info->polarity_correction = | 4208 | phy_info->polarity_correction = |
4200 | (phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >> | 4209 | ((phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >> |
4201 | M88E1000_PSCR_POLARITY_REVERSAL_SHIFT; | 4210 | M88E1000_PSCR_POLARITY_REVERSAL_SHIFT) ? |
4211 | e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled; | ||
4202 | 4212 | ||
4203 | /* Check polarity status */ | 4213 | /* Check polarity status */ |
4204 | ret_val = e1000_check_polarity(hw, &polarity); | 4214 | ret_val = e1000_check_polarity(hw, &polarity); |
@@ -4210,15 +4220,15 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4210 | if (ret_val) | 4220 | if (ret_val) |
4211 | return ret_val; | 4221 | return ret_val; |
4212 | 4222 | ||
4213 | phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> | 4223 | phy_info->mdix_mode = (e1000_auto_x_mode)((phy_data & M88E1000_PSSR_MDIX) >> |
4214 | M88E1000_PSSR_MDIX_SHIFT; | 4224 | M88E1000_PSSR_MDIX_SHIFT); |
4215 | 4225 | ||
4216 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { | 4226 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { |
4217 | /* Cable Length Estimation and Local/Remote Receiver Information | 4227 | /* Cable Length Estimation and Local/Remote Receiver Information |
4218 | * are only valid at 1000 Mbps. | 4228 | * are only valid at 1000 Mbps. |
4219 | */ | 4229 | */ |
4220 | if (hw->phy_type != e1000_phy_gg82563) { | 4230 | if (hw->phy_type != e1000_phy_gg82563) { |
4221 | phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> | 4231 | phy_info->cable_length = (e1000_cable_length)((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
4222 | M88E1000_PSSR_CABLE_LENGTH_SHIFT); | 4232 | M88E1000_PSSR_CABLE_LENGTH_SHIFT); |
4223 | } else { | 4233 | } else { |
4224 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, | 4234 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, |
@@ -4226,18 +4236,20 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4226 | if (ret_val) | 4236 | if (ret_val) |
4227 | return ret_val; | 4237 | return ret_val; |
4228 | 4238 | ||
4229 | phy_info->cable_length = phy_data & GG82563_DSPD_CABLE_LENGTH; | 4239 | phy_info->cable_length = (e1000_cable_length)(phy_data & GG82563_DSPD_CABLE_LENGTH); |
4230 | } | 4240 | } |
4231 | 4241 | ||
4232 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); | 4242 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
4233 | if (ret_val) | 4243 | if (ret_val) |
4234 | return ret_val; | 4244 | return ret_val; |
4235 | 4245 | ||
4236 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> | 4246 | phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
4237 | SR_1000T_LOCAL_RX_STATUS_SHIFT; | 4247 | SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
4248 | e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; | ||
4249 | phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> | ||
4250 | SR_1000T_REMOTE_RX_STATUS_SHIFT) ? | ||
4251 | e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; | ||
4238 | 4252 | ||
4239 | phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) >> | ||
4240 | SR_1000T_REMOTE_RX_STATUS_SHIFT; | ||
4241 | } | 4253 | } |
4242 | 4254 | ||
4243 | return E1000_SUCCESS; | 4255 | return E1000_SUCCESS; |
@@ -6841,7 +6853,7 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6841 | *****************************************************************************/ | 6853 | *****************************************************************************/ |
6842 | static int32_t | 6854 | static int32_t |
6843 | e1000_check_polarity(struct e1000_hw *hw, | 6855 | e1000_check_polarity(struct e1000_hw *hw, |
6844 | uint16_t *polarity) | 6856 | e1000_rev_polarity *polarity) |
6845 | { | 6857 | { |
6846 | int32_t ret_val; | 6858 | int32_t ret_val; |
6847 | uint16_t phy_data; | 6859 | uint16_t phy_data; |
@@ -6855,8 +6867,10 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6855 | &phy_data); | 6867 | &phy_data); |
6856 | if (ret_val) | 6868 | if (ret_val) |
6857 | return ret_val; | 6869 | return ret_val; |
6858 | *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> | 6870 | *polarity = ((phy_data & M88E1000_PSSR_REV_POLARITY) >> |
6859 | M88E1000_PSSR_REV_POLARITY_SHIFT; | 6871 | M88E1000_PSSR_REV_POLARITY_SHIFT) ? |
6872 | e1000_rev_polarity_reversed : e1000_rev_polarity_normal; | ||
6873 | |||
6860 | } else if (hw->phy_type == e1000_phy_igp || | 6874 | } else if (hw->phy_type == e1000_phy_igp || |
6861 | hw->phy_type == e1000_phy_igp_3 || | 6875 | hw->phy_type == e1000_phy_igp_3 || |
6862 | hw->phy_type == e1000_phy_igp_2) { | 6876 | hw->phy_type == e1000_phy_igp_2) { |
@@ -6878,19 +6892,22 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6878 | return ret_val; | 6892 | return ret_val; |
6879 | 6893 | ||
6880 | /* Check the polarity bits */ | 6894 | /* Check the polarity bits */ |
6881 | *polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? 1 : 0; | 6895 | *polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? |
6896 | e1000_rev_polarity_reversed : e1000_rev_polarity_normal; | ||
6882 | } else { | 6897 | } else { |
6883 | /* For 10 Mbps, read the polarity bit in the status register. (for | 6898 | /* For 10 Mbps, read the polarity bit in the status register. (for |
6884 | * 100 Mbps this bit is always 0) */ | 6899 | * 100 Mbps this bit is always 0) */ |
6885 | *polarity = phy_data & IGP01E1000_PSSR_POLARITY_REVERSED; | 6900 | *polarity = (phy_data & IGP01E1000_PSSR_POLARITY_REVERSED) ? |
6901 | e1000_rev_polarity_reversed : e1000_rev_polarity_normal; | ||
6886 | } | 6902 | } |
6887 | } else if (hw->phy_type == e1000_phy_ife) { | 6903 | } else if (hw->phy_type == e1000_phy_ife) { |
6888 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_EXTENDED_STATUS_CONTROL, | 6904 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_EXTENDED_STATUS_CONTROL, |
6889 | &phy_data); | 6905 | &phy_data); |
6890 | if (ret_val) | 6906 | if (ret_val) |
6891 | return ret_val; | 6907 | return ret_val; |
6892 | *polarity = (phy_data & IFE_PESC_POLARITY_REVERSED) >> | 6908 | *polarity = ((phy_data & IFE_PESC_POLARITY_REVERSED) >> |
6893 | IFE_PESC_POLARITY_REVERSED_SHIFT; | 6909 | IFE_PESC_POLARITY_REVERSED_SHIFT) ? |
6910 | e1000_rev_polarity_reversed : e1000_rev_polarity_normal; | ||
6894 | } | 6911 | } |
6895 | return E1000_SUCCESS; | 6912 | return E1000_SUCCESS; |
6896 | } | 6913 | } |