diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ani.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ani.c | 64 |
1 files changed, 3 insertions, 61 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index f2aa68405d2..3aa8fb1ad77 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -465,18 +465,6 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) | |||
465 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); | 465 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1); |
466 | } | 466 | } |
467 | 467 | ||
468 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) | ||
469 | { | ||
470 | struct ath_common *common = ath9k_hw_common(ah); | ||
471 | int32_t listen_time; | ||
472 | |||
473 | ath9k_hw_update_cycle_counters(ah); | ||
474 | listen_time = ah->listen_time / (common->clockrate * 1000); | ||
475 | ah->listen_time = 0; | ||
476 | |||
477 | return listen_time; | ||
478 | } | ||
479 | |||
480 | static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning) | 468 | static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning) |
481 | { | 469 | { |
482 | struct ar5416AniState *aniState; | 470 | struct ar5416AniState *aniState; |
@@ -655,7 +643,9 @@ static void ath9k_hw_ani_read_counters(struct ath_hw *ah) | |||
655 | u32 phyCnt1, phyCnt2; | 643 | u32 phyCnt1, phyCnt2; |
656 | int32_t listenTime; | 644 | int32_t listenTime; |
657 | 645 | ||
658 | listenTime = ath9k_hw_ani_get_listen_time(ah); | 646 | ath_hw_cycle_counters_update(common); |
647 | listenTime = ath_hw_get_listen_time(common); | ||
648 | |||
659 | if (listenTime < 0) { | 649 | if (listenTime < 0) { |
660 | ah->stats.ast_ani_lneg++; | 650 | ah->stats.ast_ani_lneg++; |
661 | ath9k_ani_restart(ah); | 651 | ath9k_ani_restart(ah); |
@@ -796,54 +786,6 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah) | |||
796 | } | 786 | } |
797 | EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); | 787 | EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); |
798 | 788 | ||
799 | void ath9k_hw_update_cycle_counters(struct ath_hw *ah) | ||
800 | { | ||
801 | struct ath_cycle_counters cc; | ||
802 | bool clear; | ||
803 | |||
804 | memcpy(&cc, &ah->cc, sizeof(cc)); | ||
805 | |||
806 | /* freeze counters */ | ||
807 | REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); | ||
808 | |||
809 | ah->cc.cycles = REG_READ(ah, AR_CCCNT); | ||
810 | if (ah->cc.cycles < cc.cycles) { | ||
811 | clear = true; | ||
812 | goto skip; | ||
813 | } | ||
814 | |||
815 | ah->cc.rx_clear = REG_READ(ah, AR_RCCNT); | ||
816 | ah->cc.rx_frame = REG_READ(ah, AR_RFCNT); | ||
817 | ah->cc.tx_frame = REG_READ(ah, AR_TFCNT); | ||
818 | |||
819 | /* prevent wraparound */ | ||
820 | if (ah->cc.cycles & BIT(31)) | ||
821 | clear = true; | ||
822 | |||
823 | #define CC_DELTA(_field, _reg) ah->cc_delta._field += ah->cc._field - cc._field | ||
824 | CC_DELTA(cycles, AR_CCCNT); | ||
825 | CC_DELTA(rx_frame, AR_RFCNT); | ||
826 | CC_DELTA(rx_clear, AR_RCCNT); | ||
827 | CC_DELTA(tx_frame, AR_TFCNT); | ||
828 | #undef CC_DELTA | ||
829 | |||
830 | ah->listen_time += (ah->cc.cycles - cc.cycles) - | ||
831 | ((ah->cc.rx_frame - cc.rx_frame) + | ||
832 | (ah->cc.tx_frame - cc.tx_frame)); | ||
833 | |||
834 | skip: | ||
835 | if (clear) { | ||
836 | REG_WRITE(ah, AR_CCCNT, 0); | ||
837 | REG_WRITE(ah, AR_RFCNT, 0); | ||
838 | REG_WRITE(ah, AR_RCCNT, 0); | ||
839 | REG_WRITE(ah, AR_TFCNT, 0); | ||
840 | memset(&ah->cc, 0, sizeof(ah->cc)); | ||
841 | } | ||
842 | |||
843 | /* unfreeze counters */ | ||
844 | REG_WRITE(ah, AR_MIBC, 0); | ||
845 | } | ||
846 | |||
847 | /* | 789 | /* |
848 | * Process a MIB interrupt. We may potentially be invoked because | 790 | * Process a MIB interrupt. We may potentially be invoked because |
849 | * any of the MIB counters overflow/trigger so don't assume we're | 791 | * any of the MIB counters overflow/trigger so don't assume we're |