iwl-5000.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 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/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 2
  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.max_bsm_size = 0;
  160. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  161. BIT(IEEE80211_BAND_5GHZ);
  162. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  163. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  164. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  165. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  166. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  167. if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
  168. priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
  169. /* Set initial sensitivity parameters */
  170. /* Set initial calibration set */
  171. priv->hw_params.sens = &iwl5000_sensitivity;
  172. priv->hw_params.calib_init_cfg =
  173. BIT(IWL_CALIB_XTAL) |
  174. BIT(IWL_CALIB_LO) |
  175. BIT(IWL_CALIB_TX_IQ) |
  176. BIT(IWL_CALIB_TX_IQ_PERD) |
  177. BIT(IWL_CALIB_BASE_BAND);
  178. priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
  179. return 0;
  180. }
  181. static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
  182. {
  183. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  184. priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
  185. priv->cfg->base_params->num_of_queues =
  186. priv->cfg->mod_params->num_of_queues;
  187. priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
  188. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  189. priv->hw_params.scd_bc_tbls_size =
  190. priv->cfg->base_params->num_of_queues *
  191. sizeof(struct iwlagn_scd_bc_tbl);
  192. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  193. priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
  194. priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
  195. priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
  196. priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
  197. priv->hw_params.max_bsm_size = 0;
  198. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  199. BIT(IEEE80211_BAND_5GHZ);
  200. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  201. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  202. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  203. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  204. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  205. if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
  206. priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
  207. /* Set initial sensitivity parameters */
  208. /* Set initial calibration set */
  209. priv->hw_params.sens = &iwl5150_sensitivity;
  210. priv->hw_params.calib_init_cfg =
  211. BIT(IWL_CALIB_LO) |
  212. BIT(IWL_CALIB_TX_IQ) |
  213. BIT(IWL_CALIB_BASE_BAND);
  214. if (priv->cfg->need_dc_calib)
  215. priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC);
  216. priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
  217. return 0;
  218. }
  219. static void iwl5150_temperature(struct iwl_priv *priv)
  220. {
  221. u32 vt = 0;
  222. s32 offset = iwl_temp_calib_to_offset(priv);
  223. vt = le32_to_cpu(priv->_agn.statistics.general.common.temperature);
  224. vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
  225. /* now vt hold the temperature in Kelvin */
  226. priv->temperature = KELVIN_TO_CELSIUS(vt);
  227. iwl_tt_handler(priv);
  228. }
  229. static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
  230. struct ieee80211_channel_switch *ch_switch)
  231. {
  232. /*
  233. * MULTI-FIXME
  234. * See iwl_mac_channel_switch.
  235. */
  236. struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
  237. struct iwl5000_channel_switch_cmd cmd;
  238. const struct iwl_channel_info *ch_info;
  239. u32 switch_time_in_usec, ucode_switch_time;
  240. u16 ch;
  241. u32 tsf_low;
  242. u8 switch_count;
  243. u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
  244. struct ieee80211_vif *vif = ctx->vif;
  245. struct iwl_host_cmd hcmd = {
  246. .id = REPLY_CHANNEL_SWITCH,
  247. .len = sizeof(cmd),
  248. .flags = CMD_SYNC,
  249. .data = &cmd,
  250. };
  251. cmd.band = priv->band == IEEE80211_BAND_2GHZ;
  252. ch = ch_switch->channel->hw_value;
  253. IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
  254. ctx->active.channel, ch);
  255. cmd.channel = cpu_to_le16(ch);
  256. cmd.rxon_flags = ctx->staging.flags;
  257. cmd.rxon_filter_flags = ctx->staging.filter_flags;
  258. switch_count = ch_switch->count;
  259. tsf_low = ch_switch->timestamp & 0x0ffffffff;
  260. /*
  261. * calculate the ucode channel switch time
  262. * adding TSF as one of the factor for when to switch
  263. */
  264. if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
  265. if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
  266. beacon_interval)) {
  267. switch_count -= (priv->ucode_beacon_time -
  268. tsf_low) / beacon_interval;
  269. } else
  270. switch_count = 0;
  271. }
  272. if (switch_count <= 1)
  273. cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
  274. else {
  275. switch_time_in_usec =
  276. vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
  277. ucode_switch_time = iwl_usecs_to_beacons(priv,
  278. switch_time_in_usec,
  279. beacon_interval);
  280. cmd.switch_time = iwl_add_beacon_time(priv,
  281. priv->ucode_beacon_time,
  282. ucode_switch_time,
  283. beacon_interval);
  284. }
  285. IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
  286. cmd.switch_time);
  287. ch_info = iwl_get_channel_info(priv, priv->band, ch);
  288. if (ch_info)
  289. cmd.expect_beacon = is_channel_radar(ch_info);
  290. else {
  291. IWL_ERR(priv, "invalid channel switch from %u to %u\n",
  292. ctx->active.channel, ch);
  293. return -EFAULT;
  294. }
  295. priv->switch_rxon.channel = cmd.channel;
  296. priv->switch_rxon.switch_in_progress = true;
  297. return iwl_send_cmd_sync(priv, &hcmd);
  298. }
  299. static struct iwl_lib_ops iwl5000_lib = {
  300. .set_hw_params = iwl5000_hw_set_hw_params,
  301. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  302. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  303. .txq_set_sched = iwlagn_txq_set_sched,
  304. .txq_agg_enable = iwlagn_txq_agg_enable,
  305. .txq_agg_disable = iwlagn_txq_agg_disable,
  306. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  307. .txq_free_tfd = iwl_hw_txq_free_tfd,
  308. .txq_init = iwl_hw_tx_queue_init,
  309. .rx_handler_setup = iwlagn_rx_handler_setup,
  310. .setup_deferred_work = iwlagn_setup_deferred_work,
  311. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  312. .dump_nic_event_log = iwl_dump_nic_event_log,
  313. .dump_nic_error_log = iwl_dump_nic_error_log,
  314. .dump_csr = iwl_dump_csr,
  315. .dump_fh = iwl_dump_fh,
  316. .load_ucode = iwlagn_load_ucode,
  317. .init_alive_start = iwlagn_init_alive_start,
  318. .alive_notify = iwlagn_alive_notify,
  319. .send_tx_power = iwlagn_send_tx_power,
  320. .update_chain_flags = iwl_update_chain_flags,
  321. .set_channel_switch = iwl5000_hw_channel_switch,
  322. .apm_ops = {
  323. .init = iwl_apm_init,
  324. .stop = iwl_apm_stop,
  325. .config = iwl5000_nic_config,
  326. .set_pwr_src = iwl_set_pwr_src,
  327. },
  328. .eeprom_ops = {
  329. .regulatory_bands = {
  330. EEPROM_REG_BAND_1_CHANNELS,
  331. EEPROM_REG_BAND_2_CHANNELS,
  332. EEPROM_REG_BAND_3_CHANNELS,
  333. EEPROM_REG_BAND_4_CHANNELS,
  334. EEPROM_REG_BAND_5_CHANNELS,
  335. EEPROM_REG_BAND_24_HT40_CHANNELS,
  336. EEPROM_REG_BAND_52_HT40_CHANNELS
  337. },
  338. .verify_signature = iwlcore_eeprom_verify_signature,
  339. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  340. .release_semaphore = iwlcore_eeprom_release_semaphore,
  341. .calib_version = iwlagn_eeprom_calib_version,
  342. .query_addr = iwlagn_eeprom_query_addr,
  343. },
  344. .post_associate = iwl_post_associate,
  345. .isr = iwl_isr_ict,
  346. .config_ap = iwl_config_ap,
  347. .temp_ops = {
  348. .temperature = iwlagn_temperature,
  349. .set_ct_kill = iwl5000_set_ct_threshold,
  350. },
  351. .manage_ibss_station = iwlagn_manage_ibss_station,
  352. .update_bcast_stations = iwl_update_bcast_stations,
  353. .debugfs_ops = {
  354. .rx_stats_read = iwl_ucode_rx_stats_read,
  355. .tx_stats_read = iwl_ucode_tx_stats_read,
  356. .general_stats_read = iwl_ucode_general_stats_read,
  357. .bt_stats_read = iwl_ucode_bt_stats_read,
  358. .reply_tx_error = iwl_reply_tx_error_read,
  359. },
  360. .recover_from_tx_stall = iwl_bg_monitor_recover,
  361. .check_plcp_health = iwl_good_plcp_health,
  362. .check_ack_health = iwl_good_ack_health,
  363. .txfifo_flush = iwlagn_txfifo_flush,
  364. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  365. .tt_ops = {
  366. .lower_power_detection = iwl_tt_is_low_power_state,
  367. .tt_power_mode = iwl_tt_current_power_mode,
  368. .ct_kill_check = iwl_check_for_ct_kill,
  369. }
  370. };
  371. static struct iwl_lib_ops iwl5150_lib = {
  372. .set_hw_params = iwl5150_hw_set_hw_params,
  373. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  374. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  375. .txq_set_sched = iwlagn_txq_set_sched,
  376. .txq_agg_enable = iwlagn_txq_agg_enable,
  377. .txq_agg_disable = iwlagn_txq_agg_disable,
  378. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  379. .txq_free_tfd = iwl_hw_txq_free_tfd,
  380. .txq_init = iwl_hw_tx_queue_init,
  381. .rx_handler_setup = iwlagn_rx_handler_setup,
  382. .setup_deferred_work = iwlagn_setup_deferred_work,
  383. .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
  384. .dump_nic_event_log = iwl_dump_nic_event_log,
  385. .dump_nic_error_log = iwl_dump_nic_error_log,
  386. .dump_csr = iwl_dump_csr,
  387. .load_ucode = iwlagn_load_ucode,
  388. .init_alive_start = iwlagn_init_alive_start,
  389. .alive_notify = iwlagn_alive_notify,
  390. .send_tx_power = iwlagn_send_tx_power,
  391. .update_chain_flags = iwl_update_chain_flags,
  392. .set_channel_switch = iwl5000_hw_channel_switch,
  393. .apm_ops = {
  394. .init = iwl_apm_init,
  395. .stop = iwl_apm_stop,
  396. .config = iwl5000_nic_config,
  397. .set_pwr_src = iwl_set_pwr_src,
  398. },
  399. .eeprom_ops = {
  400. .regulatory_bands = {
  401. EEPROM_REG_BAND_1_CHANNELS,
  402. EEPROM_REG_BAND_2_CHANNELS,
  403. EEPROM_REG_BAND_3_CHANNELS,
  404. EEPROM_REG_BAND_4_CHANNELS,
  405. EEPROM_REG_BAND_5_CHANNELS,
  406. EEPROM_REG_BAND_24_HT40_CHANNELS,
  407. EEPROM_REG_BAND_52_HT40_CHANNELS
  408. },
  409. .verify_signature = iwlcore_eeprom_verify_signature,
  410. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  411. .release_semaphore = iwlcore_eeprom_release_semaphore,
  412. .calib_version = iwlagn_eeprom_calib_version,
  413. .query_addr = iwlagn_eeprom_query_addr,
  414. },
  415. .post_associate = iwl_post_associate,
  416. .isr = iwl_isr_ict,
  417. .config_ap = iwl_config_ap,
  418. .temp_ops = {
  419. .temperature = iwl5150_temperature,
  420. .set_ct_kill = iwl5150_set_ct_threshold,
  421. },
  422. .manage_ibss_station = iwlagn_manage_ibss_station,
  423. .update_bcast_stations = iwl_update_bcast_stations,
  424. .debugfs_ops = {
  425. .rx_stats_read = iwl_ucode_rx_stats_read,
  426. .tx_stats_read = iwl_ucode_tx_stats_read,
  427. .general_stats_read = iwl_ucode_general_stats_read,
  428. .bt_stats_read = iwl_ucode_bt_stats_read,
  429. .reply_tx_error = iwl_reply_tx_error_read,
  430. },
  431. .recover_from_tx_stall = iwl_bg_monitor_recover,
  432. .check_plcp_health = iwl_good_plcp_health,
  433. .check_ack_health = iwl_good_ack_health,
  434. .txfifo_flush = iwlagn_txfifo_flush,
  435. .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
  436. .tt_ops = {
  437. .lower_power_detection = iwl_tt_is_low_power_state,
  438. .tt_power_mode = iwl_tt_current_power_mode,
  439. .ct_kill_check = iwl_check_for_ct_kill,
  440. }
  441. };
  442. static const struct iwl_ops iwl5000_ops = {
  443. .lib = &iwl5000_lib,
  444. .hcmd = &iwlagn_hcmd,
  445. .utils = &iwlagn_hcmd_utils,
  446. .led = &iwlagn_led_ops,
  447. };
  448. static const struct iwl_ops iwl5150_ops = {
  449. .lib = &iwl5150_lib,
  450. .hcmd = &iwlagn_hcmd,
  451. .utils = &iwlagn_hcmd_utils,
  452. .led = &iwlagn_led_ops,
  453. };
  454. static struct iwl_base_params iwl5000_base_params = {
  455. .eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
  456. .num_of_queues = IWLAGN_NUM_QUEUES,
  457. .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
  458. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  459. .set_l0s = true,
  460. .use_bsm = false,
  461. .led_compensation = 51,
  462. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  463. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  464. .chain_noise_scale = 1000,
  465. .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
  466. .max_event_log_size = 512,
  467. .ucode_tracing = true,
  468. .sensitivity_calib_by_driver = true,
  469. .chain_noise_calib_by_driver = true,
  470. };
  471. static struct iwl_ht_params iwl5000_ht_params = {
  472. .ht_greenfield_support = true,
  473. .use_rts_for_aggregation = true, /* use rts/cts protection */
  474. };
  475. struct iwl_cfg iwl5300_agn_cfg = {
  476. .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
  477. .fw_name_pre = IWL5000_FW_PRE,
  478. .ucode_api_max = IWL5000_UCODE_API_MAX,
  479. .ucode_api_min = IWL5000_UCODE_API_MIN,
  480. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  481. .valid_tx_ant = ANT_ABC,
  482. .valid_rx_ant = ANT_ABC,
  483. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  484. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  485. .ops = &iwl5000_ops,
  486. .mod_params = &iwlagn_mod_params,
  487. .base_params = &iwl5000_base_params,
  488. .ht_params = &iwl5000_ht_params,
  489. };
  490. struct iwl_cfg iwl5100_bgn_cfg = {
  491. .name = "Intel(R) WiFi Link 5100 BGN",
  492. .fw_name_pre = IWL5000_FW_PRE,
  493. .ucode_api_max = IWL5000_UCODE_API_MAX,
  494. .ucode_api_min = IWL5000_UCODE_API_MIN,
  495. .sku = IWL_SKU_G|IWL_SKU_N,
  496. .valid_tx_ant = ANT_B,
  497. .valid_rx_ant = ANT_AB,
  498. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  499. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  500. .ops = &iwl5000_ops,
  501. .mod_params = &iwlagn_mod_params,
  502. .base_params = &iwl5000_base_params,
  503. .ht_params = &iwl5000_ht_params,
  504. };
  505. struct iwl_cfg iwl5100_abg_cfg = {
  506. .name = "Intel(R) WiFi Link 5100 ABG",
  507. .fw_name_pre = IWL5000_FW_PRE,
  508. .ucode_api_max = IWL5000_UCODE_API_MAX,
  509. .ucode_api_min = IWL5000_UCODE_API_MIN,
  510. .sku = IWL_SKU_A|IWL_SKU_G,
  511. .valid_tx_ant = ANT_B,
  512. .valid_rx_ant = ANT_AB,
  513. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  514. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  515. .ops = &iwl5000_ops,
  516. .mod_params = &iwlagn_mod_params,
  517. .base_params = &iwl5000_base_params,
  518. };
  519. struct iwl_cfg iwl5100_agn_cfg = {
  520. .name = "Intel(R) WiFi Link 5100 AGN",
  521. .fw_name_pre = IWL5000_FW_PRE,
  522. .ucode_api_max = IWL5000_UCODE_API_MAX,
  523. .ucode_api_min = IWL5000_UCODE_API_MIN,
  524. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  525. .valid_tx_ant = ANT_B,
  526. .valid_rx_ant = ANT_AB,
  527. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  528. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  529. .ops = &iwl5000_ops,
  530. .mod_params = &iwlagn_mod_params,
  531. .base_params = &iwl5000_base_params,
  532. .ht_params = &iwl5000_ht_params,
  533. };
  534. struct iwl_cfg iwl5350_agn_cfg = {
  535. .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
  536. .fw_name_pre = IWL5000_FW_PRE,
  537. .ucode_api_max = IWL5000_UCODE_API_MAX,
  538. .ucode_api_min = IWL5000_UCODE_API_MIN,
  539. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  540. .valid_tx_ant = ANT_ABC,
  541. .valid_rx_ant = ANT_ABC,
  542. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  543. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  544. .ops = &iwl5000_ops,
  545. .mod_params = &iwlagn_mod_params,
  546. .base_params = &iwl5000_base_params,
  547. .ht_params = &iwl5000_ht_params,
  548. };
  549. struct iwl_cfg iwl5150_agn_cfg = {
  550. .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
  551. .fw_name_pre = IWL5150_FW_PRE,
  552. .ucode_api_max = IWL5150_UCODE_API_MAX,
  553. .ucode_api_min = IWL5150_UCODE_API_MIN,
  554. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  555. .valid_tx_ant = ANT_A,
  556. .valid_rx_ant = ANT_AB,
  557. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  558. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  559. .ops = &iwl5150_ops,
  560. .mod_params = &iwlagn_mod_params,
  561. .base_params = &iwl5000_base_params,
  562. .ht_params = &iwl5000_ht_params,
  563. .need_dc_calib = true,
  564. };
  565. struct iwl_cfg iwl5150_abg_cfg = {
  566. .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
  567. .fw_name_pre = IWL5150_FW_PRE,
  568. .ucode_api_max = IWL5150_UCODE_API_MAX,
  569. .ucode_api_min = IWL5150_UCODE_API_MIN,
  570. .sku = IWL_SKU_A|IWL_SKU_G,
  571. .valid_tx_ant = ANT_A,
  572. .valid_rx_ant = ANT_AB,
  573. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  574. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  575. .ops = &iwl5150_ops,
  576. .mod_params = &iwlagn_mod_params,
  577. .base_params = &iwl5000_base_params,
  578. .need_dc_calib = true,
  579. };
  580. MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
  581. MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));