iwlwifi: create disable SCD Tx FIFOs handler

This patch moves disabeling Tx FIFOs in NIC SCD to seperate handlers
in 4965 and 5000 cards.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Ron Rindjunsky 2008-05-05 10:22:42 +08:00 committed by John W. Linville
parent 47c5196e4a
commit 5a676bbeaf
3 changed files with 50 additions and 14 deletions

View File

@ -470,6 +470,27 @@ static void iwl4965_kw_free(struct iwl_priv *priv)
} }
} }
static int iwl4965_disable_tx_fifo(struct iwl_priv *priv)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&priv->lock, flags);
ret = iwl_grab_nic_access(priv);
if (unlikely(ret)) {
IWL_ERROR("Tx fifo reset failed");
spin_unlock_irqrestore(&priv->lock, flags);
return ret;
}
iwl_write_prph(priv, IWL49_SCD_TXFACT, 0);
iwl_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
/** /**
* iwl4965_txq_ctx_reset - Reset TX queue context * iwl4965_txq_ctx_reset - Reset TX queue context
* Destroys all DMA structures and initialise them again * Destroys all DMA structures and initialise them again
@ -481,7 +502,6 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
{ {
int rc = 0; int rc = 0;
int txq_id, slots_num; int txq_id, slots_num;
unsigned long flags;
iwl4965_kw_free(priv); iwl4965_kw_free(priv);
@ -495,19 +515,10 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
goto error_kw; goto error_kw;
} }
spin_lock_irqsave(&priv->lock, flags); /* Turn off all Tx DMA fifos */
rc = priv->cfg->ops->lib->disable_tx_fifo(priv);
rc = iwl_grab_nic_access(priv); if (unlikely(rc))
if (unlikely(rc)) {
IWL_ERROR("TX reset failed");
spin_unlock_irqrestore(&priv->lock, flags);
goto error_reset; goto error_reset;
}
/* Turn off all Tx DMA channels */
iwl_write_prph(priv, IWL49_SCD_TXFACT, 0);
iwl_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
/* Tell 4965 where to find the keep-warm buffer */ /* Tell 4965 where to find the keep-warm buffer */
rc = iwl4965_kw_init(priv); rc = iwl4965_kw_init(priv);
@ -538,6 +549,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
error_kw: error_kw:
return rc; return rc;
} }
static int iwl4965_apm_init(struct iwl_priv *priv) static int iwl4965_apm_init(struct iwl_priv *priv)
{ {
unsigned long flags; unsigned long flags;
@ -621,7 +633,6 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
} }
int iwl4965_hw_nic_init(struct iwl_priv *priv) int iwl4965_hw_nic_init(struct iwl_priv *priv)
{ {
unsigned long flags; unsigned long flags;
@ -4044,6 +4055,7 @@ static struct iwl_lib_ops iwl4965_lib = {
.free_shared_mem = iwl4965_free_shared_mem, .free_shared_mem = iwl4965_free_shared_mem,
.txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
.hw_nic_init = iwl4965_hw_nic_init, .hw_nic_init = iwl4965_hw_nic_init,
.disable_tx_fifo = iwl4965_disable_tx_fifo,
.rx_handler_setup = iwl4965_rx_handler_setup, .rx_handler_setup = iwl4965_rx_handler_setup,
.is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr,
.alive_notify = iwl4965_alive_notify, .alive_notify = iwl4965_alive_notify,

View File

@ -430,6 +430,27 @@ static u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
} }
static int iwl5000_disable_tx_fifo(struct iwl_priv *priv)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&priv->lock, flags);
ret = iwl_grab_nic_access(priv);
if (unlikely(ret)) {
IWL_ERROR("Tx fifo reset failed");
spin_unlock_irqrestore(&priv->lock, flags);
return ret;
}
iwl_write_prph(priv, IWL50_SCD_TXFACT, 0);
iwl_release_nic_access(priv);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
static struct iwl_hcmd_ops iwl5000_hcmd = { static struct iwl_hcmd_ops iwl5000_hcmd = {
}; };
@ -446,6 +467,7 @@ static struct iwl_lib_ops iwl5000_lib = {
.alloc_shared_mem = iwl5000_alloc_shared_mem, .alloc_shared_mem = iwl5000_alloc_shared_mem,
.free_shared_mem = iwl5000_free_shared_mem, .free_shared_mem = iwl5000_free_shared_mem,
.txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
.disable_tx_fifo = iwl5000_disable_tx_fifo,
.apm_ops = { .apm_ops = {
.init = iwl5000_apm_init, .init = iwl5000_apm_init,
.config = iwl5000_nic_config, .config = iwl5000_nic_config,

View File

@ -110,6 +110,8 @@ struct iwl_lib_ops {
void (*rx_handler_setup)(struct iwl_priv *priv); void (*rx_handler_setup)(struct iwl_priv *priv);
/* nic init */ /* nic init */
int (*hw_nic_init)(struct iwl_priv *priv); int (*hw_nic_init)(struct iwl_priv *priv);
/* nic Tx fifo handling */
int (*disable_tx_fifo)(struct iwl_priv *priv);
/* alive notification */ /* alive notification */
int (*alive_notify)(struct iwl_priv *priv); int (*alive_notify)(struct iwl_priv *priv);
/* check validity of rtc data address */ /* check validity of rtc data address */