iwlagn: add an API for RX stop
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 8 Jul 2011 15:46:11 +0000 (08:46 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jul 2011 19:02:01 +0000 (15:02 -0400)
Rx stop moves to transport layer.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-trans.c

index 90d366e15d2fad1ee89b7d15916cd64072abdbc9..25a592a656a4e6e7f8349de233f46de8dc1b3dd4 100644 (file)
@@ -905,17 +905,6 @@ void iwlagn_rx_replenish_now(struct iwl_priv *priv)
        iwlagn_rx_queue_restock(priv);
 }
 
-int iwlagn_rxq_stop(struct iwl_priv *priv)
-{
-
-       /* stop Rx DMA */
-       iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
-       iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
-                           FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
-
-       return 0;
-}
-
 int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
 {
        int idx = 0;
@@ -2321,13 +2310,14 @@ void iwlagn_stop_device(struct iwl_priv *priv)
         * already dead.
         */
        if (test_bit(STATUS_DEVICE_ENABLED, &priv->status)) {
-                iwlagn_txq_ctx_stop(priv);
-                iwlagn_rxq_stop(priv);
+               iwlagn_txq_ctx_stop(priv);
+               priv->trans.ops->rx_stop(priv);
 
-                /* Power-down device's busmaster DMA clocks */
-                iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
-                udelay(5);
-        }
+               /* Power-down device's busmaster DMA clocks */
+               iwl_write_prph(priv, APMG_CLK_DIS_REG,
+                              APMG_CLK_VAL_DMA_CLK_RQT);
+               udelay(5);
+       }
 
        /* Make sure (redundant) we've released our request to stay awake */
        iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
index fabab0ff557795cde68fc4c6fe3694120dcfc280..0fa379b4f46b42afe3f5ab68247ab0baca54d2e7 100644 (file)
@@ -193,7 +193,6 @@ void iwlagn_rx_queue_restock(struct iwl_priv *priv);
 void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority);
 void iwlagn_rx_replenish(struct iwl_priv *priv);
 void iwlagn_rx_replenish_now(struct iwl_priv *priv);
-int iwlagn_rxq_stop(struct iwl_priv *priv);
 int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
 void iwl_setup_rx_handlers(struct iwl_priv *priv);
 
index a29fdd43a9f3449d72f81a0e423e61ef28d72210..8611cf0e555652db7b6ba1caa9cbefa4e04fa045 100644 (file)
@@ -1231,12 +1231,14 @@ struct iwl_trans;
  * struct iwl_trans_ops - transport specific operations
 
  * @rx_init: inits the rx memory, allocate it if needed
+ * @rx_stop: stop the rx
  * @rx_free: frees the rx memory
  * @tx_init:inits the tx memory, allocate if needed
  * @tx_free: frees the tx memory
  */
 struct iwl_trans_ops {
        int (*rx_init)(struct iwl_priv *priv);
+       int (*rx_stop)(struct iwl_priv *priv);
        void (*rx_free)(struct iwl_priv *priv);
 
        int (*tx_init)(struct iwl_priv *priv);
index 38b43e41d5613d3fcbaa78cb7cb7f7871d31bd11..c4cd363d81f2f028ec17cb81716b16698eb5bb46 100644 (file)
@@ -188,6 +188,15 @@ static void iwl_trans_rx_free(struct iwl_priv *priv)
        rxq->rb_stts = NULL;
 }
 
+static int iwl_trans_rx_stop(struct iwl_priv *priv)
+{
+
+       /* stop Rx DMA */
+       iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
+       return iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
+                           FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
+}
+
 /* TODO:remove this code duplication */
 static inline int iwlagn_alloc_dma_ptr(struct iwl_priv *priv,
                                    struct iwl_dma_ptr *ptr, size_t size)
@@ -490,6 +499,7 @@ error:
 
 static const struct iwl_trans_ops trans_ops = {
        .rx_init = iwl_trans_rx_init,
+       .rx_stop = iwl_trans_rx_stop,
        .rx_free = iwl_trans_rx_free,
 
        .tx_init = iwl_trans_tx_init,