aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch')
-rw-r--r--package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch282
1 files changed, 282 insertions, 0 deletions
diff --git a/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch b/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
new file mode 100644
index 0000000000..a208e1cda0
--- /dev/null
+++ b/package/mac80211/patches/405-ath9k-use-correct-init-values-for-ar9100-devices.patch
@@ -0,0 +1,282 @@
+From 91ada2959c75a3690bf009fd4314dd52454568df Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Tue, 3 Mar 2009 15:21:30 +0100
+Subject: [RFC] ath9k: use correct init values for ar9100 devices
+
+Changes-licensed-under: ISC
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
+---
+ drivers/net/wireless/ath9k/initvals.h | 44 ++++++++++++++++----------------
+ drivers/net/wireless/ath9k/reg.h | 32 ++++++++++++-----------
+ 2 files changed, 39 insertions(+), 37 deletions(-)
+
+Hi,
+
+Currently I'm trying to resolve the following mysterious issues caused by the
+ath9k driver on the ar913x based devices:
+
+1. In some cases the ethernet interface goes down for a short time
+after'ifconfig wlan0 up'.
+2. Sometimes the device simply reboots itself after 'ifconfig wlan0 up'.
+
+After I have added some printk statements into the code, I noticed that the
+ar5416 and ar9100 devices use the same initval arrays currently. I assume
+that they requires different initialization, because we have different
+arrays for them.
+
+Although I have no detailed knowledge about the evolution of the ath9k devices,
+but the version checking macros for ther AR5416 cards seemed weird enough, so I
+have replaced them. Unfortunately, this leaded to very bad performance with the
+ar5416 cards I have, but the driver was working on the ar913x boards.
+
+After some digging, I have found an interesting ifdef statement in Sam's current
+HAL. In his ar5416Common initval array, this ifdef conditionally selects the
+right RTC register offsets for the ar5416/ar9100 devices. The strange thing,
+that in the ath9k driver the ar5416 specific RTC register offsets are used in
+the ar5416Common_ar9100 array, while the ar9100 specific offsets are used in the
+ar5416Common.
+
+After I have renamed the arrays and tested the ath9k driver with the new
+settings on the ar9100 devices, the strange problems I have mentioned above
+disappeared. Unfortunately I have no ar5418 devices so I can't test them,
+but they are using the same array as before so this change should not
+cause problems on them.
+
+Regards,
+Gabor
+
+diff --git a/drivers/net/wireless/ath9k/initvals.h b/drivers/net/wireless/ath9k/initvals.h
+index d492363..4eb8b59 100644
+--- a/drivers/net/wireless/ath9k/initvals.h
++++ b/drivers/net/wireless/ath9k/initvals.h
+@@ -14,7 +14,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-static const u32 ar5416Modes_9100[][6] = {
++static const u32 ar5416Modes[][6] = {
+ { 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
+ { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
+ { 0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38, 0x00001180 },
+@@ -78,7 +78,7 @@ static const u32 ar5416Modes_9100[][6] = {
+ { 0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ };
+
+-static const u32 ar5416Common_9100[][2] = {
++static const u32 ar5416Common[][2] = {
+ { 0x0000000c, 0x00000000 },
+ { 0x00000030, 0x00020015 },
+ { 0x00000034, 0x00000005 },
+@@ -456,12 +456,12 @@ static const u32 ar5416Common_9100[][2] = {
+ { 0x0000a3e0, 0x000001ce },
+ };
+
+-static const u32 ar5416Bank0_9100[][2] = {
++static const u32 ar5416Bank0[][2] = {
+ { 0x000098b0, 0x1e5795e5 },
+ { 0x000098e0, 0x02008020 },
+ };
+
+-static const u32 ar5416BB_RfGain_9100[][3] = {
++static const u32 ar5416BB_RfGain[][3] = {
+ { 0x00009a00, 0x00000000, 0x00000000 },
+ { 0x00009a04, 0x00000040, 0x00000040 },
+ { 0x00009a08, 0x00000080, 0x00000080 },
+@@ -528,21 +528,21 @@ static const u32 ar5416BB_RfGain_9100[][3] = {
+ { 0x00009afc, 0x000000f9, 0x000000f9 },
+ };
+
+-static const u32 ar5416Bank1_9100[][2] = {
++static const u32 ar5416Bank1[][2] = {
+ { 0x000098b0, 0x02108421 },
+ { 0x000098ec, 0x00000008 },
+ };
+
+-static const u32 ar5416Bank2_9100[][2] = {
++static const u32 ar5416Bank2[][2] = {
+ { 0x000098b0, 0x0e73ff17 },
+ { 0x000098e0, 0x00000420 },
+ };
+
+-static const u32 ar5416Bank3_9100[][3] = {
++static const u32 ar5416Bank3[][3] = {
+ { 0x000098f0, 0x01400018, 0x01c00018 },
+ };
+
+-static const u32 ar5416Bank6_9100[][3] = {
++static const u32 ar5416Bank6[][3] = {
+
+ { 0x0000989c, 0x00000000, 0x00000000 },
+ { 0x0000989c, 0x00000000, 0x00000000 },
+@@ -579,7 +579,7 @@ static const u32 ar5416Bank6_9100[][3] = {
+ { 0x000098d0, 0x0000000f, 0x0010000f },
+ };
+
+-static const u32 ar5416Bank6TPC_9100[][3] = {
++static const u32 ar5416Bank6TPC[][3] = {
+ { 0x0000989c, 0x00000000, 0x00000000 },
+ { 0x0000989c, 0x00000000, 0x00000000 },
+ { 0x0000989c, 0x00000000, 0x00000000 },
+@@ -615,13 +615,13 @@ static const u32 ar5416Bank6TPC_9100[][3] = {
+ { 0x000098d0, 0x0000000f, 0x0010000f },
+ };
+
+-static const u32 ar5416Bank7_9100[][2] = {
++static const u32 ar5416Bank7[][2] = {
+ { 0x0000989c, 0x00000500 },
+ { 0x0000989c, 0x00000800 },
+ { 0x000098cc, 0x0000000e },
+ };
+
+-static const u32 ar5416Addac_9100[][2] = {
++static const u32 ar5416Addac[][2] = {
+ {0x0000989c, 0x00000000 },
+ {0x0000989c, 0x00000003 },
+ {0x0000989c, 0x00000000 },
+@@ -661,7 +661,7 @@ static const u32 ar5416Addac_9100[][2] = {
+ {0x000098cc, 0x00000000 },
+ };
+
+-static const u32 ar5416Modes[][6] = {
++static const u32 ar5416Modes_9100[][6] = {
+ { 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
+ { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
+ { 0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38, 0x00001180 },
+@@ -735,7 +735,7 @@ static const u32 ar5416Modes[][6] = {
+ { 0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ };
+
+-static const u32 ar5416Common[][2] = {
++static const u32 ar5416Common_9100[][2] = {
+ { 0x0000000c, 0x00000000 },
+ { 0x00000030, 0x00020015 },
+ { 0x00000034, 0x00000005 },
+@@ -1109,12 +1109,12 @@ static const u32 ar5416Common[][2] = {
+ { 0x0000a3e0, 0x000001ce },
+ };
+
+-static const u32 ar5416Bank0[][2] = {
++static const u32 ar5416Bank0_9100[][2] = {
+ { 0x000098b0, 0x1e5795e5 },
+ { 0x000098e0, 0x02008020 },
+ };
+
+-static const u32 ar5416BB_RfGain[][3] = {
++static const u32 ar5416BB_RfGain_9100[][3] = {
+ { 0x00009a00, 0x00000000, 0x00000000 },
+ { 0x00009a04, 0x00000040, 0x00000040 },
+ { 0x00009a08, 0x00000080, 0x00000080 },
+@@ -1181,21 +1181,21 @@ static const u32 ar5416BB_RfGain[][3] = {
+ { 0x00009afc, 0x000000f9, 0x000000f9 },
+ };
+
+-static const u32 ar5416Bank1[][2] = {
++static const u32 ar5416Bank1_9100[][2] = {
+ { 0x000098b0, 0x02108421},
+ { 0x000098ec, 0x00000008},
+ };
+
+-static const u32 ar5416Bank2[][2] = {
++static const u32 ar5416Bank2_9100[][2] = {
+ { 0x000098b0, 0x0e73ff17},
+ { 0x000098e0, 0x00000420},
+ };
+
+-static const u32 ar5416Bank3[][3] = {
++static const u32 ar5416Bank3_9100[][3] = {
+ { 0x000098f0, 0x01400018, 0x01c00018 },
+ };
+
+-static const u32 ar5416Bank6[][3] = {
++static const u32 ar5416Bank6_9100[][3] = {
+
+ { 0x0000989c, 0x00000000, 0x00000000 },
+ { 0x0000989c, 0x00000000, 0x00000000 },
+@@ -1233,7 +1233,7 @@ static const u32 ar5416Bank6[][3] = {
+ };
+
+
+-static const u32 ar5416Bank6TPC[][3] = {
++static const u32 ar5416Bank6TPC_9100[][3] = {
+
+ { 0x0000989c, 0x00000000, 0x00000000 },
+ { 0x0000989c, 0x00000000, 0x00000000 },
+@@ -1270,13 +1270,13 @@ static const u32 ar5416Bank6TPC[][3] = {
+ { 0x000098d0, 0x0000000f, 0x0010000f },
+ };
+
+-static const u32 ar5416Bank7[][2] = {
++static const u32 ar5416Bank7_9100[][2] = {
+ { 0x0000989c, 0x00000500 },
+ { 0x0000989c, 0x00000800 },
+ { 0x000098cc, 0x0000000e },
+ };
+
+-static const u32 ar5416Addac[][2] = {
++static const u32 ar5416Addac_9100[][2] = {
+ {0x0000989c, 0x00000000 },
+ {0x0000989c, 0x00000000 },
+ {0x0000989c, 0x00000000 },
+diff --git a/drivers/net/wireless/ath9k/reg.h b/drivers/net/wireless/ath9k/reg.h
+index 8d85106..22a14a4 100644
+--- a/drivers/net/wireless/ath9k/reg.h
++++ b/drivers/net/wireless/ath9k/reg.h
+@@ -158,14 +158,6 @@
+ #define AR_CST_TIMEOUT_LIMIT 0xFFFF0000
+ #define AR_CST_TIMEOUT_LIMIT_S 16
+
+-#define AR_SREV_VERSION_9100 0x014
+-
+-#define AR_SREV_9100(ah) ((ah->hw_version.macVersion) == AR_SREV_VERSION_9100)
+-#define AR_SREV_5416_V20_OR_LATER(_ah) \
+- (AR_SREV_9100((_ah)) || AR_SREV_5416_20_OR_LATER(_ah))
+-#define AR_SREV_5416_V22_OR_LATER(_ah) \
+- (AR_SREV_9100((_ah)) || AR_SREV_5416_22_OR_LATER(_ah))
+-
+ #define AR_ISR 0x0080
+ #define AR_ISR_RXOK 0x00000001
+ #define AR_ISR_RXDESC 0x00000002
+@@ -734,6 +726,7 @@
+ #define AR_SREV_REVISION_5416_10 0
+ #define AR_SREV_REVISION_5416_20 1
+ #define AR_SREV_REVISION_5416_22 2
++#define AR_SREV_VERSION_9100 0x14
+ #define AR_SREV_VERSION_9160 0x40
+ #define AR_SREV_REVISION_9160_10 0
+ #define AR_SREV_REVISION_9160_11 1
+@@ -746,14 +739,23 @@
+ #define AR_SREV_REVISION_9285_11 1
+ #define AR_SREV_REVISION_9285_12 2
+
++#define AR_SREV_5416(_ah) \
++ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE) || \
++ ((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI))
++#define AR_SREV_5416_V20_OR_LATER(_ah) \
++ (((_ah)->hw_version.macVersion > AR_SREV_VERSION_5416_PCIE) || \
++ ((AR_SREV_5416(_ah)) && \
++ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_20)))
++#define AR_SREV_5416_V22_OR_LATER(_ah) \
++ (((_ah)->hw_version.macVersion > AR_SREV_VERSION_5416_PCIE) || \
++ ((AR_SREV_5416(_ah)) && \
++ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22)))
++
++#define AR_SREV_9100(ah) \
++ ((ah->hw_version.macVersion) == AR_SREV_VERSION_9100)
+ #define AR_SREV_9100_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_5416_PCIE))
+-#define AR_SREV_5416_20_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160) || \
+- ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_20))
+-#define AR_SREV_5416_22_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160) || \
+- ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22))
++ ((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100)
++
+ #define AR_SREV_9160(_ah) \
+ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9160))
+ #define AR_SREV_9160_10_OR_LATER(_ah) \
+--
+1.5.3.2
+