iwl-6000.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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 IWL6000_UCODE_API_MAX 3
  47. #define IWL6050_UCODE_API_MAX 3
  48. /* Lowest firmware API version supported */
  49. #define IWL6000_UCODE_API_MIN 1
  50. #define IWL6050_UCODE_API_MIN 1
  51. #define IWL6000_FW_PRE "iwlwifi-6000-"
  52. #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
  53. #define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
  54. #define IWL6050_FW_PRE "iwlwifi-6050-"
  55. #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
  56. #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
  57. static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
  58. {
  59. /* want Celsius */
  60. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
  61. priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
  62. }
  63. static struct iwl_lib_ops iwl6000_lib = {
  64. .set_hw_params = iwl5000_hw_set_hw_params,
  65. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  66. .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
  67. .txq_set_sched = iwl5000_txq_set_sched,
  68. .txq_agg_enable = iwl5000_txq_agg_enable,
  69. .txq_agg_disable = iwl5000_txq_agg_disable,
  70. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  71. .txq_free_tfd = iwl_hw_txq_free_tfd,
  72. .txq_init = iwl_hw_tx_queue_init,
  73. .rx_handler_setup = iwl5000_rx_handler_setup,
  74. .setup_deferred_work = iwl5000_setup_deferred_work,
  75. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  76. .load_ucode = iwl5000_load_ucode,
  77. .init_alive_start = iwl5000_init_alive_start,
  78. .alive_notify = iwl5000_alive_notify,
  79. .send_tx_power = iwl5000_send_tx_power,
  80. .update_chain_flags = iwl_update_chain_flags,
  81. .apm_ops = {
  82. .init = iwl5000_apm_init,
  83. .reset = iwl5000_apm_reset,
  84. .stop = iwl5000_apm_stop,
  85. .config = iwl5000_nic_config,
  86. .set_pwr_src = iwl_set_pwr_src,
  87. },
  88. .eeprom_ops = {
  89. .regulatory_bands = {
  90. EEPROM_5000_REG_BAND_1_CHANNELS,
  91. EEPROM_5000_REG_BAND_2_CHANNELS,
  92. EEPROM_5000_REG_BAND_3_CHANNELS,
  93. EEPROM_5000_REG_BAND_4_CHANNELS,
  94. EEPROM_5000_REG_BAND_5_CHANNELS,
  95. EEPROM_5000_REG_BAND_24_FAT_CHANNELS,
  96. EEPROM_5000_REG_BAND_52_FAT_CHANNELS
  97. },
  98. .verify_signature = iwlcore_eeprom_verify_signature,
  99. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  100. .release_semaphore = iwlcore_eeprom_release_semaphore,
  101. .calib_version = iwl5000_eeprom_calib_version,
  102. .query_addr = iwl5000_eeprom_query_addr,
  103. },
  104. .post_associate = iwl_post_associate,
  105. .isr = iwl_isr_ict,
  106. .config_ap = iwl_config_ap,
  107. .temp_ops = {
  108. .temperature = iwl5000_temperature,
  109. .set_ct_kill = iwl6000_set_ct_threshold,
  110. },
  111. };
  112. static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = {
  113. .get_hcmd_size = iwl5000_get_hcmd_size,
  114. .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
  115. .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag,
  116. .calc_rssi = iwl5000_calc_rssi,
  117. };
  118. static struct iwl_ops iwl6000_ops = {
  119. .ucode = &iwl5000_ucode,
  120. .lib = &iwl6000_lib,
  121. .hcmd = &iwl5000_hcmd,
  122. .utils = &iwl6000_hcmd_utils,
  123. };
  124. struct iwl_cfg iwl6000_2ag_cfg = {
  125. .name = "6000 Series 2x2 AG",
  126. .fw_name_pre = IWL6000_FW_PRE,
  127. .ucode_api_max = IWL6000_UCODE_API_MAX,
  128. .ucode_api_min = IWL6000_UCODE_API_MIN,
  129. .sku = IWL_SKU_A|IWL_SKU_G,
  130. .ops = &iwl6000_ops,
  131. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  132. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  133. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  134. .mod_params = &iwl50_mod_params,
  135. .valid_tx_ant = ANT_BC,
  136. .valid_rx_ant = ANT_BC,
  137. .need_pll_cfg = false,
  138. };
  139. struct iwl_cfg iwl6000_2agn_cfg = {
  140. .name = "6000 Series 2x2 AGN",
  141. .fw_name_pre = IWL6000_FW_PRE,
  142. .ucode_api_max = IWL6000_UCODE_API_MAX,
  143. .ucode_api_min = IWL6000_UCODE_API_MIN,
  144. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  145. .ops = &iwl6000_ops,
  146. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  147. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  148. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  149. .mod_params = &iwl50_mod_params,
  150. .valid_tx_ant = ANT_AB,
  151. .valid_rx_ant = ANT_AB,
  152. .need_pll_cfg = false,
  153. };
  154. struct iwl_cfg iwl6050_2agn_cfg = {
  155. .name = "6050 Series 2x2 AGN",
  156. .fw_name_pre = IWL6050_FW_PRE,
  157. .ucode_api_max = IWL6050_UCODE_API_MAX,
  158. .ucode_api_min = IWL6050_UCODE_API_MIN,
  159. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  160. .ops = &iwl6000_ops,
  161. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  162. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  163. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  164. .mod_params = &iwl50_mod_params,
  165. .valid_tx_ant = ANT_AB,
  166. .valid_rx_ant = ANT_AB,
  167. .need_pll_cfg = false,
  168. };
  169. struct iwl_cfg iwl6000_3agn_cfg = {
  170. .name = "6000 Series 3x3 AGN",
  171. .fw_name_pre = IWL6000_FW_PRE,
  172. .ucode_api_max = IWL6000_UCODE_API_MAX,
  173. .ucode_api_min = IWL6000_UCODE_API_MIN,
  174. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  175. .ops = &iwl6000_ops,
  176. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  177. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  178. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  179. .mod_params = &iwl50_mod_params,
  180. .valid_tx_ant = ANT_ABC,
  181. .valid_rx_ant = ANT_ABC,
  182. .need_pll_cfg = false,
  183. };
  184. struct iwl_cfg iwl6050_3agn_cfg = {
  185. .name = "6050 Series 3x3 AGN",
  186. .fw_name_pre = IWL6050_FW_PRE,
  187. .ucode_api_max = IWL6050_UCODE_API_MAX,
  188. .ucode_api_min = IWL6050_UCODE_API_MIN,
  189. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  190. .ops = &iwl6000_ops,
  191. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  192. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  193. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  194. .mod_params = &iwl50_mod_params,
  195. .valid_tx_ant = ANT_ABC,
  196. .valid_rx_ant = ANT_ABC,
  197. .need_pll_cfg = false,
  198. };
  199. MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
  200. MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));