aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-08-07 00:15:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:35 -0400
commit7f63845f2a5f54c64968a4221561c619468b8a54 (patch)
treece7675b78c54cc1a0620f0b7e21d3e813883f5ff /drivers
parent066edc80ebd9e429d593dcfe97b3ed01c9823847 (diff)
ath9k: Clean antenna configuration for 4K EEPROM chips
This patch revamps the antenna configuration mechanism for 4K chips. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h33
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_4k.c103
-rw-r--r--drivers/net/wireless/ath/ath9k/phy.h1
3 files changed, 84 insertions, 53 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 7d825b6d9c8c..4fe33f7eee9d 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -404,8 +404,13 @@ struct modal_eep_4k_header {
404 u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; 404 u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS];
405 u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; 405 u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS];
406 u8 pdGainOverlap; 406 u8 pdGainOverlap;
407 u8 ob_01; 407#ifdef __BIG_ENDIAN_BITFIELD
408 u8 db1_01; 408 u8 ob_1:4, ob_0:4;
409 u8 db1_1:4, db1_0:4;
410#else
411 u8 ob_0:4, ob_1:4;
412 u8 db1_0:4, db1_1:4;
413#endif
409 u8 xpaBiasLvl; 414 u8 xpaBiasLvl;
410 u8 txFrameToDataStart; 415 u8 txFrameToDataStart;
411 u8 txFrameToPaOn; 416 u8 txFrameToPaOn;
@@ -415,11 +420,27 @@ struct modal_eep_4k_header {
415 u8 swSettleHt40; 420 u8 swSettleHt40;
416 u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; 421 u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS];
417 u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; 422 u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS];
418 u8 db2_01; 423#ifdef __BIG_ENDIAN_BITFIELD
424 u8 db2_1:4, db2_0:4;
425#else
426 u8 db2_0:4, db2_1:4;
427#endif
419 u8 version; 428 u8 version;
420 u16 ob_234; 429#ifdef __BIG_ENDIAN_BITFIELD
421 u16 db1_234; 430 u8 ob_3:4, ob_2:4;
422 u16 db2_234; 431 u8 antdiv_ctl1:4, ob_4:4;
432 u8 db1_3:4, db1_2:4;
433 u8 antdiv_ctl2:4, db1_4:4;
434 u8 db2_2:4, db2_3:4;
435 u8 reserved:4, db2_4:4;
436#else
437 u8 ob_2:4, ob_3:4;
438 u8 ob_4:4, antdiv_ctl1:4;
439 u8 db1_2:4, db1_3:4;
440 u8 db1_4:4, antdiv_ctl2:4;
441 u8 db2_2:4, db2_3:4;
442 u8 db2_4:4, reserved:4;
443#endif
423 u8 futureModal[4]; 444 u8 futureModal[4];
424 struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; 445 struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
425} __packed; 446} __packed;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index aafc6d33da75..c9636159b8f4 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -197,9 +197,9 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah,
197 case EEP_RF_SILENT: 197 case EEP_RF_SILENT:
198 return pBase->rfSilent; 198 return pBase->rfSilent;
199 case EEP_OB_2: 199 case EEP_OB_2:
200 return pModal->ob_01; 200 return pModal->ob_0;
201 case EEP_DB_2: 201 case EEP_DB_2:
202 return pModal->db1_01; 202 return pModal->db1_1;
203 case EEP_MINOR_REV: 203 case EEP_MINOR_REV:
204 return pBase->version & AR5416_EEP_VER_MINOR_MASK; 204 return pBase->version & AR5416_EEP_VER_MINOR_MASK;
205 case EEP_TX_MASK: 205 case EEP_TX_MASK:
@@ -923,58 +923,67 @@ static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,
923 923
924 /* Initialize Ant Diversity settings from EEPROM */ 924 /* Initialize Ant Diversity settings from EEPROM */
925 if (pModal->version >= 3) { 925 if (pModal->version >= 3) {
926 ant_div_control1 = ((pModal->ob_234 >> 12) & 0xf); 926 ant_div_control1 = pModal->antdiv_ctl1;
927 ant_div_control2 = ((pModal->db1_234 >> 12) & 0xf); 927 ant_div_control2 = pModal->antdiv_ctl2;
928 regVal = REG_READ(ah, 0x99ac); 928
929 regVal &= (~(0x7f000000)); 929 regVal = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL);
930 regVal |= ((ant_div_control1 & 0x1) << 24); 930 regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL));
931 regVal |= (((ant_div_control1 >> 1) & 0x1) << 29); 931
932 regVal |= (((ant_div_control1 >> 2) & 0x1) << 30); 932 regVal |= SM(ant_div_control1,
933 regVal |= ((ant_div_control2 & 0x3) << 25); 933 AR_PHY_9285_ANT_DIV_CTL);
934 regVal |= (((ant_div_control2 >> 2) & 0x3) << 27); 934 regVal |= SM(ant_div_control2,
935 REG_WRITE(ah, 0x99ac, regVal); 935 AR_PHY_9285_ANT_DIV_ALT_LNACONF);
936 regVal = REG_READ(ah, 0x99ac); 936 regVal |= SM((ant_div_control2 >> 2),
937 regVal = REG_READ(ah, 0xa208); 937 AR_PHY_9285_ANT_DIV_MAIN_LNACONF);
938 regVal &= (~(0x1 << 13)); 938 regVal |= SM((ant_div_control1 >> 1),
939 regVal |= (((ant_div_control1 >> 3) & 0x1) << 13); 939 AR_PHY_9285_ANT_DIV_ALT_GAINTB);
940 REG_WRITE(ah, 0xa208, regVal); 940 regVal |= SM((ant_div_control1 >> 2),
941 regVal = REG_READ(ah, 0xa208); 941 AR_PHY_9285_ANT_DIV_MAIN_GAINTB);
942
943
944 REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal);
945 regVal = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL);
946 regVal = REG_READ(ah, AR_PHY_CCK_DETECT);
947 regVal &= (~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
948 regVal |= SM((ant_div_control1 >> 3),
949 AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
950
951 REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal);
952 regVal = REG_READ(ah, AR_PHY_CCK_DETECT);
942 } 953 }
943 954
944 if (pModal->version >= 2) { 955 if (pModal->version >= 2) {
945 ob[0] = (pModal->ob_01 & 0xf); 956 ob[0] = pModal->ob_0;
946 ob[1] = (pModal->ob_01 >> 4) & 0xf; 957 ob[1] = pModal->ob_1;
947 ob[2] = (pModal->ob_234 & 0xf); 958 ob[2] = pModal->ob_2;
948 ob[3] = ((pModal->ob_234 >> 4) & 0xf); 959 ob[3] = pModal->ob_3;
949 ob[4] = ((pModal->ob_234 >> 8) & 0xf); 960 ob[4] = pModal->ob_4;
950 961
951 db1[0] = (pModal->db1_01 & 0xf); 962 db1[0] = pModal->db1_0;
952 db1[1] = ((pModal->db1_01 >> 4) & 0xf); 963 db1[1] = pModal->db1_1;
953 db1[2] = (pModal->db1_234 & 0xf); 964 db1[2] = pModal->db1_2;
954 db1[3] = ((pModal->db1_234 >> 4) & 0xf); 965 db1[3] = pModal->db1_3;
955 db1[4] = ((pModal->db1_234 >> 8) & 0xf); 966 db1[4] = pModal->db1_4;
956 967
957 db2[0] = (pModal->db2_01 & 0xf); 968 db2[0] = pModal->db2_0;
958 db2[1] = ((pModal->db2_01 >> 4) & 0xf); 969 db2[1] = pModal->db2_1;
959 db2[2] = (pModal->db2_234 & 0xf); 970 db2[2] = pModal->db2_2;
960 db2[3] = ((pModal->db2_234 >> 4) & 0xf); 971 db2[3] = pModal->db2_3;
961 db2[4] = ((pModal->db2_234 >> 8) & 0xf); 972 db2[4] = pModal->db2_4;
962
963 } else if (pModal->version == 1) { 973 } else if (pModal->version == 1) {
964 ob[0] = (pModal->ob_01 & 0xf); 974 ob[0] = pModal->ob_0;
965 ob[1] = ob[2] = ob[3] = ob[4] = (pModal->ob_01 >> 4) & 0xf; 975 ob[1] = ob[2] = ob[3] = ob[4] = pModal->ob_1;
966 db1[0] = (pModal->db1_01 & 0xf); 976 db1[0] = pModal->db1_0;
967 db1[1] = db1[2] = db1[3] = 977 db1[1] = db1[2] = db1[3] = db1[4] = pModal->db1_1;
968 db1[4] = ((pModal->db1_01 >> 4) & 0xf); 978 db2[0] = pModal->db2_0;
969 db2[0] = (pModal->db2_01 & 0xf); 979 db2[1] = db2[2] = db2[3] = db2[4] = pModal->db2_1;
970 db2[1] = db2[2] = db2[3] =
971 db2[4] = ((pModal->db2_01 >> 4) & 0xf);
972 } else { 980 } else {
973 int i; 981 int i;
982
974 for (i = 0; i < 5; i++) { 983 for (i = 0; i < 5; i++) {
975 ob[i] = pModal->ob_01; 984 ob[i] = pModal->ob_0;
976 db1[i] = pModal->db1_01; 985 db1[i] = pModal->db1_0;
977 db2[i] = pModal->db1_01; 986 db2[i] = pModal->db1_0;
978 } 987 }
979 } 988 }
980 989
diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h
index 5317e0503f64..e83cd4ab87f0 100644
--- a/drivers/net/wireless/ath/ath9k/phy.h
+++ b/drivers/net/wireless/ath/ath9k/phy.h
@@ -419,6 +419,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
419#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001FC0 419#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001FC0
420#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6 420#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6
421#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000 421#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000
422#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV_S 13
422 423
423#define AR_PHY_GAIN_2GHZ 0xA20C 424#define AR_PHY_GAIN_2GHZ 0xA20C
424#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN 0x00FC0000 425#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN 0x00FC0000