2 * Copyright (c) 2008-2011 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include "ar9003_mac.h"
19 #include "ar9003_2p2_initvals.h"
20 #include "ar9485_initvals.h"
21 #include "ar9340_initvals.h"
22 #include "ar9330_1p1_initvals.h"
23 #include "ar9330_1p2_initvals.h"
24 #include "ar9580_1p0_initvals.h"
25 #include "ar9462_2p0_initvals.h"
27 /* General hardware code for the AR9003 hadware family */
30 * The AR9003 family uses a new INI format (pre, core, post
31 * arrays per subsystem). This provides support for the
32 * AR9003 2.2 chipsets.
34 static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
36 #define PCIE_PLL_ON_CREQ_DIS_L1_2P0 \
37 ar9462_pciephy_pll_on_clkreq_disable_L1_2p0
39 #define AR9462_BB_CTX_COEFJ(x) \
40 ar9462_##x##_baseband_core_txfir_coeff_japan_2484
42 #define AR9462_BBC_TXIFR_COEFFJ \
43 ar9462_2p0_baseband_core_txfir_coeff_japan_2484
44 if (AR_SREV_9330_11(ah)) {
46 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
47 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
49 ARRAY_SIZE(ar9331_1p1_mac_core), 2);
50 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
51 ar9331_1p1_mac_postamble,
52 ARRAY_SIZE(ar9331_1p1_mac_postamble), 5);
55 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
56 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
57 ar9331_1p1_baseband_core,
58 ARRAY_SIZE(ar9331_1p1_baseband_core), 2);
59 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
60 ar9331_1p1_baseband_postamble,
61 ARRAY_SIZE(ar9331_1p1_baseband_postamble), 5);
64 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
65 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
66 ar9331_1p1_radio_core,
67 ARRAY_SIZE(ar9331_1p1_radio_core), 2);
68 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], NULL, 0, 0);
71 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
72 ar9331_1p1_soc_preamble,
73 ARRAY_SIZE(ar9331_1p1_soc_preamble), 2);
74 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
75 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
76 ar9331_1p1_soc_postamble,
77 ARRAY_SIZE(ar9331_1p1_soc_postamble), 2);
80 INIT_INI_ARRAY(&ah->iniModesRxGain,
81 ar9331_common_rx_gain_1p1,
82 ARRAY_SIZE(ar9331_common_rx_gain_1p1), 2);
83 INIT_INI_ARRAY(&ah->iniModesTxGain,
84 ar9331_modes_lowest_ob_db_tx_gain_1p1,
85 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
88 /* additional clock settings */
90 INIT_INI_ARRAY(&ah->iniModesAdditional,
92 ARRAY_SIZE(ar9331_1p1_xtal_25M), 2);
94 INIT_INI_ARRAY(&ah->iniModesAdditional,
96 ARRAY_SIZE(ar9331_1p1_xtal_40M), 2);
97 } else if (AR_SREV_9330_12(ah)) {
99 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
100 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
102 ARRAY_SIZE(ar9331_1p2_mac_core), 2);
103 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
104 ar9331_1p2_mac_postamble,
105 ARRAY_SIZE(ar9331_1p2_mac_postamble), 5);
108 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
109 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
110 ar9331_1p2_baseband_core,
111 ARRAY_SIZE(ar9331_1p2_baseband_core), 2);
112 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
113 ar9331_1p2_baseband_postamble,
114 ARRAY_SIZE(ar9331_1p2_baseband_postamble), 5);
117 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
118 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
119 ar9331_1p2_radio_core,
120 ARRAY_SIZE(ar9331_1p2_radio_core), 2);
121 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], NULL, 0, 0);
124 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
125 ar9331_1p2_soc_preamble,
126 ARRAY_SIZE(ar9331_1p2_soc_preamble), 2);
127 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
128 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
129 ar9331_1p2_soc_postamble,
130 ARRAY_SIZE(ar9331_1p2_soc_postamble), 2);
133 INIT_INI_ARRAY(&ah->iniModesRxGain,
134 ar9331_common_rx_gain_1p2,
135 ARRAY_SIZE(ar9331_common_rx_gain_1p2), 2);
136 INIT_INI_ARRAY(&ah->iniModesTxGain,
137 ar9331_modes_lowest_ob_db_tx_gain_1p2,
138 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
141 /* additional clock settings */
142 if (ah->is_clk_25mhz)
143 INIT_INI_ARRAY(&ah->iniModesAdditional,
145 ARRAY_SIZE(ar9331_1p2_xtal_25M), 2);
147 INIT_INI_ARRAY(&ah->iniModesAdditional,
149 ARRAY_SIZE(ar9331_1p2_xtal_40M), 2);
150 } else if (AR_SREV_9340(ah)) {
152 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
153 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
155 ARRAY_SIZE(ar9340_1p0_mac_core), 2);
156 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
157 ar9340_1p0_mac_postamble,
158 ARRAY_SIZE(ar9340_1p0_mac_postamble), 5);
161 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
162 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
163 ar9340_1p0_baseband_core,
164 ARRAY_SIZE(ar9340_1p0_baseband_core), 2);
165 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
166 ar9340_1p0_baseband_postamble,
167 ARRAY_SIZE(ar9340_1p0_baseband_postamble), 5);
170 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
171 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
172 ar9340_1p0_radio_core,
173 ARRAY_SIZE(ar9340_1p0_radio_core), 2);
174 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
175 ar9340_1p0_radio_postamble,
176 ARRAY_SIZE(ar9340_1p0_radio_postamble), 5);
179 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
180 ar9340_1p0_soc_preamble,
181 ARRAY_SIZE(ar9340_1p0_soc_preamble), 2);
182 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
183 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
184 ar9340_1p0_soc_postamble,
185 ARRAY_SIZE(ar9340_1p0_soc_postamble), 5);
188 INIT_INI_ARRAY(&ah->iniModesRxGain,
189 ar9340Common_wo_xlna_rx_gain_table_1p0,
190 ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
192 INIT_INI_ARRAY(&ah->iniModesTxGain,
193 ar9340Modes_high_ob_db_tx_gain_table_1p0,
194 ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0),
197 INIT_INI_ARRAY(&ah->iniModesAdditional,
198 ar9340Modes_fast_clock_1p0,
199 ARRAY_SIZE(ar9340Modes_fast_clock_1p0),
202 INIT_INI_ARRAY(&ah->iniModesAdditional_40M,
203 ar9340_1p0_radio_core_40M,
204 ARRAY_SIZE(ar9340_1p0_radio_core_40M),
206 } else if (AR_SREV_9485_11(ah)) {
208 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
209 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
211 ARRAY_SIZE(ar9485_1_1_mac_core), 2);
212 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
213 ar9485_1_1_mac_postamble,
214 ARRAY_SIZE(ar9485_1_1_mac_postamble), 5);
217 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1,
218 ARRAY_SIZE(ar9485_1_1), 2);
219 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
220 ar9485_1_1_baseband_core,
221 ARRAY_SIZE(ar9485_1_1_baseband_core), 2);
222 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
223 ar9485_1_1_baseband_postamble,
224 ARRAY_SIZE(ar9485_1_1_baseband_postamble), 5);
227 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
228 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
229 ar9485_1_1_radio_core,
230 ARRAY_SIZE(ar9485_1_1_radio_core), 2);
231 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
232 ar9485_1_1_radio_postamble,
233 ARRAY_SIZE(ar9485_1_1_radio_postamble), 2);
236 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
237 ar9485_1_1_soc_preamble,
238 ARRAY_SIZE(ar9485_1_1_soc_preamble), 2);
239 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
240 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], NULL, 0, 0);
243 INIT_INI_ARRAY(&ah->iniModesRxGain,
244 ar9485Common_wo_xlna_rx_gain_1_1,
245 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), 2);
246 INIT_INI_ARRAY(&ah->iniModesTxGain,
247 ar9485_modes_lowest_ob_db_tx_gain_1_1,
248 ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
251 /* Load PCIE SERDES settings from INI */
255 INIT_INI_ARRAY(&ah->iniPcieSerdes,
256 ar9485_1_1_pcie_phy_clkreq_disable_L1,
257 ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
262 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
263 ar9485_1_1_pcie_phy_clkreq_disable_L1,
264 ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
266 } else if (AR_SREV_9462_20(ah)) {
268 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
269 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core,
270 ARRAY_SIZE(ar9462_2p0_mac_core), 2);
271 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
272 ar9462_2p0_mac_postamble,
273 ARRAY_SIZE(ar9462_2p0_mac_postamble), 5);
275 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
276 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
277 ar9462_2p0_baseband_core,
278 ARRAY_SIZE(ar9462_2p0_baseband_core), 2);
279 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
280 ar9462_2p0_baseband_postamble,
281 ARRAY_SIZE(ar9462_2p0_baseband_postamble), 5);
283 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
284 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
285 ar9462_2p0_radio_core,
286 ARRAY_SIZE(ar9462_2p0_radio_core), 2);
287 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
288 ar9462_2p0_radio_postamble,
289 ARRAY_SIZE(ar9462_2p0_radio_postamble), 5);
290 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
291 ar9462_2p0_radio_postamble_sys2ant,
292 ARRAY_SIZE(ar9462_2p0_radio_postamble_sys2ant),
295 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
296 ar9462_2p0_soc_preamble,
297 ARRAY_SIZE(ar9462_2p0_soc_preamble), 2);
298 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
299 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
300 ar9462_2p0_soc_postamble,
301 ARRAY_SIZE(ar9462_2p0_soc_postamble), 5);
303 INIT_INI_ARRAY(&ah->iniModesRxGain,
304 ar9462_common_rx_gain_table_2p0,
305 ARRAY_SIZE(ar9462_common_rx_gain_table_2p0), 2);
307 INIT_INI_ARRAY(&ah->ini_BTCOEX_MAX_TXPWR,
308 ar9462_2p0_BTCOEX_MAX_TXPWR_table,
309 ARRAY_SIZE(ar9462_2p0_BTCOEX_MAX_TXPWR_table),
312 /* Awake -> Sleep Setting */
313 INIT_INI_ARRAY(&ah->iniPcieSerdes,
314 PCIE_PLL_ON_CREQ_DIS_L1_2P0,
315 ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
317 /* Sleep -> Awake Setting */
318 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
319 PCIE_PLL_ON_CREQ_DIS_L1_2P0,
320 ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
323 /* Fast clock modal settings */
324 INIT_INI_ARRAY(&ah->iniModesAdditional,
325 ar9462_modes_fast_clock_2p0,
326 ARRAY_SIZE(ar9462_modes_fast_clock_2p0), 3);
328 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
329 AR9462_BB_CTX_COEFJ(2p0),
330 ARRAY_SIZE(AR9462_BB_CTX_COEFJ(2p0)), 2);
332 INIT_INI_ARRAY(&ah->ini_japan2484, AR9462_BBC_TXIFR_COEFFJ,
333 ARRAY_SIZE(AR9462_BBC_TXIFR_COEFFJ), 2);
335 } else if (AR_SREV_9580(ah)) {
337 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
338 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
340 ARRAY_SIZE(ar9580_1p0_mac_core), 2);
341 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
342 ar9580_1p0_mac_postamble,
343 ARRAY_SIZE(ar9580_1p0_mac_postamble), 5);
346 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
347 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
348 ar9580_1p0_baseband_core,
349 ARRAY_SIZE(ar9580_1p0_baseband_core), 2);
350 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
351 ar9580_1p0_baseband_postamble,
352 ARRAY_SIZE(ar9580_1p0_baseband_postamble), 5);
355 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
356 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
357 ar9580_1p0_radio_core,
358 ARRAY_SIZE(ar9580_1p0_radio_core), 2);
359 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
360 ar9580_1p0_radio_postamble,
361 ARRAY_SIZE(ar9580_1p0_radio_postamble), 5);
364 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
365 ar9580_1p0_soc_preamble,
366 ARRAY_SIZE(ar9580_1p0_soc_preamble), 2);
367 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
368 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
369 ar9580_1p0_soc_postamble,
370 ARRAY_SIZE(ar9580_1p0_soc_postamble), 5);
373 INIT_INI_ARRAY(&ah->iniModesRxGain,
374 ar9580_1p0_rx_gain_table,
375 ARRAY_SIZE(ar9580_1p0_rx_gain_table), 2);
376 INIT_INI_ARRAY(&ah->iniModesTxGain,
377 ar9580_1p0_low_ob_db_tx_gain_table,
378 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
381 INIT_INI_ARRAY(&ah->iniModesAdditional,
382 ar9580_1p0_modes_fast_clock,
383 ARRAY_SIZE(ar9580_1p0_modes_fast_clock),
387 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
388 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
390 ARRAY_SIZE(ar9300_2p2_mac_core), 2);
391 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
392 ar9300_2p2_mac_postamble,
393 ARRAY_SIZE(ar9300_2p2_mac_postamble), 5);
396 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
397 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
398 ar9300_2p2_baseband_core,
399 ARRAY_SIZE(ar9300_2p2_baseband_core), 2);
400 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
401 ar9300_2p2_baseband_postamble,
402 ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5);
405 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
406 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
407 ar9300_2p2_radio_core,
408 ARRAY_SIZE(ar9300_2p2_radio_core), 2);
409 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
410 ar9300_2p2_radio_postamble,
411 ARRAY_SIZE(ar9300_2p2_radio_postamble), 5);
414 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
415 ar9300_2p2_soc_preamble,
416 ARRAY_SIZE(ar9300_2p2_soc_preamble), 2);
417 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
418 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
419 ar9300_2p2_soc_postamble,
420 ARRAY_SIZE(ar9300_2p2_soc_postamble), 5);
423 INIT_INI_ARRAY(&ah->iniModesRxGain,
424 ar9300Common_rx_gain_table_2p2,
425 ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2);
426 INIT_INI_ARRAY(&ah->iniModesTxGain,
427 ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
428 ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
431 /* Load PCIE SERDES settings from INI */
435 INIT_INI_ARRAY(&ah->iniPcieSerdes,
436 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
437 ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
442 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
443 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
444 ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
447 /* Fast clock modal settings */
448 INIT_INI_ARRAY(&ah->iniModesAdditional,
449 ar9300Modes_fast_clock_2p2,
450 ARRAY_SIZE(ar9300Modes_fast_clock_2p2),
455 static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
457 if (AR_SREV_9330_12(ah))
458 INIT_INI_ARRAY(&ah->iniModesTxGain,
459 ar9331_modes_lowest_ob_db_tx_gain_1p2,
460 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
462 else if (AR_SREV_9330_11(ah))
463 INIT_INI_ARRAY(&ah->iniModesTxGain,
464 ar9331_modes_lowest_ob_db_tx_gain_1p1,
465 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
467 else if (AR_SREV_9340(ah))
468 INIT_INI_ARRAY(&ah->iniModesTxGain,
469 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
470 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
472 else if (AR_SREV_9485_11(ah))
473 INIT_INI_ARRAY(&ah->iniModesTxGain,
474 ar9485_modes_lowest_ob_db_tx_gain_1_1,
475 ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
477 else if (AR_SREV_9580(ah))
478 INIT_INI_ARRAY(&ah->iniModesTxGain,
479 ar9580_1p0_lowest_ob_db_tx_gain_table,
480 ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
482 else if (AR_SREV_9462_20(ah))
483 INIT_INI_ARRAY(&ah->iniModesTxGain,
484 ar9462_modes_low_ob_db_tx_gain_table_2p0,
485 ARRAY_SIZE(ar9462_modes_low_ob_db_tx_gain_table_2p0),
488 INIT_INI_ARRAY(&ah->iniModesTxGain,
489 ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
490 ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
494 static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
496 if (AR_SREV_9330_12(ah))
497 INIT_INI_ARRAY(&ah->iniModesTxGain,
498 ar9331_modes_high_ob_db_tx_gain_1p2,
499 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p2),
501 else if (AR_SREV_9330_11(ah))
502 INIT_INI_ARRAY(&ah->iniModesTxGain,
503 ar9331_modes_high_ob_db_tx_gain_1p1,
504 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p1),
506 else if (AR_SREV_9340(ah))
507 INIT_INI_ARRAY(&ah->iniModesTxGain,
508 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
509 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
511 else if (AR_SREV_9485_11(ah))
512 INIT_INI_ARRAY(&ah->iniModesTxGain,
513 ar9485Modes_high_ob_db_tx_gain_1_1,
514 ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1),
516 else if (AR_SREV_9580(ah))
517 INIT_INI_ARRAY(&ah->iniModesTxGain,
518 ar9580_1p0_high_ob_db_tx_gain_table,
519 ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
521 else if (AR_SREV_9462_20(ah))
522 INIT_INI_ARRAY(&ah->iniModesTxGain,
523 ar9462_modes_high_ob_db_tx_gain_table_2p0,
524 ARRAY_SIZE(ar9462_modes_high_ob_db_tx_gain_table_2p0),
527 INIT_INI_ARRAY(&ah->iniModesTxGain,
528 ar9300Modes_high_ob_db_tx_gain_table_2p2,
529 ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
533 static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
535 if (AR_SREV_9330_12(ah))
536 INIT_INI_ARRAY(&ah->iniModesTxGain,
537 ar9331_modes_low_ob_db_tx_gain_1p2,
538 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p2),
540 else if (AR_SREV_9330_11(ah))
541 INIT_INI_ARRAY(&ah->iniModesTxGain,
542 ar9331_modes_low_ob_db_tx_gain_1p1,
543 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p1),
545 else if (AR_SREV_9340(ah))
546 INIT_INI_ARRAY(&ah->iniModesTxGain,
547 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
548 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
550 else if (AR_SREV_9485_11(ah))
551 INIT_INI_ARRAY(&ah->iniModesTxGain,
552 ar9485Modes_low_ob_db_tx_gain_1_1,
553 ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1),
555 else if (AR_SREV_9580(ah))
556 INIT_INI_ARRAY(&ah->iniModesTxGain,
557 ar9580_1p0_low_ob_db_tx_gain_table,
558 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
561 INIT_INI_ARRAY(&ah->iniModesTxGain,
562 ar9300Modes_low_ob_db_tx_gain_table_2p2,
563 ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
567 static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
569 if (AR_SREV_9330_12(ah))
570 INIT_INI_ARRAY(&ah->iniModesTxGain,
571 ar9331_modes_high_power_tx_gain_1p2,
572 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p2),
574 else if (AR_SREV_9330_11(ah))
575 INIT_INI_ARRAY(&ah->iniModesTxGain,
576 ar9331_modes_high_power_tx_gain_1p1,
577 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p1),
579 else if (AR_SREV_9340(ah))
580 INIT_INI_ARRAY(&ah->iniModesTxGain,
581 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
582 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
584 else if (AR_SREV_9485_11(ah))
585 INIT_INI_ARRAY(&ah->iniModesTxGain,
586 ar9485Modes_high_power_tx_gain_1_1,
587 ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1),
589 else if (AR_SREV_9580(ah))
590 INIT_INI_ARRAY(&ah->iniModesTxGain,
591 ar9580_1p0_high_power_tx_gain_table,
592 ARRAY_SIZE(ar9580_1p0_high_power_tx_gain_table),
595 INIT_INI_ARRAY(&ah->iniModesTxGain,
596 ar9300Modes_high_power_tx_gain_table_2p2,
597 ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2),
601 static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
603 switch (ar9003_hw_get_tx_gain_idx(ah)) {
606 ar9003_tx_gain_table_mode0(ah);
609 ar9003_tx_gain_table_mode1(ah);
612 ar9003_tx_gain_table_mode2(ah);
615 ar9003_tx_gain_table_mode3(ah);
620 static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
622 if (AR_SREV_9330_12(ah))
623 INIT_INI_ARRAY(&ah->iniModesRxGain,
624 ar9331_common_rx_gain_1p2,
625 ARRAY_SIZE(ar9331_common_rx_gain_1p2),
627 else if (AR_SREV_9330_11(ah))
628 INIT_INI_ARRAY(&ah->iniModesRxGain,
629 ar9331_common_rx_gain_1p1,
630 ARRAY_SIZE(ar9331_common_rx_gain_1p1),
632 else if (AR_SREV_9340(ah))
633 INIT_INI_ARRAY(&ah->iniModesRxGain,
634 ar9340Common_rx_gain_table_1p0,
635 ARRAY_SIZE(ar9340Common_rx_gain_table_1p0),
637 else if (AR_SREV_9485_11(ah))
638 INIT_INI_ARRAY(&ah->iniModesRxGain,
639 ar9485Common_wo_xlna_rx_gain_1_1,
640 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
642 else if (AR_SREV_9580(ah))
643 INIT_INI_ARRAY(&ah->iniModesRxGain,
644 ar9580_1p0_rx_gain_table,
645 ARRAY_SIZE(ar9580_1p0_rx_gain_table),
647 else if (AR_SREV_9462_20(ah))
648 INIT_INI_ARRAY(&ah->iniModesRxGain,
649 ar9462_common_rx_gain_table_2p0,
650 ARRAY_SIZE(ar9462_common_rx_gain_table_2p0),
653 INIT_INI_ARRAY(&ah->iniModesRxGain,
654 ar9300Common_rx_gain_table_2p2,
655 ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
659 static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
661 if (AR_SREV_9330_12(ah))
662 INIT_INI_ARRAY(&ah->iniModesRxGain,
663 ar9331_common_wo_xlna_rx_gain_1p2,
664 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p2),
666 else if (AR_SREV_9330_11(ah))
667 INIT_INI_ARRAY(&ah->iniModesRxGain,
668 ar9331_common_wo_xlna_rx_gain_1p1,
669 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p1),
671 else if (AR_SREV_9340(ah))
672 INIT_INI_ARRAY(&ah->iniModesRxGain,
673 ar9340Common_wo_xlna_rx_gain_table_1p0,
674 ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
676 else if (AR_SREV_9485_11(ah))
677 INIT_INI_ARRAY(&ah->iniModesRxGain,
678 ar9485Common_wo_xlna_rx_gain_1_1,
679 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
681 else if (AR_SREV_9462_20(ah))
682 INIT_INI_ARRAY(&ah->iniModesRxGain,
683 ar9462_common_wo_xlna_rx_gain_table_2p0,
684 ARRAY_SIZE(ar9462_common_wo_xlna_rx_gain_table_2p0),
686 else if (AR_SREV_9580(ah))
687 INIT_INI_ARRAY(&ah->iniModesRxGain,
688 ar9580_1p0_wo_xlna_rx_gain_table,
689 ARRAY_SIZE(ar9580_1p0_wo_xlna_rx_gain_table),
692 INIT_INI_ARRAY(&ah->iniModesRxGain,
693 ar9300Common_wo_xlna_rx_gain_table_2p2,
694 ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
698 static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
700 if (AR_SREV_9462_20(ah))
701 INIT_INI_ARRAY(&ah->iniModesRxGain,
702 ar9462_common_mixed_rx_gain_table_2p0,
703 ARRAY_SIZE(ar9462_common_mixed_rx_gain_table_2p0), 2);
706 static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
708 switch (ar9003_hw_get_rx_gain_idx(ah)) {
711 ar9003_rx_gain_table_mode0(ah);
714 ar9003_rx_gain_table_mode1(ah);
717 ar9003_rx_gain_table_mode2(ah);
722 /* set gain table pointers according to values read from the eeprom */
723 static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
725 ar9003_tx_gain_table_apply(ah);
726 ar9003_rx_gain_table_apply(ah);
730 * Helper for ASPM support.
732 * Disable PLL when in L0s as well as receiver clock when in L1.
733 * This power saving option must be enabled through the SerDes.
735 * Programming the SerDes must go through the same 288 bit serial shift
736 * register as the other analog registers. Hence the 9 writes.
738 static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
741 /* Nothing to do on restore for 11N */
742 if (!power_off /* !restore */) {
743 /* set bit 19 to allow forcing of pcie core into L1 state */
744 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
746 /* Several PCIe massages to ensure proper behaviour */
747 if (ah->config.pcie_waen)
748 REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
750 REG_WRITE(ah, AR_WA, ah->WARegVal);
754 * Configire PCIE after Ini init. SERDES values now come from ini file
755 * This enables PCIe low power mode.
757 if (ah->config.pcieSerDesWrite) {
759 struct ar5416IniArray *array;
761 array = power_off ? &ah->iniPcieSerdes :
762 &ah->iniPcieSerdesLowPower;
764 for (i = 0; i < array->ia_rows; i++) {
767 INI_RA(array, i, 1));
772 /* Sets up the AR9003 hardware familiy callbacks */
773 void ar9003_hw_attach_ops(struct ath_hw *ah)
775 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
776 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
778 priv_ops->init_mode_regs = ar9003_hw_init_mode_regs;
779 priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
781 ops->config_pci_powersave = ar9003_hw_configpcipowersave;
783 ar9003_hw_attach_phy_ops(ah);
784 ar9003_hw_attach_calib_ops(ah);
785 ar9003_hw_attach_mac_ops(ah);