iwl-1000.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. #include "iwl-agn-led.h"
  46. /* Highest firmware API version supported */
  47. #define IWL1000_UCODE_API_MAX 3
  48. /* Lowest firmware API version supported */
  49. #define IWL1000_UCODE_API_MIN 1
  50. #define IWL1000_FW_PRE "iwlwifi-1000-"
  51. #define _IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE #api ".ucode"
  52. #define IWL1000_MODULE_FIRMWARE(api) _IWL1000_MODULE_FIRMWARE(api)
  53. /*
  54. * For 1000, use advance thermal throttling critical temperature threshold,
  55. * but legacy thermal management implementation for now.
  56. * This is for the reason of 1000 uCode using advance thermal throttling API
  57. * but not implement ct_kill_exit based on ct_kill exit temperature
  58. * so the thermal throttling will still based on legacy thermal throttling
  59. * management.
  60. * The code here need to be modified once 1000 uCode has the advanced thermal
  61. * throttling algorithm in place
  62. */
  63. static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
  64. {
  65. /* want Celsius */
  66. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
  67. priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
  68. }
  69. /* NIC configuration for 1000 series */
  70. static void iwl1000_nic_config(struct iwl_priv *priv)
  71. {
  72. /* set CSR_HW_CONFIG_REG for uCode use */
  73. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  74. CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
  75. CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
  76. /* Setting digital SVR for 1000 card to 1.32V */
  77. /* locking is acquired in iwl_set_bits_mask_prph() function */
  78. iwl_set_bits_mask_prph(priv, APMG_DIGITAL_SVR_REG,
  79. APMG_SVR_DIGITAL_VOLTAGE_1_32,
  80. ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
  81. }
  82. static struct iwl_lib_ops iwl1000_lib = {
  83. .set_hw_params = iwl5000_hw_set_hw_params,
  84. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  85. .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
  86. .txq_set_sched = iwl5000_txq_set_sched,
  87. .txq_agg_enable = iwl5000_txq_agg_enable,
  88. .txq_agg_disable = iwl5000_txq_agg_disable,
  89. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  90. .txq_free_tfd = iwl_hw_txq_free_tfd,
  91. .txq_init = iwl_hw_tx_queue_init,
  92. .rx_handler_setup = iwl5000_rx_handler_setup,
  93. .setup_deferred_work = iwl5000_setup_deferred_work,
  94. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  95. .load_ucode = iwl5000_load_ucode,
  96. .dump_nic_event_log = iwl_dump_nic_event_log,
  97. .dump_nic_error_log = iwl_dump_nic_error_log,
  98. .init_alive_start = iwl5000_init_alive_start,
  99. .alive_notify = iwl5000_alive_notify,
  100. .send_tx_power = iwl5000_send_tx_power,
  101. .update_chain_flags = iwl_update_chain_flags,
  102. .apm_ops = {
  103. .init = iwl5000_apm_init,
  104. .reset = iwl5000_apm_reset,
  105. .stop = iwl_apm_stop,
  106. .config = iwl1000_nic_config,
  107. .set_pwr_src = iwl_set_pwr_src,
  108. },
  109. .eeprom_ops = {
  110. .regulatory_bands = {
  111. EEPROM_5000_REG_BAND_1_CHANNELS,
  112. EEPROM_5000_REG_BAND_2_CHANNELS,
  113. EEPROM_5000_REG_BAND_3_CHANNELS,
  114. EEPROM_5000_REG_BAND_4_CHANNELS,
  115. EEPROM_5000_REG_BAND_5_CHANNELS,
  116. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  117. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  118. },
  119. .verify_signature = iwlcore_eeprom_verify_signature,
  120. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  121. .release_semaphore = iwlcore_eeprom_release_semaphore,
  122. .calib_version = iwl5000_eeprom_calib_version,
  123. .query_addr = iwl5000_eeprom_query_addr,
  124. },
  125. .post_associate = iwl_post_associate,
  126. .isr = iwl_isr_ict,
  127. .config_ap = iwl_config_ap,
  128. .temp_ops = {
  129. .temperature = iwl5000_temperature,
  130. .set_ct_kill = iwl1000_set_ct_threshold,
  131. },
  132. };
  133. static struct iwl_ops iwl1000_ops = {
  134. .ucode = &iwl5000_ucode,
  135. .lib = &iwl1000_lib,
  136. .hcmd = &iwl5000_hcmd,
  137. .utils = &iwl5000_hcmd_utils,
  138. .led = &iwlagn_led_ops,
  139. };
  140. struct iwl_cfg iwl1000_bgn_cfg = {
  141. .name = "1000 Series BGN",
  142. .fw_name_pre = IWL1000_FW_PRE,
  143. .ucode_api_max = IWL1000_UCODE_API_MAX,
  144. .ucode_api_min = IWL1000_UCODE_API_MIN,
  145. .sku = IWL_SKU_G|IWL_SKU_N,
  146. .ops = &iwl1000_ops,
  147. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  148. .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
  149. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  150. .mod_params = &iwl50_mod_params,
  151. .valid_tx_ant = ANT_A,
  152. .valid_rx_ant = ANT_AB,
  153. .need_pll_cfg = true,
  154. .max_ll_items = OTP_MAX_LL_ITEMS_1000,
  155. .shadow_ram_support = false,
  156. .ht_greenfield_support = true,
  157. .led_compensation = 51,
  158. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  159. };
  160. struct iwl_cfg iwl1000_bg_cfg = {
  161. .name = "1000 Series BG",
  162. .fw_name_pre = IWL1000_FW_PRE,
  163. .ucode_api_max = IWL1000_UCODE_API_MAX,
  164. .ucode_api_min = IWL1000_UCODE_API_MIN,
  165. .sku = IWL_SKU_G,
  166. .ops = &iwl1000_ops,
  167. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  168. .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
  169. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  170. .mod_params = &iwl50_mod_params,
  171. .valid_tx_ant = ANT_A,
  172. .valid_rx_ant = ANT_AB,
  173. .need_pll_cfg = true,
  174. .max_ll_items = OTP_MAX_LL_ITEMS_1000,
  175. .shadow_ram_support = false,
  176. .ht_greenfield_support = true,
  177. .led_compensation = 51,
  178. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  179. };
  180. MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));