diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-04-15 17:38:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-16 15:43:27 -0400 |
commit | 641d99217f507024720d21f0a76a8075824fcc46 (patch) | |
tree | 885eadc6bb378c8c76b324c89d804ae5afea3ec1 /drivers | |
parent | b5c80475abaad015699384ca64ef8229fdd88758 (diff) |
ath9k_hw: Split out the function for reading the noise floor
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar5008_phy.c | 50 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9002_phy.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 110 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.c | 90 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw-ops.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 12 |
7 files changed, 235 insertions, 89 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index dddca59ea46d..bd3792c78af1 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -1198,6 +1198,55 @@ static bool ar5008_hw_ani_control(struct ath_hw *ah, | |||
1198 | return true; | 1198 | return true; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | static void ar5008_hw_do_getnf(struct ath_hw *ah, | ||
1202 | int16_t nfarray[NUM_NF_READINGS]) | ||
1203 | { | ||
1204 | struct ath_common *common = ath9k_hw_common(ah); | ||
1205 | int16_t nf; | ||
1206 | |||
1207 | nf = MS(REG_READ(ah, AR_PHY_CCA), AR_PHY_MINCCA_PWR); | ||
1208 | if (nf & 0x100) | ||
1209 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1210 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1211 | "NF calibrated [ctl] [chain 0] is %d\n", nf); | ||
1212 | nfarray[0] = nf; | ||
1213 | |||
1214 | nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), AR_PHY_CH1_MINCCA_PWR); | ||
1215 | if (nf & 0x100) | ||
1216 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1217 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1218 | "NF calibrated [ctl] [chain 1] is %d\n", nf); | ||
1219 | nfarray[1] = nf; | ||
1220 | |||
1221 | nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR); | ||
1222 | if (nf & 0x100) | ||
1223 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1224 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1225 | "NF calibrated [ctl] [chain 2] is %d\n", nf); | ||
1226 | nfarray[2] = nf; | ||
1227 | |||
1228 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); | ||
1229 | if (nf & 0x100) | ||
1230 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1231 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1232 | "NF calibrated [ext] [chain 0] is %d\n", nf); | ||
1233 | nfarray[3] = nf; | ||
1234 | |||
1235 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR_PHY_CH1_EXT_MINCCA_PWR); | ||
1236 | if (nf & 0x100) | ||
1237 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1238 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1239 | "NF calibrated [ext] [chain 1] is %d\n", nf); | ||
1240 | nfarray[4] = nf; | ||
1241 | |||
1242 | nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA), AR_PHY_CH2_EXT_MINCCA_PWR); | ||
1243 | if (nf & 0x100) | ||
1244 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
1245 | ath_print(common, ATH_DBG_CALIBRATE, | ||
1246 | "NF calibrated [ext] [chain 2] is %d\n", nf); | ||
1247 | nfarray[5] = nf; | ||
1248 | } | ||
1249 | |||
1201 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah) | 1250 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah) |
1202 | { | 1251 | { |
1203 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); | 1252 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); |
@@ -1220,6 +1269,7 @@ void ar5008_hw_attach_phy_ops(struct ath_hw *ah) | |||
1220 | priv_ops->restore_chainmask = ar5008_restore_chainmask; | 1269 | priv_ops->restore_chainmask = ar5008_restore_chainmask; |
1221 | priv_ops->set_diversity = ar5008_set_diversity; | 1270 | priv_ops->set_diversity = ar5008_set_diversity; |
1222 | priv_ops->ani_control = ar5008_hw_ani_control; | 1271 | priv_ops->ani_control = ar5008_hw_ani_control; |
1272 | priv_ops->do_getnf = ar5008_hw_do_getnf; | ||
1223 | 1273 | ||
1224 | if (AR_SREV_9100(ah)) | 1274 | if (AR_SREV_9100(ah)) |
1225 | priv_ops->compute_pll_control = ar9100_hw_compute_pll_control; | 1275 | priv_ops->compute_pll_control = ar9100_hw_compute_pll_control; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c index 1f8ac0ae471a..a0a2f58db29c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c | |||
@@ -467,6 +467,58 @@ static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah, | |||
467 | return pll; | 467 | return pll; |
468 | } | 468 | } |
469 | 469 | ||
470 | static void ar9002_hw_do_getnf(struct ath_hw *ah, | ||
471 | int16_t nfarray[NUM_NF_READINGS]) | ||
472 | { | ||
473 | struct ath_common *common = ath9k_hw_common(ah); | ||
474 | int16_t nf; | ||
475 | |||
476 | nf = MS(REG_READ(ah, AR_PHY_CCA), AR9280_PHY_MINCCA_PWR); | ||
477 | |||
478 | if (nf & 0x100) | ||
479 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
480 | ath_print(common, ATH_DBG_CALIBRATE, | ||
481 | "NF calibrated [ctl] [chain 0] is %d\n", nf); | ||
482 | |||
483 | if (AR_SREV_9271(ah) && (nf >= -114)) | ||
484 | nf = -116; | ||
485 | |||
486 | nfarray[0] = nf; | ||
487 | |||
488 | if (!AR_SREV_9285(ah) && !AR_SREV_9271(ah)) { | ||
489 | nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), | ||
490 | AR9280_PHY_CH1_MINCCA_PWR); | ||
491 | |||
492 | if (nf & 0x100) | ||
493 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
494 | ath_print(common, ATH_DBG_CALIBRATE, | ||
495 | "NF calibrated [ctl] [chain 1] is %d\n", nf); | ||
496 | nfarray[1] = nf; | ||
497 | } | ||
498 | |||
499 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); | ||
500 | if (nf & 0x100) | ||
501 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
502 | ath_print(common, ATH_DBG_CALIBRATE, | ||
503 | "NF calibrated [ext] [chain 0] is %d\n", nf); | ||
504 | |||
505 | if (AR_SREV_9271(ah) && (nf >= -114)) | ||
506 | nf = -116; | ||
507 | |||
508 | nfarray[3] = nf; | ||
509 | |||
510 | if (!AR_SREV_9285(ah) && !AR_SREV_9271(ah)) { | ||
511 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), | ||
512 | AR9280_PHY_CH1_EXT_MINCCA_PWR); | ||
513 | |||
514 | if (nf & 0x100) | ||
515 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
516 | ath_print(common, ATH_DBG_CALIBRATE, | ||
517 | "NF calibrated [ext] [chain 1] is %d\n", nf); | ||
518 | nfarray[4] = nf; | ||
519 | } | ||
520 | } | ||
521 | |||
470 | void ar9002_hw_attach_phy_ops(struct ath_hw *ah) | 522 | void ar9002_hw_attach_phy_ops(struct ath_hw *ah) |
471 | { | 523 | { |
472 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); | 524 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); |
@@ -478,4 +530,5 @@ void ar9002_hw_attach_phy_ops(struct ath_hw *ah) | |||
478 | priv_ops->spur_mitigate_freq = ar9002_hw_spur_mitigate; | 530 | priv_ops->spur_mitigate_freq = ar9002_hw_spur_mitigate; |
479 | priv_ops->olc_init = ar9002_olc_init; | 531 | priv_ops->olc_init = ar9002_olc_init; |
480 | priv_ops->compute_pll_control = ar9002_hw_compute_pll_control; | 532 | priv_ops->compute_pll_control = ar9002_hw_compute_pll_control; |
533 | priv_ops->do_getnf = ar9002_hw_do_getnf; | ||
481 | } | 534 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index c938b85c174e..67b3b6518436 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -705,6 +705,115 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
705 | return true; | 705 | return true; |
706 | } | 706 | } |
707 | 707 | ||
708 | static void ar9003_hw_nf_sanitize_2g(struct ath_hw *ah, s16 *nf) | ||
709 | { | ||
710 | struct ath_common *common = ath9k_hw_common(ah); | ||
711 | |||
712 | if (*nf > ah->nf_2g_max) { | ||
713 | ath_print(common, ATH_DBG_CALIBRATE, | ||
714 | "2 GHz NF (%d) > MAX (%d), " | ||
715 | "correcting to MAX", | ||
716 | *nf, ah->nf_2g_max); | ||
717 | *nf = ah->nf_2g_max; | ||
718 | } else if (*nf < ah->nf_2g_min) { | ||
719 | ath_print(common, ATH_DBG_CALIBRATE, | ||
720 | "2 GHz NF (%d) < MIN (%d), " | ||
721 | "correcting to MIN", | ||
722 | *nf, ah->nf_2g_min); | ||
723 | *nf = ah->nf_2g_min; | ||
724 | } | ||
725 | } | ||
726 | |||
727 | static void ar9003_hw_nf_sanitize_5g(struct ath_hw *ah, s16 *nf) | ||
728 | { | ||
729 | struct ath_common *common = ath9k_hw_common(ah); | ||
730 | |||
731 | if (*nf > ah->nf_5g_max) { | ||
732 | ath_print(common, ATH_DBG_CALIBRATE, | ||
733 | "5 GHz NF (%d) > MAX (%d), " | ||
734 | "correcting to MAX", | ||
735 | *nf, ah->nf_5g_max); | ||
736 | *nf = ah->nf_5g_max; | ||
737 | } else if (*nf < ah->nf_5g_min) { | ||
738 | ath_print(common, ATH_DBG_CALIBRATE, | ||
739 | "5 GHz NF (%d) < MIN (%d), " | ||
740 | "correcting to MIN", | ||
741 | *nf, ah->nf_5g_min); | ||
742 | *nf = ah->nf_5g_min; | ||
743 | } | ||
744 | } | ||
745 | |||
746 | static void ar9003_hw_nf_sanitize(struct ath_hw *ah, s16 *nf) | ||
747 | { | ||
748 | if (IS_CHAN_2GHZ(ah->curchan)) | ||
749 | ar9003_hw_nf_sanitize_2g(ah, nf); | ||
750 | else | ||
751 | ar9003_hw_nf_sanitize_5g(ah, nf); | ||
752 | } | ||
753 | |||
754 | static void ar9003_hw_do_getnf(struct ath_hw *ah, | ||
755 | int16_t nfarray[NUM_NF_READINGS]) | ||
756 | { | ||
757 | struct ath_common *common = ath9k_hw_common(ah); | ||
758 | int16_t nf; | ||
759 | |||
760 | nf = MS(REG_READ(ah, AR_PHY_CCA_0), AR_PHY_MINCCA_PWR); | ||
761 | if (nf & 0x100) | ||
762 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
763 | ar9003_hw_nf_sanitize(ah, &nf); | ||
764 | ath_print(common, ATH_DBG_CALIBRATE, | ||
765 | "NF calibrated [ctl] [chain 0] is %d\n", nf); | ||
766 | nfarray[0] = nf; | ||
767 | |||
768 | nf = MS(REG_READ(ah, AR_PHY_CCA_1), AR_PHY_CH1_MINCCA_PWR); | ||
769 | if (nf & 0x100) | ||
770 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
771 | ar9003_hw_nf_sanitize(ah, &nf); | ||
772 | ath_print(common, ATH_DBG_CALIBRATE, | ||
773 | "NF calibrated [ctl] [chain 1] is %d\n", nf); | ||
774 | nfarray[1] = nf; | ||
775 | |||
776 | nf = MS(REG_READ(ah, AR_PHY_CCA_2), AR_PHY_CH2_MINCCA_PWR); | ||
777 | if (nf & 0x100) | ||
778 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
779 | ar9003_hw_nf_sanitize(ah, &nf); | ||
780 | ath_print(common, ATH_DBG_CALIBRATE, | ||
781 | "NF calibrated [ctl] [chain 2] is %d\n", nf); | ||
782 | nfarray[2] = nf; | ||
783 | |||
784 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); | ||
785 | if (nf & 0x100) | ||
786 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
787 | ar9003_hw_nf_sanitize(ah, &nf); | ||
788 | ath_print(common, ATH_DBG_CALIBRATE, | ||
789 | "NF calibrated [ext] [chain 0] is %d\n", nf); | ||
790 | nfarray[3] = nf; | ||
791 | |||
792 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA_1), AR_PHY_CH1_EXT_MINCCA_PWR); | ||
793 | if (nf & 0x100) | ||
794 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
795 | ar9003_hw_nf_sanitize(ah, &nf); | ||
796 | ath_print(common, ATH_DBG_CALIBRATE, | ||
797 | "NF calibrated [ext] [chain 1] is %d\n", nf); | ||
798 | nfarray[4] = nf; | ||
799 | |||
800 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA_2), AR_PHY_CH2_EXT_MINCCA_PWR); | ||
801 | if (nf & 0x100) | ||
802 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
803 | ar9003_hw_nf_sanitize(ah, &nf); | ||
804 | ath_print(common, ATH_DBG_CALIBRATE, | ||
805 | "NF calibrated [ext] [chain 2] is %d\n", nf); | ||
806 | nfarray[5] = nf; | ||
807 | } | ||
808 | |||
809 | void ar9003_hw_set_nf_limits(struct ath_hw *ah) | ||
810 | { | ||
811 | ah->nf_2g_max = AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ; | ||
812 | ah->nf_2g_min = AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ; | ||
813 | ah->nf_5g_max = AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ; | ||
814 | ah->nf_5g_min = AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ; | ||
815 | } | ||
816 | |||
708 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah) | 817 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah) |
709 | { | 818 | { |
710 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); | 819 | struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); |
@@ -723,4 +832,5 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) | |||
723 | priv_ops->enable_rfkill = ar9003_hw_enable_rfkill; | 832 | priv_ops->enable_rfkill = ar9003_hw_enable_rfkill; |
724 | priv_ops->set_diversity = ar9003_hw_set_diversity; | 833 | priv_ops->set_diversity = ar9003_hw_set_diversity; |
725 | priv_ops->ani_control = ar9003_hw_ani_control; | 834 | priv_ops->ani_control = ar9003_hw_ani_control; |
835 | priv_ops->do_getnf = ar9003_hw_do_getnf; | ||
726 | } | 836 | } |
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index eba85adb7cd3..eed2c76f56c6 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "hw.h" | 17 | #include "hw.h" |
18 | #include "hw-ops.h" | ||
18 | #include "ar9002_phy.h" | 19 | #include "ar9002_phy.h" |
19 | 20 | ||
20 | /* We can tune this as we go by monitoring really low values */ | 21 | /* We can tune this as we go by monitoring really low values */ |
@@ -88,95 +89,6 @@ static void ath9k_hw_update_nfcal_hist_buffer(struct ath9k_nfcal_hist *h, | |||
88 | return; | 89 | return; |
89 | } | 90 | } |
90 | 91 | ||
91 | static void ath9k_hw_do_getnf(struct ath_hw *ah, | ||
92 | int16_t nfarray[NUM_NF_READINGS]) | ||
93 | { | ||
94 | struct ath_common *common = ath9k_hw_common(ah); | ||
95 | int16_t nf; | ||
96 | |||
97 | if (AR_SREV_9280_10_OR_LATER(ah)) | ||
98 | nf = MS(REG_READ(ah, AR_PHY_CCA), AR9280_PHY_MINCCA_PWR); | ||
99 | else | ||
100 | nf = MS(REG_READ(ah, AR_PHY_CCA), AR_PHY_MINCCA_PWR); | ||
101 | |||
102 | if (nf & 0x100) | ||
103 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
104 | ath_print(common, ATH_DBG_CALIBRATE, | ||
105 | "NF calibrated [ctl] [chain 0] is %d\n", nf); | ||
106 | |||
107 | if (AR_SREV_9271(ah) && (nf >= -114)) | ||
108 | nf = -116; | ||
109 | |||
110 | nfarray[0] = nf; | ||
111 | |||
112 | if (!AR_SREV_9285(ah) && !AR_SREV_9271(ah)) { | ||
113 | if (AR_SREV_9280_10_OR_LATER(ah)) | ||
114 | nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), | ||
115 | AR9280_PHY_CH1_MINCCA_PWR); | ||
116 | else | ||
117 | nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), | ||
118 | AR_PHY_CH1_MINCCA_PWR); | ||
119 | |||
120 | if (nf & 0x100) | ||
121 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
122 | ath_print(common, ATH_DBG_CALIBRATE, | ||
123 | "NF calibrated [ctl] [chain 1] is %d\n", nf); | ||
124 | nfarray[1] = nf; | ||
125 | |||
126 | if (!AR_SREV_9280(ah) && !AR_SREV_9287(ah)) { | ||
127 | nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), | ||
128 | AR_PHY_CH2_MINCCA_PWR); | ||
129 | if (nf & 0x100) | ||
130 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
131 | ath_print(common, ATH_DBG_CALIBRATE, | ||
132 | "NF calibrated [ctl] [chain 2] is %d\n", nf); | ||
133 | nfarray[2] = nf; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | if (AR_SREV_9280_10_OR_LATER(ah)) | ||
138 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), | ||
139 | AR9280_PHY_EXT_MINCCA_PWR); | ||
140 | else | ||
141 | nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), | ||
142 | AR_PHY_EXT_MINCCA_PWR); | ||
143 | |||
144 | if (nf & 0x100) | ||
145 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
146 | ath_print(common, ATH_DBG_CALIBRATE, | ||
147 | "NF calibrated [ext] [chain 0] is %d\n", nf); | ||
148 | |||
149 | if (AR_SREV_9271(ah) && (nf >= -114)) | ||
150 | nf = -116; | ||
151 | |||
152 | nfarray[3] = nf; | ||
153 | |||
154 | if (!AR_SREV_9285(ah) && !AR_SREV_9271(ah)) { | ||
155 | if (AR_SREV_9280_10_OR_LATER(ah)) | ||
156 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), | ||
157 | AR9280_PHY_CH1_EXT_MINCCA_PWR); | ||
158 | else | ||
159 | nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), | ||
160 | AR_PHY_CH1_EXT_MINCCA_PWR); | ||
161 | |||
162 | if (nf & 0x100) | ||
163 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
164 | ath_print(common, ATH_DBG_CALIBRATE, | ||
165 | "NF calibrated [ext] [chain 1] is %d\n", nf); | ||
166 | nfarray[4] = nf; | ||
167 | |||
168 | if (!AR_SREV_9280(ah) && !AR_SREV_9287(ah)) { | ||
169 | nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA), | ||
170 | AR_PHY_CH2_EXT_MINCCA_PWR); | ||
171 | if (nf & 0x100) | ||
172 | nf = 0 - ((nf ^ 0x1ff) + 1); | ||
173 | ath_print(common, ATH_DBG_CALIBRATE, | ||
174 | "NF calibrated [ext] [chain 2] is %d\n", nf); | ||
175 | nfarray[5] = nf; | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | static bool getNoiseFloorThresh(struct ath_hw *ah, | 92 | static bool getNoiseFloorThresh(struct ath_hw *ah, |
181 | enum ieee80211_band band, | 93 | enum ieee80211_band band, |
182 | int16_t *nft) | 94 | int16_t *nft) |
diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h index a7701079a88a..e2b8ad4df904 100644 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h +++ b/drivers/net/wireless/ath/ath9k/hw-ops.h | |||
@@ -163,4 +163,10 @@ static inline bool ath9k_hw_ani_control(struct ath_hw *ah, | |||
163 | return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param); | 163 | return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param); |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline void ath9k_hw_do_getnf(struct ath_hw *ah, | ||
167 | int16_t nfarray[NUM_NF_READINGS]) | ||
168 | { | ||
169 | return ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray); | ||
170 | } | ||
171 | |||
166 | #endif /* ATH9K_HW_OPS_H */ | 172 | #endif /* ATH9K_HW_OPS_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index f45e724c841f..6ee719e36798 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1071,6 +1071,9 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
1071 | else | 1071 | else |
1072 | ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S); | 1072 | ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S); |
1073 | 1073 | ||
1074 | if (AR_SREV_9300_20_OR_LATER(ah)) | ||
1075 | ar9003_hw_set_nf_limits(ah); | ||
1076 | |||
1074 | ath9k_init_nfcal_hist_buffer(ah); | 1077 | ath9k_init_nfcal_hist_buffer(ah); |
1075 | 1078 | ||
1076 | common->state = ATH_HW_INITIALIZED; | 1079 | common->state = ATH_HW_INITIALIZED; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 1eceda22ae5f..7889ecbfeeec 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -513,6 +513,7 @@ struct ath_hw_private_ops { | |||
513 | struct ath9k_channel *chan); | 513 | struct ath9k_channel *chan); |
514 | bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, | 514 | bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, |
515 | int param); | 515 | int param); |
516 | void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); | ||
516 | }; | 517 | }; |
517 | 518 | ||
518 | /** | 519 | /** |
@@ -553,6 +554,10 @@ struct ath_hw { | |||
553 | bool is_pciexpress; | 554 | bool is_pciexpress; |
554 | bool need_an_top2_fixup; | 555 | bool need_an_top2_fixup; |
555 | u16 tx_trig_level; | 556 | u16 tx_trig_level; |
557 | s16 nf_2g_max; | ||
558 | s16 nf_2g_min; | ||
559 | s16 nf_5g_max; | ||
560 | s16 nf_5g_min; | ||
556 | u16 rfsilent; | 561 | u16 rfsilent; |
557 | u32 rfkill_gpio; | 562 | u32 rfkill_gpio; |
558 | u32 rfkill_polarity; | 563 | u32 rfkill_polarity; |
@@ -818,6 +823,13 @@ void ath9k_hw_htc_resetinit(struct ath_hw *ah); | |||
818 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 823 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
819 | u32 *coef_mantissa, u32 *coef_exponent); | 824 | u32 *coef_mantissa, u32 *coef_exponent); |
820 | 825 | ||
826 | /* | ||
827 | * Code specifric to AR9003, we stuff these here to avoid callbacks | ||
828 | * for older families | ||
829 | */ | ||
830 | void ar9003_hw_set_nf_limits(struct ath_hw *ah); | ||
831 | |||
832 | /* Hardware family op attach helpers */ | ||
821 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah); | 833 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah); |
822 | void ar9002_hw_attach_phy_ops(struct ath_hw *ah); | 834 | void ar9002_hw_attach_phy_ops(struct ath_hw *ah); |
823 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah); | 835 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah); |