Commit 4c9706dc authored by Liad Kaufman's avatar Liad Kaufman Committed by Emmanuel Grumbach

iwlwifi: update nmi register

In the 8000 HW family the register for forcing an NMI has
changed, so this allows to still be able to force an NMI
while taking into account the HW in order to write to the
correct register.
Signed-off-by: default avatarLiad Kaufman <liad.kaufman@intel.com>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent cf52023c
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-prph.h"
#include "iwl-fh.h" #include "iwl-fh.h"
#define IWL_POLL_INTERVAL 10 /* microseconds */ #define IWL_POLL_INTERVAL 10 /* microseconds */
...@@ -183,6 +184,23 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) ...@@ -183,6 +184,23 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask)
} }
IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); IWL_EXPORT_SYMBOL(iwl_clear_bits_prph);
void iwl_force_nmi(struct iwl_trans *trans)
{
/*
* In HW previous to the 8000 HW family, and in the 8000 HW family
* itself when the revision step==0, the DEVICE_SET_NMI_REG is used
* to force an NMI. Otherwise, a different register -
* DEVICE_SET_NMI_8000B_REG - is used.
*/
if ((trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) ||
((trans->hw_rev & 0xc) == 0x0))
iwl_write_prph(trans, DEVICE_SET_NMI_REG, DEVICE_SET_NMI_VAL);
else
iwl_write_prph(trans, DEVICE_SET_NMI_8000B_REG,
DEVICE_SET_NMI_8000B_VAL);
}
IWL_EXPORT_SYMBOL(iwl_force_nmi);
static const char *get_fh_string(int cmd) static const char *get_fh_string(int cmd)
{ {
#define IWL_CMD(x) case x: return #x #define IWL_CMD(x) case x: return #x
......
...@@ -80,6 +80,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); ...@@ -80,6 +80,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
u32 bits, u32 mask); u32 bits, u32 mask);
void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
void iwl_force_nmi(struct iwl_trans *trans);
/* Error handling */ /* Error handling */
int iwl_dump_fh(struct iwl_trans *trans, char **buf); int iwl_dump_fh(struct iwl_trans *trans, char **buf);
......
...@@ -105,6 +105,9 @@ ...@@ -105,6 +105,9 @@
/* Device NMI register */ /* Device NMI register */
#define DEVICE_SET_NMI_REG 0x00a01c30 #define DEVICE_SET_NMI_REG 0x00a01c30
#define DEVICE_SET_NMI_VAL 0x1
#define DEVICE_SET_NMI_8000B_REG 0x00a01c24
#define DEVICE_SET_NMI_8000B_VAL 0x1000000
/* Shared registers (0x0..0x3ff, via target indirect or periphery */ /* Shared registers (0x0..0x3ff, via target indirect or periphery */
#define SHR_BASE 0x00a10000 #define SHR_BASE 0x00a10000
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include "mvm.h" #include "mvm.h"
#include "sta.h" #include "sta.h"
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-prph.h"
#include "debugfs.h" #include "debugfs.h"
#include "iwl-fw-error-dump.h" #include "iwl-fw-error-dump.h"
...@@ -691,7 +690,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, ...@@ -691,7 +690,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,
static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf, static ssize_t iwl_dbgfs_fw_nmi_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
iwl_write_prph(mvm->trans, DEVICE_SET_NMI_REG, 1); iwl_force_nmi(mvm->trans);
return count; return count;
} }
......
...@@ -201,7 +201,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) ...@@ -201,7 +201,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
IWL_ERR(trans, "scratch %d = 0x%08x\n", i, IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
le32_to_cpu(txq->scratchbufs[i].scratch)); le32_to_cpu(txq->scratchbufs[i].scratch));
iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); iwl_force_nmi(trans);
} }
/* /*
...@@ -1029,7 +1029,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) ...@@ -1029,7 +1029,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx)
if (nfreed++ > 0) { if (nfreed++ > 0) {
IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
idx, q->write_ptr, q->read_ptr); idx, q->write_ptr, q->read_ptr);
iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); iwl_force_nmi(trans);
} }
} }
...@@ -1600,7 +1600,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, ...@@ -1600,7 +1600,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
get_cmd_string(trans_pcie, cmd->id)); get_cmd_string(trans_pcie, cmd->id));
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
iwl_write_prph(trans, DEVICE_SET_NMI_REG, 1); iwl_force_nmi(trans);
iwl_trans_fw_error(trans); iwl_trans_fw_error(trans);
goto cancel; goto cancel;
......
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