]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-agn.c
iwlwifi: send DC calib config to runtime ucode
[karo-tx-linux.git] / drivers / net / wireless / iwlwifi / iwl-agn.c
index df2edccdf9bd8ec1fcfd8872e11e57039ef0ab54..e23c554b73a8018cac222245d7a79b3269c3f62f 100644 (file)
@@ -110,6 +110,9 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
        if (!iwl_is_alive(priv))
                return -EBUSY;
 
+       if (!ctx->is_active)
+               return 0;
+
        /* always get timestamp with Rx frame */
        ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK;
 
@@ -223,9 +226,8 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
                        return ret;
                }
        }
-
-       priv->start_calib = 0;
        if (new_assoc) {
+               priv->start_calib = 0;
                /* Apply the new configuration
                 * RXON assoc doesn't clear the station table in uCode,
                 */
@@ -2763,6 +2765,25 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
        }
 }
 
+static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
+{
+       struct iwl_calib_cfg_cmd calib_cfg_cmd;
+       struct iwl_host_cmd cmd = {
+               .id = CALIBRATION_CFG_CMD,
+               .len = sizeof(struct iwl_calib_cfg_cmd),
+               .data = &calib_cfg_cmd,
+       };
+
+       memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
+       calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
+       calib_cfg_cmd.ucd_calib_cfg.once.start = cfg;
+       calib_cfg_cmd.ucd_calib_cfg.once.send_res = 0;
+       calib_cfg_cmd.ucd_calib_cfg.flags = 0;
+
+       return iwl_send_cmd(priv, &cmd);
+}
+
+
 /**
  * iwl_alive_start - called after REPLY_ALIVE notification received
  *                   from protocol/runtime uCode (initialization uCode's
@@ -2799,6 +2820,10 @@ static void iwl_alive_start(struct iwl_priv *priv)
                goto restart;
        }
 
+       if (priv->hw_params.calib_rt_cfg)
+               iwlagn_send_calib_cfg_rt(priv, priv->hw_params.calib_rt_cfg);
+
+
        /* After the ALIVE response, we can send host commands to the uCode */
        set_bit(STATUS_ALIVE, &priv->status);
 
@@ -2890,8 +2915,9 @@ static void __iwl_down(struct iwl_priv *priv)
 
        IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
 
-       if (!exit_pending)
-               set_bit(STATUS_EXIT_PENDING, &priv->status);
+       iwl_scan_cancel_timeout(priv, 200);
+
+       exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
 
        /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
         * to prevent rearm timer */
@@ -3501,15 +3527,6 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
 
        priv->is_open = 0;
 
-       if (iwl_is_ready_rf(priv) || test_bit(STATUS_SCAN_HW, &priv->status)) {
-               /* stop mac, cancel any scan request and clear
-                * RXON_FILTER_ASSOC_MSK BIT
-                */
-               mutex_lock(&priv->mutex);
-               iwl_scan_cancel_timeout(priv, 100);
-               mutex_unlock(&priv->mutex);
-       }
-
        iwl_down(priv);
 
        flush_workqueue(priv->workqueue);
@@ -4077,13 +4094,15 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
                priv->cfg->ops->lib->cancel_deferred_work(priv);
 
        cancel_delayed_work_sync(&priv->init_alive_start);
-       cancel_delayed_work(&priv->scan_check);
-       cancel_work_sync(&priv->start_internal_scan);
        cancel_delayed_work(&priv->alive_start);
        cancel_work_sync(&priv->run_time_calib_work);
        cancel_work_sync(&priv->beacon_update);
+
+       iwl_cancel_scan_deferred_work(priv);
+
        cancel_work_sync(&priv->bt_full_concurrency);
        cancel_work_sync(&priv->bt_runtime_config);
+
        del_timer_sync(&priv->statistics_periodic);
        del_timer_sync(&priv->ucode_trace);
 }
@@ -4301,6 +4320,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        for (i = 0; i < NUM_IWL_RXON_CTX; i++)
                priv->contexts[i].ctxid = i;
 
+       priv->contexts[IWL_RXON_CTX_BSS].always_active = true;
+       priv->contexts[IWL_RXON_CTX_BSS].is_active = true;
        priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
        priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
        priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
@@ -4790,6 +4811,12 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)},
        {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)},
        {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)},
+
+       {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)},
+       {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)},
+       {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)},
+       {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)},
+       {IWL_PCI_DEVICE(0x08AE, 0x1017, iwl100_bg_cfg)},
 #endif /* CONFIG_IWL5000 */
 
        {0}