]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
iwlwifi-5000: add eeprom check version handler
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 24 Apr 2008 18:55:35 +0000 (11:55 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 May 2008 19:02:25 +0000 (15:02 -0400)
This patch adds implementation for eeprom check version
handler for 5000 HW

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

index 1e63b497471d6e9ac9af9a624b742f081221428d..d8e3dd70423aa1929b24acefc197de4a7d22a195 100644 (file)
@@ -125,6 +125,33 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
        return (address & ADDRESS_MSK) + (offset << 1);
 }
 
+static int iwl5000_eeprom_check_version(struct iwl_priv *priv)
+{
+       u16 eeprom_ver;
+       struct iwl_eeprom_calib_hdr {
+               u8 version;
+               u8 pa_type;
+               u16 voltage;
+       } *hdr;
+
+       eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
+
+       hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
+                                                       EEPROM_5000_CALIB_ALL);
+
+       if (eeprom_ver < EEPROM_5000_EEPROM_VERSION ||
+           hdr->version < EEPROM_5000_TX_POWER_VERSION)
+               goto err;
+
+       return 0;
+err:
+       IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
+                 eeprom_ver, EEPROM_5000_EEPROM_VERSION,
+                 hdr->version, EEPROM_5000_TX_POWER_VERSION);
+       return -EINVAL;
+
+}
+
 #ifdef CONFIG_IWL5000_RUN_TIME_CALIB
 
 static void iwl5000_gain_computation(struct iwl_priv *priv,
@@ -179,6 +206,7 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
        data->beacon_count = 0;
 }
 
+
 static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
 {
        struct iwl_chain_noise_data *data = &priv->chain_noise_data;
@@ -394,6 +422,7 @@ static struct iwl_lib_ops iwl5000_lib = {
                .verify_signature  = iwlcore_eeprom_verify_signature,
                .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
                .release_semaphore = iwlcore_eeprom_release_semaphore,
+               .check_version  = iwl5000_eeprom_check_version,
                .query_addr = iwl5000_eeprom_query_addr,
        },
 };
index 56e0a07b8183cd37a7023bc4dfac1f6f69be9958..06ed30044a4daf537f227f7791d0791a71fa6427 100644 (file)
@@ -140,6 +140,10 @@ struct iwl_eeprom_channel {
 #define EEPROM_4965_BOARD_REVISION             (2*0x4F) /* 2 bytes */
 #define EEPROM_4965_BOARD_PBA                  (2*0x56+1) /* 9 bytes */
 
+/* 5000 Specific */
+#define EEPROM_5000_TX_POWER_VERSION    (4)
+#define EEPROM_5000_EEPROM_VERSION     (0x11A)
+
 /*5000 calibrations */
 #define EEPROM_5000_CALIB_ALL  (INDIRECT_ADDRESS | INDIRECT_CALIBRATION)