diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-10-19 02:33:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-30 16:50:38 -0400 |
commit | a77658286105c8be3741305c5dcf4c319746817f (patch) | |
tree | 223b0b6fb66f95e03c8ec6e914c3955bd9884838 /drivers/net/wireless/ath | |
parent | 896ff260351f736f0d9d32f4fd36257f3e75bd97 (diff) |
ath9k_hw: Fix and complete force bias for AR5416
Force bias is a fix for usage of AR5416 radios on the 2.4 GHz band
for orientation sensitivity. This was only partially implemented
with the ath9k_hw_decrease_chain_power() but first -- this was being
called for all chipsets which is not correct and second -- it was
missing the actual orientation code.
We now ensure to only enable force bias only for AR5416 and BUG_ON()
on other chipsets. Although ath9k_hw_decrease_chain_power() was enabled
for newer chipsets I suspect that it never ran unless the EEPROM had
ATH9K_ANT_FIXED_A or ATH9K_ANT_FIXED_B for antenna diversity.
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')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/phy.c | 70 |
2 files changed, 73 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 7300db9f8117..111ff049f75d 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2055,7 +2055,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
2055 | 2055 | ||
2056 | ah->ath9k_hw_spur_mitigate_freq(ah, chan); | 2056 | ah->ath9k_hw_spur_mitigate_freq(ah, chan); |
2057 | ah->eep_ops->set_board_values(ah, chan); | 2057 | ah->eep_ops->set_board_values(ah, chan); |
2058 | ath9k_hw_decrease_chain_power(ah, chan); | 2058 | |
2059 | if (AR_SREV_5416(ah)) | ||
2060 | ath9k_hw_decrease_chain_power(ah, chan); | ||
2059 | 2061 | ||
2060 | REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(common->macaddr)); | 2062 | REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(common->macaddr)); |
2061 | REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(common->macaddr + 4) | 2063 | REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(common->macaddr + 4) |
diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c index a15532eaae19..df55e28a6560 100644 --- a/drivers/net/wireless/ath/ath9k/phy.c +++ b/drivers/net/wireless/ath/ath9k/phy.c | |||
@@ -41,6 +41,10 @@ | |||
41 | 41 | ||
42 | #include "hw.h" | 42 | #include "hw.h" |
43 | 43 | ||
44 | static void ath9k_phy_modify_rx_buffer(u32 *rfBuf, u32 reg32, | ||
45 | u32 numBits, u32 firstBit, | ||
46 | u32 column); | ||
47 | |||
44 | /** | 48 | /** |
45 | * ath9k_hw_write_regs - ?? | 49 | * ath9k_hw_write_regs - ?? |
46 | * | 50 | * |
@@ -429,6 +433,67 @@ void ath9k_hw_9280_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan) | |||
429 | 433 | ||
430 | /* All code below is for non single-chip solutions */ | 434 | /* All code below is for non single-chip solutions */ |
431 | 435 | ||
436 | /* | ||
437 | * Fix on 2.4 GHz band for orientation sensitivity issue by increasing | ||
438 | * rf_pwd_icsyndiv. | ||
439 | * | ||
440 | * Theoretical Rules: | ||
441 | * if 2 GHz band | ||
442 | * if forceBiasAuto | ||
443 | * if synth_freq < 2412 | ||
444 | * bias = 0 | ||
445 | * else if 2412 <= synth_freq <= 2422 | ||
446 | * bias = 1 | ||
447 | * else // synth_freq > 2422 | ||
448 | * bias = 2 | ||
449 | * else if forceBias > 0 | ||
450 | * bias = forceBias & 7 | ||
451 | * else | ||
452 | * no change, use value from ini file | ||
453 | * else | ||
454 | * no change, invalid band | ||
455 | * | ||
456 | * 1st Mod: | ||
457 | * 2422 also uses value of 2 | ||
458 | * <approved> | ||
459 | * | ||
460 | * 2nd Mod: | ||
461 | * Less than 2412 uses value of 0, 2412 and above uses value of 2 | ||
462 | */ | ||
463 | static void ath9k_hw_force_bias(struct ath_hw *ah, u16 synth_freq) | ||
464 | { | ||
465 | struct ath_common *common = ath9k_hw_common(ah); | ||
466 | u32 tmp_reg; | ||
467 | int reg_writes = 0; | ||
468 | u32 new_bias = 0; | ||
469 | |||
470 | if (!AR_SREV_5416(ah) || synth_freq >= 3000) { | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); | ||
475 | |||
476 | if (synth_freq < 2412) | ||
477 | new_bias = 0; | ||
478 | else if (synth_freq < 2422) | ||
479 | new_bias = 1; | ||
480 | else | ||
481 | new_bias = 2; | ||
482 | |||
483 | /* pre-reverse this field */ | ||
484 | tmp_reg = ath9k_hw_reverse_bits(new_bias, 3); | ||
485 | |||
486 | ath_print(common, ATH_DBG_CONFIG, | ||
487 | "Force rf_pwd_icsyndiv to %1d on %4d\n", | ||
488 | new_bias, synth_freq); | ||
489 | |||
490 | /* swizzle rf_pwd_icsyndiv */ | ||
491 | ath9k_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3); | ||
492 | |||
493 | /* write Bank 6 with new params */ | ||
494 | REG_WRITE_RF_ARRAY(&ah->iniBank6, ah->analogBank6Data, reg_writes); | ||
495 | } | ||
496 | |||
432 | /** | 497 | /** |
433 | * ath9k_hw_set_channel - tune to a channel on the external AR2133/AR5133 radios | 498 | * ath9k_hw_set_channel - tune to a channel on the external AR2133/AR5133 radios |
434 | * @ah: atheros hardware stucture | 499 | * @ah: atheros hardware stucture |
@@ -499,6 +564,9 @@ int ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) | |||
499 | return -EINVAL; | 564 | return -EINVAL; |
500 | } | 565 | } |
501 | 566 | ||
567 | ath9k_hw_force_bias(ah, freq); | ||
568 | ath9k_hw_decrease_chain_power(ah, chan); | ||
569 | |||
502 | reg32 = | 570 | reg32 = |
503 | (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) | | 571 | (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) | |
504 | (1 << 5) | 0x1; | 572 | (1 << 5) | 0x1; |
@@ -946,6 +1014,8 @@ ath9k_hw_decrease_chain_power(struct ath_hw *ah, struct ath9k_channel *chan) | |||
946 | u32 bank6SelMask; | 1014 | u32 bank6SelMask; |
947 | u32 *bank6Temp = ah->bank6Temp; | 1015 | u32 *bank6Temp = ah->bank6Temp; |
948 | 1016 | ||
1017 | BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); | ||
1018 | |||
949 | switch (ah->config.diversity_control) { | 1019 | switch (ah->config.diversity_control) { |
950 | case ATH9K_ANT_FIXED_A: | 1020 | case ATH9K_ANT_FIXED_A: |
951 | bank6SelMask = | 1021 | bank6SelMask = |