mwl8k: Implement sw_scan start/stop cbs
authorYogesh Ashok Powar <yogeshp@marvell.com>
Tue, 25 Feb 2014 12:12:09 +0000 (17:42 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 28 Feb 2014 19:33:10 +0000 (14:33 -0500)
Implement sw_scan start and stop callbacks.
Reset BBP registers for channel, RX busy and
average noise stats which clear on read.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwl8k.c

index 6c002f3d91cdce6dd48e4f6e6aad20aefab37fe9..61d5bea9a9d7f4a6c1f3ce4518567a198e7c56b3 100644 (file)
@@ -81,6 +81,9 @@ MODULE_PARM_DESC(ap_mode_default,
  */
 
 #define        MWL8K_HW_TIMER_REGISTER                 0x0000a600
+#define BBU_RXRDY_CNT_REG                      0x0000a860
+#define NOK_CCA_CNT_REG                                0x0000a6a0
+#define BBU_AVG_NOISE_VAL                      0x67
 
 #define MWL8K_A2H_EVENTS       (MWL8K_A2H_INT_DUMMY | \
                                 MWL8K_A2H_INT_CHNL_SWITCHED | \
@@ -289,6 +292,9 @@ struct mwl8k_priv {
 
        /* bitmap of running BSSes */
        u32 running_bsses;
+
+       /* ACS related */
+       bool sw_scan_start;
 };
 
 #define MAX_WEP_KEY_LEN         13
@@ -5448,6 +5454,38 @@ mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        return rc;
 }
 
+static void mwl8k_sw_scan_start(struct ieee80211_hw *hw)
+{
+       struct mwl8k_priv *priv = hw->priv;
+       u8 tmp;
+
+       if (!priv->ap_fw)
+               return;
+
+       /* clear all stats */
+       ioread32(priv->regs + BBU_RXRDY_CNT_REG);
+       ioread32(priv->regs + NOK_CCA_CNT_REG);
+       mwl8k_cmd_bbp_reg_access(priv->hw, 0, BBU_AVG_NOISE_VAL, &tmp);
+
+       priv->sw_scan_start = true;
+}
+
+static void mwl8k_sw_scan_complete(struct ieee80211_hw *hw)
+{
+       struct mwl8k_priv *priv = hw->priv;
+       u8 tmp;
+
+       if (!priv->ap_fw)
+               return;
+
+       priv->sw_scan_start = false;
+
+       /* clear all stats */
+       ioread32(priv->regs + BBU_RXRDY_CNT_REG);
+       ioread32(priv->regs + NOK_CCA_CNT_REG);
+       mwl8k_cmd_bbp_reg_access(priv->hw, 0, BBU_AVG_NOISE_VAL, &tmp);
+}
+
 static const struct ieee80211_ops mwl8k_ops = {
        .tx                     = mwl8k_tx,
        .start                  = mwl8k_start,
@@ -5466,6 +5504,8 @@ static const struct ieee80211_ops mwl8k_ops = {
        .get_stats              = mwl8k_get_stats,
        .get_survey             = mwl8k_get_survey,
        .ampdu_action           = mwl8k_ampdu_action,
+       .sw_scan_start          = mwl8k_sw_scan_start,
+       .sw_scan_complete       = mwl8k_sw_scan_complete,
 };
 
 static void mwl8k_finalize_join_worker(struct work_struct *work)