diff options
Diffstat (limited to 'drivers/net/wireless/ath/ar9170/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ar9170/main.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 81c6cf1135bc..de0ba2bf7691 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -2192,22 +2192,30 @@ static u64 ar9170_op_get_tsf(struct ieee80211_hw *hw) | |||
2192 | { | 2192 | { |
2193 | struct ar9170 *ar = hw->priv; | 2193 | struct ar9170 *ar = hw->priv; |
2194 | int err; | 2194 | int err; |
2195 | u32 tsf_low; | ||
2196 | u32 tsf_high; | ||
2197 | u64 tsf; | 2195 | u64 tsf; |
2196 | #define NR 3 | ||
2197 | static const u32 addr[NR] = { AR9170_MAC_REG_TSF_H, | ||
2198 | AR9170_MAC_REG_TSF_L, | ||
2199 | AR9170_MAC_REG_TSF_H }; | ||
2200 | u32 val[NR]; | ||
2201 | int loops = 0; | ||
2198 | 2202 | ||
2199 | mutex_lock(&ar->mutex); | 2203 | mutex_lock(&ar->mutex); |
2200 | err = ar9170_read_reg(ar, AR9170_MAC_REG_TSF_L, &tsf_low); | 2204 | |
2201 | if (!err) | 2205 | while (loops++ < 10) { |
2202 | err = ar9170_read_reg(ar, AR9170_MAC_REG_TSF_H, &tsf_high); | 2206 | err = ar9170_read_mreg(ar, NR, addr, val); |
2207 | if (err || val[0] == val[2]) | ||
2208 | break; | ||
2209 | } | ||
2210 | |||
2203 | mutex_unlock(&ar->mutex); | 2211 | mutex_unlock(&ar->mutex); |
2204 | 2212 | ||
2205 | if (WARN_ON(err)) | 2213 | if (WARN_ON(err)) |
2206 | return 0; | 2214 | return 0; |
2207 | 2215 | tsf = val[0]; | |
2208 | tsf = tsf_high; | 2216 | tsf = (tsf << 32) | val[1]; |
2209 | tsf = (tsf << 32) | tsf_low; | ||
2210 | return tsf; | 2217 | return tsf; |
2218 | #undef NR | ||
2211 | } | 2219 | } |
2212 | 2220 | ||
2213 | static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 2221 | static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |