Commit ae17404e authored by Shahar S Matityahu's avatar Shahar S Matityahu Committed by Luca Coelho

iwlwifi: avoid code duplication in stopping fw debug data recording

Make all FW debug data stop recording flows to use
iwl_fw_dbg_stop_recording function instead of writing to FW
registers directly.
Signed-off-by: default avatarShahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent c5f97542
...@@ -1197,7 +1197,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work) ...@@ -1197,7 +1197,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work)
if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) { if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
/* stop recording */ /* stop recording */
iwl_fw_dbg_stop_recording(fwrt); iwl_fw_dbg_stop_recording(fwrt->trans);
iwl_fw_error_dump(fwrt); iwl_fw_error_dump(fwrt);
...@@ -1215,7 +1215,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work) ...@@ -1215,7 +1215,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work)
u32 in_sample = iwl_read_prph(fwrt->trans, DBGC_IN_SAMPLE); u32 in_sample = iwl_read_prph(fwrt->trans, DBGC_IN_SAMPLE);
u32 out_ctrl = iwl_read_prph(fwrt->trans, DBGC_OUT_CTRL); u32 out_ctrl = iwl_read_prph(fwrt->trans, DBGC_OUT_CTRL);
iwl_fw_dbg_stop_recording(fwrt); iwl_fw_dbg_stop_recording(fwrt->trans);
/* wait before we collect the data till the DBGC stop */ /* wait before we collect the data till the DBGC stop */
udelay(500); udelay(500);
......
...@@ -196,14 +196,14 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt, ...@@ -196,14 +196,14 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
iwl_fw_dbg_get_trigger((fwrt)->fw,\ iwl_fw_dbg_get_trigger((fwrt)->fw,\
(trig))) (trig)))
static inline void iwl_fw_dbg_stop_recording(struct iwl_fw_runtime *fwrt) static inline void iwl_fw_dbg_stop_recording(struct iwl_trans *trans)
{ {
if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) { if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
iwl_set_bits_prph(fwrt->trans, MON_BUFF_SAMPLE_CTL, 0x100); iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
} else { } else {
iwl_write_prph(fwrt->trans, DBGC_IN_SAMPLE, 0); iwl_write_prph(trans, DBGC_IN_SAMPLE, 0);
udelay(100); udelay(100);
iwl_write_prph(fwrt->trans, DBGC_OUT_CTRL, 0); iwl_write_prph(trans, DBGC_OUT_CTRL, 0);
} }
} }
......
...@@ -1042,7 +1042,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, ...@@ -1042,7 +1042,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
* the recording automatically before entering D3. This can * the recording automatically before entering D3. This can
* be removed once the FW starts doing that. * be removed once the FW starts doing that.
*/ */
iwl_fw_dbg_stop_recording(&mvm->fwrt); iwl_fw_dbg_stop_recording(mvm->fwrt.trans);
/* must be last -- this switches firmware state */ /* must be last -- this switches firmware state */
ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd);
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "iwl-context-info.h" #include "iwl-context-info.h"
#include "iwl-context-info-gen3.h" #include "iwl-context-info-gen3.h"
#include "internal.h" #include "internal.h"
#include "fw/dbg.h"
/* /*
* Start up NIC's basic functionality after it has been reset * Start up NIC's basic functionality after it has been reset
...@@ -164,9 +165,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power) ...@@ -164,9 +165,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
trans_pcie->is_down = true; trans_pcie->is_down = true;
/* Stop dbgc before stopping device */ /* Stop dbgc before stopping device */
iwl_write_prph(trans, DBGC_IN_SAMPLE, 0); iwl_fw_dbg_stop_recording(trans);
udelay(100);
iwl_write_prph(trans, DBGC_OUT_CTRL, 0);
/* tell the device to stop sending interrupts */ /* tell the device to stop sending interrupts */
iwl_disable_interrupts(trans); iwl_disable_interrupts(trans);
......
...@@ -1243,13 +1243,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power) ...@@ -1243,13 +1243,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
trans_pcie->is_down = true; trans_pcie->is_down = true;
/* Stop dbgc before stopping device */ /* Stop dbgc before stopping device */
if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) { iwl_fw_dbg_stop_recording(trans);
iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
} else {
iwl_write_prph(trans, DBGC_IN_SAMPLE, 0);
udelay(100);
iwl_write_prph(trans, DBGC_OUT_CTRL, 0);
}
/* tell the device to stop sending interrupts */ /* tell the device to stop sending interrupts */
iwl_disable_interrupts(trans); iwl_disable_interrupts(trans);
......
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