Commit f118a91d authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville

iwlwifi: implement apm stop function

This patch adds apm stop function for 4965 and 5000.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7f066108
...@@ -642,6 +642,22 @@ void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv) ...@@ -642,6 +642,22 @@ void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv)
iwl_hw_txq_ctx_free(priv); iwl_hw_txq_ctx_free(priv);
} }
static void iwl4965_apm_stop(struct iwl_priv *priv)
{
unsigned long flags;
iwl4965_hw_nic_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
udelay(10);
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
spin_unlock_irqrestore(&priv->lock, flags);
}
static int iwl4965_apm_reset(struct iwl_priv *priv) static int iwl4965_apm_reset(struct iwl_priv *priv)
{ {
int ret = 0; int ret = 0;
...@@ -658,6 +674,7 @@ static int iwl4965_apm_reset(struct iwl_priv *priv) ...@@ -658,6 +674,7 @@ static int iwl4965_apm_reset(struct iwl_priv *priv)
/* FIXME: put here L1A -L0S w/a */ /* FIXME: put here L1A -L0S w/a */
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
ret = iwl_poll_bit(priv, CSR_RESET, ret = iwl_poll_bit(priv, CSR_RESET,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25); CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25);
...@@ -689,7 +706,6 @@ static int iwl4965_apm_reset(struct iwl_priv *priv) ...@@ -689,7 +706,6 @@ static int iwl4965_apm_reset(struct iwl_priv *priv)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
return ret; return ret;
} }
#define REG_RECALIB_PERIOD (60) #define REG_RECALIB_PERIOD (60)
...@@ -3625,6 +3641,7 @@ static struct iwl_lib_ops iwl4965_lib = { ...@@ -3625,6 +3641,7 @@ static struct iwl_lib_ops iwl4965_lib = {
.apm_ops = { .apm_ops = {
.init = iwl4965_apm_init, .init = iwl4965_apm_init,
.reset = iwl4965_apm_reset, .reset = iwl4965_apm_reset,
.stop = iwl4965_apm_stop,
.config = iwl4965_nic_config, .config = iwl4965_nic_config,
.set_pwr_src = iwl4965_set_pwr_src, .set_pwr_src = iwl4965_set_pwr_src,
}, },
......
...@@ -100,6 +100,25 @@ static int iwl5000_apm_init(struct iwl_priv *priv) ...@@ -100,6 +100,25 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
return ret; return ret;
} }
/* FIXME: this is indentical to 4965 */
static void iwl5000_apm_stop(struct iwl_priv *priv)
{
unsigned long flags;
iwl4965_hw_nic_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
udelay(10);
iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
spin_unlock_irqrestore(&priv->lock, flags);
}
static int iwl5000_apm_reset(struct iwl_priv *priv) static int iwl5000_apm_reset(struct iwl_priv *priv)
{ {
int ret = 0; int ret = 0;
...@@ -859,6 +878,7 @@ static struct iwl_lib_ops iwl5000_lib = { ...@@ -859,6 +878,7 @@ static struct iwl_lib_ops iwl5000_lib = {
.apm_ops = { .apm_ops = {
.init = iwl5000_apm_init, .init = iwl5000_apm_init,
.reset = iwl5000_apm_reset, .reset = iwl5000_apm_reset,
.stop = iwl5000_apm_stop,
.config = iwl5000_nic_config, .config = iwl5000_nic_config,
.set_pwr_src = iwl4965_set_pwr_src, .set_pwr_src = iwl4965_set_pwr_src,
}, },
......
...@@ -125,6 +125,7 @@ struct iwl_lib_ops { ...@@ -125,6 +125,7 @@ struct iwl_lib_ops {
struct { struct {
int (*init)(struct iwl_priv *priv); int (*init)(struct iwl_priv *priv);
int (*reset)(struct iwl_priv *priv); int (*reset)(struct iwl_priv *priv);
void (*stop)(struct iwl_priv *priv);
void (*config)(struct iwl_priv *priv); void (*config)(struct iwl_priv *priv);
int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
} apm_ops; } apm_ops;
......
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