aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/hw.c
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/wireless/ath/ath9k/hw.c
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/wireless/ath/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c112
1 files changed, 8 insertions, 104 deletions
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);