aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-eeprom.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index ce2f47306ce..75517d05df0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -145,7 +145,7 @@ int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
145{ 145{
146 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 146 u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
147 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { 147 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
148 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); 148 IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
149 return -ENOENT; 149 return -ENOENT;
150 } 150 }
151 return 0; 151 return 0;
@@ -173,7 +173,7 @@ int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv)
173 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, 173 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
174 EEPROM_SEM_TIMEOUT); 174 EEPROM_SEM_TIMEOUT);
175 if (ret >= 0) { 175 if (ret >= 0) {
176 IWL_DEBUG_IO("Acquired semaphore after %d tries.\n", 176 IWL_DEBUG_IO(priv, "Acquired semaphore after %d tries.\n",
177 count+1); 177 count+1);
178 return ret; 178 return ret;
179 } 179 }
@@ -223,7 +223,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
223 223
224 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); 224 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
225 if (ret < 0) { 225 if (ret < 0) {
226 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); 226 IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
227 ret = -ENOENT; 227 ret = -ENOENT;
228 goto err; 228 goto err;
229 } 229 }
@@ -231,7 +231,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
231 /* Make sure driver (instead of uCode) is allowed to read EEPROM */ 231 /* Make sure driver (instead of uCode) is allowed to read EEPROM */
232 ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv); 232 ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv);
233 if (ret < 0) { 233 if (ret < 0) {
234 IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); 234 IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n");
235 ret = -ENOENT; 235 ret = -ENOENT;
236 goto err; 236 goto err;
237 } 237 }
@@ -247,7 +247,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
247 CSR_EEPROM_REG_READ_VALID_MSK, 247 CSR_EEPROM_REG_READ_VALID_MSK,
248 IWL_EEPROM_ACCESS_TIMEOUT); 248 IWL_EEPROM_ACCESS_TIMEOUT);
249 if (ret < 0) { 249 if (ret < 0) {
250 IWL_ERROR("Time out reading EEPROM[%d]\n", addr); 250 IWL_ERR(priv, "Time out reading EEPROM[%d]\n", addr);
251 goto done; 251 goto done;
252 } 252 }
253 r = _iwl_read_direct32(priv, CSR_EEPROM_REG); 253 r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
@@ -285,7 +285,7 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
285 285
286 return 0; 286 return 0;
287err: 287err:
288 IWL_ERROR("Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 288 IWL_ERR(priv, "Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
289 eeprom_ver, priv->cfg->eeprom_ver, 289 eeprom_ver, priv->cfg->eeprom_ver,
290 calib_ver, priv->cfg->eeprom_calib_ver); 290 calib_ver, priv->cfg->eeprom_calib_ver);
291 return -EINVAL; 291 return -EINVAL;
@@ -390,7 +390,7 @@ static int iwl_set_fat_chan_info(struct iwl_priv *priv,
390 if (!is_channel_valid(ch_info)) 390 if (!is_channel_valid(ch_info))
391 return -1; 391 return -1;
392 392
393 IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" 393 IWL_DEBUG_INFO(priv, "FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
394 " Ad-Hoc %ssupported\n", 394 " Ad-Hoc %ssupported\n",
395 ch_info->channel, 395 ch_info->channel,
396 is_channel_a_band(ch_info) ? 396 is_channel_a_band(ch_info) ?
@@ -432,11 +432,11 @@ int iwl_init_channel_map(struct iwl_priv *priv)
432 struct iwl_channel_info *ch_info; 432 struct iwl_channel_info *ch_info;
433 433
434 if (priv->channel_count) { 434 if (priv->channel_count) {
435 IWL_DEBUG_INFO("Channel map already initialized.\n"); 435 IWL_DEBUG_INFO(priv, "Channel map already initialized.\n");
436 return 0; 436 return 0;
437 } 437 }
438 438
439 IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); 439 IWL_DEBUG_INFO(priv, "Initializing regulatory info from EEPROM\n");
440 440
441 priv->channel_count = 441 priv->channel_count =
442 ARRAY_SIZE(iwl_eeprom_band_1) + 442 ARRAY_SIZE(iwl_eeprom_band_1) +
@@ -445,12 +445,12 @@ int iwl_init_channel_map(struct iwl_priv *priv)
445 ARRAY_SIZE(iwl_eeprom_band_4) + 445 ARRAY_SIZE(iwl_eeprom_band_4) +
446 ARRAY_SIZE(iwl_eeprom_band_5); 446 ARRAY_SIZE(iwl_eeprom_band_5);
447 447
448 IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); 448 IWL_DEBUG_INFO(priv, "Parsing data for %d channels.\n", priv->channel_count);
449 449
450 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * 450 priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) *
451 priv->channel_count, GFP_KERNEL); 451 priv->channel_count, GFP_KERNEL);
452 if (!priv->channel_info) { 452 if (!priv->channel_info) {
453 IWL_ERROR("Could not allocate channel_info\n"); 453 IWL_ERR(priv, "Could not allocate channel_info\n");
454 priv->channel_count = 0; 454 priv->channel_count = 0;
455 return -ENOMEM; 455 return -ENOMEM;
456 } 456 }
@@ -485,7 +485,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
485 IEEE80211_CHAN_NO_FAT_BELOW); 485 IEEE80211_CHAN_NO_FAT_BELOW);
486 486
487 if (!(is_channel_valid(ch_info))) { 487 if (!(is_channel_valid(ch_info))) {
488 IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - " 488 IWL_DEBUG_INFO(priv, "Ch. %d Flags %x [%sGHz] - "
489 "No traffic\n", 489 "No traffic\n",
490 ch_info->channel, 490 ch_info->channel,
491 ch_info->flags, 491 ch_info->flags,
@@ -501,7 +501,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
501 ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; 501 ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
502 ch_info->min_power = 0; 502 ch_info->min_power = 0;
503 503
504 IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm):" 504 IWL_DEBUG_INFO(priv, "Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm):"
505 " Ad-Hoc %ssupported\n", 505 " Ad-Hoc %ssupported\n",
506 ch_info->channel, 506 ch_info->channel,
507 is_channel_a_band(ch_info) ? 507 is_channel_a_band(ch_info) ?
@@ -520,7 +520,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
520 flags & EEPROM_CHANNEL_RADAR)) 520 flags & EEPROM_CHANNEL_RADAR))
521 ? "" : "not "); 521 ? "" : "not ");
522 522
523 /* Set the user_txpower_limit to the highest power 523 /* Set the tx_power_user_lmt to the highest power
524 * supported by any channel */ 524 * supported by any channel */
525 if (eeprom_ch_info[ch].max_power_avg > 525 if (eeprom_ch_info[ch].max_power_avg >
526 priv->tx_power_user_lmt) 526 priv->tx_power_user_lmt)
@@ -531,6 +531,13 @@ int iwl_init_channel_map(struct iwl_priv *priv)
531 } 531 }
532 } 532 }
533 533
534 /* Check if we do have FAT channels */
535 if (priv->cfg->ops->lib->eeprom_ops.regulatory_bands[5] ==
536 EEPROM_REGULATORY_BAND_NO_FAT &&
537 priv->cfg->ops->lib->eeprom_ops.regulatory_bands[6] ==
538 EEPROM_REGULATORY_BAND_NO_FAT)
539 return 0;
540
534 /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */ 541 /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */
535 for (band = 6; band <= 7; band++) { 542 for (band = 6; band <= 7; band++) {
536 enum ieee80211_band ieeeband; 543 enum ieee80211_band ieeeband;
@@ -582,6 +589,7 @@ void iwl_free_channel_map(struct iwl_priv *priv)
582 kfree(priv->channel_info); 589 kfree(priv->channel_info);
583 priv->channel_count = 0; 590 priv->channel_count = 0;
584} 591}
592EXPORT_SYMBOL(iwl_free_channel_map);
585 593
586/** 594/**
587 * iwl_get_channel_info - Find driver's private channel info 595 * iwl_get_channel_info - Find driver's private channel info