diff options
author | Eliad Peller <eliad@wizery.com> | 2014-02-05 12:12:24 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-02-13 03:16:19 -0500 |
commit | 5045388ceec19979e816f229f07547ec7067ccd5 (patch) | |
tree | c9cdb327040042b32270794084b09b240e645192 /drivers/net/wireless/iwlwifi/pcie/tx.c | |
parent | e57f1734d87aa0e9a00905ed08888f0c62f56227 (diff) |
iwlwifi: pcie: clean iwl_pcie_[rt]xq_inc_wr_ptr a bit
The various code blocks in iwl_pcie_[rt]xq_inc_wr_ptr
finally do the same things, so just merge them
all and make the functions cleaner.
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/pcie/tx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/tx.c | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 254126447c68..e476d9eda61a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -296,43 +296,38 @@ void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq) | |||
296 | if (txq->need_update == 0) | 296 | if (txq->need_update == 0) |
297 | return; | 297 | return; |
298 | 298 | ||
299 | if (trans->cfg->base_params->shadow_reg_enable || | 299 | /* |
300 | txq_id == trans_pcie->cmd_queue) { | 300 | * explicitly wake up the NIC if: |
301 | /* shadow register enabled */ | 301 | * 1. shadow registers aren't enabled |
302 | iwl_write32(trans, HBUS_TARG_WRPTR, | 302 | * 2. NIC is woken up for CMD regardless of shadow outside this function |
303 | txq->q.write_ptr | (txq_id << 8)); | 303 | * 3. there is a chance that the NIC is asleep |
304 | } else { | 304 | */ |
305 | /* if we're trying to save power */ | 305 | if (!trans->cfg->base_params->shadow_reg_enable && |
306 | if (test_bit(STATUS_TPOWER_PMI, &trans->status)) { | 306 | txq_id != trans_pcie->cmd_queue && |
307 | /* wake up nic if it's powered down ... | 307 | test_bit(STATUS_TPOWER_PMI, &trans->status)) { |
308 | * uCode will wake up, and interrupt us again, so next | ||
309 | * time we'll skip this part. */ | ||
310 | reg = iwl_read32(trans, CSR_UCODE_DRV_GP1); | ||
311 | |||
312 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { | ||
313 | IWL_DEBUG_INFO(trans, | ||
314 | "Tx queue %d requesting wakeup," | ||
315 | " GP1 = 0x%x\n", txq_id, reg); | ||
316 | iwl_set_bit(trans, CSR_GP_CNTRL, | ||
317 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | ||
318 | return; | ||
319 | } | ||
320 | |||
321 | IWL_DEBUG_TX(trans, "Q:%d WR: 0x%x\n", txq_id, | ||
322 | txq->q.write_ptr); | ||
323 | |||
324 | iwl_write_direct32(trans, HBUS_TARG_WRPTR, | ||
325 | txq->q.write_ptr | (txq_id << 8)); | ||
326 | |||
327 | /* | 308 | /* |
328 | * else not in power-save mode, | 309 | * wake up nic if it's powered down ... |
329 | * uCode will never sleep when we're | 310 | * uCode will wake up, and interrupt us again, so next |
330 | * trying to tx (during RFKILL, we're not trying to tx). | 311 | * time we'll skip this part. |
331 | */ | 312 | */ |
332 | } else | 313 | reg = iwl_read32(trans, CSR_UCODE_DRV_GP1); |
333 | iwl_write32(trans, HBUS_TARG_WRPTR, | 314 | |
334 | txq->q.write_ptr | (txq_id << 8)); | 315 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { |
316 | IWL_DEBUG_INFO(trans, "Tx queue %d requesting wakeup, GP1 = 0x%x\n", | ||
317 | txq_id, reg); | ||
318 | iwl_set_bit(trans, CSR_GP_CNTRL, | ||
319 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | ||
320 | return; | ||
321 | } | ||
335 | } | 322 | } |
323 | |||
324 | /* | ||
325 | * if not in power-save mode, uCode will never sleep when we're | ||
326 | * trying to tx (during RFKILL, we're not trying to tx). | ||
327 | */ | ||
328 | IWL_DEBUG_TX(trans, "Q:%d WR: 0x%x\n", txq_id, txq->q.write_ptr); | ||
329 | iwl_write32(trans, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); | ||
330 | |||
336 | txq->need_update = 0; | 331 | txq->need_update = 0; |
337 | } | 332 | } |
338 | 333 | ||