ath9k: add a missing null pointer check and some further cleanup
[openwrt.git] / package / mac80211 / patches / 510-ar9100_tsf_preserve.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -1280,7 +1280,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
4 macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
5
6 /* For chips on which RTC reset is done, save TSF before it gets cleared */
7 - if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
8 + if (AR_SREV_9100(ah) ||
9 + (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)))
10 tsf = ath9k_hw_gettsf64(ah);
11
12 saveLedState = REG_READ(ah, AR_CFG_LED) &
13 @@ -1312,7 +1313,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
14 }
15
16 /* Restore TSF */
17 - if (tsf && AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
18 + if (tsf)
19 ath9k_hw_settsf64(ah, tsf);
20
21 if (AR_SREV_9280_10_OR_LATER(ah))
22 @@ -1325,6 +1326,17 @@ int ath9k_hw_reset(struct ath_hw *ah, st
23 if (r)
24 return r;
25
26 + /*
27 + * Some AR91xx SoC devices frequently fail to accept TSF writes
28 + * right after the chip reset. When that happens, write a new
29 + * value after the initvals have been applied, with an offset
30 + * based on measured time differences
31 + */
32 + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
33 + tsf += 1500;
34 + ath9k_hw_settsf64(ah, tsf);
35 + }
36 +
37 /* Setup MFP options for CCMP */
38 if (AR_SREV_9280_20_OR_LATER(ah)) {
39 /* Mask Retry(b11), PwrMgt(b12), MoreData(b13) to 0 in mgmt
This page took 0.049514 seconds and 5 git commands to generate.