From a03d97d38334970884c5ba206c649ad37e126ad5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 27 Sep 2014 20:52:11 +0000 Subject: [PATCH] ath9k: fix some issues with ar934x rev 3 (especially ad-hoc mode) Signed-off-by: Felix Fietkau SVN-Revision: 42686 --- .../mac80211/patches/300-pending_work.patch | 94 +++++++++++++++++++ ...h9k-fix-invalid-mac-address-handling.patch | 2 +- .../510-ath9k_intr_mitigation_tweak.patch | 2 +- .../patches/513-ath9k_add_pci_ids.patch | 2 +- .../patches/560-ath9k_pcoem_optional.patch | 2 +- 5 files changed, 98 insertions(+), 4 deletions(-) diff --git a/package/kernel/mac80211/patches/300-pending_work.patch b/package/kernel/mac80211/patches/300-pending_work.patch index 62a2d68da0..1ee8e9833a 100644 --- a/package/kernel/mac80211/patches/300-pending_work.patch +++ b/package/kernel/mac80211/patches/300-pending_work.patch @@ -1,3 +1,30 @@ +commit 4c82fc569cf2f29e6c66d98ef4a1b0f3b6a98e9d +Author: Felix Fietkau +Date: Sat Sep 27 22:39:27 2014 +0200 + + ath9k_hw: disable hardware ad-hoc flag on ar934x rev 3 + + On AR934x rev 3, settin the ad-hoc flag completely messes up hardware + state - beacons get stuck, almost no packets make it out, hardware is + constantly reset. + + When leaving out that flag and setting up the hw like in AP mode, TSF + timers won't be automatically synced, but at least the rest works. + + AR934x rev 2 and older are not affected by this bug + + Signed-off-by: Felix Fietkau + +commit ecfb4b3fff006372ac5c40871f9bb182fd00444f +Author: Felix Fietkau +Date: Sat Sep 27 22:15:43 2014 +0200 + + ath9k: use ah->get_mac_revision for all SoC devices if available + + It is needed for AR934x as well + + Signed-off-by: Felix Fietkau + commit c11113bc25df22898fb995d3205bdc4f27c98073 Author: Felix Fietkau Date: Sat Sep 27 18:04:58 2014 +0200 @@ -411,3 +438,70 @@ Date: Sat Sep 27 15:57:09 2014 +0200 #include "debug.h" #include "ath5k.h" #include "reg.h" +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -222,31 +222,28 @@ static void ath9k_hw_read_revisions(stru + { + u32 val; + ++ if (ah->get_mac_revision) ++ ah->hw_version.macRev = ah->get_mac_revision(); ++ + switch (ah->hw_version.devid) { + case AR5416_AR9100_DEVID: + ah->hw_version.macVersion = AR_SREV_VERSION_9100; + break; + case AR9300_DEVID_AR9330: + ah->hw_version.macVersion = AR_SREV_VERSION_9330; +- if (ah->get_mac_revision) { +- ah->hw_version.macRev = ah->get_mac_revision(); +- } else { ++ if (!ah->get_mac_revision) { + val = REG_READ(ah, AR_SREV); + ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); + } + return; + case AR9300_DEVID_AR9340: + ah->hw_version.macVersion = AR_SREV_VERSION_9340; +- val = REG_READ(ah, AR_SREV); +- ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); + return; + case AR9300_DEVID_QCA955X: + ah->hw_version.macVersion = AR_SREV_VERSION_9550; + return; + case AR9300_DEVID_AR953X: + ah->hw_version.macVersion = AR_SREV_VERSION_9531; +- if (ah->get_mac_revision) +- ah->hw_version.macRev = ah->get_mac_revision(); + return; + } + +@@ -1192,9 +1189,12 @@ static void ath9k_hw_set_operating_mode( + + switch (opmode) { + case NL80211_IFTYPE_ADHOC: +- set |= AR_STA_ID1_ADHOC; +- REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); +- break; ++ if (!AR_SREV_9340_13(ah)) { ++ set |= AR_STA_ID1_ADHOC; ++ REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); ++ break; ++ } ++ /* fall through */ + case NL80211_IFTYPE_MESH_POINT: + case NL80211_IFTYPE_AP: + set |= AR_STA_ID1_STA_AP; +--- a/drivers/net/wireless/ath/ath9k/reg.h ++++ b/drivers/net/wireless/ath/ath9k/reg.h +@@ -903,6 +903,10 @@ + #define AR_SREV_9340(_ah) \ + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) + ++#define AR_SREV_9340_13(_ah) \ ++ (AR_SREV_9340((_ah)) && \ ++ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9340_13)) ++ + #define AR_SREV_9340_13_OR_LATER(_ah) \ + (AR_SREV_9340((_ah)) && \ + ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13)) diff --git a/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch b/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch index 63ab0dba6e..29c5ac9833 100644 --- a/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch +++ b/package/kernel/mac80211/patches/402-ath9k-fix-invalid-mac-address-handling.patch @@ -8,7 +8,7 @@ #include #include "hw.h" -@@ -449,8 +450,16 @@ static int ath9k_hw_init_macaddr(struct +@@ -446,8 +447,16 @@ static int ath9k_hw_init_macaddr(struct common->macaddr[2 * i] = eeval >> 8; common->macaddr[2 * i + 1] = eeval & 0xff; } diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch index d7478ff590..eebf6fc7a9 100644 --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -359,13 +359,8 @@ static void ath9k_hw_init_config(struct +@@ -356,13 +356,8 @@ static void ath9k_hw_init_config(struct ah->config.rx_intr_mitigation = true; diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch index e846de24a3..f1e856f4b3 100644 --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -614,6 +614,7 @@ int ath9k_hw_init(struct ath_hw *ah) +@@ -611,6 +611,7 @@ int ath9k_hw_init(struct ath_hw *ah) /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ switch (ah->hw_version.devid) { diff --git a/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch b/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch index b9e64e4bf3..cc326880d4 100644 --- a/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch +++ b/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch @@ -194,7 +194,7 @@ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11)) #define AR_SREV_9485_OR_LATER(_ah) \ (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485)) -@@ -911,34 +922,30 @@ +@@ -915,34 +926,30 @@ (AR_SREV_9285_12_OR_LATER(_ah) && \ ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) -- 2.30.2