iwl-5000.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 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/sched.h>
  33. #include <linux/skbuff.h>
  34. #include <linux/netdevice.h>
  35. #include <linux/wireless.h>
  36. #include <net/mac80211.h>
  37. #include <linux/etherdevice.h>
  38. #include <asm/unaligned.h>
  39. #include "iwl-eeprom.h"
  40. #include "iwl-dev.h"
  41. #include "iwl-core.h"
  42. #include "iwl-io.h"
  43. #include "iwl-sta.h"
  44. #include "iwl-helpers.h"
  45. #include "iwl-agn.h"
  46. #include "iwl-agn-led.h"
  47. #include "iwl-agn-hw.h"
  48. #include "iwl-5000-hw.h"
  49. #include "iwl-agn-debugfs.h"
  50. /* Highest firmware API version supported */
  51. #define IWL5000_UCODE_API_MAX 5
  52. #define IWL5150_UCODE_API_MAX 2
  53. /* Lowest firmware API version supported */
  54. #define IWL5000_UCODE_API_MIN 1
  55. #define IWL5150_UCODE_API_MIN 1
  56. #define IWL5000_FW_PRE "iwlwifi-5000-"
  57. #define _IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE #api ".ucode"
  58. #define IWL5000_MODULE_FIRMWARE(api) _IWL5000_MODULE_FIRMWARE(api)
  59. #define IWL5150_FW_PRE "iwlwifi-5150-"
  60. #define _IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE #api ".ucode"
  61. #define IWL5150_MODULE_FIRMWARE(api) _IWL5150_MODULE_FIRMWARE(api)
  62. /* NIC configuration for 5000 series */
  63. static void iwl5000_nic_config(struct iwl_priv *priv)
  64. {
  65. unsigned long flags;
  66. u16 radio_cfg;
  67. spin_lock_irqsave(&priv->lock, flags);
  68. radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
  69. /* write radio config values to register */
  70. if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
  71. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  72. EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
  73. EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
  74. EEPROM_RF_CFG_DASH_MSK(radio_cfg));
  75. /* set CSR_HW_CONFIG_REG for uCode use */
  76. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  77. CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
  78. CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
  79. /* W/A : NIC is stuck in a reset state after Early PCIe power off
  80. * (PCIe power is lost before PERST# is asserted),
  81. * causing ME FW to lose ownership and not being able to obtain it back.
  82. */
  83. iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
  84. APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
  85. ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
  86. spin_unlock_irqrestore(&priv->lock, flags);
  87. }
  88. static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
  89. .min_nrg_cck = 95,
  90. .max_nrg_cck = 0, /* not used, set to 0 */
  91. .auto_corr_min_ofdm = 90,
  92. .auto_corr_min_ofdm_mrc = 170,
  93. .auto_corr_min_ofdm_x1 = 120,
  94. .auto_corr_min_ofdm_mrc_x1 = 240,
  95. .auto_corr_max_ofdm = 120,
  96. .auto_corr_max_ofdm_mrc = 210,
  97. .auto_corr_max_ofdm_x1 = 120,
  98. .auto_corr_max_ofdm_mrc_x1 = 240,
  99. .auto_corr_min_cck = 125,
  100. .auto_corr_max_cck = 200,
  101. .auto_corr_min_cck_mrc = 170,
  102. .auto_corr_max_cck_mrc = 400,
  103. .nrg_th_cck = 95,
  104. .nrg_th_ofdm = 95,
  105. .barker_corr_th_min = 190,
  106. .barker_corr_th_min_mrc = 390,
  107. .nrg_th_cca = 62,
  108. };
  109. static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
  110. .min_nrg_cck = 95,
  111. .max_nrg_cck = 0, /* not used, set to 0 */
  112. .auto_corr_min_ofdm = 90,
  113. .auto_corr_min_ofdm_mrc = 170,
  114. .auto_corr_min_ofdm_x1 = 105,
  115. .auto_corr_min_ofdm_mrc_x1 = 220,
  116. .auto_corr_max_ofdm = 120,
  117. .auto_corr_max_ofdm_mrc = 210,
  118. /* max = min for performance bug in 5150 DSP */
  119. .auto_corr_max_ofdm_x1 = 105,
  120. .auto_corr_max_ofdm_mrc_x1 = 220,
  121. .auto_corr_min_cck = 125,
  122. .auto_corr_max_cck = 200,
  123. .auto_corr_min_cck_mrc = 170,
  124. .auto_corr_max_cck_mrc = 400,
  125. .nrg_th_cck = 95,
  126. .nrg_th_ofdm = 95,
  127. .barker_corr_th_min = 190,
  128. .barker_corr_th_min_mrc = 390,
  129. .nrg_th_cca = 62,
  130. };
  131. static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
  132. {
  133. const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
  134. s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
  135. iwl_temp_calib_to_offset(priv);
  136. priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef;
  137. }
  138. static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
  139. {
  140. /* want Celsius */
  141. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
  142. }
  143. static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
  144. {
  145. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  146. priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
  147. priv->cfg->base_params->num_of_queues =
  148. priv->cfg->mod_params->num_of_queues;
  149. priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
  150. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  151. priv->hw_params.scd_bc_tbls_size =
  152. priv->cfg->base_params->num_of_queues *
  153. sizeof(struct iwlagn_scd_bc_tbl);
  154. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  155. priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
  156. priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
  157. priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
  158. priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
  159. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  160. BIT(IEEE80211_BAND_5GHZ);
  161. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  162. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  163. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  164. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  165. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  166. iwl5000_set_ct_threshold(priv);
  167. /* Set initial sensitivity parameters */
  168. /* Set initial calibration set */
  169. priv->hw_params.sens = &iwl5000_sensitivity;
  170. priv->hw_params.calib_init_cfg =
  171. BIT(IWL_CALIB_XTAL) |
  172. BIT(IWL_CALIB_LO) |
  173. BIT(IWL_CALIB_TX_IQ) |
  174. BIT(IWL_CALIB_TX_IQ_PERD) |
  175. BIT(IWL_CALIB_BASE_BAND);
  176. priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
  177. return 0;
  178. }
  179. static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
  180. {
  181. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  182. priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
  183. priv->cfg->base_params->num_of_queues =
  184. priv->cfg->mod_params->num_of_queues;
  185. priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
  186. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  187. priv->hw_params.scd_bc_tbls_size =
  188. priv->cfg->base_params->num_of_queues *
  189. sizeof(struct iwlagn_scd_bc_tbl);
  190. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  191. priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
  192. priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
  193. priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
  194. priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
  195. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  196. BIT(IEEE80211_BAND_5GHZ);
  197. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  198. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  199. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  200. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  201. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  202. iwl5150_set_ct_threshold(priv);
  203. /* Set initial sensitivity parameters */
  204. /* Set initial calibration set */
  205. priv->hw_params.sens = &iwl5150_sensitivity;
  206. priv->hw_params.calib_init_cfg =
  207. BIT(IWL_CALIB_LO) |
  208. BIT(IWL_CALIB_TX_IQ) |
  209. BIT(IWL_CALIB_BASE_BAND);
  210. if (priv->cfg->need_dc_calib)
  211. priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC);
  212. priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
  213. return 0;
  214. }
  215. static void iwl5150_temperature(struct iwl_priv *priv)
  216. {
  217. u32 vt = 0;
  218. s32 offset = iwl_temp_calib_to_offset(priv);
  219. vt = le32_to_cpu(priv->_agn.statistics.general.common.temperature);
  220. vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
  221. /* now vt hold the temperature in Kelvin */
  222. priv->temperature = KELVIN_TO_CELSIUS(vt);
  223. iwl_tt_handler(priv);
  224. }
  225. static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
  226. struct ieee80211_channel_switch *ch_switch)
  227. {
  228. /*
  229. * MULTI-FIXME
  230. * See iwl_mac_channel_switch.
  231. */
  232. struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
  233. struct iwl5000_channel_switch_cmd cmd;
  234. const struct iwl_channel_info *ch_info;
  235. u32 switch_time_in_usec, ucode_switch_time;
  236. u16 ch;
  237. u32 tsf_low;
  238. u8 switch_count;
  239. u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
  240. struct ieee80211_vif *vif = ctx->vif;
  241. struct iwl_host_cmd hcmd = {
  242. .id = REPLY_CHANNEL_SWITCH,
  243. .len = sizeof(cmd),
  244. .flags = CMD_SYNC,
  245. .data = &cmd,
  246. };
  247. cmd.band = priv->band == IEEE80211_BAND_2GHZ;
  248. ch = ch_switch->channel->hw_value;
  249. IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
  250. ctx->active.channel, ch);
  251. cmd.channel = cpu_to_le16(ch);
  252. cmd.rxon_flags = ctx->staging.flags;
  253. cmd.rxon_filter_flags = ctx->staging.filter_flags;
  254. switch_count = ch_switch->count;
  255. tsf_low = ch_switch->timestamp & 0x0ffffffff;
  256. /*
  257. * calculate the ucode channel switch time
  258. * adding TSF as one of the factor for when to switch
  259. */
  260. if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
  261. if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
  262. beacon_interval)) {
  263. switch_count -= (priv->ucode_beacon_time -
  264. tsf_low) / beacon_interval;
  265. } else
  266. switch_count = 0;
  267. }
  268. if (switch_count <= 1)
  269. cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
  270. else {
  271. switch_time_in_usec =
  272. vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
  273. ucode_switch_time = iwl_usecs_to_beacons(priv,
  274. switch_time_in_usec,
  275. beacon_interval);
  276. cmd.switch_time = iwl_add_beacon_time(priv,
  277. priv->ucode_beacon_time,
  278. ucode_switch_time,
  279. beacon_interval);
  280. }
  281. IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
  282. cmd.switch_time);
  283. ch_info = iwl_get_channel_info(priv, priv->band, ch);
  284. if (ch_info)
  285. cmd.expect_beacon = is_channel_radar(ch_info);
  286. else {
  287. IWL_ERR(priv, "invalid channel switch from %u to %u\n",
  288. ctx->active.channel, ch);
  289. return -EFAULT;
  290. }
  291. priv->switch_rxon.channel = cmd.channel;
  292. priv->switch_rxon.switch_in_progress = true;
  293. return iwl_send_cmd_sync(priv, &hcmd);
  294. }
  295. static struct iwl_lib_ops iwl5000_lib = {
  296. .set_hw_params = iwl5000_hw_set_hw_params,
  297. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  298. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  299. .txq_set_sched = iwlagn_txq_set_sched,
  300. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  301. .txq_free_tfd = iwl_hw_txq_free_tfd,
  302. .txq_init = iwl_hw_tx_queue_init,
  303. .rx_handler_setup = iwlagn_rx_handler_setup,
  304. .setup_deferred_work = iwlagn_setup_deferred_work,
  305. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  306. .dump_nic_event_log = iwl_dump_nic_event_log,
  307. .dump_nic_error_log = iwl_dump_nic_error_log,
  308. .dump_csr = iwl_dump_csr,
  309. .dump_fh = iwl_dump_fh,
  310. .send_tx_power = iwlagn_send_tx_power,
  311. .update_chain_flags = iwl_update_chain_flags,
  312. .set_channel_switch = iwl5000_hw_channel_switch,
  313. .apm_ops = {
  314. .init = iwl_apm_init,
  315. .config = iwl5000_nic_config,
  316. },
  317. .eeprom_ops = {
  318. .regulatory_bands = {
  319. EEPROM_REG_BAND_1_CHANNELS,
  320. EEPROM_REG_BAND_2_CHANNELS,
  321. EEPROM_REG_BAND_3_CHANNELS,
  322. EEPROM_REG_BAND_4_CHANNELS,
  323. EEPROM_REG_BAND_5_CHANNELS,
  324. EEPROM_REG_BAND_24_HT40_CHANNELS,
  325. EEPROM_REG_BAND_52_HT40_CHANNELS
  326. },
  327. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  328. .release_semaphore = iwlcore_eeprom_release_semaphore,
  329. .calib_version = iwlagn_eeprom_calib_version,
  330. .query_addr = iwlagn_eeprom_query_addr,
  331. },
  332. .isr_ops = {
  333. .isr = iwl_isr_ict,
  334. .free = iwl_free_isr_ict,
  335. .alloc = iwl_alloc_isr_ict,
  336. .reset = iwl_reset_ict,
  337. .disable = iwl_disable_ict,
  338. },
  339. .temp_ops = {
  340. .temperature = iwlagn_temperature,
  341. },
  342. .debugfs_ops = {
  343. .rx_stats_read = iwl_ucode_rx_stats_read,
  344. .tx_stats_read = iwl_ucode_tx_stats_read,
  345. .general_stats_read = iwl_ucode_general_stats_read,
  346. .bt_stats_read = iwl_ucode_bt_stats_read,
  347. .reply_tx_error = iwl_reply_tx_error_read,
  348. },
  349. .txfifo_flush = iwlagn_txfifo_flush,
  350. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  351. .tt_ops = {
  352. .lower_power_detection = iwl_tt_is_low_power_state,
  353. .tt_power_mode = iwl_tt_current_power_mode,
  354. .ct_kill_check = iwl_check_for_ct_kill,
  355. }
  356. };
  357. static struct iwl_lib_ops iwl5150_lib = {
  358. .set_hw_params = iwl5150_hw_set_hw_params,
  359. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  360. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  361. .txq_set_sched = iwlagn_txq_set_sched,
  362. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  363. .txq_free_tfd = iwl_hw_txq_free_tfd,
  364. .txq_init = iwl_hw_tx_queue_init,
  365. .rx_handler_setup = iwlagn_rx_handler_setup,
  366. .setup_deferred_work = iwlagn_setup_deferred_work,
  367. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  368. .dump_nic_event_log = iwl_dump_nic_event_log,
  369. .dump_nic_error_log = iwl_dump_nic_error_log,
  370. .dump_csr = iwl_dump_csr,
  371. .send_tx_power = iwlagn_send_tx_power,
  372. .update_chain_flags = iwl_update_chain_flags,
  373. .set_channel_switch = iwl5000_hw_channel_switch,
  374. .apm_ops = {
  375. .init = iwl_apm_init,
  376. .config = iwl5000_nic_config,
  377. },
  378. .eeprom_ops = {
  379. .regulatory_bands = {
  380. EEPROM_REG_BAND_1_CHANNELS,
  381. EEPROM_REG_BAND_2_CHANNELS,
  382. EEPROM_REG_BAND_3_CHANNELS,
  383. EEPROM_REG_BAND_4_CHANNELS,
  384. EEPROM_REG_BAND_5_CHANNELS,
  385. EEPROM_REG_BAND_24_HT40_CHANNELS,
  386. EEPROM_REG_BAND_52_HT40_CHANNELS
  387. },
  388. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  389. .release_semaphore = iwlcore_eeprom_release_semaphore,
  390. .calib_version = iwlagn_eeprom_calib_version,
  391. .query_addr = iwlagn_eeprom_query_addr,
  392. },
  393. .isr_ops = {
  394. .isr = iwl_isr_ict,
  395. .free = iwl_free_isr_ict,
  396. .alloc = iwl_alloc_isr_ict,
  397. .reset = iwl_reset_ict,
  398. .disable = iwl_disable_ict,
  399. },
  400. .temp_ops = {
  401. .temperature = iwl5150_temperature,
  402. },
  403. .debugfs_ops = {
  404. .rx_stats_read = iwl_ucode_rx_stats_read,
  405. .tx_stats_read = iwl_ucode_tx_stats_read,
  406. .general_stats_read = iwl_ucode_general_stats_read,
  407. .bt_stats_read = iwl_ucode_bt_stats_read,
  408. .reply_tx_error = iwl_reply_tx_error_read,
  409. },
  410. .txfifo_flush = iwlagn_txfifo_flush,
  411. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  412. .tt_ops = {
  413. .lower_power_detection = iwl_tt_is_low_power_state,
  414. .tt_power_mode = iwl_tt_current_power_mode,
  415. .ct_kill_check = iwl_check_for_ct_kill,
  416. }
  417. };
  418. static const struct iwl_ops iwl5000_ops = {
  419. .lib = &iwl5000_lib,
  420. .hcmd = &iwlagn_hcmd,
  421. .utils = &iwlagn_hcmd_utils,
  422. .led = &iwlagn_led_ops,
  423. .ieee80211_ops = &iwlagn_hw_ops,
  424. };
  425. static const struct iwl_ops iwl5150_ops = {
  426. .lib = &iwl5150_lib,
  427. .hcmd = &iwlagn_hcmd,
  428. .utils = &iwlagn_hcmd_utils,
  429. .led = &iwlagn_led_ops,
  430. .ieee80211_ops = &iwlagn_hw_ops,
  431. };
  432. static struct iwl_base_params iwl5000_base_params = {
  433. .eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
  434. .num_of_queues = IWLAGN_NUM_QUEUES,
  435. .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
  436. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  437. .set_l0s = true,
  438. .led_compensation = 51,
  439. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  440. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  441. .chain_noise_scale = 1000,
  442. .wd_timeout = IWL_LONG_WD_TIMEOUT,
  443. .max_event_log_size = 512,
  444. .ucode_tracing = true,
  445. .sensitivity_calib_by_driver = true,
  446. .chain_noise_calib_by_driver = true,
  447. };
  448. static struct iwl_ht_params iwl5000_ht_params = {
  449. .ht_greenfield_support = true,
  450. .use_rts_for_aggregation = true, /* use rts/cts protection */
  451. };
  452. #define IWL_DEVICE_5000 \
  453. .fw_name_pre = IWL5000_FW_PRE, \
  454. .ucode_api_max = IWL5000_UCODE_API_MAX, \
  455. .ucode_api_min = IWL5000_UCODE_API_MIN, \
  456. .eeprom_ver = EEPROM_5000_EEPROM_VERSION, \
  457. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \
  458. .ops = &iwl5000_ops, \
  459. .mod_params = &iwlagn_mod_params, \
  460. .base_params = &iwl5000_base_params, \
  461. .led_mode = IWL_LED_BLINK
  462. struct iwl_cfg iwl5300_agn_cfg = {
  463. .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
  464. IWL_DEVICE_5000,
  465. .ht_params = &iwl5000_ht_params,
  466. };
  467. struct iwl_cfg iwl5100_bgn_cfg = {
  468. .name = "Intel(R) WiFi Link 5100 BGN",
  469. IWL_DEVICE_5000,
  470. .valid_tx_ant = ANT_B, /* .cfg overwrite */
  471. .valid_rx_ant = ANT_AB, /* .cfg overwrite */
  472. .ht_params = &iwl5000_ht_params,
  473. };
  474. struct iwl_cfg iwl5100_abg_cfg = {
  475. .name = "Intel(R) WiFi Link 5100 ABG",
  476. IWL_DEVICE_5000,
  477. .valid_tx_ant = ANT_B, /* .cfg overwrite */
  478. .valid_rx_ant = ANT_AB, /* .cfg overwrite */
  479. };
  480. struct iwl_cfg iwl5100_agn_cfg = {
  481. .name = "Intel(R) WiFi Link 5100 AGN",
  482. IWL_DEVICE_5000,
  483. .valid_tx_ant = ANT_B, /* .cfg overwrite */
  484. .valid_rx_ant = ANT_AB, /* .cfg overwrite */
  485. .ht_params = &iwl5000_ht_params,
  486. };
  487. struct iwl_cfg iwl5350_agn_cfg = {
  488. .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
  489. .fw_name_pre = IWL5000_FW_PRE,
  490. .ucode_api_max = IWL5000_UCODE_API_MAX,
  491. .ucode_api_min = IWL5000_UCODE_API_MIN,
  492. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  493. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  494. .ops = &iwl5000_ops,
  495. .mod_params = &iwlagn_mod_params,
  496. .base_params = &iwl5000_base_params,
  497. .ht_params = &iwl5000_ht_params,
  498. .led_mode = IWL_LED_BLINK,
  499. .internal_wimax_coex = true,
  500. };
  501. #define IWL_DEVICE_5150 \
  502. .fw_name_pre = IWL5150_FW_PRE, \
  503. .ucode_api_max = IWL5150_UCODE_API_MAX, \
  504. .ucode_api_min = IWL5150_UCODE_API_MIN, \
  505. .eeprom_ver = EEPROM_5050_EEPROM_VERSION, \
  506. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \
  507. .ops = &iwl5150_ops, \
  508. .mod_params = &iwlagn_mod_params, \
  509. .base_params = &iwl5000_base_params, \
  510. .need_dc_calib = true, \
  511. .led_mode = IWL_LED_BLINK, \
  512. .internal_wimax_coex = true
  513. struct iwl_cfg iwl5150_agn_cfg = {
  514. .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
  515. IWL_DEVICE_5150,
  516. .ht_params = &iwl5000_ht_params,
  517. };
  518. struct iwl_cfg iwl5150_abg_cfg = {
  519. .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
  520. IWL_DEVICE_5150,
  521. };
  522. MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
  523. MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));