aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-10-24 02:48:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:02:24 -0400
commit0ef2ca67b19e2286eed8eeb7ef7a35ce57d6d629 (patch)
treec19702e83267fe503a790b164290fd2fec1eb6b9 /drivers/net/wireless/iwlwifi
parented7fafec5e566a30fb21586c98cbef76c306d209 (diff)
iwlwifi: parametrize eeprom versions
This patch uses new parameters eeprom_ver and eeprom_calib_ver to support additional HW. 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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c29
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h5
5 files changed, 41 insertions, 39 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 741b425b5883..f53cd2b096df 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -318,27 +318,9 @@ static int is_fat_channel(__le32 rxon_flags)
318/* 318/*
319 * EEPROM handlers 319 * EEPROM handlers
320 */ 320 */
321 321static u16 iwl4965_eeprom_calib_version(struct iwl_priv *priv)
322static int iwl4965_eeprom_check_version(struct iwl_priv *priv)
323{ 322{
324 u16 eeprom_ver; 323 return iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET);
325 u16 calib_ver;
326
327 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
328
329 calib_ver = iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET);
330
331 if (eeprom_ver < EEPROM_4965_EEPROM_VERSION ||
332 calib_ver < EEPROM_4965_TX_POWER_VERSION)
333 goto err;
334
335 return 0;
336err:
337 IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
338 eeprom_ver, EEPROM_4965_EEPROM_VERSION,
339 calib_ver, EEPROM_4965_TX_POWER_VERSION);
340 return -EINVAL;
341
342} 324}
343 325
344/* 326/*
@@ -2355,7 +2337,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2355 .verify_signature = iwlcore_eeprom_verify_signature, 2337 .verify_signature = iwlcore_eeprom_verify_signature,
2356 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, 2338 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
2357 .release_semaphore = iwlcore_eeprom_release_semaphore, 2339 .release_semaphore = iwlcore_eeprom_release_semaphore,
2358 .check_version = iwl4965_eeprom_check_version, 2340 .calib_version = iwl4965_eeprom_calib_version,
2359 .query_addr = iwlcore_eeprom_query_addr, 2341 .query_addr = iwlcore_eeprom_query_addr,
2360 }, 2342 },
2361 .send_tx_power = iwl4965_send_tx_power, 2343 .send_tx_power = iwl4965_send_tx_power,
@@ -2374,6 +2356,8 @@ struct iwl_cfg iwl4965_agn_cfg = {
2374 .fw_name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode", 2356 .fw_name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode",
2375 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 2357 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
2376 .eeprom_size = IWL4965_EEPROM_IMG_SIZE, 2358 .eeprom_size = IWL4965_EEPROM_IMG_SIZE,
2359 .eeprom_ver = EEPROM_4965_EEPROM_VERSION,
2360 .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION,
2377 .ops = &iwl4965_ops, 2361 .ops = &iwl4965_ops,
2378 .mod_params = &iwl4965_mod_params, 2362 .mod_params = &iwl4965_mod_params,
2379}; 2363};
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index a8c8c858e209..f3316d488240 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -293,30 +293,17 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
293 return (address & ADDRESS_MSK) + (offset << 1); 293 return (address & ADDRESS_MSK) + (offset << 1);
294} 294}
295 295
296static int iwl5000_eeprom_check_version(struct iwl_priv *priv) 296static u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv)
297{ 297{
298 u16 eeprom_ver;
299 struct iwl_eeprom_calib_hdr { 298 struct iwl_eeprom_calib_hdr {
300 u8 version; 299 u8 version;
301 u8 pa_type; 300 u8 pa_type;
302 u16 voltage; 301 u16 voltage;
303 } *hdr; 302 } *hdr;
304 303
305 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
306
307 hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, 304 hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
308 EEPROM_5000_CALIB_ALL); 305 EEPROM_5000_CALIB_ALL);
309 306 return hdr->version;
310 if (eeprom_ver < EEPROM_5000_EEPROM_VERSION ||
311 hdr->version < EEPROM_5000_TX_POWER_VERSION)
312 goto err;
313
314 return 0;
315err:
316 IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
317 eeprom_ver, EEPROM_5000_EEPROM_VERSION,
318 hdr->version, EEPROM_5000_TX_POWER_VERSION);
319 return -EINVAL;
320 307
321} 308}
322 309
@@ -1510,7 +1497,7 @@ static struct iwl_lib_ops iwl5000_lib = {
1510 .verify_signature = iwlcore_eeprom_verify_signature, 1497 .verify_signature = iwlcore_eeprom_verify_signature,
1511 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, 1498 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
1512 .release_semaphore = iwlcore_eeprom_release_semaphore, 1499 .release_semaphore = iwlcore_eeprom_release_semaphore,
1513 .check_version = iwl5000_eeprom_check_version, 1500 .calib_version = iwl5000_eeprom_calib_version,
1514 .query_addr = iwl5000_eeprom_query_addr, 1501 .query_addr = iwl5000_eeprom_query_addr,
1515 }, 1502 },
1516}; 1503};
@@ -1537,6 +1524,8 @@ struct iwl_cfg iwl5300_agn_cfg = {
1537 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 1524 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1538 .ops = &iwl5000_ops, 1525 .ops = &iwl5000_ops,
1539 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, 1526 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
1527 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1528 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1540 .mod_params = &iwl50_mod_params, 1529 .mod_params = &iwl50_mod_params,
1541}; 1530};
1542 1531
@@ -1546,6 +1535,8 @@ struct iwl_cfg iwl5100_bg_cfg = {
1546 .sku = IWL_SKU_G, 1535 .sku = IWL_SKU_G,
1547 .ops = &iwl5000_ops, 1536 .ops = &iwl5000_ops,
1548 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, 1537 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
1538 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1539 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1549 .mod_params = &iwl50_mod_params, 1540 .mod_params = &iwl50_mod_params,
1550}; 1541};
1551 1542
@@ -1555,6 +1546,8 @@ struct iwl_cfg iwl5100_abg_cfg = {
1555 .sku = IWL_SKU_A|IWL_SKU_G, 1546 .sku = IWL_SKU_A|IWL_SKU_G,
1556 .ops = &iwl5000_ops, 1547 .ops = &iwl5000_ops,
1557 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, 1548 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
1549 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1550 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1558 .mod_params = &iwl50_mod_params, 1551 .mod_params = &iwl50_mod_params,
1559}; 1552};
1560 1553
@@ -1564,6 +1557,8 @@ struct iwl_cfg iwl5100_agn_cfg = {
1564 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 1557 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1565 .ops = &iwl5000_ops, 1558 .ops = &iwl5000_ops,
1566 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, 1559 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
1560 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1561 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1567 .mod_params = &iwl50_mod_params, 1562 .mod_params = &iwl50_mod_params,
1568}; 1563};
1569 1564
@@ -1573,6 +1568,8 @@ struct iwl_cfg iwl5350_agn_cfg = {
1573 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 1568 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1574 .ops = &iwl5000_ops, 1569 .ops = &iwl5000_ops,
1575 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, 1570 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
1571 .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
1572 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
1576 .mod_params = &iwl50_mod_params, 1573 .mod_params = &iwl50_mod_params,
1577}; 1574};
1578 1575
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index a2d8afe92beb..fb95c6a9825b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -173,6 +173,8 @@ struct iwl_cfg {
173 const char *fw_name; 173 const char *fw_name;
174 unsigned int sku; 174 unsigned int sku;
175 int eeprom_size; 175 int eeprom_size;
176 u16 eeprom_ver;
177 u16 eeprom_calib_ver;
176 const struct iwl_ops *ops; 178 const struct iwl_ops *ops;
177 const struct iwl_mod_params *mod_params; 179 const struct iwl_mod_params *mod_params;
178}; 180};
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 37155755efc5..5160b4b0c0de 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -279,7 +279,23 @@ EXPORT_SYMBOL(iwl_eeprom_free);
279 279
280int iwl_eeprom_check_version(struct iwl_priv *priv) 280int iwl_eeprom_check_version(struct iwl_priv *priv)
281{ 281{
282 return priv->cfg->ops->lib->eeprom_ops.check_version(priv); 282 u16 eeprom_ver;
283 u16 calib_ver;
284
285 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
286 calib_ver = priv->cfg->ops->lib->eeprom_ops.calib_version(priv);
287
288 if (eeprom_ver < priv->cfg->eeprom_ver ||
289 calib_ver < priv->cfg->eeprom_calib_ver)
290 goto err;
291
292 return 0;
293err:
294 IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
295 eeprom_ver, priv->cfg->eeprom_ver,
296 calib_ver, priv->cfg->eeprom_calib_ver);
297 return -EINVAL;
298
283} 299}
284EXPORT_SYMBOL(iwl_eeprom_check_version); 300EXPORT_SYMBOL(iwl_eeprom_check_version);
285 301
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index d3a2a5b4ac56..997f23c8db2e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -174,6 +174,9 @@ struct iwl_eeprom_channel {
174#define EEPROM_5000_REG_BAND_52_FAT_CHANNELS ((0x92)\ 174#define EEPROM_5000_REG_BAND_52_FAT_CHANNELS ((0x92)\
175 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */ 175 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */
176 176
177/* 5050 Specific */
178#define EEPROM_5050_TX_POWER_VERSION (4)
179#define EEPROM_5050_EEPROM_VERSION (0x21E)
177 180
178/* 2.4 GHz */ 181/* 2.4 GHz */
179extern const u8 iwl_eeprom_band_1[14]; 182extern const u8 iwl_eeprom_band_1[14];
@@ -371,7 +374,7 @@ struct iwl_eeprom_ops {
371 int (*verify_signature) (struct iwl_priv *priv); 374 int (*verify_signature) (struct iwl_priv *priv);
372 int (*acquire_semaphore) (struct iwl_priv *priv); 375 int (*acquire_semaphore) (struct iwl_priv *priv);
373 void (*release_semaphore) (struct iwl_priv *priv); 376 void (*release_semaphore) (struct iwl_priv *priv);
374 int (*check_version) (struct iwl_priv *priv); 377 u16 (*calib_version) (struct iwl_priv *priv);
375 const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset); 378 const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset);
376}; 379};
377 380