aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-05-23 06:20:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-05-24 12:50:22 -0400
commit86c157b3f83597e11d8f03a9dece98d1e77a8ce7 (patch)
tree039443b1f2fae511c5735e55f3b2aebfdf59eb82
parenta37a99102e4573145aa60a2f78a690cc8def027c (diff)
ath9k_hw: improve performance for AR934x v1.3+
AR934x v1.3 no longer needs the DCU backoff reduction workaround for preventing rx overruns, but in turn needs the number of usable Tx buffers to be reduced slightly. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h9
3 files changed, 20 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 01e97ce438ba..15dfefcf2d0f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1172,6 +1172,7 @@ u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
1172static inline void ath9k_hw_set_dma(struct ath_hw *ah) 1172static inline void ath9k_hw_set_dma(struct ath_hw *ah)
1173{ 1173{
1174 struct ath_common *common = ath9k_hw_common(ah); 1174 struct ath_common *common = ath9k_hw_common(ah);
1175 int txbuf_size;
1175 1176
1176 ENABLE_REGWRITE_BUFFER(ah); 1177 ENABLE_REGWRITE_BUFFER(ah);
1177 1178
@@ -1225,13 +1226,17 @@ static inline void ath9k_hw_set_dma(struct ath_hw *ah)
1225 * So set the usable tx buf size also to half to 1226 * So set the usable tx buf size also to half to
1226 * avoid data/delimiter underruns 1227 * avoid data/delimiter underruns
1227 */ 1228 */
1228 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, 1229 txbuf_size = AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE;
1229 AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE); 1230 } else if (AR_SREV_9340_13_OR_LATER(ah)) {
1230 } else if (!AR_SREV_9271(ah)) { 1231 /* Uses fewer entries for AR934x v1.3+ to prevent rx overruns */
1231 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, 1232 txbuf_size = AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE;
1232 AR_PCU_TXBUF_CTRL_USABLE_SIZE); 1233 } else {
1234 txbuf_size = AR_PCU_TXBUF_CTRL_USABLE_SIZE;
1233 } 1235 }
1234 1236
1237 if (!AR_SREV_9271(ah))
1238 REG_WRITE(ah, AR_PCU_TXBUF_CTRL, txbuf_size);
1239
1235 REGWRITE_BUFFER_FLUSH(ah); 1240 REGWRITE_BUFFER_FLUSH(ah);
1236 1241
1237 if (AR_SREV_9300_20_OR_LATER(ah)) 1242 if (AR_SREV_9300_20_OR_LATER(ah))
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 498fee04afa0..566109a40fb3 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -410,7 +410,7 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
410 410
411 REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); 411 REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ);
412 412
413 if (AR_SREV_9340(ah)) 413 if (AR_SREV_9340(ah) && !AR_SREV_9340_13_OR_LATER(ah))
414 REG_WRITE(ah, AR_DMISC(q), 414 REG_WRITE(ah, AR_DMISC(q),
415 AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); 415 AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1);
416 else 416 else
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 9c056a80b85d..f7c90cc58d56 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -798,6 +798,10 @@
798#define AR_SREV_REVISION_9485_10 0 798#define AR_SREV_REVISION_9485_10 0
799#define AR_SREV_REVISION_9485_11 1 799#define AR_SREV_REVISION_9485_11 1
800#define AR_SREV_VERSION_9340 0x300 800#define AR_SREV_VERSION_9340 0x300
801#define AR_SREV_REVISION_9340_10 0
802#define AR_SREV_REVISION_9340_11 1
803#define AR_SREV_REVISION_9340_12 2
804#define AR_SREV_REVISION_9340_13 3
801#define AR_SREV_VERSION_9580 0x1C0 805#define AR_SREV_VERSION_9580 0x1C0
802#define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ 806#define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */
803#define AR_SREV_VERSION_9462 0x280 807#define AR_SREV_VERSION_9462 0x280
@@ -897,6 +901,10 @@
897#define AR_SREV_9340(_ah) \ 901#define AR_SREV_9340(_ah) \
898 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) 902 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340))
899 903
904#define AR_SREV_9340_13_OR_LATER(_ah) \
905 (AR_SREV_9340((_ah)) && \
906 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13))
907
900#define AR_SREV_9285E_20(_ah) \ 908#define AR_SREV_9285E_20(_ah) \
901 (AR_SREV_9285_12_OR_LATER(_ah) && \ 909 (AR_SREV_9285_12_OR_LATER(_ah) && \
902 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) 910 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
@@ -1883,6 +1891,7 @@ enum {
1883#define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF 1891#define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF
1884#define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 1892#define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700
1885#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 1893#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380
1894#define AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE 0x500
1886 1895
1887#define AR_PCU_MISC_MODE2 0x8344 1896#define AR_PCU_MISC_MODE2 0x8344
1888#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 1897#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002