aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-07 11:53:14 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-11 10:13:19 -0400
commitb2ea345eab568062b321bcd3b8d72f14c93dbb63 (patch)
treed0d6abd3634465fc77ed04315d20b9d9475064a6 /drivers/net/wireless/iwlwifi/iwl-agn.c
parent4f0642a6665d1f4dbf8ef472dd5620e7585357b9 (diff)
iwlagn: Sanity check for valid context
Check EEPROM for multiple contexts support Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 488081fe1831..0acf92919048 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1485,7 +1485,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1485 priv->new_scan_threshold_behaviour = 1485 priv->new_scan_threshold_behaviour =
1486 !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); 1486 !!(ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWSCAN);
1487 1487
1488 if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) { 1488 if ((priv->cfg->sku & EEPROM_SKU_CAP_IPAN_ENABLE) &&
1489 (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN)) {
1489 priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); 1490 priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN);
1490 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; 1491 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1491 } else 1492 } else
@@ -3425,27 +3426,9 @@ out:
3425 return hw; 3426 return hw;
3426} 3427}
3427 3428
3428static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 3429static void iwl_init_context(struct iwl_priv *priv)
3429{ 3430{
3430 int err = 0, i; 3431 int i;
3431 struct iwl_priv *priv;
3432 struct ieee80211_hw *hw;
3433 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
3434 unsigned long flags;
3435 u16 pci_cmd, num_mac;
3436 u32 hw_rev;
3437
3438 /************************
3439 * 1. Allocating HW data
3440 ************************/
3441
3442 hw = iwl_alloc_all(cfg);
3443 if (!hw) {
3444 err = -ENOMEM;
3445 goto out;
3446 }
3447 priv = hw->priv;
3448 /* At this point both hw and priv are allocated. */
3449 3432
3450 /* 3433 /*
3451 * The default context is always valid, 3434 * The default context is always valid,
@@ -3477,8 +3460,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3477 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; 3460 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
3478 3461
3479 priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON; 3462 priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON;
3480 priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd = REPLY_WIPAN_RXON_TIMING; 3463 priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd =
3481 priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd = REPLY_WIPAN_RXON_ASSOC; 3464 REPLY_WIPAN_RXON_TIMING;
3465 priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd =
3466 REPLY_WIPAN_RXON_ASSOC;
3482 priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM; 3467 priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM;
3483 priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN; 3468 priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN;
3484 priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY; 3469 priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY;
@@ -3498,6 +3483,28 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3498 priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; 3483 priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P;
3499 3484
3500 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 3485 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
3486}
3487
3488static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3489{
3490 int err = 0;
3491 struct iwl_priv *priv;
3492 struct ieee80211_hw *hw;
3493 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
3494 unsigned long flags;
3495 u16 pci_cmd, num_mac;
3496 u32 hw_rev;
3497
3498 /************************
3499 * 1. Allocating HW data
3500 ************************/
3501
3502 hw = iwl_alloc_all(cfg);
3503 if (!hw) {
3504 err = -ENOMEM;
3505 goto out; }
3506 priv = hw->priv;
3507 /* At this point both hw and priv are allocated. */
3501 3508
3502 SET_IEEE80211_DEV(hw, &pdev->dev); 3509 SET_IEEE80211_DEV(hw, &pdev->dev);
3503 3510
@@ -3622,6 +3629,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3622 priv->hw->wiphy->n_addresses++; 3629 priv->hw->wiphy->n_addresses++;
3623 } 3630 }
3624 3631
3632 /* initialize all valid contexts */
3633 iwl_init_context(priv);
3634
3625 /************************ 3635 /************************
3626 * 5. Setup HW constants 3636 * 5. Setup HW constants
3627 ************************/ 3637 ************************/