aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/reset.c
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2010-12-21 03:30:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-22 15:43:28 -0500
commit0207c0c51a37659a92232e665f2a7fadec170556 (patch)
treebc5755f6252c47c7722c3e69eee92c7274b36320 /drivers/net/wireless/ath/ath5k/reset.c
parent26a51ad7f285236ca593c57cffcaadd40514084a (diff)
ath5k: Use helper function to get eeprom mode from channel
Introduce a helper function to get the EEPROM mode from channel and remove multiple similar switch statements. Also since it's now easy to get the EEPROM mode from the channel, use them inside the functions which need it, instead of passing a redundant ee_mode parameter. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/reset.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index e360e73b3260..84206898f77d 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -866,15 +866,18 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
866} 866}
867 867
868static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, 868static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
869 struct ieee80211_channel *channel, u8 ee_mode) 869 struct ieee80211_channel *channel)
870{ 870{
871 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 871 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
872 s16 cck_ofdm_pwr_delta; 872 s16 cck_ofdm_pwr_delta;
873 u8 ee_mode;
873 874
874 /* TODO: Add support for AR5210 EEPROM */ 875 /* TODO: Add support for AR5210 EEPROM */
875 if (ah->ah_version == AR5K_AR5210) 876 if (ah->ah_version == AR5K_AR5210)
876 return; 877 return;
877 878
879 ee_mode = ath5k_eeprom_mode_from_channel(channel);
880
878 /* Adjust power delta for channel 14 */ 881 /* Adjust power delta for channel 14 */
879 if (channel->center_freq == 2484) 882 if (channel->center_freq == 2484)
880 cck_ofdm_pwr_delta = 883 cck_ofdm_pwr_delta =
@@ -1020,10 +1023,9 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1020 struct ieee80211_channel *channel, bool fast, bool skip_pcu) 1023 struct ieee80211_channel *channel, bool fast, bool skip_pcu)
1021{ 1024{
1022 u32 s_seq[10], s_led[3], tsf_up, tsf_lo; 1025 u32 s_seq[10], s_led[3], tsf_up, tsf_lo;
1023 u8 mode, ee_mode; 1026 u8 mode;
1024 int i, ret; 1027 int i, ret;
1025 1028
1026 ee_mode = 0;
1027 tsf_up = 0; 1029 tsf_up = 0;
1028 tsf_lo = 0; 1030 tsf_lo = 0;
1029 mode = 0; 1031 mode = 0;
@@ -1070,7 +1072,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1070 switch (channel->hw_value & CHANNEL_MODES) { 1072 switch (channel->hw_value & CHANNEL_MODES) {
1071 case CHANNEL_A: 1073 case CHANNEL_A:
1072 mode = AR5K_MODE_11A; 1074 mode = AR5K_MODE_11A;
1073 ee_mode = AR5K_EEPROM_MODE_11A;
1074 break; 1075 break;
1075 case CHANNEL_G: 1076 case CHANNEL_G:
1076 1077
@@ -1081,7 +1082,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1081 } 1082 }
1082 1083
1083 mode = AR5K_MODE_11G; 1084 mode = AR5K_MODE_11G;
1084 ee_mode = AR5K_EEPROM_MODE_11G;
1085 break; 1085 break;
1086 case CHANNEL_B: 1086 case CHANNEL_B:
1087 1087
@@ -1092,7 +1092,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1092 } 1092 }
1093 1093
1094 mode = AR5K_MODE_11B; 1094 mode = AR5K_MODE_11B;
1095 ee_mode = AR5K_EEPROM_MODE_11B;
1096 break; 1095 break;
1097 case CHANNEL_XR: 1096 case CHANNEL_XR:
1098 if (ah->ah_version == AR5K_AR5211) { 1097 if (ah->ah_version == AR5K_AR5211) {
@@ -1101,7 +1100,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1101 return -EINVAL; 1100 return -EINVAL;
1102 } 1101 }
1103 mode = AR5K_MODE_XR; 1102 mode = AR5K_MODE_XR;
1104 ee_mode = AR5K_EEPROM_MODE_11A;
1105 break; 1103 break;
1106 default: 1104 default:
1107 ATH5K_ERR(ah->ah_sc, 1105 ATH5K_ERR(ah->ah_sc,
@@ -1114,8 +1112,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1114 * go on. If it fails continue with a normal reset. 1112 * go on. If it fails continue with a normal reset.
1115 */ 1113 */
1116 if (fast) { 1114 if (fast) {
1117 ret = ath5k_hw_phy_init(ah, channel, mode, 1115 ret = ath5k_hw_phy_init(ah, channel, mode, true);
1118 ee_mode, true);
1119 if (ret) { 1116 if (ret) {
1120 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, 1117 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
1121 "fast chan change failed, falling back to normal reset\n"); 1118 "fast chan change failed, falling back to normal reset\n");
@@ -1212,7 +1209,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1212 ath5k_hw_tweak_initval_settings(ah, channel); 1209 ath5k_hw_tweak_initval_settings(ah, channel);
1213 1210
1214 /* Commit values from EEPROM */ 1211 /* Commit values from EEPROM */
1215 ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode); 1212 ath5k_hw_commit_eeprom_settings(ah, channel);
1216 1213
1217 1214
1218 /* 1215 /*
@@ -1251,7 +1248,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1251 /* 1248 /*
1252 * Initialize PHY 1249 * Initialize PHY
1253 */ 1250 */
1254 ret = ath5k_hw_phy_init(ah, channel, mode, ee_mode, false); 1251 ret = ath5k_hw_phy_init(ah, channel, mode, false);
1255 if (ret) { 1252 if (ret) {
1256 ATH5K_ERR(ah->ah_sc, 1253 ATH5K_ERR(ah->ah_sc,
1257 "failed to initialize PHY (%i) !\n", ret); 1254 "failed to initialize PHY (%i) !\n", ret);