]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-5000.c
iwlwifi: send cmd to uCode to configure valid tx antenna
[linux-2.6.git] / drivers / net / wireless / iwlwifi / iwl-5000.c
index 1d539e3b8db1d77eae65ff56392b39a19afa615e..68d97f50fd0038e5949681922a86efce4f5dbfa5 100644 (file)
@@ -198,7 +198,7 @@ out:
 }
 
 
-/* NIC configuration for 5000 series and up */
+/* NIC configuration for 5000 series */
 void iwl5000_nic_config(struct iwl_priv *priv)
 {
        unsigned long flags;
@@ -221,7 +221,7 @@ void iwl5000_nic_config(struct iwl_priv *priv)
        radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
 
        /* write radio config values to register */
-       if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_5000_RF_CFG_TYPE_MAX)
+       if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
                iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
                            EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
@@ -833,16 +833,8 @@ int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.max_stations = IWL5000_STATION_COUNT;
        priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
 
-       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_6x00:
-       case CSR_HW_REV_TYPE_6x50:
-               priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
-               priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
-               break;
-       default:
-               priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
-               priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
-       }
+       priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
+       priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
 
        priv->hw_params.max_bsm_size = 0;
        priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
@@ -1163,6 +1155,12 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
                                           agg->frame_count, txq_id, idx);
 
                        hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
+                       if (!hdr) {
+                               IWL_ERR(priv,
+                                       "BUG_ON idx doesn't point to valid skb"
+                                       " idx=%d, txq_id=%d\n", idx, txq_id);
+                               return -1;
+                       }
 
                        sc = le16_to_cpu(hdr->seq_ctrl);
                        if (idx != (SEQ_TO_SN(sc) & 0xff)) {
@@ -1452,6 +1450,24 @@ int iwl5000_calc_rssi(struct iwl_priv *priv,
        return max_rssi - agc - IWL49_RSSI_OFFSET;
 }
 
+static int iwl5000_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
+{
+       struct iwl_tx_ant_config_cmd tx_ant_cmd = {
+         .valid = cpu_to_le32(valid_tx_ant),
+       };
+
+       if (IWL_UCODE_API(priv->ucode_ver) > 1) {
+               IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
+               return iwl_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD,
+                                       sizeof(struct iwl_tx_ant_config_cmd),
+                                       &tx_ant_cmd);
+       } else {
+               IWL_DEBUG_HC(priv, "TX_ANT_CONFIGURATION_CMD not supported\n");
+               return -EOPNOTSUPP;
+       }
+}
+
+
 #define IWL5000_UCODE_GET(item)                                                \
 static u32 iwl5000_ucode_get_##item(const struct iwl_ucode_header *ucode,\
                                    u32 api_ver)                        \
@@ -1494,6 +1510,7 @@ struct iwl_hcmd_ops iwl5000_hcmd = {
        .rxon_assoc = iwl5000_send_rxon_assoc,
        .commit_rxon = iwl_commit_rxon,
        .set_rxon_chain = iwl_set_rxon_chain,
+       .set_tx_ant = iwl5000_send_tx_ant_config,
 };
 
 struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
@@ -1529,6 +1546,8 @@ struct iwl_lib_ops iwl5000_lib = {
        .rx_handler_setup = iwl5000_rx_handler_setup,
        .setup_deferred_work = iwl5000_setup_deferred_work,
        .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
+       .dump_nic_event_log = iwl_dump_nic_event_log,
+       .dump_nic_error_log = iwl_dump_nic_error_log,
        .load_ucode = iwl5000_load_ucode,
        .init_alive_start = iwl5000_init_alive_start,
        .alive_notify = iwl5000_alive_notify,
@@ -1579,6 +1598,8 @@ static struct iwl_lib_ops iwl5150_lib = {
        .rx_handler_setup = iwl5000_rx_handler_setup,
        .setup_deferred_work = iwl5000_setup_deferred_work,
        .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
+       .dump_nic_event_log = iwl_dump_nic_event_log,
+       .dump_nic_error_log = iwl_dump_nic_error_log,
        .load_ucode = iwl5000_load_ucode,
        .init_alive_start = iwl5000_init_alive_start,
        .alive_notify = iwl5000_alive_notify,
@@ -1654,6 +1675,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .valid_rx_ant = ANT_ABC,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_bg_cfg = {
@@ -1671,6 +1693,7 @@ struct iwl_cfg iwl5100_bg_cfg = {
        .valid_rx_ant = ANT_AB,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_abg_cfg = {
@@ -1688,6 +1711,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
        .valid_rx_ant = ANT_AB,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_agn_cfg = {
@@ -1705,6 +1729,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .valid_rx_ant = ANT_AB,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 struct iwl_cfg iwl5350_agn_cfg = {
@@ -1722,6 +1747,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .valid_rx_ant = ANT_ABC,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 struct iwl_cfg iwl5150_agn_cfg = {
@@ -1739,19 +1765,21 @@ struct iwl_cfg iwl5150_agn_cfg = {
        .valid_rx_ant = ANT_AB,
        .need_pll_cfg = true,
        .ht_greenfield_support = true,
+       .led_compensation = 51,
 };
 
 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
 
-module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444);
+module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, S_IRUGO);
 MODULE_PARM_DESC(swcrypto50,
                  "using software crypto engine (default 0 [hardware])\n");
-module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444);
+module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, S_IRUGO);
 MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
-module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444);
+module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, S_IRUGO);
 MODULE_PARM_DESC(11n_disable50, "disable 50XX 11n functionality");
-module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K, int, 0444);
+module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K,
+                  int, S_IRUGO);
 MODULE_PARM_DESC(amsdu_size_8K50, "enable 8K amsdu size in 50XX series");
-module_param_named(fw_restart50, iwl50_mod_params.restart_fw, int, 0444);
+module_param_named(fw_restart50, iwl50_mod_params.restart_fw, int, S_IRUGO);
 MODULE_PARM_DESC(fw_restart50, "restart firmware in case of error");