aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-04-23 20:14:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:17 -0400
commit8614f360bdc7db8d35609a9c771601f1d45539e5 (patch)
tree9309ba2f774ea22552bafc9f68585ddb3ebce67d /drivers
parentb661c8190e91c0baeebf813fec7ff8e99e155a54 (diff)
iwlwifi: check eeprom version in pci probe time
This patch move eeprom version checking into pci probe stage 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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c32
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c4
4 files changed, 38 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index d1ddbf34b7fe..a41a83a5f816 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -494,6 +494,31 @@ int iwl4965_hw_rxq_stop(struct iwl_priv *priv)
494 return 0; 494 return 0;
495} 495}
496 496
497/*
498 * EEPROM handlers
499 */
500
501static int iwl4965_eeprom_check_version(struct iwl_priv *priv)
502{
503 u16 eeprom_ver;
504 u16 calib_ver;
505
506 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
507
508 calib_ver = iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET);
509
510 if (eeprom_ver < EEPROM_4965_EEPROM_VERSION ||
511 calib_ver < EEPROM_4965_TX_POWER_VERSION)
512 goto err;
513
514 return 0;
515err:
516 IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
517 eeprom_ver, EEPROM_4965_EEPROM_VERSION,
518 calib_ver, EEPROM_4965_TX_POWER_VERSION);
519 return -EINVAL;
520
521}
497int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 522int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
498{ 523{
499 int ret; 524 int ret;
@@ -763,12 +788,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
763 788
764 spin_unlock_irqrestore(&priv->lock, flags); 789 spin_unlock_irqrestore(&priv->lock, flags);
765 790
766 if (iwl_eeprom_query16(priv, EEPROM_4965_CALIB_VERSION_OFFSET) <
767 EEPROM_4965_TX_POWER_VERSION) {
768 IWL_ERROR("Older EEPROM detected! Aborting.\n");
769 return -EINVAL;
770 }
771
772 pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); 791 pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link);
773 792
774 /* disable L1 entry -- workaround for pre-B1 */ 793 /* disable L1 entry -- workaround for pre-B1 */
@@ -4354,6 +4373,7 @@ static struct iwl_lib_ops iwl4965_lib = {
4354 .verify_signature = iwlcore_eeprom_verify_signature, 4373 .verify_signature = iwlcore_eeprom_verify_signature,
4355 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, 4374 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
4356 .release_semaphore = iwlcore_eeprom_release_semaphore, 4375 .release_semaphore = iwlcore_eeprom_release_semaphore,
4376 .check_version = iwl4965_eeprom_check_version,
4357 .query_addr = iwlcore_eeprom_query_addr, 4377 .query_addr = iwlcore_eeprom_query_addr,
4358 }, 4378 },
4359 .radio_kill_sw = iwl4965_radio_kill_sw, 4379 .radio_kill_sw = iwl4965_radio_kill_sw,
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index efd48ca27a8e..8bec0e32f1fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -279,6 +279,11 @@ void iwl_eeprom_free(struct iwl_priv *priv)
279} 279}
280EXPORT_SYMBOL(iwl_eeprom_free); 280EXPORT_SYMBOL(iwl_eeprom_free);
281 281
282int iwl_eeprom_check_version(struct iwl_priv *priv)
283{
284 return priv->cfg->ops->lib->eeprom_ops.check_version(priv);
285}
286EXPORT_SYMBOL(iwl_eeprom_check_version);
282 287
283const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset) 288const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset)
284{ 289{
@@ -423,12 +428,6 @@ int iwl_init_channel_map(struct iwl_priv *priv)
423 return 0; 428 return 0;
424 } 429 }
425 430
426 if (iwl_eeprom_query16(priv, EEPROM_VERSION) < 0x2f) {
427 IWL_WARNING("Unsupported EEPROM version: 0x%04X\n",
428 iwl_eeprom_query16(priv, EEPROM_VERSION));
429 return -EINVAL;
430 }
431
432 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); 431 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
433 432
434 priv->channel_count = 433 priv->channel_count =
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index d5768146d02f..57fb89d5621b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -134,6 +134,7 @@ struct iwl_eeprom_channel {
134/* 4965 Specific */ 134/* 4965 Specific */
135/* 4965 driver does not work with txpower calibration version < 5 */ 135/* 4965 driver does not work with txpower calibration version < 5 */
136#define EEPROM_4965_TX_POWER_VERSION (5) 136#define EEPROM_4965_TX_POWER_VERSION (5)
137#define EEPROM_4965_EEPROM_VERSION (0x2f)
137#define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ 138#define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
138#define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ 139#define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
139#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */ 140#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
@@ -322,6 +323,7 @@ struct iwl_eeprom_ops {
322 int (*verify_signature) (struct iwl_priv *priv); 323 int (*verify_signature) (struct iwl_priv *priv);
323 int (*acquire_semaphore) (struct iwl_priv *priv); 324 int (*acquire_semaphore) (struct iwl_priv *priv);
324 void (*release_semaphore) (struct iwl_priv *priv); 325 void (*release_semaphore) (struct iwl_priv *priv);
326 int (*check_version) (struct iwl_priv *priv);
325 const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset); 327 const u8* (*query_addr) (const struct iwl_priv *priv, size_t offset);
326}; 328};
327 329
@@ -329,6 +331,7 @@ struct iwl_eeprom_ops {
329void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac); 331void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);
330int iwl_eeprom_init(struct iwl_priv *priv); 332int iwl_eeprom_init(struct iwl_priv *priv);
331void iwl_eeprom_free(struct iwl_priv *priv); 333void iwl_eeprom_free(struct iwl_priv *priv);
334int iwl_eeprom_check_version(struct iwl_priv *priv);
332const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset); 335const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset);
333u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset); 336u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset);
334 337
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 368fc9a9c2b0..c532584b11e6 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -7479,6 +7479,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7479 IWL_ERROR("Unable to init EEPROM\n"); 7479 IWL_ERROR("Unable to init EEPROM\n");
7480 goto out_iounmap; 7480 goto out_iounmap;
7481 } 7481 }
7482 err = iwl_eeprom_check_version(priv);
7483 if (err)
7484 goto out_iounmap;
7485
7482 /* MAC Address location in EEPROM same for 3945/4965 */ 7486 /* MAC Address location in EEPROM same for 3945/4965 */
7483 iwl_eeprom_get_mac(priv, priv->mac_addr); 7487 iwl_eeprom_get_mac(priv, priv->mac_addr);
7484 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); 7488 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));