summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-25 14:45:22 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-10-25 14:45:22 +0000
commit78bd998e49120d309ddfce88de4b2df42bee2646 (patch)
tree935bd041668839c9a12f15892ffe46b0915fdedd
parenta0d9489e8438190e171eaa33bcb455f88e80427e (diff)
downloadmtk-20170518-78bd998e49120d309ddfce88de4b2df42bee2646.zip
mtk-20170518-78bd998e49120d309ddfce88de4b2df42bee2646.tar.gz
mtk-20170518-78bd998e49120d309ddfce88de4b2df42bee2646.tar.bz2
ath9k: add a few calibration related fixes
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43058
-rw-r--r--package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch3
-rw-r--r--package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch26
-rw-r--r--package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch3
3 files changed, 22 insertions, 10 deletions
diff --git a/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch b/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch
index 3b8370d..6a27be7 100644
--- a/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch
+++ b/package/kernel/mac80211/patches/330-ath9k-restart-hardware-after-noise-floor-calibration.patch
@@ -164,7 +164,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
void (*set_txdesc)(struct ath_hw *ah, void *ds,
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
-@@ -371,9 +371,14 @@ void ath_ani_calibrate(unsigned long dat
+@@ -371,9 +371,15 @@ void ath_ani_calibrate(unsigned long dat
/* Perform calibration if necessary */
if (longcal || shortcal) {
@@ -174,6 +174,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+ int ret = ath9k_hw_calibrate(ah, ah->curchan, ah->rxchainmask,
+ longcal);
+ if (ret < 0) {
++ common->ani.caldone = 0;
+ ath9k_queue_reset(sc, RESET_TYPE_CALIBRATION);
+ return;
+ }
diff --git a/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch b/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
index 1d841a7..cd3c1d7 100644
--- a/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
+++ b/package/kernel/mac80211/patches/331-ath9k_hw-do-not-run-NF-and-periodic-calibration-at-t.patch
@@ -11,18 +11,23 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -660,7 +660,6 @@ static void ar9002_hw_olc_temp_compensat
+@@ -660,27 +660,26 @@ static void ar9002_hw_olc_temp_compensat
static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
u8 rxchainmask, bool longcal)
{
- bool iscaldone = true;
struct ath9k_cal_list *currCal = ah->cal_list_curr;
- bool nfcal, nfcal_pending = false;
+- bool nfcal, nfcal_pending = false;
++ bool nfcal, nfcal_pending = false, percal_pending;
int ret;
-@@ -672,15 +671,13 @@ static int ar9002_hw_calibrate(struct at
- if (currCal && !nfcal &&
- (currCal->calState == CAL_RUNNING ||
- currCal->calState == CAL_WAITING)) {
+
+ nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF);
+ if (ah->caldata)
+ nfcal_pending = test_bit(NFCAL_PENDING, &ah->caldata->cal_flags);
+
+- if (currCal && !nfcal &&
+- (currCal->calState == CAL_RUNNING ||
+- currCal->calState == CAL_WAITING)) {
- iscaldone = ar9002_hw_per_calibration(ah, chan,
- rxchainmask, currCal);
- if (iscaldone) {
@@ -32,6 +37,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
- iscaldone = false;
- ath9k_hw_reset_calibration(ah, currCal);
- }
++ percal_pending = (currCal &&
++ (currCal->calState == CAL_RUNNING ||
++ currCal->calState == CAL_WAITING));
++
++ if (percal_pending && !nfcal) {
+ if (!ar9002_hw_per_calibration(ah, chan, rxchainmask, currCal))
+ return 0;
+
@@ -42,12 +52,12 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
}
}
-@@ -710,7 +707,7 @@ static int ar9002_hw_calibrate(struct at
+@@ -710,7 +709,7 @@ static int ar9002_hw_calibrate(struct at
}
}
- return iscaldone;
-+ return 1;
++ return !percal_pending;
}
/* Carrier leakage Calibration fix */
diff --git a/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch b/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch
index e89c884..32ff525 100644
--- a/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch
+++ b/package/kernel/mac80211/patches/332-ath9k_hw-start-initial-NF-calibration-after-PA-calib.patch
@@ -10,10 +10,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
-@@ -854,6 +854,7 @@ static bool ar9002_hw_init_cal(struct at
+@@ -856,6 +856,8 @@ static bool ar9002_hw_init_cal(struct at
/* Do PA Calibration */
ar9002_hw_pa_cal(ah, true);
++ ath9k_hw_loadnf(ah, chan);
+ ath9k_hw_start_nfcal(ah, true);
if (ah->caldata)