package/mac80211/patches/520-pending_work.patch |
1 | | +++ b/net/mac80211/main.c |
2 | | @@ -103,11 +103,13 @@ int ieee80211_hw_config(struct ieee80211 |
3 | | int ret = 0; |
4 | | int power; |
5 | | enum nl80211_channel_type channel_type; |
6 | | + u32 offchannel_flag; |
7 | | |
8 | | might_sleep(); |
9 | | |
10 | | scan_chan = local->scan_channel; |
11 | | |
12 | | + offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; |
13 | | if (scan_chan) { |
14 | | chan = scan_chan; |
15 | | channel_type = NL80211_CHAN_NO_HT; |
16 | | @@ -121,8 +123,9 @@ int ieee80211_hw_config(struct ieee80211 |
17 | | channel_type = local->_oper_channel_type; |
18 | | local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; |
19 | | } |
20 | | + offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; |
21 | | |
22 | | - if (chan != local->hw.conf.channel || |
23 | | + if (offchannel_flag || chan != local->hw.conf.channel || |
24 | | channel_type != local->hw.conf.channel_type) { |
25 | | local->hw.conf.channel = chan; |
26 | | local->hw.conf.channel_type = channel_type; |
27 | | +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c |
28 | | @@ -63,6 +63,7 @@ static bool ar9002_hw_per_calibration(st |
29 | | u8 rxchainmask, |
30 | | struct ath9k_cal_list *currCal) |
31 | | { |
32 | | + struct ath9k_hw_cal_data *caldata = ah->caldata; |
33 | | bool iscaldone = false; |
34 | | |
35 | | if (currCal->calState == CAL_RUNNING) { |
36 | | @@ -81,14 +82,14 @@ static bool ar9002_hw_per_calibration(st |
37 | | } |
38 | | |
39 | | currCal->calData->calPostProc(ah, numChains); |
40 | | - ichan->CalValid |= currCal->calData->calType; |
41 | | + caldata->CalValid |= currCal->calData->calType; |
42 | | currCal->calState = CAL_DONE; |
43 | | iscaldone = true; |
44 | | } else { |
45 | | ar9002_hw_setup_calibration(ah, currCal); |
46 | | } |
47 | | } |
48 | | - } else if (!(ichan->CalValid & currCal->calData->calType)) { |
49 | | + } else if (!(caldata->CalValid & currCal->calData->calType)) { |
50 | | ath9k_hw_reset_calibration(ah, currCal); |
51 | | } |
52 | | |
53 | | @@ -686,8 +687,13 @@ static bool ar9002_hw_calibrate(struct a |
54 | | { |
55 | | bool iscaldone = true; |
56 | | struct ath9k_cal_list *currCal = ah->cal_list_curr; |
57 | | + bool nfcal, nfcal_pending = false; |
58 | | |
59 | | - if (currCal && |
60 | | + nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF); |
61 | | + if (ah->caldata) |
62 | | + nfcal_pending = ah->caldata->nfcal_pending; |
63 | | + |
64 | | + if (currCal && !nfcal && |
65 | | (currCal->calState == CAL_RUNNING || |
66 | | currCal->calState == CAL_WAITING)) { |
67 | | iscaldone = ar9002_hw_per_calibration(ah, chan, |
68 | | @@ -703,7 +709,7 @@ static bool ar9002_hw_calibrate(struct a |
69 | | } |
70 | | |
71 | | /* Do NF cal only at longer intervals */ |
72 | | - if (longcal) { |
73 | | + if (longcal || nfcal_pending) { |
74 | | /* Do periodic PAOffset Cal */ |
75 | | ar9002_hw_pa_cal(ah, false); |
76 | | ar9002_hw_olc_temp_compensation(ah); |
77 | | @@ -712,16 +718,18 @@ static bool ar9002_hw_calibrate(struct a |
78 | | * Get the value from the previous NF cal and update |
79 | | * history buffer. |
80 | | */ |
81 | | - ath9k_hw_getnf(ah, chan); |
82 | | - |
83 | | - /* |
84 | | - * Load the NF from history buffer of the current channel. |
85 | | - * NF is slow time-variant, so it is OK to use a historical |
86 | | - * value. |
87 | | - */ |
88 | | - ath9k_hw_loadnf(ah, ah->curchan); |
89 | | + if (ath9k_hw_getnf(ah, chan)) { |
90 | | + /* |
91 | | + * Load the NF from history buffer of the current |
92 | | + * channel. |
93 | | + * NF is slow time-variant, so it is OK to use a |
94 | | + * historical value. |
95 | | + */ |
96 | | + ath9k_hw_loadnf(ah, ah->curchan); |
97 | | + } |
98 | | |
99 | | - ath9k_hw_start_nfcal(ah); |
100 | | + if (longcal) |
101 | | + ath9k_hw_start_nfcal(ah, false); |
102 | | } |
103 | | |
104 | | return iscaldone; |
105 | | @@ -869,8 +877,10 @@ static bool ar9002_hw_init_cal(struct at |
106 | | ar9002_hw_pa_cal(ah, true); |
107 | | |
108 | | /* Do NF Calibration after DC offset and other calibrations */ |
109 | | - REG_WRITE(ah, AR_PHY_AGC_CONTROL, |
110 | | - REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF); |
111 | | + ath9k_hw_start_nfcal(ah, true); |
112 | | + |
113 | | + if (ah->caldata) |
114 | | + ah->caldata->nfcal_pending = true; |
115 | | |
116 | | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
117 | | |
118 | | @@ -901,7 +911,8 @@ static bool ar9002_hw_init_cal(struct at |
119 | | ath9k_hw_reset_calibration(ah, ah->cal_list_curr); |
120 | | } |
121 | | |
122 | | - chan->CalValid = 0; |
123 | | + if (ah->caldata) |
124 | | + ah->caldata->CalValid = 0; |
125 | | |
126 | | return true; |
127 | | } |
128 | | +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c |
129 | | @@ -68,6 +68,7 @@ static bool ar9003_hw_per_calibration(st |
130 | | u8 rxchainmask, |
131 | | struct ath9k_cal_list *currCal) |
132 | | { |
133 | | + struct ath9k_hw_cal_data *caldata = ah->caldata; |
134 | | /* Cal is assumed not done until explicitly set below */ |
135 | | bool iscaldone = false; |
136 | | |
137 | | @@ -95,7 +96,7 @@ static bool ar9003_hw_per_calibration(st |
138 | | currCal->calData->calPostProc(ah, numChains); |
139 | | |
140 | | /* Calibration has finished. */ |
141 | | - ichan->CalValid |= currCal->calData->calType; |
142 | | + caldata->CalValid |= currCal->calData->calType; |
143 | | currCal->calState = CAL_DONE; |
144 | | iscaldone = true; |
145 | | } else { |
146 | | @@ -106,7 +107,7 @@ static bool ar9003_hw_per_calibration(st |
147 | | ar9003_hw_setup_calibration(ah, currCal); |
148 | | } |
149 | | } |
150 | | - } else if (!(ichan->CalValid & currCal->calData->calType)) { |
151 | | + } else if (!(caldata->CalValid & currCal->calData->calType)) { |
152 | | /* If current cal is marked invalid in channel, kick it off */ |
153 | | ath9k_hw_reset_calibration(ah, currCal); |
154 | | } |
155 | | @@ -149,6 +150,12 @@ static bool ar9003_hw_calibrate(struct a |
156 | | /* Do NF cal only at longer intervals */ |
157 | | if (longcal) { |
158 | | /* |
159 | | + * Get the value from the previous NF cal and update |
160 | | + * history buffer. |
161 | | + */ |
162 | | + ath9k_hw_getnf(ah, chan); |
163 | | + |
164 | | + /* |
165 | | * Load the NF from history buffer of the current channel. |
166 | | * NF is slow time-variant, so it is OK to use a historical |
167 | | * value. |
168 | | @@ -156,7 +163,7 @@ static bool ar9003_hw_calibrate(struct a |
169 | | ath9k_hw_loadnf(ah, ah->curchan); |
170 | | |
171 | | /* start NF calibration, without updating BB NF register */ |
172 | | - ath9k_hw_start_nfcal(ah); |
173 | | + ath9k_hw_start_nfcal(ah, false); |
174 | | } |
175 | | |
176 | | return iscaldone; |
177 | | @@ -762,6 +769,8 @@ static bool ar9003_hw_init_cal(struct at |
178 | | /* Revert chainmasks to their original values before NF cal */ |
179 | | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
180 | | |
181 | | + ath9k_hw_start_nfcal(ah, true); |
182 | | + |
183 | | /* Initialize list pointers */ |
184 | | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
185 | | |
186 | | @@ -785,7 +794,8 @@ static bool ar9003_hw_init_cal(struct at |
187 | | if (ah->cal_list_curr) |
188 | | ath9k_hw_reset_calibration(ah, ah->cal_list_curr); |
189 | | |
190 | | - chan->CalValid = 0; |
191 | | + if (ah->caldata) |
192 | | + ah->caldata->CalValid = 0; |
193 | | |
194 | | return true; |
195 | | } |
196 | | +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c |
197 | | @@ -542,7 +542,11 @@ static void ar9003_hw_prog_ini(struct at |
198 | | u32 reg = INI_RA(iniArr, i, 0); |
199 | | u32 val = INI_RA(iniArr, i, column); |
200 | | |
201 | | - REG_WRITE(ah, reg, val); |
202 | | + if (reg >= 0x16000 && reg < 0x17000) |
203 | | + ath9k_hw_analog_shift_regwrite(ah, reg, val); |
204 | | + else |
205 | | + REG_WRITE(ah, reg, val); |
206 | | + |
207 | | DO_DELAY(regWrites); |
208 | | } |
209 | | } |
210 | | +++ b/drivers/net/wireless/ath/ath9k/calib.c |
211 | | @@ -22,23 +22,6 @@ |
212 | | /* We can tune this as we go by monitoring really low values */ |
213 | | #define ATH9K_NF_TOO_LOW -60 |
214 | | |
215 | | -/* AR5416 may return very high value (like -31 dBm), in those cases the nf |
216 | | - * is incorrect and we should use the static NF value. Later we can try to |
217 | | - * find out why they are reporting these values */ |
218 | | - |
219 | | -static bool ath9k_hw_nf_in_range(struct ath_hw *ah, s16 nf) |
220 | | -{ |
221 | | - if (nf > ATH9K_NF_TOO_LOW) { |
222 | | - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, |
223 | | - "noise floor value detected (%d) is " |
224 | | - "lower than what we think is a " |
225 | | - "reasonable value (%d)\n", |
226 | | - nf, ATH9K_NF_TOO_LOW); |
227 | | - return false; |
228 | | - } |
229 | | - return true; |
230 | | -} |
231 | | - |
232 | | static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) |
233 | | { |
234 | | int16_t nfval; |
235 | | @@ -121,6 +104,19 @@ void ath9k_hw_reset_calibration(struct a |
236 | | ah->cal_samples = 0; |
237 | | } |
238 | | |
239 | | +static s16 ath9k_hw_get_default_nf(struct ath_hw *ah, |
240 | | + struct ath9k_channel *chan) |
241 | | +{ |
242 | | + struct ath_nf_limits *limit; |
243 | | + |
244 | | + if (!chan || IS_CHAN_2GHZ(chan)) |
245 | | + limit = &ah->nf_2g; |
246 | | + else |
247 | | + limit = &ah->nf_5g; |
248 | | + |
249 | | + return limit->nominal; |
250 | | +} |
251 | | + |
252 | | /* This is done for the currently configured channel */ |
253 | | bool ath9k_hw_reset_calvalid(struct ath_hw *ah) |
254 | | { |
255 | | @@ -128,7 +124,7 @@ bool ath9k_hw_reset_calvalid(struct ath_ |
256 | | struct ieee80211_conf *conf = &common->hw->conf; |
257 | | struct ath9k_cal_list *currCal = ah->cal_list_curr; |
258 | | |
259 | | - if (!ah->curchan) |
260 | | + if (!ah->caldata) |
261 | | return true; |
262 | | |
263 | | if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah)) |
264 | | @@ -151,37 +147,55 @@ bool ath9k_hw_reset_calvalid(struct ath_ |
265 | | "Resetting Cal %d state for channel %u\n", |
266 | | currCal->calData->calType, conf->channel->center_freq); |
267 | | |
268 | | - ah->curchan->CalValid &= ~currCal->calData->calType; |
269 | | + ah->caldata->CalValid &= ~currCal->calData->calType; |
270 | | currCal->calState = CAL_WAITING; |
271 | | |
272 | | return false; |
273 | | } |
274 | | EXPORT_SYMBOL(ath9k_hw_reset_calvalid); |
275 | | |
276 | | -void ath9k_hw_start_nfcal(struct ath_hw *ah) |
277 | | +void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update) |
278 | | { |
279 | | + if (ah->caldata) |
280 | | + ah->caldata->nfcal_pending = true; |
281 | | + |
282 | | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, |
283 | | AR_PHY_AGC_CONTROL_ENABLE_NF); |
284 | | - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, |
285 | | + |
286 | | + if (update) |
287 | | + REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, |
288 | | + AR_PHY_AGC_CONTROL_NO_UPDATE_NF); |
289 | | + else |
290 | | + REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, |
291 | | AR_PHY_AGC_CONTROL_NO_UPDATE_NF); |
292 | | + |
293 | | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); |
294 | | } |
295 | | |
296 | | void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) |
297 | | { |
298 | | - struct ath9k_nfcal_hist *h; |
299 | | + struct ath9k_nfcal_hist *h = NULL; |
300 | | unsigned i, j; |
301 | | int32_t val; |
302 | | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; |
303 | | struct ath_common *common = ath9k_hw_common(ah); |
304 | | + s16 default_nf = ath9k_hw_get_default_nf(ah, chan); |
305 | | |
306 | | - h = ah->nfCalHist; |
307 | | + if (ah->caldata) |
308 | | + h = ah->caldata->nfCalHist; |
309 | | |
310 | | for (i = 0; i < NUM_NF_READINGS; i++) { |
311 | | if (chainmask & (1 << i)) { |
312 | | + s16 nfval; |
313 | | + |
314 | | + if (h) |
315 | | + nfval = h[i].privNF; |
316 | | + else |
317 | | + nfval = default_nf; |
318 | | + |
319 | | val = REG_READ(ah, ah->nf_regs[i]); |
320 | | val &= 0xFFFFFE00; |
321 | | - val |= (((u32) (h[i].privNF) << 1) & 0x1ff); |
322 | | + val |= (((u32) nfval << 1) & 0x1ff); |
323 | | REG_WRITE(ah, ah->nf_regs[i], val); |
324 | | } |
325 | | } |
326 | | @@ -277,22 +291,25 @@ static void ath9k_hw_nf_sanitize(struct |
327 | | } |
328 | | } |
329 | | |
330 | | -int16_t ath9k_hw_getnf(struct ath_hw *ah, |
331 | | - struct ath9k_channel *chan) |
332 | | +bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan) |
333 | | { |
334 | | struct ath_common *common = ath9k_hw_common(ah); |
335 | | int16_t nf, nfThresh; |
336 | | int16_t nfarray[NUM_NF_READINGS] = { 0 }; |
337 | | struct ath9k_nfcal_hist *h; |
338 | | struct ieee80211_channel *c = chan->chan; |
339 | | + struct ath9k_hw_cal_data *caldata = ah->caldata; |
340 | | + |
341 | | + if (!caldata) |
342 | | + return false; |
343 | | |
344 | | chan->channelFlags &= (~CHANNEL_CW_INT); |
345 | | if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { |
346 | | ath_print(common, ATH_DBG_CALIBRATE, |
347 | | "NF did not complete in calibration window\n"); |
348 | | nf = 0; |
349 | | - chan->rawNoiseFloor = nf; |
350 | | - return chan->rawNoiseFloor; |
351 | | + caldata->rawNoiseFloor = nf; |
352 | | + return false; |
353 | | } else { |
354 | | ath9k_hw_do_getnf(ah, nfarray); |
355 | | ath9k_hw_nf_sanitize(ah, nfarray); |
356 | | @@ -307,47 +324,40 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah |
357 | | } |
358 | | } |
359 | | |
360 | | - h = ah->nfCalHist; |
361 | | - |
362 | | + h = caldata->nfCalHist; |
363 | | + caldata->nfcal_pending = false; |
364 | | ath9k_hw_update_nfcal_hist_buffer(h, nfarray); |
365 | | - chan->rawNoiseFloor = h[0].privNF; |
366 | | - |
367 | | - return chan->rawNoiseFloor; |
368 | | + caldata->rawNoiseFloor = h[0].privNF; |
369 | | + return true; |
370 | | } |
371 | | |
372 | | -void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah) |
373 | | +void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, |
374 | | + struct ath9k_channel *chan) |
375 | | { |
376 | | - struct ath_nf_limits *limit; |
377 | | + struct ath9k_nfcal_hist *h; |
378 | | + s16 default_nf; |
379 | | int i, j; |
380 | | |
381 | | - if (!ah->curchan || IS_CHAN_2GHZ(ah->curchan)) |
382 | | - limit = &ah->nf_2g; |
383 | | - else |
384 | | - limit = &ah->nf_5g; |
385 | | + if (!ah->caldata) |
386 | | + return; |
387 | | |
388 | | + h = ah->caldata->nfCalHist; |
389 | | + default_nf = ath9k_hw_get_default_nf(ah, chan); |
390 | | for (i = 0; i < NUM_NF_READINGS; i++) { |
391 | | - ah->nfCalHist[i].currIndex = 0; |
392 | | - ah->nfCalHist[i].privNF = limit->nominal; |
393 | | - ah->nfCalHist[i].invalidNFcount = |
394 | | - AR_PHY_CCA_FILTERWINDOW_LENGTH; |
395 | | + h[i].currIndex = 0; |
396 | | + h[i].privNF = default_nf; |
397 | | + h[i].invalidNFcount = AR_PHY_CCA_FILTERWINDOW_LENGTH; |
398 | | for (j = 0; j < ATH9K_NF_CAL_HIST_MAX; j++) { |
399 | | - ah->nfCalHist[i].nfCalBuffer[j] = limit->nominal; |
400 | | + h[i].nfCalBuffer[j] = default_nf; |
401 | | } |
402 | | } |
403 | | } |
404 | | |
405 | | s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) |
406 | | { |
407 | | - s16 nf; |
408 | | - |
409 | | - if (chan->rawNoiseFloor == 0) |
410 | | - nf = -96; |
411 | | - else |
412 | | - nf = chan->rawNoiseFloor; |
413 | | - |
414 | | - if (!ath9k_hw_nf_in_range(ah, nf)) |
415 | | - nf = ATH_DEFAULT_NOISE_FLOOR; |
416 | | + if (!ah->caldata || !ah->caldata->rawNoiseFloor) |
417 | | + return ath9k_hw_get_default_nf(ah, chan); |
418 | | |
419 | | - return nf; |
420 | | + return ah->caldata->rawNoiseFloor; |
421 | | } |
422 | | EXPORT_SYMBOL(ath9k_hw_getchan_noise); |
423 | | +++ b/drivers/net/wireless/ath/ath9k/calib.h |
424 | | @@ -108,11 +108,11 @@ struct ath9k_pacal_info{ |
425 | | }; |
426 | | |
427 | | bool ath9k_hw_reset_calvalid(struct ath_hw *ah); |
428 | | -void ath9k_hw_start_nfcal(struct ath_hw *ah); |
429 | | +void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update); |
430 | | void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan); |
431 | | -int16_t ath9k_hw_getnf(struct ath_hw *ah, |
432 | | - struct ath9k_channel *chan); |
433 | | -void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah); |
434 | | +bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan); |
435 | | +void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, |
436 | | + struct ath9k_channel *chan); |
437 | | s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); |
438 | | void ath9k_hw_reset_calibration(struct ath_hw *ah, |
439 | | struct ath9k_cal_list *currCal); |
440 | | +++ b/drivers/net/wireless/ath/ath9k/hw.c |
441 | | @@ -622,7 +622,6 @@ static int __ath9k_hw_init(struct ath_hw |
442 | | else |
443 | | ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S); |
444 | | |
445 | | - ath9k_init_nfcal_hist_buffer(ah); |
446 | | ah->bb_watchdog_timeout_ms = 25; |
447 | | |
448 | | common->state = ATH_HW_INITIALIZED; |
449 | | @@ -1195,9 +1194,6 @@ static bool ath9k_hw_channel_change(stru |
450 | | |
451 | | ath9k_hw_spur_mitigate_freq(ah, chan); |
452 | | |
453 | | - if (!chan->oneTimeCalsDone) |
454 | | - chan->oneTimeCalsDone = true; |
455 | | - |
456 | | return true; |
457 | | } |
458 | | |
459 | | @@ -1230,7 +1226,7 @@ bool ath9k_hw_check_alive(struct ath_hw |
460 | | EXPORT_SYMBOL(ath9k_hw_check_alive); |
461 | | |
462 | | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
463 | | - bool bChannelChange) |
464 | | + struct ath9k_hw_cal_data *caldata, bool bChannelChange) |
465 | | { |
466 | | struct ath_common *common = ath9k_hw_common(ah); |
467 | | u32 saveLedState; |
468 | | @@ -1255,9 +1251,19 @@ int ath9k_hw_reset(struct ath_hw *ah, st |
469 | | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) |
470 | | return -EIO; |
471 | | |
472 | | - if (curchan && !ah->chip_fullsleep) |
473 | | + if (curchan && !ah->chip_fullsleep && ah->caldata) |
474 | | ath9k_hw_getnf(ah, curchan); |
475 | | |
476 | | + ah->caldata = caldata; |
477 | | + if (caldata && |
478 | | + (chan->channel != caldata->channel || |
479 | | + (chan->channelFlags & ~CHANNEL_CW_INT) != |
480 | | + (caldata->channelFlags & ~CHANNEL_CW_INT))) { |
481 | | + /* Operating channel changed, reset channel calibration data */ |
482 | | + memset(caldata, 0, sizeof(*caldata)); |
483 | | + ath9k_init_nfcal_hist_buffer(ah, chan); |
484 | | + } |
485 | | + |
486 | | if (bChannelChange && |
487 | | (ah->chip_fullsleep != true) && |
488 | | (ah->curchan != NULL) && |
489 | | @@ -1268,7 +1274,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st |
490 | | |
491 | | if (ath9k_hw_channel_change(ah, chan)) { |
492 | | ath9k_hw_loadnf(ah, ah->curchan); |
493 | | - ath9k_hw_start_nfcal(ah); |
494 | | + ath9k_hw_start_nfcal(ah, true); |
495 | | return 0; |
496 | | } |
497 | | } |
498 | | @@ -1473,11 +1479,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st |
499 | | if (ah->btcoex_hw.enabled) |
500 | | ath9k_hw_btcoex_enable(ah); |
501 | | |
502 | | - if (AR_SREV_9300_20_OR_LATER(ah)) { |
503 | | - ath9k_hw_loadnf(ah, curchan); |
504 | | - ath9k_hw_start_nfcal(ah); |
505 | | + if (AR_SREV_9300_20_OR_LATER(ah)) |
506 | | ar9003_hw_bb_watchdog_config(ah); |
507 | | - } |
508 | | |
509 | | return 0; |
510 | | } |
511 | | +++ b/drivers/net/wireless/ath/ath9k/main.c |
512 | | @@ -155,6 +155,27 @@ void ath9k_ps_restore(struct ath_softc * |
513 | | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
514 | | } |
515 | | |
516 | | +static void ath_start_ani(struct ath_common *common) |
517 | | +{ |
518 | | + struct ath_hw *ah = common->ah; |
519 | | + unsigned long timestamp = jiffies_to_msecs(jiffies); |
520 | | + struct ath_softc *sc = (struct ath_softc *) common->priv; |
521 | | + |
522 | | + if (!(sc->sc_flags & SC_OP_ANI_RUN)) |
523 | | + return; |
524 | | + |
525 | | + if (sc->sc_flags & SC_OP_OFFCHANNEL) |
526 | | + return; |
527 | | + |
528 | | + common->ani.longcal_timer = timestamp; |
529 | | + common->ani.shortcal_timer = timestamp; |
530 | | + common->ani.checkani_timer = timestamp; |
531 | | + |
532 | | + mod_timer(&common->ani.timer, |
533 | | + jiffies + |
534 | | + msecs_to_jiffies((u32)ah->config.ani_poll_interval)); |
535 | | +} |
536 | | + |
537 | | /* |
538 | | * Set/change channels. If the channel is really being changed, it's done |
539 | | * by reseting the chip. To accomplish this we must first cleanup any pending |
540 | | @@ -163,16 +184,23 @@ void ath9k_ps_restore(struct ath_softc * |
541 | | int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
542 | | struct ath9k_channel *hchan) |
543 | | { |
544 | | + struct ath_wiphy *aphy = hw->priv; |
545 | | struct ath_hw *ah = sc->sc_ah; |
546 | | struct ath_common *common = ath9k_hw_common(ah); |
547 | | struct ieee80211_conf *conf = &common->hw->conf; |
548 | | bool fastcc = true, stopped; |
549 | | struct ieee80211_channel *channel = hw->conf.channel; |
550 | | + struct ath9k_hw_cal_data *caldata = NULL; |
551 | | int r; |
552 | | |
553 | | if (sc->sc_flags & SC_OP_INVALID) |
554 | | return -EIO; |
555 | | |
556 | | + del_timer_sync(&common->ani.timer); |
557 | | + cancel_work_sync(&sc->paprd_work); |
558 | | + cancel_work_sync(&sc->hw_check_work); |
559 | | + cancel_delayed_work_sync(&sc->tx_complete_work); |
560 | | + |
561 | | ath9k_ps_wakeup(sc); |
562 | | |
563 | | /* |
564 | | @@ -192,9 +220,12 @@ int ath_set_channel(struct ath_softc *sc |
565 | | * to flush data frames already in queue because of |
566 | | * changing channel. */ |
567 | | |
568 | | - if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET)) |
569 | | + if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL)) |
570 | | fastcc = false; |
571 | | |
572 | | + if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) |
573 | | + caldata = &aphy->caldata; |
574 | | + |
575 | | ath_print(common, ATH_DBG_CONFIG, |
576 | | "(%u MHz) -> (%u MHz), conf_is_ht40: %d\n", |
577 | | sc->sc_ah->curchan->channel, |
578 | | @@ -202,7 +233,7 @@ int ath_set_channel(struct ath_softc *sc |
579 | | |
580 | | spin_lock_bh(&sc->sc_resetlock); |
581 | | |
582 | | - r = ath9k_hw_reset(ah, hchan, fastcc); |
583 | | + r = ath9k_hw_reset(ah, hchan, caldata, fastcc); |
584 | | if (r) { |
585 | | ath_print(common, ATH_DBG_FATAL, |
586 | | "Unable to reset channel (%u MHz), " |
587 | | @@ -213,8 +244,6 @@ int ath_set_channel(struct ath_softc *sc |
588 | | } |
589 | | spin_unlock_bh(&sc->sc_resetlock); |
590 | | |
591 | | - sc->sc_flags &= ~SC_OP_FULL_RESET; |
592 | | - |
593 | | if (ath_startrecv(sc) != 0) { |
594 | | ath_print(common, ATH_DBG_FATAL, |
595 | | "Unable to restart recv logic\n"); |
596 | | @@ -226,6 +255,12 @@ int ath_set_channel(struct ath_softc *sc |
597 | | ath_update_txpow(sc); |
598 | | ath9k_hw_set_interrupts(ah, ah->imask); |
599 | | |
600 | | + if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) { |
601 | | + ath_start_ani(common); |
602 | | + ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
603 | | + ath_beacon_config(sc, NULL); |
604 | | + } |
605 | | + |
606 | | ps_restore: |
607 | | ath9k_ps_restore(sc); |
608 | | return r; |
609 | | @@ -234,17 +269,19 @@ int ath_set_channel(struct ath_softc *sc |
610 | | static void ath_paprd_activate(struct ath_softc *sc) |
611 | | { |
612 | | struct ath_hw *ah = sc->sc_ah; |
613 | | + struct ath9k_hw_cal_data *caldata = ah->caldata; |
614 | | int chain; |
615 | | |
616 | | - if (!ah->curchan->paprd_done) |
617 | | + if (!caldata || !caldata->paprd_done) |
618 | | return; |
619 | | |
620 | | ath9k_ps_wakeup(sc); |
621 | | + ar9003_paprd_enable(ah, false); |
622 | | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
623 | | if (!(ah->caps.tx_chainmask & BIT(chain))) |
624 | | continue; |
625 | | |
626 | | - ar9003_paprd_populate_single_table(ah, ah->curchan, chain); |
627 | | + ar9003_paprd_populate_single_table(ah, caldata, chain); |
628 | | } |
629 | | |
630 | | ar9003_paprd_enable(ah, true); |
631 | | @@ -262,6 +299,7 @@ void ath_paprd_calibrate(struct work_str |
632 | | int band = hw->conf.channel->band; |
633 | | struct ieee80211_supported_band *sband = &sc->sbands[band]; |
634 | | struct ath_tx_control txctl; |
635 | | + struct ath9k_hw_cal_data *caldata = ah->caldata; |
636 | | int qnum, ftype; |
637 | | int chain_ok = 0; |
638 | | int chain; |
639 | | @@ -269,6 +307,9 @@ void ath_paprd_calibrate(struct work_str |
640 | | int time_left; |
641 | | int i; |
642 | | |
643 | | + if (!caldata) |
644 | | + return; |
645 | | + |
646 | | skb = alloc_skb(len, GFP_KERNEL); |
647 | | if (!skb) |
648 | | return; |
649 | | @@ -323,7 +364,7 @@ void ath_paprd_calibrate(struct work_str |
650 | | if (!ar9003_paprd_is_done(ah)) |
651 | | break; |
652 | | |
653 | | - if (ar9003_paprd_create_curve(ah, ah->curchan, chain) != 0) |
654 | | + if (ar9003_paprd_create_curve(ah, caldata, chain) != 0) |
655 | | break; |
656 | | |
657 | | chain_ok = 1; |
658 | | @@ -331,7 +372,7 @@ void ath_paprd_calibrate(struct work_str |
659 | | kfree_skb(skb); |
660 | | |
661 | | if (chain_ok) { |
662 | | - ah->curchan->paprd_done = true; |
663 | | + caldata->paprd_done = true; |
664 | | ath_paprd_activate(sc); |
665 | | } |
666 | | |
667 | | @@ -440,33 +481,14 @@ set_timer: |
668 | | cal_interval = min(cal_interval, (u32)short_cal_interval); |
669 | | |
670 | | mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); |
671 | | - if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && |
672 | | - !(sc->sc_flags & SC_OP_SCANNING)) { |
673 | | - if (!sc->sc_ah->curchan->paprd_done) |
674 | | + if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) { |
675 | | + if (!ah->caldata->paprd_done) |
676 | | ieee80211_queue_work(sc->hw, &sc->paprd_work); |
677 | | else |
678 | | ath_paprd_activate(sc); |
679 | | } |
680 | | } |
681 | | |
682 | | -static void ath_start_ani(struct ath_common *common) |
683 | | -{ |
684 | | - struct ath_hw *ah = common->ah; |
685 | | - unsigned long timestamp = jiffies_to_msecs(jiffies); |
686 | | - struct ath_softc *sc = (struct ath_softc *) common->priv; |
687 | | - |
688 | | - if (!(sc->sc_flags & SC_OP_ANI_RUN)) |
689 | | - return; |
690 | | - |
691 | | - common->ani.longcal_timer = timestamp; |
692 | | - common->ani.shortcal_timer = timestamp; |
693 | | - common->ani.checkani_timer = timestamp; |
694 | | - |
695 | | - mod_timer(&common->ani.timer, |
696 | | - jiffies + |
697 | | - msecs_to_jiffies((u32)ah->config.ani_poll_interval)); |
698 | | -} |
699 | | - |
700 | | /* |
701 | | * Update tx/rx chainmask. For legacy association, |
702 | | * hard code chainmask to 1x1, for 11n association, use |
703 | | @@ -478,7 +500,7 @@ void ath_update_chainmask(struct ath_sof |
704 | | struct ath_hw *ah = sc->sc_ah; |
705 | | struct ath_common *common = ath9k_hw_common(ah); |
706 | | |
707 | | - if ((sc->sc_flags & SC_OP_SCANNING) || is_ht || |
708 | | + if ((sc->sc_flags & SC_OP_OFFCHANNEL) || is_ht || |
709 | | (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE)) { |
710 | | common->tx_chainmask = ah->caps.tx_chainmask; |
711 | | common->rx_chainmask = ah->caps.rx_chainmask; |
712 | | @@ -818,7 +840,7 @@ void ath_radio_enable(struct ath_softc * |
713 | | ah->curchan = ath_get_curchannel(sc, sc->hw); |
714 | | |
715 | | spin_lock_bh(&sc->sc_resetlock); |
716 | | - r = ath9k_hw_reset(ah, ah->curchan, false); |
717 | | + r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
718 | | if (r) { |
719 | | ath_print(common, ATH_DBG_FATAL, |
720 | | "Unable to reset channel (%u MHz), " |
721 | | @@ -878,7 +900,7 @@ void ath_radio_disable(struct ath_softc |
722 | | ah->curchan = ath_get_curchannel(sc, hw); |
723 | | |
724 | | spin_lock_bh(&sc->sc_resetlock); |
725 | | - r = ath9k_hw_reset(ah, ah->curchan, false); |
726 | | + r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
727 | | if (r) { |
728 | | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, |
729 | | "Unable to reset channel (%u MHz), " |
730 | | @@ -911,7 +933,7 @@ int ath_reset(struct ath_softc *sc, bool |
731 | | ath_flushrecv(sc); |
732 | | |
733 | | spin_lock_bh(&sc->sc_resetlock); |
734 | | - r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false); |
735 | | + r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); |
736 | | if (r) |
737 | | ath_print(common, ATH_DBG_FATAL, |
738 | | "Unable to reset hardware; reset status %d\n", r); |
739 | | @@ -1086,7 +1108,7 @@ static int ath9k_start(struct ieee80211_ |
740 | | * and then setup of the interrupt mask. |
741 | | */ |
742 | | spin_lock_bh(&sc->sc_resetlock); |
743 | | - r = ath9k_hw_reset(ah, init_channel, false); |
744 | | + r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); |
745 | | if (r) { |
746 | | ath_print(common, ATH_DBG_FATAL, |
747 | | "Unable to reset hardware; reset status %d " |
748 | | @@ -1580,6 +1602,10 @@ static int ath9k_config(struct ieee80211 |
749 | | |
750 | | aphy->chan_idx = pos; |
751 | | aphy->chan_is_ht = conf_is_ht(conf); |
752 | | + if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) |
753 | | + sc->sc_flags |= SC_OP_OFFCHANNEL; |
754 | | + else |
755 | | + sc->sc_flags &= ~SC_OP_OFFCHANNEL; |
756 | | |
757 | | if (aphy->state == ATH_WIPHY_SCAN || |
758 | | aphy->state == ATH_WIPHY_ACTIVE) |
759 | | @@ -1991,7 +2017,6 @@ static void ath9k_sw_scan_start(struct i |
760 | | { |
761 | | struct ath_wiphy *aphy = hw->priv; |
762 | | struct ath_softc *sc = aphy->sc; |
763 | | - struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
764 | | |
765 | | mutex_lock(&sc->mutex); |
766 | | if (ath9k_wiphy_scanning(sc)) { |
767 | | @@ -2009,10 +2034,6 @@ static void ath9k_sw_scan_start(struct i |
768 | | aphy->state = ATH_WIPHY_SCAN; |
769 | | ath9k_wiphy_pause_all_forced(sc, aphy); |
770 | | sc->sc_flags |= SC_OP_SCANNING; |
771 | | - del_timer_sync(&common->ani.timer); |
772 | | - cancel_work_sync(&sc->paprd_work); |
773 | | - cancel_work_sync(&sc->hw_check_work); |
774 | | - cancel_delayed_work_sync(&sc->tx_complete_work); |
775 | | mutex_unlock(&sc->mutex); |
776 | | } |
777 | | |
778 | | @@ -2024,15 +2045,10 @@ static void ath9k_sw_scan_complete(struc |
779 | | { |
780 | | struct ath_wiphy *aphy = hw->priv; |
781 | | struct ath_softc *sc = aphy->sc; |
782 | | - struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
783 | | |
784 | | mutex_lock(&sc->mutex); |
785 | | aphy->state = ATH_WIPHY_ACTIVE; |
786 | | sc->sc_flags &= ~SC_OP_SCANNING; |
787 | | - sc->sc_flags |= SC_OP_FULL_RESET; |
788 | | - ath_start_ani(common); |
789 | | - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
790 | | - ath_beacon_config(sc, NULL); |
791 | | mutex_unlock(&sc->mutex); |
792 | | } |
793 | | |
794 | | +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c |
795 | | @@ -577,10 +577,11 @@ static bool create_pa_curve(u32 *data_L, |
796 | | } |
797 | | |
798 | | void ar9003_paprd_populate_single_table(struct ath_hw *ah, |
799 | | - struct ath9k_channel *chan, int chain) |
800 | | + struct ath9k_hw_cal_data *caldata, |
801 | | + int chain) |
802 | | { |
803 | | - u32 *paprd_table_val = chan->pa_table[chain]; |
804 | | - u32 small_signal_gain = chan->small_signal_gain[chain]; |
805 | | + u32 *paprd_table_val = caldata->pa_table[chain]; |
806 | | + u32 small_signal_gain = caldata->small_signal_gain[chain]; |
807 | | u32 training_power; |
808 | | u32 reg = 0; |
809 | | int i; |
810 | | @@ -654,17 +655,17 @@ int ar9003_paprd_setup_gain_table(struct |
811 | | } |
812 | | EXPORT_SYMBOL(ar9003_paprd_setup_gain_table); |
813 | | |
814 | | -int ar9003_paprd_create_curve(struct ath_hw *ah, struct ath9k_channel *chan, |
815 | | - int chain) |
816 | | +int ar9003_paprd_create_curve(struct ath_hw *ah, |
817 | | + struct ath9k_hw_cal_data *caldata, int chain) |
818 | | { |
819 | | - u16 *small_signal_gain = &chan->small_signal_gain[chain]; |
820 | | - u32 *pa_table = chan->pa_table[chain]; |
821 | | + u16 *small_signal_gain = &caldata->small_signal_gain[chain]; |
822 | | + u32 *pa_table = caldata->pa_table[chain]; |
823 | | u32 *data_L, *data_U; |
824 | | int i, status = 0; |
825 | | u32 *buf; |
826 | | u32 reg; |
827 | | |
828 | | - memset(chan->pa_table[chain], 0, sizeof(chan->pa_table[chain])); |
829 | | + memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain])); |
830 | | |
831 | | buf = kmalloc(2 * 48 * sizeof(u32), GFP_ATOMIC); |
832 | | if (!buf) |
833 | | +++ b/drivers/net/wireless/ath/ath9k/ath9k.h |
834 | | @@ -511,7 +511,7 @@ void ath_deinit_leds(struct ath_softc *s |
835 | | #define SC_OP_BEACONS BIT(1) |
836 | | #define SC_OP_RXAGGR BIT(2) |
837 | | #define SC_OP_TXAGGR BIT(3) |
838 | | -#define SC_OP_FULL_RESET BIT(4) |
839 | | +#define SC_OP_OFFCHANNEL BIT(4) |
840 | | #define SC_OP_PREAMBLE_SHORT BIT(5) |
841 | | #define SC_OP_PROTECT_ENABLE BIT(6) |
842 | | #define SC_OP_RXFLUSH BIT(7) |
843 | | @@ -612,6 +612,7 @@ struct ath_softc { |
844 | | struct ath_wiphy { |
845 | | struct ath_softc *sc; /* shared for all virtual wiphys */ |
846 | | struct ieee80211_hw *hw; |
847 | | + struct ath9k_hw_cal_data caldata; |
848 | | enum ath_wiphy_state { |
849 | | ATH_WIPHY_INACTIVE, |
850 | | ATH_WIPHY_ACTIVE, |
851 | | +++ b/drivers/net/wireless/ath/ath9k/htc.h |
852 | | @@ -353,6 +353,8 @@ struct ath9k_htc_priv { |
853 | | u16 seq_no; |
854 | | u32 bmiss_cnt; |
855 | | |
856 | | + struct ath9k_hw_cal_data caldata[38]; |
857 | | + |
858 | | spinlock_t beacon_lock; |
859 | | |
860 | | bool tx_queues_stop; |
861 | | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c |
862 | | @@ -125,6 +125,7 @@ static int ath9k_htc_set_channel(struct |
863 | | struct ieee80211_conf *conf = &common->hw->conf; |
864 | | bool fastcc = true; |
865 | | struct ieee80211_channel *channel = hw->conf.channel; |
866 | | + struct ath9k_hw_cal_data *caldata; |
867 | | enum htc_phymode mode; |
868 | | __be16 htc_mode; |
869 | | u8 cmd_rsp; |
870 | | @@ -149,7 +150,8 @@ static int ath9k_htc_set_channel(struct |
871 | | priv->ah->curchan->channel, |
872 | | channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf)); |
873 | | |
874 | | - ret = ath9k_hw_reset(ah, hchan, fastcc); |
875 | | + caldata = &priv->caldata[channel->hw_value]; |
876 | | + ret = ath9k_hw_reset(ah, hchan, caldata, fastcc); |
877 | | if (ret) { |
878 | | ath_print(common, ATH_DBG_FATAL, |
879 | | "Unable to reset channel (%u Mhz) " |
880 | | @@ -1028,7 +1030,7 @@ static void ath9k_htc_radio_enable(struc |
881 | | ah->curchan = ath9k_cmn_get_curchannel(hw, ah); |
882 | | |
883 | | /* Reset the HW */ |
884 | | - ret = ath9k_hw_reset(ah, ah->curchan, false); |
885 | | + ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
886 | | if (ret) { |
887 | | ath_print(common, ATH_DBG_FATAL, |
888 | | "Unable to reset hardware; reset status %d " |
889 | | @@ -1091,7 +1093,7 @@ static void ath9k_htc_radio_disable(stru |
890 | | ah->curchan = ath9k_cmn_get_curchannel(hw, ah); |
891 | | |
892 | | /* Reset the HW */ |
893 | | - ret = ath9k_hw_reset(ah, ah->curchan, false); |
894 | | + ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
895 | | if (ret) { |
896 | | ath_print(common, ATH_DBG_FATAL, |
897 | | "Unable to reset hardware; reset status %d " |
898 | | @@ -1179,7 +1181,7 @@ static int ath9k_htc_start(struct ieee80 |
899 | | ath9k_hw_configpcipowersave(ah, 0, 0); |
900 | | |
901 | | ath9k_hw_htc_resetinit(ah); |
902 | | - ret = ath9k_hw_reset(ah, init_channel, false); |
903 | | + ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false); |
904 | | if (ret) { |
905 | | ath_print(common, ATH_DBG_FATAL, |
906 | | "Unable to reset hardware; reset status %d " |
907 | | +++ b/drivers/net/wireless/ath/ath9k/hw.h |
908 | | @@ -346,19 +346,25 @@ enum ath9k_int { |
909 | | CHANNEL_HT40PLUS | \ |
910 | | CHANNEL_HT40MINUS) |
911 | | |
912 | | -struct ath9k_channel { |
913 | | - struct ieee80211_channel *chan; |
914 | | +struct ath9k_hw_cal_data { |
915 | | u16 channel; |
916 | | u32 channelFlags; |
917 | | - u32 chanmode; |
918 | | int32_t CalValid; |
919 | | - bool oneTimeCalsDone; |
920 | | int8_t iCoff; |
921 | | int8_t qCoff; |
922 | | int16_t rawNoiseFloor; |
923 | | bool paprd_done; |
924 | | + bool nfcal_pending; |
925 | | u16 small_signal_gain[AR9300_MAX_CHAINS]; |
926 | | u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ]; |
927 | | + struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
928 | | +}; |
929 | | + |
930 | | +struct ath9k_channel { |
931 | | + struct ieee80211_channel *chan; |
932 | | + u16 channel; |
933 | | + u32 channelFlags; |
934 | | + u32 chanmode; |
935 | | }; |
936 | | |
937 | | #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ |
938 | | @@ -669,7 +675,7 @@ struct ath_hw { |
939 | | enum nl80211_iftype opmode; |
940 | | enum ath9k_power_mode power_mode; |
941 | | |
942 | | - struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
943 | | + struct ath9k_hw_cal_data *caldata; |
944 | | struct ath9k_pacal_info pacal_info; |
945 | | struct ar5416Stats stats; |
946 | | struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; |
947 | | @@ -863,7 +869,7 @@ const char *ath9k_hw_probe(u16 vendorid, |
948 | | void ath9k_hw_deinit(struct ath_hw *ah); |
949 | | int ath9k_hw_init(struct ath_hw *ah); |
950 | | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
951 | | - bool bChannelChange); |
952 | | + struct ath9k_hw_cal_data *caldata, bool bChannelChange); |
953 | | int ath9k_hw_fill_cap_info(struct ath_hw *ah); |
954 | | u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); |
955 | | |
956 | | @@ -958,9 +964,10 @@ void ar9003_hw_bb_watchdog_read(struct a |
957 | | void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); |
958 | | void ar9003_paprd_enable(struct ath_hw *ah, bool val); |
959 | | void ar9003_paprd_populate_single_table(struct ath_hw *ah, |
960 | | - struct ath9k_channel *chan, int chain); |
961 | | -int ar9003_paprd_create_curve(struct ath_hw *ah, struct ath9k_channel *chan, |
962 | | - int chain); |
963 | | + struct ath9k_hw_cal_data *caldata, |
964 | | + int chain); |
965 | | +int ar9003_paprd_create_curve(struct ath_hw *ah, |
966 | | + struct ath9k_hw_cal_data *caldata, int chain); |
967 | | int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); |
968 | | int ar9003_paprd_init_table(struct ath_hw *ah); |
969 | | bool ar9003_paprd_is_done(struct ath_hw *ah); |
970 | | +++ b/drivers/net/wireless/ath/ath9k/xmit.c |
971 | | @@ -1181,7 +1181,7 @@ void ath_drain_all_txq(struct ath_softc |
972 | | "Failed to stop TX DMA. Resetting hardware!\n"); |
973 | | |
974 | | spin_lock_bh(&sc->sc_resetlock); |
975 | | - r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false); |
976 | | + r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); |
977 | | if (r) |
978 | | ath_print(common, ATH_DBG_FATAL, |
979 | | "Unable to reset hardware; reset status %d\n", |
package/mac80211/patches/800-nuke_led_code.patch |
16 | 16 | net/mac80211/util.c | 6 ++++++ |
17 | 17 | 15 files changed, 69 insertions(+), 7 deletions(-) |
18 | 18 | |
19 | | +++ compat-wireless-2010-07-29/config.mk |
| 19 | --- a/config.mk |
20 | 20 | @@ -115,7 +115,7 @@ CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstr |
21 | 21 | # CONFIG_MAC80211_RC_PID=y |
22 | 22 | CONFIG_MAC80211_RC_MINSTREL=y |
... | ... | |
27 | 27 | |
28 | 28 | # enable mesh networking too |
29 | 29 | CONFIG_MAC80211_MESH=y |
30 | | @@ -194,7 +194,7 @@ CONFIG_B43_PCI_AUTOSELECT=y |
| 30 | @@ -218,7 +218,7 @@ CONFIG_B43_PCI_AUTOSELECT=y |
31 | 31 | ifneq ($(CONFIG_PCMCIA),) |
32 | 32 | # CONFIG_B43_PCMCIA=y |
33 | 33 | endif |
... | ... | |
36 | 36 | CONFIG_B43_PHY_LP=y |
37 | 37 | # CONFIG_B43_NPHY is not set |
38 | 38 | # CONFIG_B43_FORCE_PIO=y |
39 | | @@ -203,7 +203,7 @@ CONFIG_B43_PHY_LP=y |
| 39 | @@ -227,7 +227,7 @@ CONFIG_B43_PHY_LP=y |
40 | 40 | CONFIG_B43LEGACY=m |
41 | 41 | CONFIG_B43LEGACY_HWRNG=y |
42 | 42 | CONFIG_B43LEGACY_PCI_AUTOSELECT=y |
... | ... | |
45 | 45 | # CONFIG_B43LEGACY_DEBUG=y |
46 | 46 | CONFIG_B43LEGACY_DMA=y |
47 | 47 | CONFIG_B43LEGACY_PIO=y |
48 | | @@ -336,13 +336,13 @@ endif |
49 | | |
50 | | CONFIG_P54_USB=m |
51 | | CONFIG_RTL8187=m |
52 | | -CONFIG_RTL8187_LEDS=y |
53 | | +# CONFIG_RTL8187_LEDS=y |
54 | | |
55 | | CONFIG_AT76C50X_USB=m |
56 | | |
57 | | ifndef CONFIG_COMPAT_KERNEL_28 |
58 | | CONFIG_AR9170_USB=m |
59 | | -CONFIG_AR9170_LEDS=y |
60 | | +# CONFIG_AR9170_LEDS=y |
61 | | endif |
62 | | |
63 | | CONFIG_ATH9K_HTC=m |
64 | | @@ -426,7 +426,7 @@ CONFIG_RT2800_LIB=m |
65 | | CONFIG_RT2X00_LIB_HT=y |
66 | | CONFIG_RT2X00_LIB_FIRMWARE=y |
67 | | CONFIG_RT2X00_LIB_CRYPTO=y |
68 | | -CONFIG_RT2X00_LIB_LEDS=y |
69 | | +# CONFIG_RT2X00_LIB_LEDS=y |
70 | | # CONFIG_RT2X00_DEBUG=y |
71 | | # CONFIG_RT2X00_LIB_DEBUGFS |
72 | | endif |
73 | | @@ -437,7 +437,7 @@ endif |
| 48 | @@ -499,7 +499,7 @@ endif |
74 | 49 | |
75 | 50 | # p54 |
76 | 51 | CONFIG_P54_COMMON=m |
... | ... | |
79 | 54 | |
80 | 55 | # Atheros |
81 | 56 | CONFIG_ATH_COMMON=m |
82 | | +++ compat-wireless-2010-07-29/include/linux/compat-2.6.25.h |
83 | | @@ -146,10 +146,12 @@ static inline void __hwrng_unregister(st |
| 57 | --- a/include/linux/compat-2.6.25.h |
| 58 | @@ -148,10 +148,12 @@ static inline void __hwrng_unregister(st |
84 | 59 | hwrng_unregister(rng); |
85 | 60 | } |
86 | 61 | |
... | ... | |
94 | 69 | |
95 | 70 | /** |
96 | 71 | * The following things are out of ./include/linux/kernel.h |
97 | | +++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/gpio.c |
| 72 | --- a/drivers/net/wireless/ath/ath9k/gpio.c |
98 | 73 | @@ -20,6 +20,7 @@ |
99 | 74 | /* LED functions */ |
100 | 75 | /********************************/ |
... | ... | |
112 | 87 | |
113 | 88 | /*******************/ |
114 | 89 | /* Rfkill */ |
115 | | +++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/pci.c |
| 90 | --- a/drivers/net/wireless/ath/ath9k/pci.c |
116 | 91 | @@ -273,7 +273,9 @@ static int ath_pci_suspend(struct pci_de |
117 | 92 | struct ath_wiphy *aphy = hw->priv; |
118 | 93 | struct ath_softc *sc = aphy->sc; |
... | ... | |
137 | 112 | |
138 | 113 | return 0; |
139 | 114 | } |
140 | | +++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/ath9k.h |
141 | | @@ -465,6 +465,7 @@ void ath9k_btcoex_timer_pause(struct ath |
| 115 | --- a/drivers/net/wireless/ath/ath9k/ath9k.h |
| 116 | @@ -457,6 +457,7 @@ void ath9k_btcoex_timer_pause(struct ath |
142 | 117 | /********************/ |
143 | 118 | /* LED Control */ |
144 | 119 | /********************/ |
... | ... | |
147 | 122 | |
148 | 123 | #define ATH_LED_PIN_DEF 1 |
149 | 124 | #define ATH_LED_PIN_9287 8 |
150 | | @@ -489,6 +490,7 @@ struct ath_led { |
| 125 | @@ -481,6 +482,7 @@ struct ath_led { |
151 | 126 | |
152 | 127 | void ath_init_leds(struct ath_softc *sc); |
153 | 128 | void ath_deinit_leds(struct ath_softc *sc); |
... | ... | |
155 | 130 | |
156 | 131 | /********************/ |
157 | 132 | /* Main driver core */ |
158 | | @@ -586,6 +588,7 @@ struct ath_softc { |
| 133 | @@ -578,6 +580,7 @@ struct ath_softc { |
159 | 134 | enum wireless_mode cur_rate_mode; |
160 | 135 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; |
161 | 136 | |
... | ... | |
163 | 138 | struct ath_led radio_led; |
164 | 139 | struct ath_led assoc_led; |
165 | 140 | struct ath_led tx_led; |
166 | | @@ -595,6 +598,7 @@ struct ath_softc { |
| 141 | @@ -587,6 +590,7 @@ struct ath_softc { |
167 | 142 | int led_off_duration; |
168 | 143 | int led_on_cnt; |
169 | 144 | int led_off_cnt; |
... | ... | |
171 | 146 | |
172 | 147 | int beacon_interval; |
173 | 148 | |
174 | | +++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/init.c |
175 | | @@ -34,9 +34,11 @@ int modparam_nohwcrypt; |
176 | | module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444); |
177 | | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); |
178 | | |
179 | | +#ifdef CONFIG_MAC80211_LEDS |
180 | | int led_blink = 1; |
181 | | module_param_named(blink, led_blink, int, 0444); |
182 | | MODULE_PARM_DESC(blink, "Enable LED blink on activity"); |
183 | | +#endif |
184 | | |
185 | | /* We use the hw_value as an index into our private channel structure */ |
186 | | |
187 | | @@ -757,7 +759,9 @@ int ath9k_init_device(u16 devid, struct |
| 149 | --- a/drivers/net/wireless/ath/ath9k/init.c |
| 150 | @@ -757,7 +757,9 @@ int ath9k_init_device(u16 devid, struct |
188 | 151 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); |
189 | 152 | sc->wiphy_scheduler_int = msecs_to_jiffies(500); |
190 | 153 | |
... | ... | |
195 | 158 | ath_start_rfkill_poll(sc); |
196 | 159 | |
197 | 160 | return 0; |
198 | | @@ -810,7 +814,9 @@ void ath9k_deinit_device(struct ath_soft |
| 161 | @@ -810,7 +812,9 @@ void ath9k_deinit_device(struct ath_soft |
199 | 162 | ath9k_ps_wakeup(sc); |
200 | 163 | |
201 | 164 | wiphy_rfkill_stop_polling(sc->hw->wiphy); |
... | ... | |
205 | 168 | |
206 | 169 | for (i = 0; i < sc->num_sec_wiphy; i++) { |
207 | 170 | struct ath_wiphy *aphy = sc->sec_wiphy[i]; |
208 | | +++ compat-wireless-2010-07-29/drivers/net/wireless/ath/ath9k/main.c |
209 | | @@ -868,9 +868,11 @@ void ath_radio_enable(struct ath_softc * |
| 171 | --- a/drivers/net/wireless/ath/ath9k/main.c |
| 172 | @@ -869,9 +869,11 @@ void ath_radio_enable(struct ath_softc * |
210 | 173 | ath9k_hw_set_interrupts(ah, ah->imask); |
211 | 174 | |
212 | 175 | /* Enable LED */ |
... | ... | |
219 | 182 | |
220 | 183 | ieee80211_wake_queues(hw); |
221 | 184 | ath9k_ps_restore(sc); |
222 | | @@ -889,10 +891,12 @@ void ath_radio_disable(struct ath_softc |
| 185 | @@ -890,10 +892,12 @@ void ath_radio_disable(struct ath_softc |
223 | 186 | * Keep the LED on when the radio is disabled |
224 | 187 | * during idle unassociated state. |
225 | 188 | */ |
... | ... | |
232 | 195 | |
233 | 196 | /* Disable interrupts */ |
234 | 197 | ath9k_hw_set_interrupts(ah, 0); |
235 | | @@ -1303,8 +1307,10 @@ static void ath9k_stop(struct ieee80211_ |
| 198 | @@ -1304,8 +1308,10 @@ static void ath9k_stop(struct ieee80211_ |
236 | 199 | |
237 | 200 | aphy->state = ATH_WIPHY_INACTIVE; |
238 | 201 | |
... | ... | |
243 | 206 | |
244 | 207 | cancel_delayed_work_sync(&sc->tx_complete_work); |
245 | 208 | cancel_work_sync(&sc->paprd_work); |
246 | | +++ compat-wireless-2010-07-29/net/mac80211/iface.c |
| 209 | --- a/net/mac80211/iface.c |
247 | 210 | @@ -21,7 +21,9 @@ |
248 | 211 | #include "sta_info.h" |
249 | 212 | #include "debugfs_netdev.h" |
... | ... | |
255 | 218 | #include "driver-ops.h" |
256 | 219 | #include "wme.h" |
257 | 220 | |
258 | | @@ -189,7 +191,9 @@ static int ieee80211_open(struct net_dev |
259 | | goto err_del_bss; |
| 221 | @@ -201,7 +203,9 @@ static int ieee80211_do_open(struct net_ |
| 222 | napi_enable(&local->napi); |
260 | 223 | /* we're brought up, everything changes */ |
261 | 224 | hw_reconf_flags = ~0; |
262 | 225 | +#ifdef CONFIG_MAC80211_LEDS |
... | ... | |
265 | 228 | } |
266 | 229 | |
267 | 230 | /* |
268 | | +++ compat-wireless-2010-07-29/net/mac80211/main.c |
| 231 | --- a/net/mac80211/main.c |
269 | 232 | @@ -29,7 +29,9 @@ |
270 | 233 | #include "rate.h" |
271 | 234 | #include "mesh.h" |
... | ... | |
277 | 240 | #include "cfg.h" |
278 | 241 | #include "debugfs.h" |
279 | 242 | |
280 | | @@ -674,7 +676,9 @@ int ieee80211_register_hw(struct ieee802 |
| 243 | @@ -778,7 +780,9 @@ int ieee80211_register_hw(struct ieee802 |
281 | 244 | |
282 | 245 | rtnl_unlock(); |
283 | 246 | |
... | ... | |
287 | 250 | |
288 | 251 | local->network_latency_notifier.notifier_call = |
289 | 252 | ieee80211_max_network_latency; |
290 | | @@ -699,7 +703,9 @@ int ieee80211_register_hw(struct ieee802 |
291 | | &local->network_latency_notifier); |
| 253 | @@ -808,7 +812,9 @@ int ieee80211_register_hw(struct ieee802 |
292 | 254 | rtnl_lock(); |
| 255 | #endif |
293 | 256 | fail_pm_qos: |
294 | 257 | +#ifdef CONFIG_MAC80211_LEDS |
295 | 258 | ieee80211_led_exit(local); |
... | ... | |
297 | 260 | ieee80211_remove_interfaces(local); |
298 | 261 | fail_rate: |
299 | 262 | rtnl_unlock(); |
300 | | @@ -755,7 +761,9 @@ void ieee80211_unregister_hw(struct ieee |
| 263 | @@ -872,7 +878,9 @@ void ieee80211_unregister_hw(struct ieee |
301 | 264 | destroy_workqueue(local->workqueue); |
302 | 265 | wiphy_unregister(local->hw.wiphy); |
303 | 266 | ieee80211_wep_free(local); |
... | ... | |
307 | 270 | kfree(local->int_scan_req); |
308 | 271 | } |
309 | 272 | EXPORT_SYMBOL(ieee80211_unregister_hw); |
310 | | +++ compat-wireless-2010-07-29/net/mac80211/mlme.c |
| 273 | --- a/net/mac80211/mlme.c |
311 | 274 | @@ -26,7 +26,9 @@ |
312 | 275 | #include "ieee80211_i.h" |
313 | 276 | #include "driver-ops.h" |
... | ... | |
319 | 282 | |
320 | 283 | #define IEEE80211_MAX_PROBE_TRIES 5 |
321 | 284 | |
322 | | @@ -872,7 +874,9 @@ static void ieee80211_set_associated(str |
| 285 | @@ -879,7 +881,9 @@ static void ieee80211_set_associated(str |
323 | 286 | */ |
324 | 287 | sdata->u.mgd.wmm_last_param_set = -1; |
325 | 288 | |
... | ... | |
329 | 292 | |
330 | 293 | if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) |
331 | 294 | bss_conf->dtim_period = bss->dtim_period; |
332 | | @@ -958,7 +962,9 @@ static void ieee80211_set_disassoc(struc |
| 295 | @@ -965,7 +969,9 @@ static void ieee80211_set_disassoc(struc |
333 | 296 | |
334 | 297 | changed |= ieee80211_reset_erp_info(sdata); |
335 | 298 | |
... | ... | |
339 | 302 | changed |= BSS_CHANGED_ASSOC; |
340 | 303 | sdata->vif.bss_conf.assoc = false; |
341 | 304 | |
342 | | +++ compat-wireless-2010-07-29/net/mac80211/pm.c |
| 305 | --- a/net/mac80211/pm.c |
343 | 306 | @@ -4,7 +4,9 @@ |
344 | 307 | #include "ieee80211_i.h" |
345 | 308 | #include "mesh.h" |
... | ... | |
351 | 314 | |
352 | 315 | int __ieee80211_suspend(struct ieee80211_hw *hw) |
353 | 316 | { |
354 | | +++ compat-wireless-2010-07-29/net/mac80211/rx.c |
| 317 | --- a/net/mac80211/rx.c |
355 | 318 | @@ -21,7 +21,9 @@ |
356 | 319 | |
357 | 320 | #include "ieee80211_i.h" |
... | ... | |
363 | 326 | #include "mesh.h" |
364 | 327 | #include "wep.h" |
365 | 328 | #include "wpa.h" |
366 | | @@ -1342,8 +1344,10 @@ ieee80211_rx_h_defragment(struct ieee802 |
| 329 | @@ -1377,8 +1379,10 @@ ieee80211_rx_h_defragment(struct ieee802 |
367 | 330 | rx->sta->rx_packets++; |
368 | 331 | if (is_multicast_ether_addr(hdr->addr1)) |
369 | 332 | rx->local->dot11MulticastReceivedFrameCount++; |
... | ... | |
374 | 337 | return RX_CONTINUE; |
375 | 338 | } |
376 | 339 | |
377 | | +++ compat-wireless-2010-07-29/net/mac80211/status.c |
| 340 | --- a/net/mac80211/status.c |
378 | 341 | @@ -13,7 +13,9 @@ |
379 | 342 | #include "ieee80211_i.h" |
380 | 343 | #include "rate.h" |
... | ... | |
386 | 349 | |
387 | 350 | |
388 | 351 | void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, |
389 | | @@ -247,7 +249,9 @@ void ieee80211_tx_status(struct ieee8021 |
| 352 | @@ -246,7 +248,9 @@ void ieee80211_tx_status(struct ieee8021 |
390 | 353 | |
391 | 354 | rcu_read_unlock(); |
392 | 355 | |
... | ... | |
396 | 359 | |
397 | 360 | /* SNMP counters |
398 | 361 | * Fragments are passed to low-level drivers as separate skbs, so these |
399 | | +++ compat-wireless-2010-07-29/net/mac80211/tx.c |
| 362 | --- a/net/mac80211/tx.c |
400 | 363 | @@ -26,7 +26,9 @@ |
401 | 364 | |
402 | 365 | #include "ieee80211_i.h" |
... | ... | |
408 | 371 | #include "mesh.h" |
409 | 372 | #include "wep.h" |
410 | 373 | #include "wpa.h" |
411 | | @@ -1312,7 +1314,9 @@ static int __ieee80211_tx(struct ieee802 |
| 374 | @@ -1334,7 +1336,9 @@ static int __ieee80211_tx(struct ieee802 |
412 | 375 | } |
413 | 376 | |
414 | 377 | *skbp = skb = next; |
... | ... | |
418 | 381 | fragm = true; |
419 | 382 | } |
420 | 383 | |
421 | | +++ compat-wireless-2010-07-29/net/mac80211/util.c |
| 384 | --- a/net/mac80211/util.c |
422 | 385 | @@ -29,7 +29,9 @@ |
423 | 386 | #include "rate.h" |
424 | 387 | #include "mesh.h" |
... | ... | |
430 | 393 | #include "wep.h" |
431 | 394 | |
432 | 395 | /* privid for wiphys to determine whether they belong to us or not */ |
433 | | @@ -1107,7 +1109,9 @@ u32 ieee80211_sta_get_rates(struct ieee8 |
| 396 | @@ -1110,7 +1112,9 @@ u32 ieee80211_sta_get_rates(struct ieee8 |
434 | 397 | |
435 | 398 | void ieee80211_stop_device(struct ieee80211_local *local) |
436 | 399 | { |
... | ... | |
440 | 403 | |
441 | 404 | cancel_work_sync(&local->reconfig_filter); |
442 | 405 | |
443 | | @@ -1141,7 +1145,9 @@ int ieee80211_reconfig(struct ieee80211_ |
| 406 | @@ -1144,7 +1148,9 @@ int ieee80211_reconfig(struct ieee80211_ |
444 | 407 | return res; |
445 | 408 | } |
446 | 409 | |