diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2015-03-22 14:29:54 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-30 04:31:32 -0400 |
commit | 9830ba6c9ad0165f4aa1025bcfc8e75d76083907 (patch) | |
tree | a7b89ddec36421e6808a3a089a7fa57a785acec5 /drivers/net/wireless | |
parent | 9c05babd933e1c4a811867c4d5aa170d788eeaf9 (diff) |
ath9k: ath9k_hw_loadnf: use REG_RMW
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index e200a6e3aca5..3e2e24e4843f 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
238 | { | 238 | { |
239 | struct ath9k_nfcal_hist *h = NULL; | 239 | struct ath9k_nfcal_hist *h = NULL; |
240 | unsigned i, j; | 240 | unsigned i, j; |
241 | int32_t val; | ||
242 | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; | 241 | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; |
243 | struct ath_common *common = ath9k_hw_common(ah); | 242 | struct ath_common *common = ath9k_hw_common(ah); |
244 | s16 default_nf = ath9k_hw_get_default_nf(ah, chan); | 243 | s16 default_nf = ath9k_hw_get_default_nf(ah, chan); |
@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
246 | if (ah->caldata) | 245 | if (ah->caldata) |
247 | h = ah->caldata->nfCalHist; | 246 | h = ah->caldata->nfCalHist; |
248 | 247 | ||
248 | ENABLE_REG_RMW_BUFFER(ah); | ||
249 | for (i = 0; i < NUM_NF_READINGS; i++) { | 249 | for (i = 0; i < NUM_NF_READINGS; i++) { |
250 | if (chainmask & (1 << i)) { | 250 | if (chainmask & (1 << i)) { |
251 | s16 nfval; | 251 | s16 nfval; |
@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
258 | else | 258 | else |
259 | nfval = default_nf; | 259 | nfval = default_nf; |
260 | 260 | ||
261 | val = REG_READ(ah, ah->nf_regs[i]); | 261 | REG_RMW(ah, ah->nf_regs[i], |
262 | val &= 0xFFFFFE00; | 262 | (((u32) nfval << 1) & 0x1ff), 0x1ff); |
263 | val |= (((u32) nfval << 1) & 0x1ff); | ||
264 | REG_WRITE(ah, ah->nf_regs[i], val); | ||
265 | } | 263 | } |
266 | } | 264 | } |
267 | 265 | ||
@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
274 | REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, | 272 | REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, |
275 | AR_PHY_AGC_CONTROL_NO_UPDATE_NF); | 273 | AR_PHY_AGC_CONTROL_NO_UPDATE_NF); |
276 | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); | 274 | REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); |
275 | REG_RMW_BUFFER_FLUSH(ah); | ||
277 | 276 | ||
278 | /* | 277 | /* |
279 | * Wait for load to complete, should be fast, a few 10s of us. | 278 | * Wait for load to complete, should be fast, a few 10s of us. |
@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
309 | * by the median we just loaded. This will be initial (and max) value | 308 | * by the median we just loaded. This will be initial (and max) value |
310 | * of next noise floor calibration the baseband does. | 309 | * of next noise floor calibration the baseband does. |
311 | */ | 310 | */ |
312 | ENABLE_REGWRITE_BUFFER(ah); | 311 | ENABLE_REG_RMW_BUFFER(ah); |
313 | for (i = 0; i < NUM_NF_READINGS; i++) { | 312 | for (i = 0; i < NUM_NF_READINGS; i++) { |
314 | if (chainmask & (1 << i)) { | 313 | if (chainmask & (1 << i)) { |
315 | if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan)) | 314 | if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan)) |
316 | continue; | 315 | continue; |
317 | 316 | ||
318 | val = REG_READ(ah, ah->nf_regs[i]); | 317 | REG_RMW(ah, ah->nf_regs[i], |
319 | val &= 0xFFFFFE00; | 318 | (((u32) (-50) << 1) & 0x1ff), 0x1ff); |
320 | val |= (((u32) (-50) << 1) & 0x1ff); | ||
321 | REG_WRITE(ah, ah->nf_regs[i], val); | ||
322 | } | 319 | } |
323 | } | 320 | } |
324 | REGWRITE_BUFFER_FLUSH(ah); | 321 | REG_RMW_BUFFER_FLUSH(ah); |
325 | 322 | ||
326 | return 0; | 323 | return 0; |
327 | } | 324 | } |