iwl-1000.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 = iwl_apm_init,
  104. .stop = iwl_apm_stop,
  105. .config = iwl1000_nic_config,
  106. .set_pwr_src = iwl_set_pwr_src,
  107. },
  108. .eeprom_ops = {
  109. .regulatory_bands = {
  110. EEPROM_5000_REG_BAND_1_CHANNELS,
  111. EEPROM_5000_REG_BAND_2_CHANNELS,
  112. EEPROM_5000_REG_BAND_3_CHANNELS,
  113. EEPROM_5000_REG_BAND_4_CHANNELS,
  114. EEPROM_5000_REG_BAND_5_CHANNELS,
  115. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  116. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  117. },
  118. .verify_signature = iwlcore_eeprom_verify_signature,
  119. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  120. .release_semaphore = iwlcore_eeprom_release_semaphore,
  121. .calib_version = iwl5000_eeprom_calib_version,
  122. .query_addr = iwl5000_eeprom_query_addr,
  123. },
  124. .post_associate = iwl_post_associate,
  125. .isr = iwl_isr_ict,
  126. .config_ap = iwl_config_ap,
  127. .temp_ops = {
  128. .temperature = iwl5000_temperature,
  129. .set_ct_kill = iwl1000_set_ct_threshold,
  130. },
  131. };
  132. static struct iwl_ops iwl1000_ops = {
  133. .ucode = &iwl5000_ucode,
  134. .lib = &iwl1000_lib,
  135. .hcmd = &iwl5000_hcmd,
  136. .utils = &iwl5000_hcmd_utils,
  137. .led = &iwlagn_led_ops,
  138. };
  139. struct iwl_cfg iwl1000_bgn_cfg = {
  140. .name = "1000 Series BGN",
  141. .fw_name_pre = IWL1000_FW_PRE,
  142. .ucode_api_max = IWL1000_UCODE_API_MAX,
  143. .ucode_api_min = IWL1000_UCODE_API_MIN,
  144. .sku = IWL_SKU_G|IWL_SKU_N,
  145. .ops = &iwl1000_ops,
  146. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  147. .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
  148. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  149. .num_of_queues = IWL50_NUM_QUEUES,
  150. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  151. .mod_params = &iwl50_mod_params,
  152. .valid_tx_ant = ANT_A,
  153. .valid_rx_ant = ANT_AB,
  154. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  155. .set_l0s = true,
  156. .use_bsm = false,
  157. .max_ll_items = OTP_MAX_LL_ITEMS_1000,
  158. .shadow_ram_support = false,
  159. .ht_greenfield_support = true,
  160. .led_compensation = 51,
  161. .use_rts_for_ht = true, /* use rts/cts protection */
  162. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  163. .support_ct_kill_exit = true,
  164. .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED,
  165. };
  166. struct iwl_cfg iwl1000_bg_cfg = {
  167. .name = "1000 Series BG",
  168. .fw_name_pre = IWL1000_FW_PRE,
  169. .ucode_api_max = IWL1000_UCODE_API_MAX,
  170. .ucode_api_min = IWL1000_UCODE_API_MIN,
  171. .sku = IWL_SKU_G,
  172. .ops = &iwl1000_ops,
  173. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  174. .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
  175. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  176. .num_of_queues = IWL50_NUM_QUEUES,
  177. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  178. .mod_params = &iwl50_mod_params,
  179. .valid_tx_ant = ANT_A,
  180. .valid_rx_ant = ANT_AB,
  181. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  182. .set_l0s = true,
  183. .use_bsm = false,
  184. .max_ll_items = OTP_MAX_LL_ITEMS_1000,
  185. .shadow_ram_support = false,
  186. .ht_greenfield_support = true,
  187. .led_compensation = 51,
  188. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  189. .support_ct_kill_exit = true,
  190. };
  191. MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));