aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-ucode.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-02-07 03:35:18 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-27 16:24:59 -0500
commite211b2427a61e92e5a6bdd629bc2c2e6114c2dc1 (patch)
treeafa76986d8cf37760861c9f0c03b4c01c543eb19 /drivers/net/wireless/iwlwifi/iwl-ucode.c
parente9daccd732971b5d0268a0b858b5d14f6b6a9d86 (diff)
iwlwifi: move content of iwl_probe to post fetch_fw
This will allow to have different behavior depending on the fw. Different fw APIs require completely different implementation of the mac80211 APIs. Each of these implementations is called an op_mode. The current op_mode is called DVM which states for dual virtual MAC. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-ucode.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.c64
1 files changed, 14 insertions, 50 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index ea757098654d..99f89b27f42c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -687,7 +687,6 @@ int iwl_run_init_ucode(struct iwl_trans *trans)
687 687
688static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); 688static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
689 689
690#define UCODE_EXPERIMENTAL_INDEX 100
691#define UCODE_EXPERIMENTAL_TAG "exp" 690#define UCODE_EXPERIMENTAL_TAG "exp"
692 691
693int __must_check iwl_request_firmware(struct iwl_nic *nic, bool first) 692int __must_check iwl_request_firmware(struct iwl_nic *nic, bool first)
@@ -1047,7 +1046,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1047 struct iwl_nic *nic = context; 1046 struct iwl_nic *nic = context;
1048 struct iwl_cfg *cfg = cfg(nic); 1047 struct iwl_cfg *cfg = cfg(nic);
1049 struct iwl_fw *fw = &nic->fw; 1048 struct iwl_fw *fw = &nic->fw;
1050 struct iwl_priv *priv = priv(nic); /* temporary */
1051 struct iwl_ucode_header *ucode; 1049 struct iwl_ucode_header *ucode;
1052 int err; 1050 int err;
1053 struct iwlagn_firmware_pieces pieces; 1051 struct iwlagn_firmware_pieces pieces;
@@ -1127,10 +1125,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1127 1125
1128 IWL_INFO(nic, "loaded firmware version %s", nic->fw.fw_version); 1126 IWL_INFO(nic, "loaded firmware version %s", nic->fw.fw_version);
1129 1127
1130 snprintf(priv->hw->wiphy->fw_version,
1131 sizeof(priv->hw->wiphy->fw_version),
1132 "%s", nic->fw.fw_version);
1133
1134 /* 1128 /*
1135 * For any of the failures below (before allocating pci memory) 1129 * For any of the failures below (before allocating pci memory)
1136 * we will try to load a version with a smaller API -- maybe the 1130 * we will try to load a version with a smaller API -- maybe the
@@ -1235,27 +1229,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1235#ifndef CONFIG_IWLWIFI_P2P 1229#ifndef CONFIG_IWLWIFI_P2P
1236 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN; 1230 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1237#endif 1231#endif
1238
1239 priv->new_scan_threshold_behaviour =
1240 !!(fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
1241
1242 if (!(cfg->sku & EEPROM_SKU_CAP_IPAN_ENABLE))
1243 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1244
1245 /*
1246 * if not PAN, then don't support P2P -- might be a uCode
1247 * packaging bug or due to the eeprom check above
1248 */
1249 if (!(fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN))
1250 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
1251
1252 if (fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) {
1253 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1254 nic->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
1255 } else {
1256 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1257 nic->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
1258 }
1259 /* 1232 /*
1260 * figure out the offset of chain noise reset and gain commands 1233 * figure out the offset of chain noise reset and gain commands
1261 * base on the size of standard phy calibration commands table size 1234 * base on the size of standard phy calibration commands table size
@@ -1265,47 +1238,38 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1265 fw->ucode_capa.standard_phy_calibration_size = 1238 fw->ucode_capa.standard_phy_calibration_size =
1266 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE; 1239 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE;
1267 1240
1268 priv->phy_calib_chain_noise_reset_cmd = 1241 if (!(cfg->sku & EEPROM_SKU_CAP_IPAN_ENABLE))
1269 fw->ucode_capa.standard_phy_calibration_size; 1242 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
1270 priv->phy_calib_chain_noise_gain_cmd =
1271 fw->ucode_capa.standard_phy_calibration_size + 1;
1272
1273 /* initialize all valid contexts */
1274 iwl_init_context(priv, fw->ucode_capa.flags);
1275
1276 /**************************************************
1277 * This is still part of probe() in a sense...
1278 *
1279 * 9. Setup and register with mac80211 and debugfs
1280 **************************************************/
1281 err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
1282 if (err)
1283 goto out_unbind;
1284 1243
1285 err = iwl_dbgfs_register(priv, DRV_NAME); 1244 /*
1286 if (err) 1245 * if not PAN, then don't support P2P -- might be a uCode
1287 IWL_ERR(nic, 1246 * packaging bug or due to the eeprom check above
1288 "failed to create debugfs files. Ignoring error: %d\n", 1247 */
1289 err); 1248 if (!(fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN))
1249 fw->ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
1290 1250
1291 /* We have our copies now, allow OS release its copies */ 1251 /* We have our copies now, allow OS release its copies */
1292 release_firmware(ucode_raw); 1252 release_firmware(ucode_raw);
1293 complete(&nic->request_firmware_complete); 1253 complete(&nic->request_firmware_complete);
1254
1255 if (iwl_op_mode_dvm_start(bus(nic), trans(nic)->ops, cfg))
1256 goto out_unbind;
1257
1294 return; 1258 return;
1295 1259
1296 try_again: 1260 try_again:
1297 /* try next, if any */ 1261 /* try next, if any */
1262 release_firmware(ucode_raw);
1298 if (iwl_request_firmware(nic, false)) 1263 if (iwl_request_firmware(nic, false))
1299 goto out_unbind; 1264 goto out_unbind;
1300 release_firmware(ucode_raw);
1301 return; 1265 return;
1302 1266
1303 err_pci_alloc: 1267 err_pci_alloc:
1304 IWL_ERR(nic, "failed to allocate pci memory\n"); 1268 IWL_ERR(nic, "failed to allocate pci memory\n");
1305 iwl_dealloc_ucode(nic); 1269 iwl_dealloc_ucode(nic);
1270 release_firmware(ucode_raw);
1306 out_unbind: 1271 out_unbind:
1307 complete(&nic->request_firmware_complete); 1272 complete(&nic->request_firmware_complete);
1308 device_release_driver(trans(nic)->dev); 1273 device_release_driver(trans(nic)->dev);
1309 release_firmware(ucode_raw);
1310} 1274}
1311 1275