]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
iwlwifi: implement apm stop function
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 29 May 2008 08:34:58 +0000 (16:34 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 3 Jun 2008 19:00:20 +0000 (15:00 -0400)
This patch adds apm stop function for 4965 and 5000.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-core.h

index 646c589b8282f91938493dab870ea9966acbc1dd..080fc54db151386fc6ac791f7ab55cd704ead2db 100644 (file)
@@ -642,6 +642,22 @@ void iwl4965_hw_txq_ctx_stop(struct iwl_priv *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)
 {
        int ret = 0;
@@ -658,6 +674,7 @@ static int iwl4965_apm_reset(struct iwl_priv *priv)
        /* FIXME: put here L1A -L0S w/a */
 
        iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+
        ret = iwl_poll_bit(priv, CSR_RESET,
                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
                          CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25);
@@ -689,7 +706,6 @@ out:
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return ret;
-
 }
 
 #define REG_RECALIB_PERIOD (60)
@@ -3625,6 +3641,7 @@ static struct iwl_lib_ops iwl4965_lib = {
        .apm_ops = {
                .init = iwl4965_apm_init,
                .reset = iwl4965_apm_reset,
+               .stop = iwl4965_apm_stop,
                .config = iwl4965_nic_config,
                .set_pwr_src = iwl4965_set_pwr_src,
        },
index 10054bdf3e4c150a65ff21dbe625e0dfbede46ee..27cfe3c9a58dc55d9bdc3cf3c522d4510b44b7b3 100644 (file)
@@ -100,6 +100,25 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
        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)
 {
        int ret = 0;
@@ -859,6 +878,7 @@ static struct iwl_lib_ops iwl5000_lib = {
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
+               .stop = iwl5000_apm_stop,
                .config = iwl5000_nic_config,
                .set_pwr_src = iwl4965_set_pwr_src,
        },
index d82660c88a38cd86270971e0f24ee95843773f6e..d6e6985181cff0e1a80ef9cfdd3c82388a0f8c75 100644 (file)
@@ -125,6 +125,7 @@ struct iwl_lib_ops {
        struct {
                int (*init)(struct iwl_priv *priv);
                int (*reset)(struct iwl_priv *priv);
+               void (*stop)(struct iwl_priv *priv);
                void (*config)(struct iwl_priv *priv);
                int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
        } apm_ops;