iwl-1000.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2008-2009 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. #include <linux/kernel.h>
  27. #include <linux/module.h>
  28. #include <linux/init.h>
  29. #include <linux/pci.h>
  30. #include <linux/dma-mapping.h>
  31. #include <linux/delay.h>
  32. #include <linux/skbuff.h>
  33. #include <linux/netdevice.h>
  34. #include <linux/wireless.h>
  35. #include <net/mac80211.h>
  36. #include <linux/etherdevice.h>
  37. #include <asm/unaligned.h>
  38. #include "iwl-eeprom.h"
  39. #include "iwl-dev.h"
  40. #include "iwl-core.h"
  41. #include "iwl-io.h"
  42. #include "iwl-sta.h"
  43. #include "iwl-helpers.h"
  44. #include "iwl-5000-hw.h"
  45. /* Highest firmware API version supported */
  46. #define IWL1000_UCODE_API_MAX 3
  47. /* Lowest firmware API version supported */
  48. #define IWL1000_UCODE_API_MIN 1
  49. #define IWL1000_FW_PRE "iwlwifi-1000-"
  50. #define _IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE #api ".ucode"
  51. #define IWL1000_MODULE_FIRMWARE(api) _IWL1000_MODULE_FIRMWARE(api)
  52. /*
  53. * For 1000, use advance thermal throttling critical temperature threshold,
  54. * but legacy thermal management implementation for now.
  55. * This is for the reason of 1000 uCode using advance thermal throttling API
  56. * but not implement ct_kill_exit based on ct_kill exit temperature
  57. * so the thermal throttling will still based on legacy thermal throttling
  58. * management.
  59. * The code here need to be modified once 1000 uCode has the advanced thermal
  60. * throttling algorithm in place
  61. */
  62. static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
  63. {
  64. /* want Celsius */
  65. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
  66. priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
  67. }
  68. /* NIC configuration for 1000 series */
  69. static void iwl1000_nic_config(struct iwl_priv *priv)
  70. {
  71. iwl5000_nic_config(priv);
  72. /* Setting digital SVR for 1000 card to 1.32V */
  73. /* locking is acquired in iwl_set_bits_mask_prph() function */
  74. iwl_set_bits_mask_prph(priv, APMG_DIGITAL_SVR_REG,
  75. APMG_SVR_DIGITAL_VOLTAGE_1_32,
  76. ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
  77. }
  78. static struct iwl_lib_ops iwl1000_lib = {
  79. .set_hw_params = iwl5000_hw_set_hw_params,
  80. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  81. .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
  82. .txq_set_sched = iwl5000_txq_set_sched,
  83. .txq_agg_enable = iwl5000_txq_agg_enable,
  84. .txq_agg_disable = iwl5000_txq_agg_disable,
  85. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  86. .txq_free_tfd = iwl_hw_txq_free_tfd,
  87. .txq_init = iwl_hw_tx_queue_init,
  88. .rx_handler_setup = iwl5000_rx_handler_setup,
  89. .setup_deferred_work = iwl5000_setup_deferred_work,
  90. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  91. .load_ucode = iwl5000_load_ucode,
  92. .init_alive_start = iwl5000_init_alive_start,
  93. .alive_notify = iwl5000_alive_notify,
  94. .send_tx_power = iwl5000_send_tx_power,
  95. .update_chain_flags = iwl_update_chain_flags,
  96. .apm_ops = {
  97. .init = iwl5000_apm_init,
  98. .reset = iwl5000_apm_reset,
  99. .stop = iwl5000_apm_stop,
  100. .config = iwl1000_nic_config,
  101. .set_pwr_src = iwl_set_pwr_src,
  102. },
  103. .eeprom_ops = {
  104. .regulatory_bands = {
  105. EEPROM_5000_REG_BAND_1_CHANNELS,
  106. EEPROM_5000_REG_BAND_2_CHANNELS,
  107. EEPROM_5000_REG_BAND_3_CHANNELS,
  108. EEPROM_5000_REG_BAND_4_CHANNELS,
  109. EEPROM_5000_REG_BAND_5_CHANNELS,
  110. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  111. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  112. },
  113. .verify_signature = iwlcore_eeprom_verify_signature,
  114. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  115. .release_semaphore = iwlcore_eeprom_release_semaphore,
  116. .calib_version = iwl5000_eeprom_calib_version,
  117. .query_addr = iwl5000_eeprom_query_addr,
  118. },
  119. .post_associate = iwl_post_associate,
  120. .isr = iwl_isr_ict,
  121. .config_ap = iwl_config_ap,
  122. .temp_ops = {
  123. .temperature = iwl5000_temperature,
  124. .set_ct_kill = iwl1000_set_ct_threshold,
  125. },
  126. };
  127. static struct iwl_ops iwl1000_ops = {
  128. .ucode = &iwl5000_ucode,
  129. .lib = &iwl1000_lib,
  130. .hcmd = &iwl5000_hcmd,
  131. .utils = &iwl5000_hcmd_utils,
  132. };
  133. struct iwl_cfg iwl1000_bgn_cfg = {
  134. .name = "1000 Series BGN",
  135. .fw_name_pre = IWL1000_FW_PRE,
  136. .ucode_api_max = IWL1000_UCODE_API_MAX,
  137. .ucode_api_min = IWL1000_UCODE_API_MIN,
  138. .sku = IWL_SKU_G|IWL_SKU_N,
  139. .ops = &iwl1000_ops,
  140. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  141. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  142. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  143. .mod_params = &iwl50_mod_params,
  144. .valid_tx_ant = ANT_A,
  145. .valid_rx_ant = ANT_AB,
  146. .need_pll_cfg = true,
  147. .max_ll_items = OTP_MAX_LL_ITEMS_1000,
  148. .shadow_ram_support = false,
  149. .ht_greenfield_support = true,
  150. };