iwl-5000.c 19 KB

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