iwmc3200wifi: Update wireless_mode with eeprom values
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 24 Nov 2009 03:33:29 +0000 (11:33 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Nov 2009 20:04:42 +0000 (15:04 -0500)
The iwmc3200wifi eeprom contains information about the available PHYs on
the chip. We should update our wireless_mode setting and profile according
to it.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwmc3200wifi/eeprom.c
drivers/net/wireless/iwmc3200wifi/eeprom.h
drivers/net/wireless/iwmc3200wifi/main.c

index c574f58dfb20b74a42d6824c46eeca83e4cde0ec..8091421ee5e5da1d1a94595f89d147fff1e62f52 100644 (file)
@@ -176,6 +176,26 @@ int iwm_eeprom_fat_channels(struct iwm_priv *iwm)
        return 0;
 }
 
+u32 iwm_eeprom_wireless_mode(struct iwm_priv *iwm)
+{
+       u16 sku_cap;
+       u32 wireless_mode = 0;
+
+       sku_cap = *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP));
+
+       if (sku_cap & IWM_EEPROM_SKU_CAP_BAND_24GHZ)
+               wireless_mode |= WIRELESS_MODE_11G;
+
+       if (sku_cap & IWM_EEPROM_SKU_CAP_BAND_52GHZ)
+               wireless_mode |= WIRELESS_MODE_11A;
+
+       if (sku_cap & IWM_EEPROM_SKU_CAP_11N_ENABLE)
+               wireless_mode |= WIRELESS_MODE_11N;
+
+       return wireless_mode;
+}
+
+
 int iwm_eeprom_init(struct iwm_priv *iwm)
 {
        int i, ret = 0;
index 0f7f226916cf2ca6378466403000e9751205bd02..4e3a3fdab0d309281efeadbf82a8f6809e3b5b63 100644 (file)
@@ -122,5 +122,6 @@ int iwm_eeprom_init(struct iwm_priv *iwm);
 void iwm_eeprom_exit(struct iwm_priv *iwm);
 u8 *iwm_eeprom_access(struct iwm_priv *iwm, u8 eeprom_id);
 int iwm_eeprom_fat_channels(struct iwm_priv *iwm);
+u32 iwm_eeprom_wireless_mode(struct iwm_priv *iwm);
 
 #endif
index 365f3fc37d25585d271101b502502f6a505d6aec..e61265af92cd00459a6f38b5459adec75cfba747 100644 (file)
@@ -80,7 +80,8 @@ static struct iwm_conf def_iwm_conf = {
 
        .assoc_timeout          = 2,
        .roam_timeout           = 10,
-       .wireless_mode          = WIRELESS_MODE_11A | WIRELESS_MODE_11G,
+       .wireless_mode          = WIRELESS_MODE_11A | WIRELESS_MODE_11G |
+                                 WIRELESS_MODE_11N,
        .coexist_mode           = COEX_MODE_CM,
 
        /* IBSS */
@@ -630,6 +631,7 @@ static int __iwm_up(struct iwm_priv *iwm)
        int ret;
        struct iwm_notif *notif_reboot, *notif_ack = NULL;
        struct wiphy *wiphy = iwm_to_wiphy(iwm);
+       u32 wireless_mode;
 
        ret = iwm_bus_enable(iwm);
        if (ret) {
@@ -697,6 +699,21 @@ static int __iwm_up(struct iwm_priv *iwm)
                goto err_fw;
        }
 
+       /*
+        * Read our SKU capabilities.
+        * If it's valid, we overwrite the wireless mode conf entry and the
+        * current profile one.
+        */
+       wireless_mode = iwm_eeprom_wireless_mode(iwm);
+       if (wireless_mode) {
+               iwm->conf.wireless_mode = wireless_mode;
+               if (iwm->umac_profile)
+                       iwm->umac_profile->wireless_mode =
+                                       iwm->conf.wireless_mode;
+       } else
+               IWM_ERR(iwm, "Wrong SKU capabilities: 0x%x\n",
+                       *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP)));
+
        snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "L%s_U%s",
                 iwm->lmac_version, iwm->umac_version);