iwl-6000.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2008 - 2010 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-agn.h"
  44. #include "iwl-helpers.h"
  45. #include "iwl-agn-hw.h"
  46. #include "iwl-6000-hw.h"
  47. #include "iwl-agn-led.h"
  48. #include "iwl-agn-debugfs.h"
  49. /* Highest firmware API version supported */
  50. #define IWL6000_UCODE_API_MAX 4
  51. #define IWL6050_UCODE_API_MAX 5
  52. #define IWL6000G2_UCODE_API_MAX 5
  53. #define IWL130_UCODE_API_MAX 5
  54. /* Lowest firmware API version supported */
  55. #define IWL6000_UCODE_API_MIN 4
  56. #define IWL6050_UCODE_API_MIN 4
  57. #define IWL6000G2_UCODE_API_MIN 4
  58. #define IWL130_UCODE_API_MIN 5
  59. #define IWL6000_FW_PRE "iwlwifi-6000-"
  60. #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
  61. #define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
  62. #define IWL6050_FW_PRE "iwlwifi-6050-"
  63. #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
  64. #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
  65. #define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-"
  66. #define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode"
  67. #define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api)
  68. #define IWL6000G2B_FW_PRE "iwlwifi-6000g2b-"
  69. #define _IWL6000G2B_MODULE_FIRMWARE(api) IWL6000G2B_FW_PRE #api ".ucode"
  70. #define IWL6000G2B_MODULE_FIRMWARE(api) _IWL6000G2B_MODULE_FIRMWARE(api)
  71. #define IWL130_FW_PRE "iwlwifi-130-"
  72. #define _IWL130_MODULE_FIRMWARE(api) IWL130_FW_PRE #api ".ucode"
  73. #define IWL130_MODULE_FIRMWARE(api) _IWL130_MODULE_FIRMWARE(api)
  74. static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
  75. {
  76. /* want Celsius */
  77. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
  78. priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
  79. }
  80. static void iwl6050_additional_nic_config(struct iwl_priv *priv)
  81. {
  82. /* Indicate calibration version to uCode. */
  83. if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
  84. iwl_set_bit(priv, CSR_GP_DRIVER_REG,
  85. CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
  86. }
  87. static void iwl6050g2_additional_nic_config(struct iwl_priv *priv)
  88. {
  89. /* Indicate calibration version to uCode. */
  90. if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
  91. iwl_set_bit(priv, CSR_GP_DRIVER_REG,
  92. CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
  93. iwl_set_bit(priv, CSR_GP_DRIVER_REG,
  94. CSR_GP_DRIVER_REG_BIT_6050_1x2);
  95. }
  96. /* NIC configuration for 6000 series */
  97. static void iwl6000_nic_config(struct iwl_priv *priv)
  98. {
  99. u16 radio_cfg;
  100. radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
  101. /* write radio config values to register */
  102. if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
  103. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  104. EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
  105. EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
  106. EEPROM_RF_CFG_DASH_MSK(radio_cfg));
  107. /* set CSR_HW_CONFIG_REG for uCode use */
  108. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  109. CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
  110. CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
  111. /* no locking required for register write */
  112. if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
  113. /* 2x2 IPA phy type */
  114. iwl_write32(priv, CSR_GP_DRIVER_REG,
  115. CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
  116. }
  117. /* do additional nic configuration if needed */
  118. if (priv->cfg->ops->nic &&
  119. priv->cfg->ops->nic->additional_nic_config) {
  120. priv->cfg->ops->nic->additional_nic_config(priv);
  121. }
  122. }
  123. static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
  124. .min_nrg_cck = 97,
  125. .max_nrg_cck = 0, /* not used, set to 0 */
  126. .auto_corr_min_ofdm = 80,
  127. .auto_corr_min_ofdm_mrc = 128,
  128. .auto_corr_min_ofdm_x1 = 105,
  129. .auto_corr_min_ofdm_mrc_x1 = 192,
  130. .auto_corr_max_ofdm = 145,
  131. .auto_corr_max_ofdm_mrc = 232,
  132. .auto_corr_max_ofdm_x1 = 110,
  133. .auto_corr_max_ofdm_mrc_x1 = 232,
  134. .auto_corr_min_cck = 125,
  135. .auto_corr_max_cck = 175,
  136. .auto_corr_min_cck_mrc = 160,
  137. .auto_corr_max_cck_mrc = 310,
  138. .nrg_th_cck = 97,
  139. .nrg_th_ofdm = 100,
  140. .barker_corr_th_min = 190,
  141. .barker_corr_th_min_mrc = 390,
  142. .nrg_th_cca = 62,
  143. };
  144. static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
  145. {
  146. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  147. priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
  148. priv->cfg->base_params->num_of_queues =
  149. priv->cfg->mod_params->num_of_queues;
  150. priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
  151. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  152. priv->hw_params.scd_bc_tbls_size =
  153. priv->cfg->base_params->num_of_queues *
  154. sizeof(struct iwlagn_scd_bc_tbl);
  155. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  156. priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
  157. priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
  158. priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
  159. priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
  160. priv->hw_params.max_bsm_size = 0;
  161. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  162. BIT(IEEE80211_BAND_5GHZ);
  163. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  164. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  165. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  166. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  167. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  168. if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
  169. priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
  170. /* Set initial sensitivity parameters */
  171. /* Set initial calibration set */
  172. priv->hw_params.sens = &iwl6000_sensitivity;
  173. priv->hw_params.calib_init_cfg =
  174. BIT(IWL_CALIB_XTAL) |
  175. BIT(IWL_CALIB_LO) |
  176. BIT(IWL_CALIB_TX_IQ) |
  177. BIT(IWL_CALIB_BASE_BAND);
  178. if (priv->cfg->need_dc_calib)
  179. priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX);
  180. priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
  181. return 0;
  182. }
  183. static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
  184. struct ieee80211_channel_switch *ch_switch)
  185. {
  186. /*
  187. * MULTI-FIXME
  188. * See iwl_mac_channel_switch.
  189. */
  190. struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
  191. struct iwl6000_channel_switch_cmd cmd;
  192. const struct iwl_channel_info *ch_info;
  193. u32 switch_time_in_usec, ucode_switch_time;
  194. u16 ch;
  195. u32 tsf_low;
  196. u8 switch_count;
  197. u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
  198. struct ieee80211_vif *vif = ctx->vif;
  199. struct iwl_host_cmd hcmd = {
  200. .id = REPLY_CHANNEL_SWITCH,
  201. .len = sizeof(cmd),
  202. .flags = CMD_SYNC,
  203. .data = &cmd,
  204. };
  205. cmd.band = priv->band == IEEE80211_BAND_2GHZ;
  206. ch = ch_switch->channel->hw_value;
  207. IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
  208. ctx->active.channel, ch);
  209. cmd.channel = cpu_to_le16(ch);
  210. cmd.rxon_flags = ctx->staging.flags;
  211. cmd.rxon_filter_flags = ctx->staging.filter_flags;
  212. switch_count = ch_switch->count;
  213. tsf_low = ch_switch->timestamp & 0x0ffffffff;
  214. /*
  215. * calculate the ucode channel switch time
  216. * adding TSF as one of the factor for when to switch
  217. */
  218. if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
  219. if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
  220. beacon_interval)) {
  221. switch_count -= (priv->ucode_beacon_time -
  222. tsf_low) / beacon_interval;
  223. } else
  224. switch_count = 0;
  225. }
  226. if (switch_count <= 1)
  227. cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
  228. else {
  229. switch_time_in_usec =
  230. vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
  231. ucode_switch_time = iwl_usecs_to_beacons(priv,
  232. switch_time_in_usec,
  233. beacon_interval);
  234. cmd.switch_time = iwl_add_beacon_time(priv,
  235. priv->ucode_beacon_time,
  236. ucode_switch_time,
  237. beacon_interval);
  238. }
  239. IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
  240. cmd.switch_time);
  241. ch_info = iwl_get_channel_info(priv, priv->band, ch);
  242. if (ch_info)
  243. cmd.expect_beacon = is_channel_radar(ch_info);
  244. else {
  245. IWL_ERR(priv, "invalid channel switch from %u to %u\n",
  246. ctx->active.channel, ch);
  247. return -EFAULT;
  248. }
  249. priv->switch_rxon.channel = cmd.channel;
  250. priv->switch_rxon.switch_in_progress = true;
  251. return iwl_send_cmd_sync(priv, &hcmd);
  252. }
  253. static struct iwl_lib_ops iwl6000_lib = {
  254. .set_hw_params = iwl6000_hw_set_hw_params,
  255. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  256. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  257. .txq_set_sched = iwlagn_txq_set_sched,
  258. .txq_agg_enable = iwlagn_txq_agg_enable,
  259. .txq_agg_disable = iwlagn_txq_agg_disable,
  260. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  261. .txq_free_tfd = iwl_hw_txq_free_tfd,
  262. .txq_init = iwl_hw_tx_queue_init,
  263. .rx_handler_setup = iwlagn_rx_handler_setup,
  264. .setup_deferred_work = iwlagn_setup_deferred_work,
  265. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  266. .load_ucode = iwlagn_load_ucode,
  267. .dump_nic_event_log = iwl_dump_nic_event_log,
  268. .dump_nic_error_log = iwl_dump_nic_error_log,
  269. .dump_csr = iwl_dump_csr,
  270. .dump_fh = iwl_dump_fh,
  271. .init_alive_start = iwlagn_init_alive_start,
  272. .alive_notify = iwlagn_alive_notify,
  273. .send_tx_power = iwlagn_send_tx_power,
  274. .update_chain_flags = iwl_update_chain_flags,
  275. .set_channel_switch = iwl6000_hw_channel_switch,
  276. .apm_ops = {
  277. .init = iwl_apm_init,
  278. .stop = iwl_apm_stop,
  279. .config = iwl6000_nic_config,
  280. .set_pwr_src = iwl_set_pwr_src,
  281. },
  282. .eeprom_ops = {
  283. .regulatory_bands = {
  284. EEPROM_REG_BAND_1_CHANNELS,
  285. EEPROM_REG_BAND_2_CHANNELS,
  286. EEPROM_REG_BAND_3_CHANNELS,
  287. EEPROM_REG_BAND_4_CHANNELS,
  288. EEPROM_REG_BAND_5_CHANNELS,
  289. EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
  290. EEPROM_REG_BAND_52_HT40_CHANNELS
  291. },
  292. .verify_signature = iwlcore_eeprom_verify_signature,
  293. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  294. .release_semaphore = iwlcore_eeprom_release_semaphore,
  295. .calib_version = iwlagn_eeprom_calib_version,
  296. .query_addr = iwlagn_eeprom_query_addr,
  297. .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
  298. },
  299. .post_associate = iwl_post_associate,
  300. .isr = iwl_isr_ict,
  301. .config_ap = iwl_config_ap,
  302. .temp_ops = {
  303. .temperature = iwlagn_temperature,
  304. .set_ct_kill = iwl6000_set_ct_threshold,
  305. },
  306. .manage_ibss_station = iwlagn_manage_ibss_station,
  307. .update_bcast_stations = iwl_update_bcast_stations,
  308. .debugfs_ops = {
  309. .rx_stats_read = iwl_ucode_rx_stats_read,
  310. .tx_stats_read = iwl_ucode_tx_stats_read,
  311. .general_stats_read = iwl_ucode_general_stats_read,
  312. .bt_stats_read = iwl_ucode_bt_stats_read,
  313. .reply_tx_error = iwl_reply_tx_error_read,
  314. },
  315. .recover_from_tx_stall = iwl_bg_monitor_recover,
  316. .check_plcp_health = iwl_good_plcp_health,
  317. .check_ack_health = iwl_good_ack_health,
  318. .txfifo_flush = iwlagn_txfifo_flush,
  319. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  320. .tt_ops = {
  321. .lower_power_detection = iwl_tt_is_low_power_state,
  322. .tt_power_mode = iwl_tt_current_power_mode,
  323. .ct_kill_check = iwl_check_for_ct_kill,
  324. }
  325. };
  326. static struct iwl_lib_ops iwl6000g2b_lib = {
  327. .set_hw_params = iwl6000_hw_set_hw_params,
  328. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  329. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  330. .txq_set_sched = iwlagn_txq_set_sched,
  331. .txq_agg_enable = iwlagn_txq_agg_enable,
  332. .txq_agg_disable = iwlagn_txq_agg_disable,
  333. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  334. .txq_free_tfd = iwl_hw_txq_free_tfd,
  335. .txq_init = iwl_hw_tx_queue_init,
  336. .rx_handler_setup = iwlagn_bt_rx_handler_setup,
  337. .setup_deferred_work = iwlagn_bt_setup_deferred_work,
  338. .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
  339. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  340. .load_ucode = iwlagn_load_ucode,
  341. .dump_nic_event_log = iwl_dump_nic_event_log,
  342. .dump_nic_error_log = iwl_dump_nic_error_log,
  343. .dump_csr = iwl_dump_csr,
  344. .dump_fh = iwl_dump_fh,
  345. .init_alive_start = iwlagn_init_alive_start,
  346. .alive_notify = iwlagn_alive_notify,
  347. .send_tx_power = iwlagn_send_tx_power,
  348. .update_chain_flags = iwl_update_chain_flags,
  349. .set_channel_switch = iwl6000_hw_channel_switch,
  350. .apm_ops = {
  351. .init = iwl_apm_init,
  352. .stop = iwl_apm_stop,
  353. .config = iwl6000_nic_config,
  354. .set_pwr_src = iwl_set_pwr_src,
  355. },
  356. .eeprom_ops = {
  357. .regulatory_bands = {
  358. EEPROM_REG_BAND_1_CHANNELS,
  359. EEPROM_REG_BAND_2_CHANNELS,
  360. EEPROM_REG_BAND_3_CHANNELS,
  361. EEPROM_REG_BAND_4_CHANNELS,
  362. EEPROM_REG_BAND_5_CHANNELS,
  363. EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
  364. EEPROM_REG_BAND_52_HT40_CHANNELS
  365. },
  366. .verify_signature = iwlcore_eeprom_verify_signature,
  367. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  368. .release_semaphore = iwlcore_eeprom_release_semaphore,
  369. .calib_version = iwlagn_eeprom_calib_version,
  370. .query_addr = iwlagn_eeprom_query_addr,
  371. .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
  372. },
  373. .post_associate = iwl_post_associate,
  374. .isr = iwl_isr_ict,
  375. .config_ap = iwl_config_ap,
  376. .temp_ops = {
  377. .temperature = iwlagn_temperature,
  378. .set_ct_kill = iwl6000_set_ct_threshold,
  379. },
  380. .manage_ibss_station = iwlagn_manage_ibss_station,
  381. .update_bcast_stations = iwl_update_bcast_stations,
  382. .debugfs_ops = {
  383. .rx_stats_read = iwl_ucode_rx_stats_read,
  384. .tx_stats_read = iwl_ucode_tx_stats_read,
  385. .general_stats_read = iwl_ucode_general_stats_read,
  386. .bt_stats_read = iwl_ucode_bt_stats_read,
  387. .reply_tx_error = iwl_reply_tx_error_read,
  388. },
  389. .recover_from_tx_stall = iwl_bg_monitor_recover,
  390. .check_plcp_health = iwl_good_plcp_health,
  391. .check_ack_health = iwl_good_ack_health,
  392. .txfifo_flush = iwlagn_txfifo_flush,
  393. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  394. .tt_ops = {
  395. .lower_power_detection = iwl_tt_is_low_power_state,
  396. .tt_power_mode = iwl_tt_current_power_mode,
  397. .ct_kill_check = iwl_check_for_ct_kill,
  398. }
  399. };
  400. static struct iwl_nic_ops iwl6050_nic_ops = {
  401. .additional_nic_config = &iwl6050_additional_nic_config,
  402. };
  403. static struct iwl_nic_ops iwl6050g2_nic_ops = {
  404. .additional_nic_config = &iwl6050g2_additional_nic_config,
  405. };
  406. static const struct iwl_ops iwl6000_ops = {
  407. .lib = &iwl6000_lib,
  408. .hcmd = &iwlagn_hcmd,
  409. .utils = &iwlagn_hcmd_utils,
  410. .led = &iwlagn_led_ops,
  411. };
  412. static const struct iwl_ops iwl6050_ops = {
  413. .lib = &iwl6000_lib,
  414. .hcmd = &iwlagn_hcmd,
  415. .utils = &iwlagn_hcmd_utils,
  416. .led = &iwlagn_led_ops,
  417. .nic = &iwl6050_nic_ops,
  418. };
  419. static const struct iwl_ops iwl6050g2_ops = {
  420. .lib = &iwl6000_lib,
  421. .hcmd = &iwlagn_hcmd,
  422. .utils = &iwlagn_hcmd_utils,
  423. .led = &iwlagn_led_ops,
  424. .nic = &iwl6050g2_nic_ops,
  425. };
  426. static const struct iwl_ops iwl6000g2b_ops = {
  427. .lib = &iwl6000g2b_lib,
  428. .hcmd = &iwlagn_bt_hcmd,
  429. .utils = &iwlagn_hcmd_utils,
  430. .led = &iwlagn_led_ops,
  431. };
  432. static struct iwl_base_params iwl6000_base_params = {
  433. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  434. .num_of_queues = IWLAGN_NUM_QUEUES,
  435. .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
  436. .pll_cfg_val = 0,
  437. .set_l0s = true,
  438. .use_bsm = false,
  439. .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
  440. .shadow_ram_support = true,
  441. .led_compensation = 51,
  442. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  443. .supports_idle = true,
  444. .adv_thermal_throttle = true,
  445. .support_ct_kill_exit = true,
  446. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
  447. .chain_noise_scale = 1000,
  448. .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
  449. .max_event_log_size = 512,
  450. .ucode_tracing = true,
  451. .sensitivity_calib_by_driver = true,
  452. .chain_noise_calib_by_driver = true,
  453. };
  454. static struct iwl_base_params iwl6050_base_params = {
  455. .eeprom_size = OTP_LOW_IMAGE_SIZE,
  456. .num_of_queues = IWLAGN_NUM_QUEUES,
  457. .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
  458. .pll_cfg_val = 0,
  459. .set_l0s = true,
  460. .use_bsm = false,
  461. .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
  462. .shadow_ram_support = true,
  463. .led_compensation = 51,
  464. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  465. .supports_idle = true,
  466. .adv_thermal_throttle = true,
  467. .support_ct_kill_exit = true,
  468. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
  469. .chain_noise_scale = 1500,
  470. .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
  471. .max_event_log_size = 1024,
  472. .ucode_tracing = true,
  473. .sensitivity_calib_by_driver = true,
  474. .chain_noise_calib_by_driver = true,
  475. };
  476. static struct iwl_ht_params iwl6000_ht_params = {
  477. .ht_greenfield_support = true,
  478. .use_rts_for_aggregation = true, /* use rts/cts protection */
  479. };
  480. static struct iwl_bt_params iwl6000_bt_params = {
  481. .bt_statistics = true,
  482. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  483. .advanced_bt_coexist = true,
  484. .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
  485. .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
  486. };
  487. struct iwl_cfg iwl6000g2a_2agn_cfg = {
  488. .name = "6000 Series 2x2 AGN Gen2a",
  489. .fw_name_pre = IWL6000G2A_FW_PRE,
  490. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  491. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  492. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  493. .valid_tx_ant = ANT_AB,
  494. .valid_rx_ant = ANT_AB,
  495. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  496. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  497. .ops = &iwl6000_ops,
  498. .mod_params = &iwlagn_mod_params,
  499. .base_params = &iwl6000_base_params,
  500. .ht_params = &iwl6000_ht_params,
  501. .need_dc_calib = true,
  502. };
  503. struct iwl_cfg iwl6000g2a_2abg_cfg = {
  504. .name = "6000 Series 2x2 ABG Gen2a",
  505. .fw_name_pre = IWL6000G2A_FW_PRE,
  506. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  507. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  508. .sku = IWL_SKU_A|IWL_SKU_G,
  509. .valid_tx_ant = ANT_AB,
  510. .valid_rx_ant = ANT_AB,
  511. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  512. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  513. .ops = &iwl6000_ops,
  514. .mod_params = &iwlagn_mod_params,
  515. .base_params = &iwl6000_base_params,
  516. .need_dc_calib = true,
  517. };
  518. struct iwl_cfg iwl6000g2a_2bg_cfg = {
  519. .name = "6000 Series 2x2 BG Gen2a",
  520. .fw_name_pre = IWL6000G2A_FW_PRE,
  521. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  522. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  523. .sku = IWL_SKU_G,
  524. .valid_tx_ant = ANT_AB,
  525. .valid_rx_ant = ANT_AB,
  526. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  527. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  528. .ops = &iwl6000_ops,
  529. .mod_params = &iwlagn_mod_params,
  530. .base_params = &iwl6000_base_params,
  531. .need_dc_calib = true,
  532. };
  533. struct iwl_cfg iwl6000g2b_2agn_cfg = {
  534. .name = "6000 Series 2x2 AGN Gen2b",
  535. .fw_name_pre = IWL6000G2B_FW_PRE,
  536. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  537. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  538. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  539. .valid_tx_ant = ANT_AB,
  540. .valid_rx_ant = ANT_AB,
  541. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  542. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  543. .ops = &iwl6000g2b_ops,
  544. .mod_params = &iwlagn_mod_params,
  545. .base_params = &iwl6000_base_params,
  546. .bt_params = &iwl6000_bt_params,
  547. .ht_params = &iwl6000_ht_params,
  548. .need_dc_calib = true,
  549. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  550. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  551. };
  552. struct iwl_cfg iwl6000g2b_2abg_cfg = {
  553. .name = "6000 Series 2x2 ABG Gen2b",
  554. .fw_name_pre = IWL6000G2B_FW_PRE,
  555. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  556. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  557. .sku = IWL_SKU_A|IWL_SKU_G,
  558. .valid_tx_ant = ANT_AB,
  559. .valid_rx_ant = ANT_AB,
  560. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  561. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  562. .ops = &iwl6000g2b_ops,
  563. .mod_params = &iwlagn_mod_params,
  564. .base_params = &iwl6000_base_params,
  565. .bt_params = &iwl6000_bt_params,
  566. .need_dc_calib = true,
  567. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  568. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  569. };
  570. struct iwl_cfg iwl6000g2b_2bgn_cfg = {
  571. .name = "6000 Series 2x2 BGN Gen2b",
  572. .fw_name_pre = IWL6000G2B_FW_PRE,
  573. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  574. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  575. .sku = IWL_SKU_G|IWL_SKU_N,
  576. .valid_tx_ant = ANT_AB,
  577. .valid_rx_ant = ANT_AB,
  578. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  579. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  580. .ops = &iwl6000g2b_ops,
  581. .mod_params = &iwlagn_mod_params,
  582. .base_params = &iwl6000_base_params,
  583. .bt_params = &iwl6000_bt_params,
  584. .ht_params = &iwl6000_ht_params,
  585. .need_dc_calib = true,
  586. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  587. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  588. };
  589. struct iwl_cfg iwl6000g2b_2bg_cfg = {
  590. .name = "6000 Series 2x2 BG Gen2b",
  591. .fw_name_pre = IWL6000G2B_FW_PRE,
  592. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  593. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  594. .sku = IWL_SKU_G,
  595. .valid_tx_ant = ANT_AB,
  596. .valid_rx_ant = ANT_AB,
  597. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  598. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  599. .ops = &iwl6000g2b_ops,
  600. .mod_params = &iwlagn_mod_params,
  601. .base_params = &iwl6000_base_params,
  602. .bt_params = &iwl6000_bt_params,
  603. .need_dc_calib = true,
  604. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  605. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  606. };
  607. struct iwl_cfg iwl6000g2b_bgn_cfg = {
  608. .name = "6000 Series 1x2 BGN Gen2b",
  609. .fw_name_pre = IWL6000G2B_FW_PRE,
  610. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  611. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  612. .sku = IWL_SKU_G|IWL_SKU_N,
  613. .valid_tx_ant = ANT_A,
  614. .valid_rx_ant = ANT_AB,
  615. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  616. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  617. .ops = &iwl6000g2b_ops,
  618. .mod_params = &iwlagn_mod_params,
  619. .base_params = &iwl6000_base_params,
  620. .bt_params = &iwl6000_bt_params,
  621. .ht_params = &iwl6000_ht_params,
  622. .need_dc_calib = true,
  623. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  624. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  625. };
  626. struct iwl_cfg iwl6000g2b_bg_cfg = {
  627. .name = "6000 Series 1x2 BG Gen2b",
  628. .fw_name_pre = IWL6000G2B_FW_PRE,
  629. .ucode_api_max = IWL6000G2_UCODE_API_MAX,
  630. .ucode_api_min = IWL6000G2_UCODE_API_MIN,
  631. .sku = IWL_SKU_G,
  632. .valid_tx_ant = ANT_A,
  633. .valid_rx_ant = ANT_AB,
  634. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  635. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  636. .ops = &iwl6000g2b_ops,
  637. .mod_params = &iwlagn_mod_params,
  638. .base_params = &iwl6000_base_params,
  639. .bt_params = &iwl6000_bt_params,
  640. .need_dc_calib = true,
  641. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  642. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  643. };
  644. /*
  645. * "i": Internal configuration, use internal Power Amplifier
  646. */
  647. struct iwl_cfg iwl6000i_2agn_cfg = {
  648. .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
  649. .fw_name_pre = IWL6000_FW_PRE,
  650. .ucode_api_max = IWL6000_UCODE_API_MAX,
  651. .ucode_api_min = IWL6000_UCODE_API_MIN,
  652. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  653. .valid_tx_ant = ANT_BC,
  654. .valid_rx_ant = ANT_BC,
  655. .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
  656. .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
  657. .ops = &iwl6000_ops,
  658. .mod_params = &iwlagn_mod_params,
  659. .base_params = &iwl6000_base_params,
  660. .ht_params = &iwl6000_ht_params,
  661. .pa_type = IWL_PA_INTERNAL,
  662. };
  663. struct iwl_cfg iwl6000i_2abg_cfg = {
  664. .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
  665. .fw_name_pre = IWL6000_FW_PRE,
  666. .ucode_api_max = IWL6000_UCODE_API_MAX,
  667. .ucode_api_min = IWL6000_UCODE_API_MIN,
  668. .sku = IWL_SKU_A|IWL_SKU_G,
  669. .valid_tx_ant = ANT_BC,
  670. .valid_rx_ant = ANT_BC,
  671. .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
  672. .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
  673. .ops = &iwl6000_ops,
  674. .mod_params = &iwlagn_mod_params,
  675. .base_params = &iwl6000_base_params,
  676. .pa_type = IWL_PA_INTERNAL,
  677. };
  678. struct iwl_cfg iwl6000i_2bg_cfg = {
  679. .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
  680. .fw_name_pre = IWL6000_FW_PRE,
  681. .ucode_api_max = IWL6000_UCODE_API_MAX,
  682. .ucode_api_min = IWL6000_UCODE_API_MIN,
  683. .sku = IWL_SKU_G,
  684. .valid_tx_ant = ANT_BC,
  685. .valid_rx_ant = ANT_BC,
  686. .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
  687. .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
  688. .ops = &iwl6000_ops,
  689. .mod_params = &iwlagn_mod_params,
  690. .base_params = &iwl6000_base_params,
  691. .pa_type = IWL_PA_INTERNAL,
  692. };
  693. struct iwl_cfg iwl6050_2agn_cfg = {
  694. .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
  695. .fw_name_pre = IWL6050_FW_PRE,
  696. .ucode_api_max = IWL6050_UCODE_API_MAX,
  697. .ucode_api_min = IWL6050_UCODE_API_MIN,
  698. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  699. .valid_tx_ant = ANT_AB,
  700. .valid_rx_ant = ANT_AB,
  701. .ops = &iwl6000_ops,
  702. .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
  703. .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
  704. .mod_params = &iwlagn_mod_params,
  705. .base_params = &iwl6050_base_params,
  706. .ht_params = &iwl6000_ht_params,
  707. .need_dc_calib = true,
  708. };
  709. struct iwl_cfg iwl6050g2_bgn_cfg = {
  710. .name = "6050 Series 1x2 BGN Gen2",
  711. .fw_name_pre = IWL6050_FW_PRE,
  712. .ucode_api_max = IWL6050_UCODE_API_MAX,
  713. .ucode_api_min = IWL6050_UCODE_API_MIN,
  714. .sku = IWL_SKU_G|IWL_SKU_N,
  715. .valid_tx_ant = ANT_A,
  716. .valid_rx_ant = ANT_AB,
  717. .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
  718. .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
  719. .ops = &iwl6050g2_ops,
  720. .mod_params = &iwlagn_mod_params,
  721. .base_params = &iwl6050_base_params,
  722. .ht_params = &iwl6000_ht_params,
  723. .need_dc_calib = true,
  724. };
  725. struct iwl_cfg iwl6050_2abg_cfg = {
  726. .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
  727. .fw_name_pre = IWL6050_FW_PRE,
  728. .ucode_api_max = IWL6050_UCODE_API_MAX,
  729. .ucode_api_min = IWL6050_UCODE_API_MIN,
  730. .sku = IWL_SKU_A|IWL_SKU_G,
  731. .valid_tx_ant = ANT_AB,
  732. .valid_rx_ant = ANT_AB,
  733. .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
  734. .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
  735. .ops = &iwl6050_ops,
  736. .mod_params = &iwlagn_mod_params,
  737. .base_params = &iwl6050_base_params,
  738. .need_dc_calib = true,
  739. };
  740. struct iwl_cfg iwl6000_3agn_cfg = {
  741. .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
  742. .fw_name_pre = IWL6000_FW_PRE,
  743. .ucode_api_max = IWL6000_UCODE_API_MAX,
  744. .ucode_api_min = IWL6000_UCODE_API_MIN,
  745. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  746. .valid_tx_ant = ANT_ABC,
  747. .valid_rx_ant = ANT_ABC,
  748. .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
  749. .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
  750. .ops = &iwl6000_ops,
  751. .mod_params = &iwlagn_mod_params,
  752. .base_params = &iwl6000_base_params,
  753. .ht_params = &iwl6000_ht_params,
  754. .need_dc_calib = true,
  755. };
  756. struct iwl_cfg iwl130_bgn_cfg = {
  757. .name = "Intel(R) 130 Series 1x1 BGN",
  758. .fw_name_pre = IWL6000G2B_FW_PRE,
  759. .ucode_api_max = IWL130_UCODE_API_MAX,
  760. .ucode_api_min = IWL130_UCODE_API_MIN,
  761. .sku = IWL_SKU_G|IWL_SKU_N,
  762. .valid_tx_ant = ANT_A,
  763. .valid_rx_ant = ANT_A,
  764. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  765. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  766. .ops = &iwl6000g2b_ops,
  767. .mod_params = &iwlagn_mod_params,
  768. .base_params = &iwl6000_base_params,
  769. .bt_params = &iwl6000_bt_params,
  770. .ht_params = &iwl6000_ht_params,
  771. .need_dc_calib = true,
  772. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  773. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  774. };
  775. struct iwl_cfg iwl130_bg_cfg = {
  776. .name = "Intel(R) 130 Series 1x2 BG",
  777. .fw_name_pre = IWL6000G2B_FW_PRE,
  778. .ucode_api_max = IWL130_UCODE_API_MAX,
  779. .ucode_api_min = IWL130_UCODE_API_MIN,
  780. .sku = IWL_SKU_G,
  781. .valid_tx_ant = ANT_A,
  782. .valid_rx_ant = ANT_A,
  783. .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
  784. .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
  785. .ops = &iwl6000g2b_ops,
  786. .mod_params = &iwlagn_mod_params,
  787. .base_params = &iwl6000_base_params,
  788. .bt_params = &iwl6000_bt_params,
  789. .need_dc_calib = true,
  790. /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
  791. .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
  792. };
  793. MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
  794. MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
  795. MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
  796. MODULE_FIRMWARE(IWL6000G2B_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
  797. MODULE_FIRMWARE(IWL130_MODULE_FIRMWARE(IWL130_UCODE_API_MAX));