iwl-5000.c 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401
  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 Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  23. *
  24. *****************************************************************************/
  25. #include <linux/kernel.h>
  26. #include <linux/module.h>
  27. #include <linux/init.h>
  28. #include <linux/pci.h>
  29. #include <linux/dma-mapping.h>
  30. #include <linux/delay.h>
  31. #include <linux/sched.h>
  32. #include <linux/skbuff.h>
  33. #include <linux/netdevice.h>
  34. #include <linux/wireless.h>
  35. #include <net/mac80211.h>
  36. #include <linux/etherdevice.h>
  37. #include <asm/unaligned.h>
  38. #include "iwl-eeprom.h"
  39. #include "iwl-dev.h"
  40. #include "iwl-core.h"
  41. #include "iwl-io.h"
  42. #include "iwl-sta.h"
  43. #include "iwl-helpers.h"
  44. #include "iwl-agn.h"
  45. #include "iwl-agn-led.h"
  46. #include "iwl-5000-hw.h"
  47. #include "iwl-6000-hw.h"
  48. /* Highest firmware API version supported */
  49. #define IWL5000_UCODE_API_MAX 2
  50. #define IWL5150_UCODE_API_MAX 2
  51. /* Lowest firmware API version supported */
  52. #define IWL5000_UCODE_API_MIN 1
  53. #define IWL5150_UCODE_API_MIN 1
  54. #define IWL5000_FW_PRE "iwlwifi-5000-"
  55. #define _IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE #api ".ucode"
  56. #define IWL5000_MODULE_FIRMWARE(api) _IWL5000_MODULE_FIRMWARE(api)
  57. #define IWL5150_FW_PRE "iwlwifi-5150-"
  58. #define _IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE #api ".ucode"
  59. #define IWL5150_MODULE_FIRMWARE(api) _IWL5150_MODULE_FIRMWARE(api)
  60. static const s8 iwl5000_default_queue_to_tx_fifo[] = {
  61. IWL_TX_FIFO_VO,
  62. IWL_TX_FIFO_VI,
  63. IWL_TX_FIFO_BE,
  64. IWL_TX_FIFO_BK,
  65. IWL50_CMD_FIFO_NUM,
  66. IWL_TX_FIFO_UNUSED,
  67. IWL_TX_FIFO_UNUSED,
  68. IWL_TX_FIFO_UNUSED,
  69. IWL_TX_FIFO_UNUSED,
  70. IWL_TX_FIFO_UNUSED,
  71. };
  72. /* NIC configuration for 5000 series */
  73. void iwl5000_nic_config(struct iwl_priv *priv)
  74. {
  75. unsigned long flags;
  76. u16 radio_cfg;
  77. spin_lock_irqsave(&priv->lock, flags);
  78. radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
  79. /* write radio config values to register */
  80. if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
  81. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  82. EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
  83. EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
  84. EEPROM_RF_CFG_DASH_MSK(radio_cfg));
  85. /* set CSR_HW_CONFIG_REG for uCode use */
  86. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  87. CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
  88. CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
  89. /* W/A : NIC is stuck in a reset state after Early PCIe power off
  90. * (PCIe power is lost before PERST# is asserted),
  91. * causing ME FW to lose ownership and not being able to obtain it back.
  92. */
  93. iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
  94. APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
  95. ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
  96. spin_unlock_irqrestore(&priv->lock, flags);
  97. }
  98. /*
  99. * EEPROM
  100. */
  101. static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
  102. {
  103. u16 offset = 0;
  104. if ((address & INDIRECT_ADDRESS) == 0)
  105. return address;
  106. switch (address & INDIRECT_TYPE_MSK) {
  107. case INDIRECT_HOST:
  108. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_HOST);
  109. break;
  110. case INDIRECT_GENERAL:
  111. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_GENERAL);
  112. break;
  113. case INDIRECT_REGULATORY:
  114. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_REGULATORY);
  115. break;
  116. case INDIRECT_CALIBRATION:
  117. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_CALIBRATION);
  118. break;
  119. case INDIRECT_PROCESS_ADJST:
  120. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_PROCESS_ADJST);
  121. break;
  122. case INDIRECT_OTHERS:
  123. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS);
  124. break;
  125. default:
  126. IWL_ERR(priv, "illegal indirect type: 0x%X\n",
  127. address & INDIRECT_TYPE_MSK);
  128. break;
  129. }
  130. /* translate the offset from words to byte */
  131. return (address & ADDRESS_MSK) + (offset << 1);
  132. }
  133. u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv)
  134. {
  135. struct iwl_eeprom_calib_hdr {
  136. u8 version;
  137. u8 pa_type;
  138. u16 voltage;
  139. } *hdr;
  140. hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
  141. EEPROM_5000_CALIB_ALL);
  142. return hdr->version;
  143. }
  144. static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
  145. .min_nrg_cck = 95,
  146. .max_nrg_cck = 0, /* not used, set to 0 */
  147. .auto_corr_min_ofdm = 90,
  148. .auto_corr_min_ofdm_mrc = 170,
  149. .auto_corr_min_ofdm_x1 = 120,
  150. .auto_corr_min_ofdm_mrc_x1 = 240,
  151. .auto_corr_max_ofdm = 120,
  152. .auto_corr_max_ofdm_mrc = 210,
  153. .auto_corr_max_ofdm_x1 = 120,
  154. .auto_corr_max_ofdm_mrc_x1 = 240,
  155. .auto_corr_min_cck = 125,
  156. .auto_corr_max_cck = 200,
  157. .auto_corr_min_cck_mrc = 170,
  158. .auto_corr_max_cck_mrc = 400,
  159. .nrg_th_cck = 95,
  160. .nrg_th_ofdm = 95,
  161. .barker_corr_th_min = 190,
  162. .barker_corr_th_min_mrc = 390,
  163. .nrg_th_cca = 62,
  164. };
  165. static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
  166. .min_nrg_cck = 95,
  167. .max_nrg_cck = 0, /* not used, set to 0 */
  168. .auto_corr_min_ofdm = 90,
  169. .auto_corr_min_ofdm_mrc = 170,
  170. .auto_corr_min_ofdm_x1 = 105,
  171. .auto_corr_min_ofdm_mrc_x1 = 220,
  172. .auto_corr_max_ofdm = 120,
  173. .auto_corr_max_ofdm_mrc = 210,
  174. /* max = min for performance bug in 5150 DSP */
  175. .auto_corr_max_ofdm_x1 = 105,
  176. .auto_corr_max_ofdm_mrc_x1 = 220,
  177. .auto_corr_min_cck = 125,
  178. .auto_corr_max_cck = 200,
  179. .auto_corr_min_cck_mrc = 170,
  180. .auto_corr_max_cck_mrc = 400,
  181. .nrg_th_cck = 95,
  182. .nrg_th_ofdm = 95,
  183. .barker_corr_th_min = 190,
  184. .barker_corr_th_min_mrc = 390,
  185. .nrg_th_cca = 62,
  186. };
  187. const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
  188. size_t offset)
  189. {
  190. u32 address = eeprom_indirect_address(priv, offset);
  191. BUG_ON(address >= priv->cfg->eeprom_size);
  192. return &priv->eeprom[address];
  193. }
  194. static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
  195. {
  196. const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
  197. s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
  198. iwl_temp_calib_to_offset(priv);
  199. priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef;
  200. }
  201. static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
  202. {
  203. /* want Celsius */
  204. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
  205. }
  206. /*
  207. * Calibration
  208. */
  209. static int iwl5000_set_Xtal_calib(struct iwl_priv *priv)
  210. {
  211. struct iwl_calib_xtal_freq_cmd cmd;
  212. __le16 *xtal_calib =
  213. (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
  214. cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD;
  215. cmd.hdr.first_group = 0;
  216. cmd.hdr.groups_num = 1;
  217. cmd.hdr.data_valid = 1;
  218. cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
  219. cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
  220. return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL],
  221. (u8 *)&cmd, sizeof(cmd));
  222. }
  223. static int iwl5000_send_calib_cfg(struct iwl_priv *priv)
  224. {
  225. struct iwl_calib_cfg_cmd calib_cfg_cmd;
  226. struct iwl_host_cmd cmd = {
  227. .id = CALIBRATION_CFG_CMD,
  228. .len = sizeof(struct iwl_calib_cfg_cmd),
  229. .data = &calib_cfg_cmd,
  230. };
  231. memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
  232. calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
  233. calib_cfg_cmd.ucd_calib_cfg.once.start = IWL_CALIB_INIT_CFG_ALL;
  234. calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL;
  235. calib_cfg_cmd.ucd_calib_cfg.flags = IWL_CALIB_INIT_CFG_ALL;
  236. return iwl_send_cmd(priv, &cmd);
  237. }
  238. static void iwl5000_rx_calib_result(struct iwl_priv *priv,
  239. struct iwl_rx_mem_buffer *rxb)
  240. {
  241. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  242. struct iwl_calib_hdr *hdr = (struct iwl_calib_hdr *)pkt->u.raw;
  243. int len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
  244. int index;
  245. /* reduce the size of the length field itself */
  246. len -= 4;
  247. /* Define the order in which the results will be sent to the runtime
  248. * uCode. iwl_send_calib_results sends them in a row according to their
  249. * index. We sort them here */
  250. switch (hdr->op_code) {
  251. case IWL_PHY_CALIBRATE_DC_CMD:
  252. index = IWL_CALIB_DC;
  253. break;
  254. case IWL_PHY_CALIBRATE_LO_CMD:
  255. index = IWL_CALIB_LO;
  256. break;
  257. case IWL_PHY_CALIBRATE_TX_IQ_CMD:
  258. index = IWL_CALIB_TX_IQ;
  259. break;
  260. case IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD:
  261. index = IWL_CALIB_TX_IQ_PERD;
  262. break;
  263. case IWL_PHY_CALIBRATE_BASE_BAND_CMD:
  264. index = IWL_CALIB_BASE_BAND;
  265. break;
  266. default:
  267. IWL_ERR(priv, "Unknown calibration notification %d\n",
  268. hdr->op_code);
  269. return;
  270. }
  271. iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len);
  272. }
  273. static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
  274. struct iwl_rx_mem_buffer *rxb)
  275. {
  276. IWL_DEBUG_INFO(priv, "Init. calibration is completed, restarting fw.\n");
  277. queue_work(priv->workqueue, &priv->restart);
  278. }
  279. void iwl5000_init_alive_start(struct iwl_priv *priv)
  280. {
  281. int ret = 0;
  282. /* Check alive response for "valid" sign from uCode */
  283. if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
  284. /* We had an error bringing up the hardware, so take it
  285. * all the way back down so we can try again */
  286. IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
  287. goto restart;
  288. }
  289. /* initialize uCode was loaded... verify inst image.
  290. * This is a paranoid check, because we would not have gotten the
  291. * "initialize" alive if code weren't properly loaded. */
  292. if (iwl_verify_ucode(priv)) {
  293. /* Runtime instruction load was bad;
  294. * take it all the way back down so we can try again */
  295. IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
  296. goto restart;
  297. }
  298. ret = priv->cfg->ops->lib->alive_notify(priv);
  299. if (ret) {
  300. IWL_WARN(priv,
  301. "Could not complete ALIVE transition: %d\n", ret);
  302. goto restart;
  303. }
  304. iwl5000_send_calib_cfg(priv);
  305. return;
  306. restart:
  307. /* real restart (first load init_ucode) */
  308. queue_work(priv->workqueue, &priv->restart);
  309. }
  310. static void iwl5000_set_wr_ptrs(struct iwl_priv *priv,
  311. int txq_id, u32 index)
  312. {
  313. iwl_write_direct32(priv, HBUS_TARG_WRPTR,
  314. (index & 0xff) | (txq_id << 8));
  315. iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(txq_id), index);
  316. }
  317. static void iwl5000_tx_queue_set_status(struct iwl_priv *priv,
  318. struct iwl_tx_queue *txq,
  319. int tx_fifo_id, int scd_retry)
  320. {
  321. int txq_id = txq->q.id;
  322. int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0;
  323. iwl_write_prph(priv, IWL50_SCD_QUEUE_STATUS_BITS(txq_id),
  324. (active << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
  325. (tx_fifo_id << IWL50_SCD_QUEUE_STTS_REG_POS_TXF) |
  326. (1 << IWL50_SCD_QUEUE_STTS_REG_POS_WSL) |
  327. IWL50_SCD_QUEUE_STTS_REG_MSK);
  328. txq->sched_retry = scd_retry;
  329. IWL_DEBUG_INFO(priv, "%s %s Queue %d on FIFO %d\n",
  330. active ? "Activate" : "Deactivate",
  331. scd_retry ? "BA" : "AC/CMD", txq_id, tx_fifo_id);
  332. }
  333. int iwl5000_alive_notify(struct iwl_priv *priv)
  334. {
  335. u32 a;
  336. unsigned long flags;
  337. int i, chan;
  338. u32 reg_val;
  339. spin_lock_irqsave(&priv->lock, flags);
  340. priv->scd_base_addr = iwl_read_prph(priv, IWL50_SCD_SRAM_BASE_ADDR);
  341. a = priv->scd_base_addr + IWL50_SCD_CONTEXT_DATA_OFFSET;
  342. for (; a < priv->scd_base_addr + IWL50_SCD_TX_STTS_BITMAP_OFFSET;
  343. a += 4)
  344. iwl_write_targ_mem(priv, a, 0);
  345. for (; a < priv->scd_base_addr + IWL50_SCD_TRANSLATE_TBL_OFFSET;
  346. a += 4)
  347. iwl_write_targ_mem(priv, a, 0);
  348. for (; a < priv->scd_base_addr +
  349. IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
  350. iwl_write_targ_mem(priv, a, 0);
  351. iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR,
  352. priv->scd_bc_tbls.dma >> 10);
  353. /* Enable DMA channel */
  354. for (chan = 0; chan < FH50_TCSR_CHNL_NUM ; chan++)
  355. iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan),
  356. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
  357. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
  358. /* Update FH chicken bits */
  359. reg_val = iwl_read_direct32(priv, FH_TX_CHICKEN_BITS_REG);
  360. iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG,
  361. reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
  362. iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL,
  363. IWL50_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num));
  364. iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0);
  365. /* initiate the queues */
  366. for (i = 0; i < priv->hw_params.max_txq_num; i++) {
  367. iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(i), 0);
  368. iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
  369. iwl_write_targ_mem(priv, priv->scd_base_addr +
  370. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
  371. iwl_write_targ_mem(priv, priv->scd_base_addr +
  372. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i) +
  373. sizeof(u32),
  374. ((SCD_WIN_SIZE <<
  375. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
  376. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
  377. ((SCD_FRAME_LIMIT <<
  378. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
  379. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
  380. }
  381. iwl_write_prph(priv, IWL50_SCD_INTERRUPT_MASK,
  382. IWL_MASK(0, priv->hw_params.max_txq_num));
  383. /* Activate all Tx DMA/FIFO channels */
  384. priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7));
  385. iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
  386. /* make sure all queue are not stopped */
  387. memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
  388. for (i = 0; i < 4; i++)
  389. atomic_set(&priv->queue_stop_count[i], 0);
  390. /* reset to 0 to enable all the queue first */
  391. priv->txq_ctx_active_msk = 0;
  392. /* map qos queues to fifos one-to-one */
  393. BUILD_BUG_ON(ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo) != 10);
  394. for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) {
  395. int ac = iwl5000_default_queue_to_tx_fifo[i];
  396. iwl_txq_ctx_activate(priv, i);
  397. if (ac == IWL_TX_FIFO_UNUSED)
  398. continue;
  399. iwl5000_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
  400. }
  401. spin_unlock_irqrestore(&priv->lock, flags);
  402. iwl_send_wimax_coex(priv);
  403. iwl5000_set_Xtal_calib(priv);
  404. iwl_send_calib_results(priv);
  405. return 0;
  406. }
  407. int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
  408. {
  409. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  410. priv->cfg->mod_params->num_of_queues <= IWL50_NUM_QUEUES)
  411. priv->cfg->num_of_queues =
  412. priv->cfg->mod_params->num_of_queues;
  413. priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
  414. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  415. priv->hw_params.scd_bc_tbls_size =
  416. priv->cfg->num_of_queues *
  417. sizeof(struct iwl5000_scd_bc_tbl);
  418. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  419. priv->hw_params.max_stations = IWL5000_STATION_COUNT;
  420. priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
  421. priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
  422. priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
  423. priv->hw_params.max_bsm_size = 0;
  424. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  425. BIT(IEEE80211_BAND_5GHZ);
  426. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  427. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  428. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  429. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  430. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  431. if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
  432. priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
  433. /* Set initial sensitivity parameters */
  434. /* Set initial calibration set */
  435. switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
  436. case CSR_HW_REV_TYPE_5150:
  437. priv->hw_params.sens = &iwl5150_sensitivity;
  438. priv->hw_params.calib_init_cfg =
  439. BIT(IWL_CALIB_DC) |
  440. BIT(IWL_CALIB_LO) |
  441. BIT(IWL_CALIB_TX_IQ) |
  442. BIT(IWL_CALIB_BASE_BAND);
  443. break;
  444. default:
  445. priv->hw_params.sens = &iwl5000_sensitivity;
  446. priv->hw_params.calib_init_cfg =
  447. BIT(IWL_CALIB_XTAL) |
  448. BIT(IWL_CALIB_LO) |
  449. BIT(IWL_CALIB_TX_IQ) |
  450. BIT(IWL_CALIB_TX_IQ_PERD) |
  451. BIT(IWL_CALIB_BASE_BAND);
  452. break;
  453. }
  454. return 0;
  455. }
  456. /**
  457. * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
  458. */
  459. void iwl5000_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
  460. struct iwl_tx_queue *txq,
  461. u16 byte_cnt)
  462. {
  463. struct iwl5000_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr;
  464. int write_ptr = txq->q.write_ptr;
  465. int txq_id = txq->q.id;
  466. u8 sec_ctl = 0;
  467. u8 sta_id = 0;
  468. u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE;
  469. __le16 bc_ent;
  470. WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX);
  471. if (txq_id != IWL_CMD_QUEUE_NUM) {
  472. sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id;
  473. sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl;
  474. switch (sec_ctl & TX_CMD_SEC_MSK) {
  475. case TX_CMD_SEC_CCM:
  476. len += CCMP_MIC_LEN;
  477. break;
  478. case TX_CMD_SEC_TKIP:
  479. len += TKIP_ICV_LEN;
  480. break;
  481. case TX_CMD_SEC_WEP:
  482. len += WEP_IV_LEN + WEP_ICV_LEN;
  483. break;
  484. }
  485. }
  486. bc_ent = cpu_to_le16((len & 0xFFF) | (sta_id << 12));
  487. scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent;
  488. if (write_ptr < TFD_QUEUE_SIZE_BC_DUP)
  489. scd_bc_tbl[txq_id].
  490. tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent;
  491. }
  492. void iwl5000_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
  493. struct iwl_tx_queue *txq)
  494. {
  495. struct iwl5000_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr;
  496. int txq_id = txq->q.id;
  497. int read_ptr = txq->q.read_ptr;
  498. u8 sta_id = 0;
  499. __le16 bc_ent;
  500. WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
  501. if (txq_id != IWL_CMD_QUEUE_NUM)
  502. sta_id = txq->cmd[read_ptr]->cmd.tx.sta_id;
  503. bc_ent = cpu_to_le16(1 | (sta_id << 12));
  504. scd_bc_tbl[txq_id].tfd_offset[read_ptr] = bc_ent;
  505. if (read_ptr < TFD_QUEUE_SIZE_BC_DUP)
  506. scd_bc_tbl[txq_id].
  507. tfd_offset[TFD_QUEUE_SIZE_MAX + read_ptr] = bc_ent;
  508. }
  509. static int iwl5000_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
  510. u16 txq_id)
  511. {
  512. u32 tbl_dw_addr;
  513. u32 tbl_dw;
  514. u16 scd_q2ratid;
  515. scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK;
  516. tbl_dw_addr = priv->scd_base_addr +
  517. IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id);
  518. tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr);
  519. if (txq_id & 0x1)
  520. tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF);
  521. else
  522. tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000);
  523. iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw);
  524. return 0;
  525. }
  526. static void iwl5000_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id)
  527. {
  528. /* Simply stop the queue, but don't change any configuration;
  529. * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */
  530. iwl_write_prph(priv,
  531. IWL50_SCD_QUEUE_STATUS_BITS(txq_id),
  532. (0 << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE)|
  533. (1 << IWL50_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
  534. }
  535. int iwl5000_txq_agg_enable(struct iwl_priv *priv, int txq_id,
  536. int tx_fifo, int sta_id, int tid, u16 ssn_idx)
  537. {
  538. unsigned long flags;
  539. u16 ra_tid;
  540. if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
  541. (IWL50_FIRST_AMPDU_QUEUE + priv->cfg->num_of_ampdu_queues
  542. <= txq_id)) {
  543. IWL_WARN(priv,
  544. "queue number out of range: %d, must be %d to %d\n",
  545. txq_id, IWL50_FIRST_AMPDU_QUEUE,
  546. IWL50_FIRST_AMPDU_QUEUE +
  547. priv->cfg->num_of_ampdu_queues - 1);
  548. return -EINVAL;
  549. }
  550. ra_tid = BUILD_RAxTID(sta_id, tid);
  551. /* Modify device's station table to Tx this TID */
  552. iwl_sta_tx_modify_enable_tid(priv, sta_id, tid);
  553. spin_lock_irqsave(&priv->lock, flags);
  554. /* Stop this Tx queue before configuring it */
  555. iwl5000_tx_queue_stop_scheduler(priv, txq_id);
  556. /* Map receiver-address / traffic-ID to this queue */
  557. iwl5000_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
  558. /* Set this queue as a chain-building queue */
  559. iwl_set_bits_prph(priv, IWL50_SCD_QUEUECHAIN_SEL, (1<<txq_id));
  560. /* enable aggregations for the queue */
  561. iwl_set_bits_prph(priv, IWL50_SCD_AGGR_SEL, (1<<txq_id));
  562. /* Place first TFD at index corresponding to start sequence number.
  563. * Assumes that ssn_idx is valid (!= 0xFFF) */
  564. priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
  565. priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
  566. iwl5000_set_wr_ptrs(priv, txq_id, ssn_idx);
  567. /* Set up Tx window size and frame limit for this queue */
  568. iwl_write_targ_mem(priv, priv->scd_base_addr +
  569. IWL50_SCD_CONTEXT_QUEUE_OFFSET(txq_id) +
  570. sizeof(u32),
  571. ((SCD_WIN_SIZE <<
  572. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
  573. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
  574. ((SCD_FRAME_LIMIT <<
  575. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
  576. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
  577. iwl_set_bits_prph(priv, IWL50_SCD_INTERRUPT_MASK, (1 << txq_id));
  578. /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */
  579. iwl5000_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
  580. spin_unlock_irqrestore(&priv->lock, flags);
  581. return 0;
  582. }
  583. int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
  584. u16 ssn_idx, u8 tx_fifo)
  585. {
  586. if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
  587. (IWL50_FIRST_AMPDU_QUEUE + priv->cfg->num_of_ampdu_queues
  588. <= txq_id)) {
  589. IWL_ERR(priv,
  590. "queue number out of range: %d, must be %d to %d\n",
  591. txq_id, IWL50_FIRST_AMPDU_QUEUE,
  592. IWL50_FIRST_AMPDU_QUEUE +
  593. priv->cfg->num_of_ampdu_queues - 1);
  594. return -EINVAL;
  595. }
  596. iwl5000_tx_queue_stop_scheduler(priv, txq_id);
  597. iwl_clear_bits_prph(priv, IWL50_SCD_AGGR_SEL, (1 << txq_id));
  598. priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
  599. priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
  600. /* supposes that ssn_idx is valid (!= 0xFFF) */
  601. iwl5000_set_wr_ptrs(priv, txq_id, ssn_idx);
  602. iwl_clear_bits_prph(priv, IWL50_SCD_INTERRUPT_MASK, (1 << txq_id));
  603. iwl_txq_ctx_deactivate(priv, txq_id);
  604. iwl5000_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
  605. return 0;
  606. }
  607. /*
  608. * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask
  609. * must be called under priv->lock and mac access
  610. */
  611. void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask)
  612. {
  613. iwl_write_prph(priv, IWL50_SCD_TXFACT, mask);
  614. }
  615. static inline u32 iwl5000_get_scd_ssn(struct iwl5000_tx_resp *tx_resp)
  616. {
  617. return le32_to_cpup((__le32 *)&tx_resp->status +
  618. tx_resp->frame_count) & MAX_SN;
  619. }
  620. static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
  621. struct iwl_ht_agg *agg,
  622. struct iwl5000_tx_resp *tx_resp,
  623. int txq_id, u16 start_idx)
  624. {
  625. u16 status;
  626. struct agg_tx_status *frame_status = &tx_resp->status;
  627. struct ieee80211_tx_info *info = NULL;
  628. struct ieee80211_hdr *hdr = NULL;
  629. u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
  630. int i, sh, idx;
  631. u16 seq;
  632. if (agg->wait_for_ba)
  633. IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n");
  634. agg->frame_count = tx_resp->frame_count;
  635. agg->start_idx = start_idx;
  636. agg->rate_n_flags = rate_n_flags;
  637. agg->bitmap = 0;
  638. /* # frames attempted by Tx command */
  639. if (agg->frame_count == 1) {
  640. /* Only one frame was attempted; no block-ack will arrive */
  641. status = le16_to_cpu(frame_status[0].status);
  642. idx = start_idx;
  643. /* FIXME: code repetition */
  644. IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
  645. agg->frame_count, agg->start_idx, idx);
  646. info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
  647. info->status.rates[0].count = tx_resp->failure_frame + 1;
  648. info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  649. info->flags |= iwl_tx_status_to_mac80211(status);
  650. iwl_hwrate_to_tx_control(priv, rate_n_flags, info);
  651. /* FIXME: code repetition end */
  652. IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
  653. status & 0xff, tx_resp->failure_frame);
  654. IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
  655. agg->wait_for_ba = 0;
  656. } else {
  657. /* Two or more frames were attempted; expect block-ack */
  658. u64 bitmap = 0;
  659. int start = agg->start_idx;
  660. /* Construct bit-map of pending frames within Tx window */
  661. for (i = 0; i < agg->frame_count; i++) {
  662. u16 sc;
  663. status = le16_to_cpu(frame_status[i].status);
  664. seq = le16_to_cpu(frame_status[i].sequence);
  665. idx = SEQ_TO_INDEX(seq);
  666. txq_id = SEQ_TO_QUEUE(seq);
  667. if (status & (AGG_TX_STATE_FEW_BYTES_MSK |
  668. AGG_TX_STATE_ABORT_MSK))
  669. continue;
  670. IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
  671. agg->frame_count, txq_id, idx);
  672. hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
  673. if (!hdr) {
  674. IWL_ERR(priv,
  675. "BUG_ON idx doesn't point to valid skb"
  676. " idx=%d, txq_id=%d\n", idx, txq_id);
  677. return -1;
  678. }
  679. sc = le16_to_cpu(hdr->seq_ctrl);
  680. if (idx != (SEQ_TO_SN(sc) & 0xff)) {
  681. IWL_ERR(priv,
  682. "BUG_ON idx doesn't match seq control"
  683. " idx=%d, seq_idx=%d, seq=%d\n",
  684. idx, SEQ_TO_SN(sc),
  685. hdr->seq_ctrl);
  686. return -1;
  687. }
  688. IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
  689. i, idx, SEQ_TO_SN(sc));
  690. sh = idx - start;
  691. if (sh > 64) {
  692. sh = (start - idx) + 0xff;
  693. bitmap = bitmap << sh;
  694. sh = 0;
  695. start = idx;
  696. } else if (sh < -64)
  697. sh = 0xff - (start - idx);
  698. else if (sh < 0) {
  699. sh = start - idx;
  700. start = idx;
  701. bitmap = bitmap << sh;
  702. sh = 0;
  703. }
  704. bitmap |= 1ULL << sh;
  705. IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
  706. start, (unsigned long long)bitmap);
  707. }
  708. agg->bitmap = bitmap;
  709. agg->start_idx = start;
  710. IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
  711. agg->frame_count, agg->start_idx,
  712. (unsigned long long)agg->bitmap);
  713. if (bitmap)
  714. agg->wait_for_ba = 1;
  715. }
  716. return 0;
  717. }
  718. static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
  719. struct iwl_rx_mem_buffer *rxb)
  720. {
  721. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  722. u16 sequence = le16_to_cpu(pkt->hdr.sequence);
  723. int txq_id = SEQ_TO_QUEUE(sequence);
  724. int index = SEQ_TO_INDEX(sequence);
  725. struct iwl_tx_queue *txq = &priv->txq[txq_id];
  726. struct ieee80211_tx_info *info;
  727. struct iwl5000_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
  728. u32 status = le16_to_cpu(tx_resp->status.status);
  729. int tid;
  730. int sta_id;
  731. int freed;
  732. if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
  733. IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
  734. "is out of range [0-%d] %d %d\n", txq_id,
  735. index, txq->q.n_bd, txq->q.write_ptr,
  736. txq->q.read_ptr);
  737. return;
  738. }
  739. info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
  740. memset(&info->status, 0, sizeof(info->status));
  741. tid = (tx_resp->ra_tid & IWL50_TX_RES_TID_MSK) >> IWL50_TX_RES_TID_POS;
  742. sta_id = (tx_resp->ra_tid & IWL50_TX_RES_RA_MSK) >> IWL50_TX_RES_RA_POS;
  743. if (txq->sched_retry) {
  744. const u32 scd_ssn = iwl5000_get_scd_ssn(tx_resp);
  745. struct iwl_ht_agg *agg = NULL;
  746. agg = &priv->stations[sta_id].tid[tid].agg;
  747. iwl5000_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index);
  748. /* check if BAR is needed */
  749. if ((tx_resp->frame_count == 1) && !iwl_is_tx_success(status))
  750. info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
  751. if (txq->q.read_ptr != (scd_ssn & 0xff)) {
  752. index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
  753. IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim "
  754. "scd_ssn=%d idx=%d txq=%d swq=%d\n",
  755. scd_ssn , index, txq_id, txq->swq_id);
  756. freed = iwl_tx_queue_reclaim(priv, txq_id, index);
  757. iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
  758. if (priv->mac80211_registered &&
  759. (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
  760. (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) {
  761. if (agg->state == IWL_AGG_OFF)
  762. iwl_wake_queue(priv, txq_id);
  763. else
  764. iwl_wake_queue(priv, txq->swq_id);
  765. }
  766. }
  767. } else {
  768. BUG_ON(txq_id != txq->swq_id);
  769. info->status.rates[0].count = tx_resp->failure_frame + 1;
  770. info->flags |= iwl_tx_status_to_mac80211(status);
  771. iwl_hwrate_to_tx_control(priv,
  772. le32_to_cpu(tx_resp->rate_n_flags),
  773. info);
  774. IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
  775. "0x%x retries %d\n",
  776. txq_id,
  777. iwl_get_tx_fail_reason(status), status,
  778. le32_to_cpu(tx_resp->rate_n_flags),
  779. tx_resp->failure_frame);
  780. freed = iwl_tx_queue_reclaim(priv, txq_id, index);
  781. iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
  782. if (priv->mac80211_registered &&
  783. (iwl_queue_space(&txq->q) > txq->q.low_mark))
  784. iwl_wake_queue(priv, txq_id);
  785. }
  786. iwl_txq_check_empty(priv, sta_id, tid, txq_id);
  787. if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
  788. IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
  789. }
  790. void iwl5000_setup_deferred_work(struct iwl_priv *priv)
  791. {
  792. /* in 5000 the tx power calibration is done in uCode */
  793. priv->disable_tx_power_cal = 1;
  794. }
  795. void iwl5000_rx_handler_setup(struct iwl_priv *priv)
  796. {
  797. /* init calibration handlers */
  798. priv->rx_handlers[CALIBRATION_RES_NOTIFICATION] =
  799. iwl5000_rx_calib_result;
  800. priv->rx_handlers[CALIBRATION_COMPLETE_NOTIFICATION] =
  801. iwl5000_rx_calib_complete;
  802. priv->rx_handlers[REPLY_TX] = iwl5000_rx_reply_tx;
  803. }
  804. int iwl5000_hw_valid_rtc_data_addr(u32 addr)
  805. {
  806. return (addr >= IWL50_RTC_DATA_LOWER_BOUND) &&
  807. (addr < IWL50_RTC_DATA_UPPER_BOUND);
  808. }
  809. int iwl5000_send_tx_power(struct iwl_priv *priv)
  810. {
  811. struct iwl5000_tx_power_dbm_cmd tx_power_cmd;
  812. u8 tx_ant_cfg_cmd;
  813. /* half dBm need to multiply */
  814. tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
  815. if (priv->tx_power_lmt_in_half_dbm &&
  816. priv->tx_power_lmt_in_half_dbm < tx_power_cmd.global_lmt) {
  817. /*
  818. * For the newer devices which using enhanced/extend tx power
  819. * table in EEPROM, the format is in half dBm. driver need to
  820. * convert to dBm format before report to mac80211.
  821. * By doing so, there is a possibility of 1/2 dBm resolution
  822. * lost. driver will perform "round-up" operation before
  823. * reporting, but it will cause 1/2 dBm tx power over the
  824. * regulatory limit. Perform the checking here, if the
  825. * "tx_power_user_lmt" is higher than EEPROM value (in
  826. * half-dBm format), lower the tx power based on EEPROM
  827. */
  828. tx_power_cmd.global_lmt = priv->tx_power_lmt_in_half_dbm;
  829. }
  830. tx_power_cmd.flags = IWL50_TX_POWER_NO_CLOSED;
  831. tx_power_cmd.srv_chan_lmt = IWL50_TX_POWER_AUTO;
  832. if (IWL_UCODE_API(priv->ucode_ver) == 1)
  833. tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
  834. else
  835. tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
  836. return iwl_send_cmd_pdu_async(priv, tx_ant_cfg_cmd,
  837. sizeof(tx_power_cmd), &tx_power_cmd,
  838. NULL);
  839. }
  840. void iwl5000_temperature(struct iwl_priv *priv)
  841. {
  842. /* store temperature from statistics (in Celsius) */
  843. priv->temperature = le32_to_cpu(priv->statistics.general.temperature);
  844. iwl_tt_handler(priv);
  845. }
  846. static void iwl5150_temperature(struct iwl_priv *priv)
  847. {
  848. u32 vt = 0;
  849. s32 offset = iwl_temp_calib_to_offset(priv);
  850. vt = le32_to_cpu(priv->statistics.general.temperature);
  851. vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
  852. /* now vt hold the temperature in Kelvin */
  853. priv->temperature = KELVIN_TO_CELSIUS(vt);
  854. iwl_tt_handler(priv);
  855. }
  856. static int iwl5000_hw_channel_switch(struct iwl_priv *priv, u16 channel)
  857. {
  858. struct iwl5000_channel_switch_cmd cmd;
  859. const struct iwl_channel_info *ch_info;
  860. struct iwl_host_cmd hcmd = {
  861. .id = REPLY_CHANNEL_SWITCH,
  862. .len = sizeof(cmd),
  863. .flags = CMD_SIZE_HUGE,
  864. .data = &cmd,
  865. };
  866. IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
  867. priv->active_rxon.channel, channel);
  868. cmd.band = priv->band == IEEE80211_BAND_2GHZ;
  869. cmd.channel = cpu_to_le16(channel);
  870. cmd.rxon_flags = priv->staging_rxon.flags;
  871. cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
  872. cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
  873. ch_info = iwl_get_channel_info(priv, priv->band, channel);
  874. if (ch_info)
  875. cmd.expect_beacon = is_channel_radar(ch_info);
  876. else {
  877. IWL_ERR(priv, "invalid channel switch from %u to %u\n",
  878. priv->active_rxon.channel, channel);
  879. return -EFAULT;
  880. }
  881. priv->switch_rxon.channel = cpu_to_le16(channel);
  882. priv->switch_rxon.switch_in_progress = true;
  883. return iwl_send_cmd_sync(priv, &hcmd);
  884. }
  885. struct iwl_lib_ops iwl5000_lib = {
  886. .set_hw_params = iwl5000_hw_set_hw_params,
  887. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  888. .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
  889. .txq_set_sched = iwl5000_txq_set_sched,
  890. .txq_agg_enable = iwl5000_txq_agg_enable,
  891. .txq_agg_disable = iwl5000_txq_agg_disable,
  892. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  893. .txq_free_tfd = iwl_hw_txq_free_tfd,
  894. .txq_init = iwl_hw_tx_queue_init,
  895. .rx_handler_setup = iwl5000_rx_handler_setup,
  896. .setup_deferred_work = iwl5000_setup_deferred_work,
  897. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  898. .dump_nic_event_log = iwl_dump_nic_event_log,
  899. .dump_nic_error_log = iwl_dump_nic_error_log,
  900. .dump_csr = iwl_dump_csr,
  901. .dump_fh = iwl_dump_fh,
  902. .load_ucode = iwlagn_load_ucode,
  903. .init_alive_start = iwl5000_init_alive_start,
  904. .alive_notify = iwl5000_alive_notify,
  905. .send_tx_power = iwl5000_send_tx_power,
  906. .update_chain_flags = iwl_update_chain_flags,
  907. .set_channel_switch = iwl5000_hw_channel_switch,
  908. .apm_ops = {
  909. .init = iwl_apm_init,
  910. .stop = iwl_apm_stop,
  911. .config = iwl5000_nic_config,
  912. .set_pwr_src = iwl_set_pwr_src,
  913. },
  914. .eeprom_ops = {
  915. .regulatory_bands = {
  916. EEPROM_5000_REG_BAND_1_CHANNELS,
  917. EEPROM_5000_REG_BAND_2_CHANNELS,
  918. EEPROM_5000_REG_BAND_3_CHANNELS,
  919. EEPROM_5000_REG_BAND_4_CHANNELS,
  920. EEPROM_5000_REG_BAND_5_CHANNELS,
  921. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  922. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  923. },
  924. .verify_signature = iwlcore_eeprom_verify_signature,
  925. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  926. .release_semaphore = iwlcore_eeprom_release_semaphore,
  927. .calib_version = iwl5000_eeprom_calib_version,
  928. .query_addr = iwl5000_eeprom_query_addr,
  929. },
  930. .post_associate = iwl_post_associate,
  931. .isr = iwl_isr_ict,
  932. .config_ap = iwl_config_ap,
  933. .temp_ops = {
  934. .temperature = iwl5000_temperature,
  935. .set_ct_kill = iwl5000_set_ct_threshold,
  936. },
  937. .add_bcast_station = iwl_add_bcast_station,
  938. .recover_from_tx_stall = iwl_bg_monitor_recover,
  939. .check_plcp_health = iwl_good_plcp_health,
  940. .check_ack_health = iwl_good_ack_health,
  941. };
  942. static struct iwl_lib_ops iwl5150_lib = {
  943. .set_hw_params = iwl5000_hw_set_hw_params,
  944. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  945. .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
  946. .txq_set_sched = iwl5000_txq_set_sched,
  947. .txq_agg_enable = iwl5000_txq_agg_enable,
  948. .txq_agg_disable = iwl5000_txq_agg_disable,
  949. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  950. .txq_free_tfd = iwl_hw_txq_free_tfd,
  951. .txq_init = iwl_hw_tx_queue_init,
  952. .rx_handler_setup = iwl5000_rx_handler_setup,
  953. .setup_deferred_work = iwl5000_setup_deferred_work,
  954. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  955. .dump_nic_event_log = iwl_dump_nic_event_log,
  956. .dump_nic_error_log = iwl_dump_nic_error_log,
  957. .dump_csr = iwl_dump_csr,
  958. .load_ucode = iwlagn_load_ucode,
  959. .init_alive_start = iwl5000_init_alive_start,
  960. .alive_notify = iwl5000_alive_notify,
  961. .send_tx_power = iwl5000_send_tx_power,
  962. .update_chain_flags = iwl_update_chain_flags,
  963. .set_channel_switch = iwl5000_hw_channel_switch,
  964. .apm_ops = {
  965. .init = iwl_apm_init,
  966. .stop = iwl_apm_stop,
  967. .config = iwl5000_nic_config,
  968. .set_pwr_src = iwl_set_pwr_src,
  969. },
  970. .eeprom_ops = {
  971. .regulatory_bands = {
  972. EEPROM_5000_REG_BAND_1_CHANNELS,
  973. EEPROM_5000_REG_BAND_2_CHANNELS,
  974. EEPROM_5000_REG_BAND_3_CHANNELS,
  975. EEPROM_5000_REG_BAND_4_CHANNELS,
  976. EEPROM_5000_REG_BAND_5_CHANNELS,
  977. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  978. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  979. },
  980. .verify_signature = iwlcore_eeprom_verify_signature,
  981. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  982. .release_semaphore = iwlcore_eeprom_release_semaphore,
  983. .calib_version = iwl5000_eeprom_calib_version,
  984. .query_addr = iwl5000_eeprom_query_addr,
  985. },
  986. .post_associate = iwl_post_associate,
  987. .isr = iwl_isr_ict,
  988. .config_ap = iwl_config_ap,
  989. .temp_ops = {
  990. .temperature = iwl5150_temperature,
  991. .set_ct_kill = iwl5150_set_ct_threshold,
  992. },
  993. .add_bcast_station = iwl_add_bcast_station,
  994. .recover_from_tx_stall = iwl_bg_monitor_recover,
  995. .check_plcp_health = iwl_good_plcp_health,
  996. .check_ack_health = iwl_good_ack_health,
  997. };
  998. static const struct iwl_ops iwl5000_ops = {
  999. .ucode = &iwlagn_ucode,
  1000. .lib = &iwl5000_lib,
  1001. .hcmd = &iwlagn_hcmd,
  1002. .utils = &iwlagn_hcmd_utils,
  1003. .led = &iwlagn_led_ops,
  1004. };
  1005. static const struct iwl_ops iwl5150_ops = {
  1006. .ucode = &iwlagn_ucode,
  1007. .lib = &iwl5150_lib,
  1008. .hcmd = &iwlagn_hcmd,
  1009. .utils = &iwlagn_hcmd_utils,
  1010. .led = &iwlagn_led_ops,
  1011. };
  1012. struct iwl_mod_params iwl50_mod_params = {
  1013. .amsdu_size_8K = 1,
  1014. .restart_fw = 1,
  1015. /* the rest are 0 by default */
  1016. };
  1017. struct iwl_cfg iwl5300_agn_cfg = {
  1018. .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
  1019. .fw_name_pre = IWL5000_FW_PRE,
  1020. .ucode_api_max = IWL5000_UCODE_API_MAX,
  1021. .ucode_api_min = IWL5000_UCODE_API_MIN,
  1022. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  1023. .ops = &iwl5000_ops,
  1024. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1025. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  1026. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  1027. .num_of_queues = IWL50_NUM_QUEUES,
  1028. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1029. .mod_params = &iwl50_mod_params,
  1030. .valid_tx_ant = ANT_ABC,
  1031. .valid_rx_ant = ANT_ABC,
  1032. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1033. .set_l0s = true,
  1034. .use_bsm = false,
  1035. .ht_greenfield_support = true,
  1036. .led_compensation = 51,
  1037. .use_rts_for_ht = true, /* use rts/cts protection */
  1038. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1039. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1040. .chain_noise_scale = 1000,
  1041. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1042. };
  1043. struct iwl_cfg iwl5100_bgn_cfg = {
  1044. .name = "Intel(R) WiFi Link 5100 BGN",
  1045. .fw_name_pre = IWL5000_FW_PRE,
  1046. .ucode_api_max = IWL5000_UCODE_API_MAX,
  1047. .ucode_api_min = IWL5000_UCODE_API_MIN,
  1048. .sku = IWL_SKU_G|IWL_SKU_N,
  1049. .ops = &iwl5000_ops,
  1050. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1051. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  1052. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  1053. .num_of_queues = IWL50_NUM_QUEUES,
  1054. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1055. .mod_params = &iwl50_mod_params,
  1056. .valid_tx_ant = ANT_B,
  1057. .valid_rx_ant = ANT_AB,
  1058. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1059. .set_l0s = true,
  1060. .use_bsm = false,
  1061. .ht_greenfield_support = true,
  1062. .led_compensation = 51,
  1063. .use_rts_for_ht = true, /* use rts/cts protection */
  1064. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1065. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1066. .chain_noise_scale = 1000,
  1067. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1068. };
  1069. struct iwl_cfg iwl5100_abg_cfg = {
  1070. .name = "Intel(R) WiFi Link 5100 ABG",
  1071. .fw_name_pre = IWL5000_FW_PRE,
  1072. .ucode_api_max = IWL5000_UCODE_API_MAX,
  1073. .ucode_api_min = IWL5000_UCODE_API_MIN,
  1074. .sku = IWL_SKU_A|IWL_SKU_G,
  1075. .ops = &iwl5000_ops,
  1076. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1077. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  1078. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  1079. .num_of_queues = IWL50_NUM_QUEUES,
  1080. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1081. .mod_params = &iwl50_mod_params,
  1082. .valid_tx_ant = ANT_B,
  1083. .valid_rx_ant = ANT_AB,
  1084. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1085. .set_l0s = true,
  1086. .use_bsm = false,
  1087. .led_compensation = 51,
  1088. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1089. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1090. .chain_noise_scale = 1000,
  1091. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1092. };
  1093. struct iwl_cfg iwl5100_agn_cfg = {
  1094. .name = "Intel(R) WiFi Link 5100 AGN",
  1095. .fw_name_pre = IWL5000_FW_PRE,
  1096. .ucode_api_max = IWL5000_UCODE_API_MAX,
  1097. .ucode_api_min = IWL5000_UCODE_API_MIN,
  1098. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  1099. .ops = &iwl5000_ops,
  1100. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1101. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  1102. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  1103. .num_of_queues = IWL50_NUM_QUEUES,
  1104. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1105. .mod_params = &iwl50_mod_params,
  1106. .valid_tx_ant = ANT_B,
  1107. .valid_rx_ant = ANT_AB,
  1108. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1109. .set_l0s = true,
  1110. .use_bsm = false,
  1111. .ht_greenfield_support = true,
  1112. .led_compensation = 51,
  1113. .use_rts_for_ht = true, /* use rts/cts protection */
  1114. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1115. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1116. .chain_noise_scale = 1000,
  1117. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1118. };
  1119. struct iwl_cfg iwl5350_agn_cfg = {
  1120. .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
  1121. .fw_name_pre = IWL5000_FW_PRE,
  1122. .ucode_api_max = IWL5000_UCODE_API_MAX,
  1123. .ucode_api_min = IWL5000_UCODE_API_MIN,
  1124. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  1125. .ops = &iwl5000_ops,
  1126. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1127. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  1128. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  1129. .num_of_queues = IWL50_NUM_QUEUES,
  1130. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1131. .mod_params = &iwl50_mod_params,
  1132. .valid_tx_ant = ANT_ABC,
  1133. .valid_rx_ant = ANT_ABC,
  1134. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1135. .set_l0s = true,
  1136. .use_bsm = false,
  1137. .ht_greenfield_support = true,
  1138. .led_compensation = 51,
  1139. .use_rts_for_ht = true, /* use rts/cts protection */
  1140. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1141. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1142. .chain_noise_scale = 1000,
  1143. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1144. };
  1145. struct iwl_cfg iwl5150_agn_cfg = {
  1146. .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
  1147. .fw_name_pre = IWL5150_FW_PRE,
  1148. .ucode_api_max = IWL5150_UCODE_API_MAX,
  1149. .ucode_api_min = IWL5150_UCODE_API_MIN,
  1150. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  1151. .ops = &iwl5150_ops,
  1152. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1153. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  1154. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  1155. .num_of_queues = IWL50_NUM_QUEUES,
  1156. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1157. .mod_params = &iwl50_mod_params,
  1158. .valid_tx_ant = ANT_A,
  1159. .valid_rx_ant = ANT_AB,
  1160. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1161. .set_l0s = true,
  1162. .use_bsm = false,
  1163. .ht_greenfield_support = true,
  1164. .led_compensation = 51,
  1165. .use_rts_for_ht = true, /* use rts/cts protection */
  1166. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1167. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1168. .chain_noise_scale = 1000,
  1169. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1170. };
  1171. struct iwl_cfg iwl5150_abg_cfg = {
  1172. .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
  1173. .fw_name_pre = IWL5150_FW_PRE,
  1174. .ucode_api_max = IWL5150_UCODE_API_MAX,
  1175. .ucode_api_min = IWL5150_UCODE_API_MIN,
  1176. .sku = IWL_SKU_A|IWL_SKU_G,
  1177. .ops = &iwl5150_ops,
  1178. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  1179. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  1180. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  1181. .num_of_queues = IWL50_NUM_QUEUES,
  1182. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1183. .mod_params = &iwl50_mod_params,
  1184. .valid_tx_ant = ANT_A,
  1185. .valid_rx_ant = ANT_AB,
  1186. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1187. .set_l0s = true,
  1188. .use_bsm = false,
  1189. .led_compensation = 51,
  1190. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1191. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1192. .chain_noise_scale = 1000,
  1193. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1194. };
  1195. MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
  1196. MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
  1197. module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, S_IRUGO);
  1198. MODULE_PARM_DESC(swcrypto50,
  1199. "using software crypto engine (default 0 [hardware])\n");
  1200. module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, S_IRUGO);
  1201. MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
  1202. module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, S_IRUGO);
  1203. MODULE_PARM_DESC(11n_disable50, "disable 50XX 11n functionality");
  1204. module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K,
  1205. int, S_IRUGO);
  1206. MODULE_PARM_DESC(amsdu_size_8K50, "enable 8K amsdu size in 50XX series");
  1207. module_param_named(fw_restart50, iwl50_mod_params.restart_fw, int, S_IRUGO);
  1208. MODULE_PARM_DESC(fw_restart50, "restart firmware in case of error");