iwlwifi-5000: EEPROM settings for 5000
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 24 Apr 2008 18:55:27 +0000 (11:55 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 May 2008 19:02:23 +0000 (15:02 -0400)
This patch adds eeprom handlers and values for 5000 HW family

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-5000-hw.h
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-eeprom.h

index 72a266581aef19e4564aaf80749736c4965fe750..5cf8a684b3e1cb7e0d8f8dc85e661459825f42e2 100644 (file)
@@ -68,6 +68,9 @@
 #ifndef __iwl_5000_hw_h__
 #define __iwl_5000_hw_h__
 
+/* EERPROM */
+#define IWL_5000_EEPROM_IMG_SIZE                       2048
+
 
 #define IWL50_MAX_WIN_SIZE                64
 #define IWL50_QUEUE_SIZE                 256
index 58a35cb2d78b3ca67939030cacebb54b8186b24d..91b3e563bbea9a9b65db23d4882b39a13756be0f 100644 (file)
@@ -86,6 +86,55 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
        return ret;
 }
 
+/*
+ * EEPROM
+ */
+static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
+{
+       u16 offset = 0;
+
+       if ((address & INDIRECT_ADDRESS) == 0)
+               return address;
+
+       switch (address & INDIRECT_TYPE_MSK) {
+       case INDIRECT_HOST:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_HOST);
+               break;
+       case INDIRECT_GENERAL:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_GENERAL);
+               break;
+       case INDIRECT_REGULATORY:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_REGULATORY);
+               break;
+       case INDIRECT_CALIBRATION:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_CALIBRATION);
+               break;
+       case INDIRECT_PROCESS_ADJST:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_PROCESS_ADJST);
+               break;
+       case INDIRECT_OTHERS:
+               offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS);
+               break;
+       default:
+               IWL_ERROR("illegal indirect type: 0x%X\n",
+               address & INDIRECT_TYPE_MSK);
+               break;
+       }
+
+       /* translate the offset from words to byte */
+       return (address & ADDRESS_MSK) + (offset << 1);
+}
+
+static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
+                                          size_t offset)
+{
+       u32 address = eeprom_indirect_address(priv, offset);
+       BUG_ON(address >= priv->cfg->eeprom_size);
+       return &priv->eeprom[address];
+}
+
+
+
 static struct iwl_hcmd_ops iwl5000_hcmd = {
 };
 
@@ -98,9 +147,19 @@ static struct iwl_lib_ops iwl5000_lib = {
                .set_pwr_src = iwl4965_set_pwr_src,
        },
        .eeprom_ops = {
+               .regulatory_bands = {
+                       EEPROM_5000_REG_BAND_1_CHANNELS,
+                       EEPROM_5000_REG_BAND_2_CHANNELS,
+                       EEPROM_5000_REG_BAND_3_CHANNELS,
+                       EEPROM_5000_REG_BAND_4_CHANNELS,
+                       EEPROM_5000_REG_BAND_5_CHANNELS,
+                       EEPROM_5000_REG_BAND_24_FAT_CHANNELS,
+                       EEPROM_5000_REG_BAND_52_FAT_CHANNELS
+               },
                .verify_signature  = iwlcore_eeprom_verify_signature,
                .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
                .release_semaphore = iwlcore_eeprom_release_semaphore,
+               .query_addr = iwl5000_eeprom_query_addr,
        },
 };
 
@@ -123,6 +182,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
        .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
        .ops = &iwl5000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
        .mod_params = &iwl50_mod_params,
 };
 
@@ -131,6 +191,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
        .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
        .ops = &iwl5000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
        .mod_params = &iwl50_mod_params,
 };
 
@@ -139,6 +200,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
        .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
        .ops = &iwl5000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
        .mod_params = &iwl50_mod_params,
 };
 
index 0c42e5a1288bd7055e3ff448e0b9030ac6af0b5e..56e0a07b8183cd37a7023bc4dfac1f6f69be9958 100644 (file)
@@ -140,6 +140,36 @@ struct iwl_eeprom_channel {
 #define EEPROM_4965_BOARD_REVISION             (2*0x4F) /* 2 bytes */
 #define EEPROM_4965_BOARD_PBA                  (2*0x56+1) /* 9 bytes */
 
+/*5000 calibrations */
+#define EEPROM_5000_CALIB_ALL  (INDIRECT_ADDRESS | INDIRECT_CALIBRATION)
+
+/* 5000 links */
+#define EEPROM_5000_LINK_HOST             (2*0x64)
+#define EEPROM_5000_LINK_GENERAL          (2*0x65)
+#define EEPROM_5000_LINK_REGULATORY       (2*0x66)
+#define EEPROM_5000_LINK_CALIBRATION      (2*0x67)
+#define EEPROM_5000_LINK_PROCESS_ADJST    (2*0x68)
+#define EEPROM_5000_LINK_OTHERS           (2*0x69)
+
+/* 5000 regulatory - indirect access */
+#define EEPROM_5000_REG_SKU_ID ((0x02)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 4  bytes */
+#define EEPROM_5000_REG_BAND_1_CHANNELS       ((0x08)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 28 bytes */
+#define EEPROM_5000_REG_BAND_2_CHANNELS       ((0x26)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 26 bytes */
+#define EEPROM_5000_REG_BAND_3_CHANNELS       ((0x42)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 24 bytes */
+#define EEPROM_5000_REG_BAND_4_CHANNELS       ((0x5C)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 22 bytes */
+#define EEPROM_5000_REG_BAND_5_CHANNELS       ((0x74)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 12 bytes */
+#define EEPROM_5000_REG_BAND_24_FAT_CHANNELS  ((0x82)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 14  bytes */
+#define EEPROM_5000_REG_BAND_52_FAT_CHANNELS  ((0x92)\
+               | INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 22  bytes */
+
+
 /* 2.4 GHz */
 extern const u8 iwl_eeprom_band_1[14];