aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9002_hw.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-04-15 17:39:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-16 15:43:41 -0400
commitebd5a14a450e31611696dfe96781a3b8915d835c (patch)
treeb44246ca07fcea61e3032325344c74f0685dcf92 /drivers/net/wireless/ath/ath9k/ar9002_hw.c
parent57b98384e5450996300d77ece61739b58325a84f (diff)
ath9k_hw: move the RF claim stuff to AR9002 hardware family
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/ar9002_hw.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index eeaea2631c18..5b21e6914386 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -483,6 +483,49 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
483 } 483 }
484} 484}
485 485
486static int ar9002_hw_get_radiorev(struct ath_hw *ah)
487{
488 u32 val;
489 int i;
490
491 REG_WRITE(ah, AR_PHY(0x36), 0x00007058);
492
493 for (i = 0; i < 8; i++)
494 REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
495 val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
496 val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
497
498 return ath9k_hw_reverse_bits(val, 8);
499}
500
501int ar9002_hw_rf_claim(struct ath_hw *ah)
502{
503 u32 val;
504
505 REG_WRITE(ah, AR_PHY(0), 0x00000007);
506
507 val = ar9002_hw_get_radiorev(ah);
508 switch (val & AR_RADIO_SREV_MAJOR) {
509 case 0:
510 val = AR_RAD5133_SREV_MAJOR;
511 break;
512 case AR_RAD5133_SREV_MAJOR:
513 case AR_RAD5122_SREV_MAJOR:
514 case AR_RAD2133_SREV_MAJOR:
515 case AR_RAD2122_SREV_MAJOR:
516 break;
517 default:
518 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
519 "Radio Chip Rev 0x%02X not supported\n",
520 val & AR_RADIO_SREV_MAJOR);
521 return -EOPNOTSUPP;
522 }
523
524 ah->hw_version.analog5GhzRev = val;
525
526 return 0;
527}
528
486/* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ 529/* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */
487void ar9002_hw_attach_ops(struct ath_hw *ah) 530void ar9002_hw_attach_ops(struct ath_hw *ah)
488{ 531{