mac80211: add more ath9k patches
[openwrt/openwrt.git] / package / mac80211 / patches / 405-ath9k-make-use-ath9k_hw_wait-int-ath9k_hw_reset_tsf.patch
1 From 9a0a0221024ddb4ddf0e33bb6fdbb3b02eaaf292 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Sat, 20 Jun 2009 23:57:23 +0200
4 Subject: [PATCH] ath9k: make use ath9k_hw_wait int ath9k_hw_reset_tsf
5
6 We have a dedicated function for this kind of checks, use that
7 instead of duplicating the code.
8
9 Changes-licensed-under: ISC
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 ---
12 drivers/net/wireless/ath/ath9k/hw.c | 17 +++++------------
13 drivers/net/wireless/ath/ath9k/hw.h | 1 +
14 2 files changed, 6 insertions(+), 12 deletions(-)
15
16 --- a/drivers/net/wireless/ath/ath9k/hw.c
17 +++ b/drivers/net/wireless/ath/ath9k/hw.c
18 @@ -3801,19 +3801,12 @@ void ath9k_hw_settsf64(struct ath_hw *ah
19
20 void ath9k_hw_reset_tsf(struct ath_hw *ah)
21 {
22 - int count;
23 -
24 ath9k_ps_wakeup(ah->ah_sc);
25 - count = 0;
26 - while (REG_READ(ah, AR_SLP32_MODE) & AR_SLP32_TSF_WRITE_STATUS) {
27 - count++;
28 - if (count > 10) {
29 - DPRINTF(ah->ah_sc, ATH_DBG_RESET,
30 - "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n");
31 - break;
32 - }
33 - udelay(10);
34 - }
35 + if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0,
36 + AH_TSF_WRITE_TIMEOUT))
37 + DPRINTF(ah->ah_sc, ATH_DBG_RESET,
38 + "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n");
39 +
40 REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE);
41 ath9k_ps_restore(ah->ah_sc);
42 }
43 --- a/drivers/net/wireless/ath/ath9k/hw.h
44 +++ b/drivers/net/wireless/ath/ath9k/hw.h
45 @@ -95,6 +95,7 @@
46
47 #define MAX_RATE_POWER 63
48 #define AH_WAIT_TIMEOUT 100000 /* (us) */
49 +#define AH_TSF_WRITE_TIMEOUT 100 /* (us) */
50 #define AH_TIME_QUANTUM 10
51 #define AR_KEYTABLE_SIZE 128
52 #define POWER_UP_TIME 200000