iwlagn: use sku capabilities information from EEPROM
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Mon, 6 Jun 2011 19:05:46 +0000 (12:05 -0700)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 11 Jun 2011 14:09:28 +0000 (07:09 -0700)
Instead of having the separated define, use the sku capabilities in EEPROM

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-eeprom.h

index 2ef9448b1c201ac3063326d9777de22eb02faece..512d8beb3dfd4c8a6a5a58f62041da5cb0819a1a 100644 (file)
@@ -108,18 +108,11 @@ err:
 
 int iwl_eeprom_check_sku(struct iwl_priv *priv)
 {
-       u16 eeprom_sku;
        u16 radio_cfg;
 
-       eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP);
-
        if (!priv->cfg->sku) {
                /* not using sku overwrite */
-               priv->cfg->sku =
-                       ((eeprom_sku & EEPROM_SKU_CAP_BAND_SELECTION) >>
-                       EEPROM_SKU_CAP_BAND_POS);
-               if (eeprom_sku & EEPROM_SKU_CAP_11N_ENABLE)
-                       priv->cfg->sku |= IWL_SKU_N;
+               priv->cfg->sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP);
        }
        if (!priv->cfg->sku) {
                IWL_ERR(priv, "Invalid device sku\n");
index 58f6da0acfd243868404f838a6cd7a6607dd317f..90cd647088a7a32afe3f95625838111f1bce7d8d 100644 (file)
@@ -1532,7 +1532,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
        memset(&flush_cmd, 0, sizeof(flush_cmd));
        flush_cmd.fifo_control = IWL_TX_FIFO_VO_MSK | IWL_TX_FIFO_VI_MSK |
                                 IWL_TX_FIFO_BE_MSK | IWL_TX_FIFO_BK_MSK;
-       if (priv->cfg->sku & IWL_SKU_N)
+       if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
                flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK;
 
        IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n",
@@ -2318,7 +2318,8 @@ int iwlagn_start_device(struct iwl_priv *priv)
 {
        int ret;
 
-       if (iwl_prepare_card_hw(priv)) {
+       if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) &&
+            iwl_prepare_card_hw(priv)) {
                IWL_WARN(priv, "Exit HW not ready\n");
                return -EIO;
        }
index 3cd42a5209562a7b59a6484a3d051ef75f323a7f..488081fe1831ce523ff8e7d088b55ff073c6855e 100644 (file)
@@ -2515,7 +2515,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
        hw->flags |= IEEE80211_HW_SUPPORTS_PS |
                     IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
 
-       if (priv->cfg->sku & IWL_SKU_N)
+       if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
                hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
                             IEEE80211_HW_SUPPORTS_STATIC_SMPS;
 
@@ -2756,7 +2756,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
        IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
                     sta->addr, tid);
 
-       if (!(priv->cfg->sku & IWL_SKU_N))
+       if (!(priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE))
                return -EACCES;
 
        mutex_lock(&priv->mutex);
@@ -3375,7 +3375,7 @@ static int iwl_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL;
 
        if (iwlagn_mod_params.disable_11n)
-               priv->cfg->sku &= ~IWL_SKU_N;
+               priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
 
        /* Device-specific setup */
        return priv->cfg->ops->lib->set_hw_params(priv);
index ad54f82597caf145c12dbc81b46900ebc29afa3a..445ddac065412236953718776d25ec728776165d 100644 (file)
@@ -143,7 +143,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
        sband->bitrates = &rates[IWL_FIRST_OFDM_RATE];
        sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE;
 
-       if (priv->cfg->sku & IWL_SKU_N)
+       if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
                iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
                                         IEEE80211_BAND_5GHZ);
 
@@ -153,7 +153,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
        sband->bitrates = rates;
        sband->n_bitrates = IWL_RATE_COUNT_LEGACY;
 
-       if (priv->cfg->sku & IWL_SKU_N)
+       if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
                iwlcore_init_ht_hw_capab(priv, &sband->ht_cap,
                                         IEEE80211_BAND_2GHZ);
 
@@ -208,12 +208,12 @@ int iwlcore_init_geos(struct iwl_priv *priv)
        priv->tx_power_next = max_tx_power;
 
        if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
-            priv->cfg->sku & IWL_SKU_A) {
+            priv->cfg->sku & EEPROM_SKU_CAP_BAND_52GHZ) {
                IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
                        "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
                           priv->pci_dev->device,
                           priv->pci_dev->subsystem_device);
-               priv->cfg->sku &= ~IWL_SKU_A;
+               priv->cfg->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ;
        }
 
        IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
index a16daf72e67527411656ce24e9abd637658a7e2b..83ec5eb64ede07b2dbfa35a29f241a2da269e690 100644 (file)
@@ -83,10 +83,6 @@ struct iwl_cmd;
 
 #define TIME_UNIT              1024
 
-#define IWL_SKU_G       0x1
-#define IWL_SKU_A       0x2
-#define IWL_SKU_N       0x8
-
 #define IWL_CMD(x) case x: return #x
 
 struct iwl_hcmd_ops {
@@ -292,7 +288,7 @@ struct iwl_cfg {
        const unsigned int ucode_api_min;
        u8   valid_tx_ant;
        u8   valid_rx_ant;
-       unsigned int sku;
+       u16  sku;
        u16  eeprom_ver;
        u16  eeprom_calib_ver;
        const struct iwl_ops *ops;
index 508631888c145f7e03d80ae682f5006c3cbb3194..2d7005385be7e60e23a82c4e9634127f5c4d3e00 100644 (file)
@@ -110,9 +110,6 @@ enum {
 };
 
 /* SKU Capabilities */
-#define EEPROM_SKU_CAP_BAND_POS                                (4)
-#define EEPROM_SKU_CAP_BAND_SELECTION                  \
-               (3 << EEPROM_SKU_CAP_BAND_POS)
 #define EEPROM_SKU_CAP_BAND_24GHZ                      (1 << 4)
 #define EEPROM_SKU_CAP_BAND_52GHZ                      (1 << 5)
 #define EEPROM_SKU_CAP_11N_ENABLE                      (1 << 6)