iwl-5000.c 36 KB

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