ath9k: add some more ani fixes
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 574-ath9k_remove_old_ani.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -104,11 +104,6 @@ static const struct ani_cck_level_entry
4 #define ATH9K_ANI_CCK_DEF_LEVEL \
5 2 /* default level - matches the INI settings */
6
7 -static bool use_new_ani(struct ath_hw *ah)
8 -{
9 - return AR_SREV_9300_20_OR_LATER(ah) || modparam_force_new_ani;
10 -}
11 -
12 static void ath9k_hw_update_mibstats(struct ath_hw *ah,
13 struct ath9k_mib_stats *stats)
14 {
15 @@ -131,11 +126,6 @@ static void ath9k_ani_restart(struct ath
16 aniState = &ah->curchan->ani;
17 aniState->listenTime = 0;
18
19 - if (!use_new_ani(ah)) {
20 - ofdm_base = AR_PHY_COUNTMAX - ah->config.ofdm_trig_high;
21 - cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high;
22 - }
23 -
24 ath_dbg(common, ANI, "Writing ofdmbase=%u cckbase=%u\n",
25 ofdm_base, cck_base);
26
27 @@ -154,110 +144,6 @@ static void ath9k_ani_restart(struct ath
28 aniState->cckPhyErrCount = 0;
29 }
30
31 -static void ath9k_hw_ani_ofdm_err_trigger_old(struct ath_hw *ah)
32 -{
33 - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
34 - struct ar5416AniState *aniState;
35 - int32_t rssi;
36 -
37 - aniState = &ah->curchan->ani;
38 -
39 - if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
40 - if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
41 - aniState->noiseImmunityLevel + 1)) {
42 - return;
43 - }
44 - }
45 -
46 - if (aniState->spurImmunityLevel < HAL_SPUR_IMMUNE_MAX) {
47 - if (ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
48 - aniState->spurImmunityLevel + 1)) {
49 - return;
50 - }
51 - }
52 -
53 - if (ah->opmode != NL80211_IFTYPE_STATION) {
54 - if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
55 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
56 - aniState->firstepLevel + 1);
57 - }
58 - return;
59 - }
60 - rssi = BEACON_RSSI(ah);
61 - if (rssi > aniState->rssiThrHigh) {
62 - if (aniState->ofdmWeakSigDetect) {
63 - if (ath9k_hw_ani_control(ah,
64 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
65 - false)) {
66 - ath9k_hw_ani_control(ah,
67 - ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0);
68 - return;
69 - }
70 - }
71 - if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
72 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
73 - aniState->firstepLevel + 1);
74 - return;
75 - }
76 - } else if (rssi > aniState->rssiThrLow) {
77 - if (!aniState->ofdmWeakSigDetect)
78 - ath9k_hw_ani_control(ah,
79 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
80 - true);
81 - if (aniState->firstepLevel < HAL_FIRST_STEP_MAX)
82 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
83 - aniState->firstepLevel + 1);
84 - return;
85 - } else {
86 - if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
87 - !conf_is_ht(conf)) {
88 - if (aniState->ofdmWeakSigDetect)
89 - ath9k_hw_ani_control(ah,
90 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
91 - false);
92 - if (aniState->firstepLevel > 0)
93 - ath9k_hw_ani_control(ah,
94 - ATH9K_ANI_FIRSTEP_LEVEL, 0);
95 - return;
96 - }
97 - }
98 -}
99 -
100 -static void ath9k_hw_ani_cck_err_trigger_old(struct ath_hw *ah)
101 -{
102 - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
103 - struct ar5416AniState *aniState;
104 - int32_t rssi;
105 -
106 - aniState = &ah->curchan->ani;
107 - if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
108 - if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
109 - aniState->noiseImmunityLevel + 1)) {
110 - return;
111 - }
112 - }
113 - if (ah->opmode != NL80211_IFTYPE_STATION) {
114 - if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
115 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
116 - aniState->firstepLevel + 1);
117 - }
118 - return;
119 - }
120 - rssi = BEACON_RSSI(ah);
121 - if (rssi > aniState->rssiThrLow) {
122 - if (aniState->firstepLevel < HAL_FIRST_STEP_MAX)
123 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
124 - aniState->firstepLevel + 1);
125 - } else {
126 - if ((conf->channel->band == IEEE80211_BAND_2GHZ) &&
127 - !conf_is_ht(conf)) {
128 - if (aniState->firstepLevel > 0)
129 - ath9k_hw_ani_control(ah,
130 - ATH9K_ANI_FIRSTEP_LEVEL, 0);
131 - }
132 - }
133 -}
134 -
135 /* Adjust the OFDM Noise Immunity Level */
136 static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
137 {
138 @@ -309,11 +195,6 @@ static void ath9k_hw_ani_ofdm_err_trigge
139 if (!DO_ANI(ah))
140 return;
141
142 - if (!use_new_ani(ah)) {
143 - ath9k_hw_ani_ofdm_err_trigger_old(ah);
144 - return;
145 - }
146 -
147 aniState = &ah->curchan->ani;
148
149 if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
150 @@ -371,70 +252,12 @@ static void ath9k_hw_ani_cck_err_trigger
151 if (!DO_ANI(ah))
152 return;
153
154 - if (!use_new_ani(ah)) {
155 - ath9k_hw_ani_cck_err_trigger_old(ah);
156 - return;
157 - }
158 -
159 aniState = &ah->curchan->ani;
160
161 if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
162 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1);
163 }
164
165 -static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah)
166 -{
167 - struct ar5416AniState *aniState;
168 - int32_t rssi;
169 -
170 - aniState = &ah->curchan->ani;
171 -
172 - if (ah->opmode != NL80211_IFTYPE_STATION) {
173 - if (aniState->firstepLevel > 0) {
174 - if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
175 - aniState->firstepLevel - 1))
176 - return;
177 - }
178 - } else {
179 - rssi = BEACON_RSSI(ah);
180 - if (rssi > aniState->rssiThrHigh) {
181 - /* XXX: Handle me */
182 - } else if (rssi > aniState->rssiThrLow) {
183 - if (!aniState->ofdmWeakSigDetect) {
184 - if (ath9k_hw_ani_control(ah,
185 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
186 - true))
187 - return;
188 - }
189 - if (aniState->firstepLevel > 0) {
190 - if (ath9k_hw_ani_control(ah,
191 - ATH9K_ANI_FIRSTEP_LEVEL,
192 - aniState->firstepLevel - 1))
193 - return;
194 - }
195 - } else {
196 - if (aniState->firstepLevel > 0) {
197 - if (ath9k_hw_ani_control(ah,
198 - ATH9K_ANI_FIRSTEP_LEVEL,
199 - aniState->firstepLevel - 1))
200 - return;
201 - }
202 - }
203 - }
204 -
205 - if (aniState->spurImmunityLevel > 0) {
206 - if (ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
207 - aniState->spurImmunityLevel - 1))
208 - return;
209 - }
210 -
211 - if (aniState->noiseImmunityLevel > 0) {
212 - ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
213 - aniState->noiseImmunityLevel - 1);
214 - return;
215 - }
216 -}
217 -
218 /*
219 * only lower either OFDM or CCK errors per turn
220 * we lower the other one next time
221 @@ -445,11 +268,6 @@ static void ath9k_hw_ani_lower_immunity(
222
223 aniState = &ah->curchan->ani;
224
225 - if (!use_new_ani(ah)) {
226 - ath9k_hw_ani_lower_immunity_old(ah);
227 - return;
228 - }
229 -
230 /* lower OFDM noise immunity */
231 if (aniState->ofdmNoiseImmunityLevel > 0 &&
232 (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) {
233 @@ -462,71 +280,6 @@ static void ath9k_hw_ani_lower_immunity(
234 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1);
235 }
236
237 -static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning)
238 -{
239 - struct ar5416AniState *aniState;
240 - struct ath9k_channel *chan = ah->curchan;
241 - struct ath_common *common = ath9k_hw_common(ah);
242 -
243 - if (!DO_ANI(ah))
244 - return;
245 -
246 - aniState = &ah->curchan->ani;
247 -
248 - if (ah->opmode != NL80211_IFTYPE_STATION) {
249 - ath_dbg(common, ANI, "Reset ANI state opmode %u\n", ah->opmode);
250 - ah->stats.ast_ani_reset++;
251 -
252 - if (ah->opmode == NL80211_IFTYPE_AP) {
253 - /*
254 - * ath9k_hw_ani_control() will only process items set on
255 - * ah->ani_function
256 - */
257 - if (IS_CHAN_2GHZ(chan))
258 - ah->ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL |
259 - ATH9K_ANI_FIRSTEP_LEVEL);
260 - else
261 - ah->ani_function = 0;
262 - }
263 -
264 - ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0);
265 - ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0);
266 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 0);
267 - ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
268 - !ATH9K_ANI_USE_OFDM_WEAK_SIG);
269 - ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR,
270 - ATH9K_ANI_CCK_WEAK_SIG_THR);
271 -
272 - ath9k_ani_restart(ah);
273 - return;
274 - }
275 -
276 - if (aniState->noiseImmunityLevel != 0)
277 - ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
278 - aniState->noiseImmunityLevel);
279 - if (aniState->spurImmunityLevel != 0)
280 - ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
281 - aniState->spurImmunityLevel);
282 - if (!aniState->ofdmWeakSigDetect)
283 - ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
284 - aniState->ofdmWeakSigDetect);
285 - if (aniState->cckWeakSigThreshold)
286 - ath9k_hw_ani_control(ah, ATH9K_ANI_CCK_WEAK_SIGNAL_THR,
287 - aniState->cckWeakSigThreshold);
288 - if (aniState->firstepLevel != 0)
289 - ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
290 - aniState->firstepLevel);
291 -
292 - ath9k_ani_restart(ah);
293 -
294 - ENABLE_REGWRITE_BUFFER(ah);
295 -
296 - REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
297 - REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
298 -
299 - REGWRITE_BUFFER_FLUSH(ah);
300 -}
301 -
302 /*
303 * Restore the ANI parameters in the HAL and reset the statistics.
304 * This routine should be called for every hardware reset and for
305 @@ -541,9 +294,6 @@ void ath9k_ani_reset(struct ath_hw *ah,
306 if (!DO_ANI(ah))
307 return;
308
309 - if (!use_new_ani(ah))
310 - return ath9k_ani_reset_old(ah, is_scanning);
311 -
312 BUG_ON(aniState == NULL);
313 ah->stats.ast_ani_reset++;
314
315 @@ -640,11 +390,6 @@ static bool ath9k_hw_ani_read_counters(s
316 return false;
317 }
318
319 - if (!use_new_ani(ah)) {
320 - ofdm_base = AR_PHY_COUNTMAX - ah->config.ofdm_trig_high;
321 - cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high;
322 - }
323 -
324 aniState->listenTime += listenTime;
325
326 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
327 @@ -652,26 +397,6 @@ static bool ath9k_hw_ani_read_counters(s
328 phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
329 phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
330
331 - if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) {
332 - if (phyCnt1 < ofdm_base) {
333 - ath_dbg(common, ANI,
334 - "phyCnt1 0x%x, resetting counter value to 0x%x\n",
335 - phyCnt1, ofdm_base);
336 - REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base);
337 - REG_WRITE(ah, AR_PHY_ERR_MASK_1,
338 - AR_PHY_ERR_OFDM_TIMING);
339 - }
340 - if (phyCnt2 < cck_base) {
341 - ath_dbg(common, ANI,
342 - "phyCnt2 0x%x, resetting counter value to 0x%x\n",
343 - phyCnt2, cck_base);
344 - REG_WRITE(ah, AR_PHY_ERR_2, cck_base);
345 - REG_WRITE(ah, AR_PHY_ERR_MASK_2,
346 - AR_PHY_ERR_CCK_TIMING);
347 - }
348 - return false;
349 - }
350 -
351 ofdmPhyErrCnt = phyCnt1 - ofdm_base;
352 ah->stats.ast_ani_ofdmerrs +=
353 ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
354 @@ -810,9 +535,6 @@ void ath9k_hw_proc_mib_event(struct ath_
355 if (((phyCnt1 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK) ||
356 ((phyCnt2 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK)) {
357
358 - if (!use_new_ani(ah))
359 - ath9k_hw_ani_read_counters(ah);
360 -
361 /* NB: always restart to insure the h/w counters are reset */
362 ath9k_ani_restart(ah);
363 }
364 @@ -843,45 +565,28 @@ void ath9k_hw_ani_init(struct ath_hw *ah
365
366 ath_dbg(common, ANI, "Initialize ANI\n");
367
368 - if (use_new_ani(ah)) {
369 - ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW;
370 - ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_NEW;
371 + ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW;
372 + ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_NEW;
373
374 - ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_NEW;
375 - ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_NEW;
376 - } else {
377 - ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD;
378 - ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD;
379 -
380 - ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD;
381 - ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD;
382 - }
383 + ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_NEW;
384 + ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_NEW;
385
386 for (i = 0; i < ARRAY_SIZE(ah->channels); i++) {
387 struct ath9k_channel *chan = &ah->channels[i];
388 struct ar5416AniState *ani = &chan->ani;
389
390 - if (use_new_ani(ah)) {
391 - ani->spurImmunityLevel =
392 - ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
393 + ani->spurImmunityLevel =
394 + ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;
395
396 - ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
397 + ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;
398
399 - if (AR_SREV_9300_20_OR_LATER(ah))
400 - ani->mrcCCKOff =
401 - !ATH9K_ANI_ENABLE_MRC_CCK;
402 - else
403 - ani->mrcCCKOff = true;
404 -
405 - ani->ofdmsTurn = true;
406 - } else {
407 - ani->spurImmunityLevel =
408 - ATH9K_ANI_SPUR_IMMUNE_LVL_OLD;
409 - ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_OLD;
410 + if (AR_SREV_9300_20_OR_LATER(ah))
411 + ani->mrcCCKOff =
412 + !ATH9K_ANI_ENABLE_MRC_CCK;
413 + else
414 + ani->mrcCCKOff = true;
415
416 - ani->cckWeakSigThreshold =
417 - ATH9K_ANI_CCK_WEAK_SIG_THR;
418 - }
419 + ani->ofdmsTurn = true;
420
421 ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
422 ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
423 @@ -895,13 +600,8 @@ void ath9k_hw_ani_init(struct ath_hw *ah
424 * since we expect some ongoing maintenance on the tables, let's sanity
425 * check here default level should not modify INI setting.
426 */
427 - if (use_new_ani(ah)) {
428 - ah->aniperiod = ATH9K_ANI_PERIOD_NEW;
429 - ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW;
430 - } else {
431 - ah->aniperiod = ATH9K_ANI_PERIOD_OLD;
432 - ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_OLD;
433 - }
434 + ah->aniperiod = ATH9K_ANI_PERIOD_NEW;
435 + ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW;
436
437 if (ah->config.enable_ani)
438 ah->proc_phyerr |= HAL_PROCESS_ANI;
439 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
440 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
441 @@ -995,141 +995,6 @@ static u32 ar5008_hw_compute_pll_control
442 return pll;
443 }
444
445 -static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
446 - enum ath9k_ani_cmd cmd,
447 - int param)
448 -{
449 - struct ar5416AniState *aniState = &ah->curchan->ani;
450 - struct ath_common *common = ath9k_hw_common(ah);
451 -
452 - switch (cmd & ah->ani_function) {
453 - case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{
454 - u32 level = param;
455 -
456 - if (level >= ARRAY_SIZE(ah->totalSizeDesired)) {
457 - ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
458 - level, ARRAY_SIZE(ah->totalSizeDesired));
459 - return false;
460 - }
461 -
462 - REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
463 - AR_PHY_DESIRED_SZ_TOT_DES,
464 - ah->totalSizeDesired[level]);
465 - REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
466 - AR_PHY_AGC_CTL1_COARSE_LOW,
467 - ah->coarse_low[level]);
468 - REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
469 - AR_PHY_AGC_CTL1_COARSE_HIGH,
470 - ah->coarse_high[level]);
471 - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
472 - AR_PHY_FIND_SIG_FIRPWR,
473 - ah->firpwr[level]);
474 -
475 - if (level > aniState->noiseImmunityLevel)
476 - ah->stats.ast_ani_niup++;
477 - else if (level < aniState->noiseImmunityLevel)
478 - ah->stats.ast_ani_nidown++;
479 - aniState->noiseImmunityLevel = level;
480 - break;
481 - }
482 - case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{
483 - u32 on = param ? 1 : 0;
484 -
485 - if (on)
486 - REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
487 - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
488 - else
489 - REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
490 - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
491 -
492 - if (on != aniState->ofdmWeakSigDetect) {
493 - if (on)
494 - ah->stats.ast_ani_ofdmon++;
495 - else
496 - ah->stats.ast_ani_ofdmoff++;
497 - aniState->ofdmWeakSigDetect = on;
498 - }
499 - break;
500 - }
501 - case ATH9K_ANI_CCK_WEAK_SIGNAL_THR:{
502 - static const int weakSigThrCck[] = { 8, 6 };
503 - u32 high = param ? 1 : 0;
504 -
505 - REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT,
506 - AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK,
507 - weakSigThrCck[high]);
508 - if (high != aniState->cckWeakSigThreshold) {
509 - if (high)
510 - ah->stats.ast_ani_cckhigh++;
511 - else
512 - ah->stats.ast_ani_ccklow++;
513 - aniState->cckWeakSigThreshold = high;
514 - }
515 - break;
516 - }
517 - case ATH9K_ANI_FIRSTEP_LEVEL:{
518 - static const int firstep[] = { 0, 4, 8 };
519 - u32 level = param;
520 -
521 - if (level >= ARRAY_SIZE(firstep)) {
522 - ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
523 - level, ARRAY_SIZE(firstep));
524 - return false;
525 - }
526 - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
527 - AR_PHY_FIND_SIG_FIRSTEP,
528 - firstep[level]);
529 - if (level > aniState->firstepLevel)
530 - ah->stats.ast_ani_stepup++;
531 - else if (level < aniState->firstepLevel)
532 - ah->stats.ast_ani_stepdown++;
533 - aniState->firstepLevel = level;
534 - break;
535 - }
536 - case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{
537 - static const int cycpwrThr1[] = { 2, 4, 6, 8, 10, 12, 14, 16 };
538 - u32 level = param;
539 -
540 - if (level >= ARRAY_SIZE(cycpwrThr1)) {
541 - ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
542 - level, ARRAY_SIZE(cycpwrThr1));
543 - return false;
544 - }
545 - REG_RMW_FIELD(ah, AR_PHY_TIMING5,
546 - AR_PHY_TIMING5_CYCPWR_THR1,
547 - cycpwrThr1[level]);
548 - if (level > aniState->spurImmunityLevel)
549 - ah->stats.ast_ani_spurup++;
550 - else if (level < aniState->spurImmunityLevel)
551 - ah->stats.ast_ani_spurdown++;
552 - aniState->spurImmunityLevel = level;
553 - break;
554 - }
555 - case ATH9K_ANI_PRESENT:
556 - break;
557 - default:
558 - ath_dbg(common, ANI, "invalid cmd %u\n", cmd);
559 - return false;
560 - }
561 -
562 - ath_dbg(common, ANI, "ANI parameters:\n");
563 - ath_dbg(common, ANI,
564 - "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetect=%d\n",
565 - aniState->noiseImmunityLevel,
566 - aniState->spurImmunityLevel,
567 - aniState->ofdmWeakSigDetect);
568 - ath_dbg(common, ANI,
569 - "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
570 - aniState->cckWeakSigThreshold,
571 - aniState->firstepLevel,
572 - aniState->listenTime);
573 - ath_dbg(common, ANI, "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n",
574 - aniState->ofdmPhyErrCount,
575 - aniState->cckPhyErrCount);
576 -
577 - return true;
578 -}
579 -
580 static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
581 enum ath9k_ani_cmd cmd,
582 int param)
583 @@ -1545,11 +1410,8 @@ void ar5008_hw_attach_phy_ops(struct ath
584 priv_ops->do_getnf = ar5008_hw_do_getnf;
585 priv_ops->set_radar_params = ar5008_hw_set_radar_params;
586
587 - if (modparam_force_new_ani) {
588 - priv_ops->ani_control = ar5008_hw_ani_control_new;
589 - priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs;
590 - } else
591 - priv_ops->ani_control = ar5008_hw_ani_control_old;
592 + priv_ops->ani_control = ar5008_hw_ani_control_new;
593 + priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs;
594
595 if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah))
596 priv_ops->compute_pll_control = ar9160_hw_compute_pll_control;
597 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
598 +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
599 @@ -21,10 +21,6 @@
600 #include "ar9002_initvals.h"
601 #include "ar9002_phy.h"
602
603 -int modparam_force_new_ani;
604 -module_param_named(force_new_ani, modparam_force_new_ani, int, 0444);
605 -MODULE_PARM_DESC(force_new_ani, "Force new ANI for AR5008, AR9001, AR9002");
606 -
607 /* General hardware code for the A5008/AR9001/AR9002 hadware families */
608
609 static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
610 --- a/drivers/net/wireless/ath/ath9k/hw.h
611 +++ b/drivers/net/wireless/ath/ath9k/hw.h
612 @@ -1021,14 +1021,7 @@ void ar9002_hw_attach_ops(struct ath_hw
613 void ar9003_hw_attach_ops(struct ath_hw *ah);
614
615 void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan);
616 -/*
617 - * ANI work can be shared between all families but a next
618 - * generation implementation of ANI will be used only for AR9003 only
619 - * for now as the other families still need to be tested with the same
620 - * next generation ANI. Feel free to start testing it though for the
621 - * older families (AR5008, AR9001, AR9002) by using modparam_force_new_ani.
622 - */
623 -extern int modparam_force_new_ani;
624 +
625 void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning);
626 void ath9k_hw_proc_mib_event(struct ath_hw *ah);
627 void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan);