Commit 14ef1b43 authored by Golan Ben-Ami's avatar Golan Ben-Ami Committed by Emmanuel Grumbach

iwlwifi: export the _no_grab version of PRPH IO functions

Expose _no_grab prph i/o functions that allow performing i/o
outside the transport, without requiring grab and release NIC access
for each operation. In addition, rename the functions so they reflect
their non-grabbing behavior.

This can be very useful for consecutive prph i/o operation that occur
outside trans, such as fw dumps.
Signed-off-by: default avatarGolan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 1412ee39
/****************************************************************************** /******************************************************************************
* *
* Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2015 Intel Deutschland GmbH
* *
* Portions of this file are derived from the ipw3945 project. * Portions of this file are derived from the ipw3945 project.
* *
...@@ -117,18 +118,20 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, ...@@ -117,18 +118,20 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
} }
IWL_EXPORT_SYMBOL(iwl_poll_direct_bit); IWL_EXPORT_SYMBOL(iwl_poll_direct_bit);
u32 __iwl_read_prph(struct iwl_trans *trans, u32 ofs) u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs)
{ {
u32 val = iwl_trans_read_prph(trans, ofs); u32 val = iwl_trans_read_prph(trans, ofs);
trace_iwlwifi_dev_ioread_prph32(trans->dev, ofs, val); trace_iwlwifi_dev_ioread_prph32(trans->dev, ofs, val);
return val; return val;
} }
IWL_EXPORT_SYMBOL(iwl_read_prph_no_grab);
void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val)
{ {
trace_iwlwifi_dev_iowrite_prph32(trans->dev, ofs, val); trace_iwlwifi_dev_iowrite_prph32(trans->dev, ofs, val);
iwl_trans_write_prph(trans, ofs, val); iwl_trans_write_prph(trans, ofs, val);
} }
IWL_EXPORT_SYMBOL(iwl_write_prph_no_grab);
u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs)
{ {
...@@ -136,7 +139,7 @@ u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) ...@@ -136,7 +139,7 @@ u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs)
u32 val = 0x5a5a5a5a; u32 val = 0x5a5a5a5a;
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
val = __iwl_read_prph(trans, ofs); val = iwl_read_prph_no_grab(trans, ofs);
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
} }
return val; return val;
...@@ -148,7 +151,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) ...@@ -148,7 +151,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val)
unsigned long flags; unsigned long flags;
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
__iwl_write_prph(trans, ofs, val); iwl_write_prph_no_grab(trans, ofs, val);
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
} }
} }
...@@ -174,8 +177,9 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) ...@@ -174,8 +177,9 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
unsigned long flags; unsigned long flags;
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
__iwl_write_prph(trans, ofs, iwl_write_prph_no_grab(trans, ofs,
__iwl_read_prph(trans, ofs) | mask); iwl_read_prph_no_grab(trans, ofs) |
mask);
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
} }
} }
...@@ -187,8 +191,9 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, ...@@ -187,8 +191,9 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
unsigned long flags; unsigned long flags;
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
__iwl_write_prph(trans, ofs, iwl_write_prph_no_grab(trans, ofs,
(__iwl_read_prph(trans, ofs) & mask) | bits); (iwl_read_prph_no_grab(trans, ofs) &
mask) | bits);
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
} }
} }
...@@ -200,8 +205,8 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) ...@@ -200,8 +205,8 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
u32 val; u32 val;
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
val = __iwl_read_prph(trans, ofs); val = iwl_read_prph_no_grab(trans, ofs);
__iwl_write_prph(trans, ofs, (val & ~mask)); iwl_write_prph_no_grab(trans, ofs, (val & ~mask));
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
} }
} }
......
...@@ -55,9 +55,9 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); ...@@ -55,9 +55,9 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg);
void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value);
u32 __iwl_read_prph(struct iwl_trans *trans, u32 ofs); u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs);
u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs);
void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val);
void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val);
int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr,
u32 bits, u32 mask, int timeout); u32 bits, u32 mask, int timeout);
......
...@@ -2382,10 +2382,11 @@ iwl_trans_pci_dump_marbh_monitor(struct iwl_trans *trans, ...@@ -2382,10 +2382,11 @@ iwl_trans_pci_dump_marbh_monitor(struct iwl_trans *trans,
if (!iwl_trans_grab_nic_access(trans, false, &flags)) if (!iwl_trans_grab_nic_access(trans, false, &flags))
return 0; return 0;
__iwl_write_prph(trans, MON_DMARB_RD_CTL_ADDR, 0x1); iwl_write_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x1);
for (i = 0; i < buf_size_in_dwords; i++) for (i = 0; i < buf_size_in_dwords; i++)
buffer[i] = __iwl_read_prph(trans, MON_DMARB_RD_DATA_ADDR); buffer[i] = iwl_read_prph_no_grab(trans,
__iwl_write_prph(trans, MON_DMARB_RD_CTL_ADDR, 0x0); MON_DMARB_RD_DATA_ADDR);
iwl_write_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x0);
iwl_trans_release_nic_access(trans, &flags); iwl_trans_release_nic_access(trans, &flags);
...@@ -2773,10 +2774,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, ...@@ -2773,10 +2774,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
if (iwl_trans_grab_nic_access(trans, false, &flags)) { if (iwl_trans_grab_nic_access(trans, false, &flags)) {
u32 hw_step; u32 hw_step;
hw_step = __iwl_read_prph(trans, WFPM_CTRL_REG); hw_step = iwl_read_prph_no_grab(trans, WFPM_CTRL_REG);
hw_step |= ENABLE_WFPM; hw_step |= ENABLE_WFPM;
__iwl_write_prph(trans, WFPM_CTRL_REG, hw_step); iwl_write_prph_no_grab(trans, WFPM_CTRL_REG, hw_step);
hw_step = __iwl_read_prph(trans, AUX_MISC_REG); hw_step = iwl_read_prph_no_grab(trans, AUX_MISC_REG);
hw_step = (hw_step >> HW_STEP_LOCATION_BITS) & 0xF; hw_step = (hw_step >> HW_STEP_LOCATION_BITS) & 0xF;
if (hw_step == 0x3) if (hw_step == 0x3)
trans->hw_rev = (trans->hw_rev & 0xFFFFFFF3) | trans->hw_rev = (trans->hw_rev & 0xFFFFFFF3) |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment