aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-04-15 17:39:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-16 15:43:33 -0400
commit991312d88cb8844e3e1a1e57a72823802da36fcd (patch)
tree1ddad01c2af56e26fcaeeb441a88d6729aa12acb /drivers/net
parentd8f492b7d9a4c1cfdac69ba18a81acbd86d1dc6e (diff)
ath9k_hw: move TX/RX gain INI stuff to its own hardware family code
The AR9003 TX/RX gain is currently initialized with the other components, so for now AR9003 does not implment this callback, after hardware bring up we can test moving the TX/RX gain there as well and if it works well move them to its own callback as well. Since all INI stuff is now moved out hw.c no longer needs to include and touch any original INI headers/structs. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c106
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c112
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h2
4 files changed, 120 insertions, 104 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index ff81efa8bc0..eeaea2631c1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -244,6 +244,111 @@ void ar9002_hw_cck_chan14_spread(struct ath_hw *ah)
244 } 244 }
245} 245}
246 246
247static void ar9280_20_hw_init_rxgain_ini(struct ath_hw *ah)
248{
249 u32 rxgain_type;
250
251 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >=
252 AR5416_EEP_MINOR_VER_17) {
253 rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE);
254
255 if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF)
256 INIT_INI_ARRAY(&ah->iniModesRxGain,
257 ar9280Modes_backoff_13db_rxgain_9280_2,
258 ARRAY_SIZE(ar9280Modes_backoff_13db_rxgain_9280_2), 6);
259 else if (rxgain_type == AR5416_EEP_RXGAIN_23DB_BACKOFF)
260 INIT_INI_ARRAY(&ah->iniModesRxGain,
261 ar9280Modes_backoff_23db_rxgain_9280_2,
262 ARRAY_SIZE(ar9280Modes_backoff_23db_rxgain_9280_2), 6);
263 else
264 INIT_INI_ARRAY(&ah->iniModesRxGain,
265 ar9280Modes_original_rxgain_9280_2,
266 ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
267 } else {
268 INIT_INI_ARRAY(&ah->iniModesRxGain,
269 ar9280Modes_original_rxgain_9280_2,
270 ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
271 }
272}
273
274static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah)
275{
276 u32 txgain_type;
277
278 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >=
279 AR5416_EEP_MINOR_VER_19) {
280 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
281
282 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
283 INIT_INI_ARRAY(&ah->iniModesTxGain,
284 ar9280Modes_high_power_tx_gain_9280_2,
285 ARRAY_SIZE(ar9280Modes_high_power_tx_gain_9280_2), 6);
286 else
287 INIT_INI_ARRAY(&ah->iniModesTxGain,
288 ar9280Modes_original_tx_gain_9280_2,
289 ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
290 } else {
291 INIT_INI_ARRAY(&ah->iniModesTxGain,
292 ar9280Modes_original_tx_gain_9280_2,
293 ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
294 }
295}
296
297static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)
298{
299 if (AR_SREV_9287_11_OR_LATER(ah))
300 INIT_INI_ARRAY(&ah->iniModesRxGain,
301 ar9287Modes_rx_gain_9287_1_1,
302 ARRAY_SIZE(ar9287Modes_rx_gain_9287_1_1), 6);
303 else if (AR_SREV_9287_10(ah))
304 INIT_INI_ARRAY(&ah->iniModesRxGain,
305 ar9287Modes_rx_gain_9287_1_0,
306 ARRAY_SIZE(ar9287Modes_rx_gain_9287_1_0), 6);
307 else if (AR_SREV_9280_20(ah))
308 ar9280_20_hw_init_rxgain_ini(ah);
309
310 if (AR_SREV_9287_11_OR_LATER(ah)) {
311 INIT_INI_ARRAY(&ah->iniModesTxGain,
312 ar9287Modes_tx_gain_9287_1_1,
313 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_1), 6);
314 } else if (AR_SREV_9287_10(ah)) {
315 INIT_INI_ARRAY(&ah->iniModesTxGain,
316 ar9287Modes_tx_gain_9287_1_0,
317 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_0), 6);
318 } else if (AR_SREV_9280_20(ah)) {
319 ar9280_20_hw_init_txgain_ini(ah);
320 } else if (AR_SREV_9285_12_OR_LATER(ah)) {
321 u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
322
323 /* txgain table */
324 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) {
325 if (AR_SREV_9285E_20(ah)) {
326 INIT_INI_ARRAY(&ah->iniModesTxGain,
327 ar9285Modes_XE2_0_high_power,
328 ARRAY_SIZE(
329 ar9285Modes_XE2_0_high_power), 6);
330 } else {
331 INIT_INI_ARRAY(&ah->iniModesTxGain,
332 ar9285Modes_high_power_tx_gain_9285_1_2,
333 ARRAY_SIZE(
334 ar9285Modes_high_power_tx_gain_9285_1_2), 6);
335 }
336 } else {
337 if (AR_SREV_9285E_20(ah)) {
338 INIT_INI_ARRAY(&ah->iniModesTxGain,
339 ar9285Modes_XE2_0_normal_power,
340 ARRAY_SIZE(
341 ar9285Modes_XE2_0_normal_power), 6);
342 } else {
343 INIT_INI_ARRAY(&ah->iniModesTxGain,
344 ar9285Modes_original_tx_gain_9285_1_2,
345 ARRAY_SIZE(
346 ar9285Modes_original_tx_gain_9285_1_2), 6);
347 }
348 }
349 }
350}
351
247/* 352/*
248 * Helper for ASPM support. 353 * Helper for ASPM support.
249 * 354 *
@@ -385,6 +490,7 @@ void ar9002_hw_attach_ops(struct ath_hw *ah)
385 struct ath_hw_ops *ops = ath9k_hw_ops(ah); 490 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
386 491
387 priv_ops->init_mode_regs = ar9002_hw_init_mode_regs; 492 priv_ops->init_mode_regs = ar9002_hw_init_mode_regs;
493 priv_ops->init_mode_gain_regs = ar9002_hw_init_mode_gain_regs;
388 priv_ops->macversion_supported = ar9002_hw_macversion_supported; 494 priv_ops->macversion_supported = ar9002_hw_macversion_supported;
389 495
390 ops->config_pci_powersave = ar9002_hw_configpcipowersave; 496 ops->config_pci_powersave = ar9002_hw_configpcipowersave;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 6111bdb7779..1984b4f78bc 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -31,6 +31,10 @@ static bool ar9003_hw_macversion_supported(u32 macversion)
31} 31}
32 32
33/* AR9003 2.0 - new INI format (pre, core, post arrays per subsystem) */ 33/* AR9003 2.0 - new INI format (pre, core, post arrays per subsystem) */
34/*
35 * XXX: move TX/RX gain INI to its own init_mode_gain_regs after
36 * ensuring it does not affect hardware bring up
37 */
34static void ar9003_hw_init_mode_regs(struct ath_hw *ah) 38static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
35{ 39{
36 /* mac */ 40 /* mac */
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 40cacbfee30..127546c4222 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -20,7 +20,6 @@
20#include "hw.h" 20#include "hw.h"
21#include "hw-ops.h" 21#include "hw-ops.h"
22#include "rc.h" 22#include "rc.h"
23#include "ar9002_initvals.h"
24 23
25#define ATH9K_CLOCK_RATE_CCK 22 24#define ATH9K_CLOCK_RATE_CCK 22
26#define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 25#define ATH9K_CLOCK_RATE_5GHZ_OFDM 40
@@ -70,6 +69,14 @@ static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah,
70 return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan); 69 return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan);
71} 70}
72 71
72static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
73{
74 if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs)
75 return;
76
77 ath9k_hw_private_ops(ah)->init_mode_gain_regs(ah);
78}
79
73/********************/ 80/********************/
74/* Helper Functions */ 81/* Helper Functions */
75/********************/ 82/********************/
@@ -479,54 +486,6 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah)
479 return 0; 486 return 0;
480} 487}
481 488
482static void ath9k_hw_init_rxgain_ini(struct ath_hw *ah)
483{
484 u32 rxgain_type;
485
486 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_17) {
487 rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE);
488
489 if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF)
490 INIT_INI_ARRAY(&ah->iniModesRxGain,
491 ar9280Modes_backoff_13db_rxgain_9280_2,
492 ARRAY_SIZE(ar9280Modes_backoff_13db_rxgain_9280_2), 6);
493 else if (rxgain_type == AR5416_EEP_RXGAIN_23DB_BACKOFF)
494 INIT_INI_ARRAY(&ah->iniModesRxGain,
495 ar9280Modes_backoff_23db_rxgain_9280_2,
496 ARRAY_SIZE(ar9280Modes_backoff_23db_rxgain_9280_2), 6);
497 else
498 INIT_INI_ARRAY(&ah->iniModesRxGain,
499 ar9280Modes_original_rxgain_9280_2,
500 ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
501 } else {
502 INIT_INI_ARRAY(&ah->iniModesRxGain,
503 ar9280Modes_original_rxgain_9280_2,
504 ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
505 }
506}
507
508static void ath9k_hw_init_txgain_ini(struct ath_hw *ah)
509{
510 u32 txgain_type;
511
512 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_19) {
513 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
514
515 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
516 INIT_INI_ARRAY(&ah->iniModesTxGain,
517 ar9280Modes_high_power_tx_gain_9280_2,
518 ARRAY_SIZE(ar9280Modes_high_power_tx_gain_9280_2), 6);
519 else
520 INIT_INI_ARRAY(&ah->iniModesTxGain,
521 ar9280Modes_original_tx_gain_9280_2,
522 ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
523 } else {
524 INIT_INI_ARRAY(&ah->iniModesTxGain,
525 ar9280Modes_original_tx_gain_9280_2,
526 ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
527 }
528}
529
530static int ath9k_hw_post_init(struct ath_hw *ah) 489static int ath9k_hw_post_init(struct ath_hw *ah)
531{ 490{
532 int ecode; 491 int ecode;
@@ -565,61 +524,6 @@ static int ath9k_hw_post_init(struct ath_hw *ah)
565 return 0; 524 return 0;
566} 525}
567 526
568static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
569{
570 if (AR_SREV_9287_11_OR_LATER(ah))
571 INIT_INI_ARRAY(&ah->iniModesRxGain,
572 ar9287Modes_rx_gain_9287_1_1,
573 ARRAY_SIZE(ar9287Modes_rx_gain_9287_1_1), 6);
574 else if (AR_SREV_9287_10(ah))
575 INIT_INI_ARRAY(&ah->iniModesRxGain,
576 ar9287Modes_rx_gain_9287_1_0,
577 ARRAY_SIZE(ar9287Modes_rx_gain_9287_1_0), 6);
578 else if (AR_SREV_9280_20(ah))
579 ath9k_hw_init_rxgain_ini(ah);
580
581 if (AR_SREV_9287_11_OR_LATER(ah)) {
582 INIT_INI_ARRAY(&ah->iniModesTxGain,
583 ar9287Modes_tx_gain_9287_1_1,
584 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_1), 6);
585 } else if (AR_SREV_9287_10(ah)) {
586 INIT_INI_ARRAY(&ah->iniModesTxGain,
587 ar9287Modes_tx_gain_9287_1_0,
588 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_0), 6);
589 } else if (AR_SREV_9280_20(ah)) {
590 ath9k_hw_init_txgain_ini(ah);
591 } else if (AR_SREV_9285_12_OR_LATER(ah)) {
592 u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
593
594 /* txgain table */
595 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) {
596 if (AR_SREV_9285E_20(ah)) {
597 INIT_INI_ARRAY(&ah->iniModesTxGain,
598 ar9285Modes_XE2_0_high_power,
599 ARRAY_SIZE(
600 ar9285Modes_XE2_0_high_power), 6);
601 } else {
602 INIT_INI_ARRAY(&ah->iniModesTxGain,
603 ar9285Modes_high_power_tx_gain_9285_1_2,
604 ARRAY_SIZE(
605 ar9285Modes_high_power_tx_gain_9285_1_2), 6);
606 }
607 } else {
608 if (AR_SREV_9285E_20(ah)) {
609 INIT_INI_ARRAY(&ah->iniModesTxGain,
610 ar9285Modes_XE2_0_normal_power,
611 ARRAY_SIZE(
612 ar9285Modes_XE2_0_normal_power), 6);
613 } else {
614 INIT_INI_ARRAY(&ah->iniModesTxGain,
615 ar9285Modes_original_tx_gain_9285_1_2,
616 ARRAY_SIZE(
617 ar9285Modes_original_tx_gain_9285_1_2), 6);
618 }
619 }
620 }
621}
622
623static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah) 527static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah)
624{ 528{
625 struct base_eep_header *pBase = &(ah->eeprom.def.baseEepHeader); 529 struct base_eep_header *pBase = &(ah->eeprom.def.baseEepHeader);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 56c57355645..b27e76b82dc 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -473,6 +473,7 @@ struct ath_gen_timer_table {
473 * @init_cal: starts actual calibration 473 * @init_cal: starts actual calibration
474 * 474 *
475 * @init_mode_regs: Initializes mode registers 475 * @init_mode_regs: Initializes mode registers
476 * @init_mode_gain_regs: Initialize TX/RX gain registers
476 * @macversion_supported: If this specific mac revision is supported 477 * @macversion_supported: If this specific mac revision is supported
477 * 478 *
478 * @rf_set_freq: change frequency 479 * @rf_set_freq: change frequency
@@ -491,6 +492,7 @@ struct ath_hw_private_ops {
491 bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); 492 bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan);
492 493
493 void (*init_mode_regs)(struct ath_hw *ah); 494 void (*init_mode_regs)(struct ath_hw *ah);
495 void (*init_mode_gain_regs)(struct ath_hw *ah);
494 bool (*macversion_supported)(u32 macversion); 496 bool (*macversion_supported)(u32 macversion);
495 void (*setup_calibration)(struct ath_hw *ah, 497 void (*setup_calibration)(struct ath_hw *ah,
496 struct ath9k_cal_list *currCal); 498 struct ath9k_cal_list *currCal);