iwl-5000.c 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  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. int iwl5000_alive_notify(struct iwl_priv *priv)
  311. {
  312. u32 a;
  313. unsigned long flags;
  314. int i, chan;
  315. u32 reg_val;
  316. spin_lock_irqsave(&priv->lock, flags);
  317. priv->scd_base_addr = iwl_read_prph(priv, IWL50_SCD_SRAM_BASE_ADDR);
  318. a = priv->scd_base_addr + IWL50_SCD_CONTEXT_DATA_OFFSET;
  319. for (; a < priv->scd_base_addr + IWL50_SCD_TX_STTS_BITMAP_OFFSET;
  320. a += 4)
  321. iwl_write_targ_mem(priv, a, 0);
  322. for (; a < priv->scd_base_addr + IWL50_SCD_TRANSLATE_TBL_OFFSET;
  323. a += 4)
  324. iwl_write_targ_mem(priv, a, 0);
  325. for (; a < priv->scd_base_addr +
  326. IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
  327. iwl_write_targ_mem(priv, a, 0);
  328. iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR,
  329. priv->scd_bc_tbls.dma >> 10);
  330. /* Enable DMA channel */
  331. for (chan = 0; chan < FH50_TCSR_CHNL_NUM ; chan++)
  332. iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan),
  333. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
  334. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
  335. /* Update FH chicken bits */
  336. reg_val = iwl_read_direct32(priv, FH_TX_CHICKEN_BITS_REG);
  337. iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG,
  338. reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
  339. iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL,
  340. IWL50_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num));
  341. iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0);
  342. /* initiate the queues */
  343. for (i = 0; i < priv->hw_params.max_txq_num; i++) {
  344. iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(i), 0);
  345. iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
  346. iwl_write_targ_mem(priv, priv->scd_base_addr +
  347. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
  348. iwl_write_targ_mem(priv, priv->scd_base_addr +
  349. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i) +
  350. sizeof(u32),
  351. ((SCD_WIN_SIZE <<
  352. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
  353. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
  354. ((SCD_FRAME_LIMIT <<
  355. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
  356. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
  357. }
  358. iwl_write_prph(priv, IWL50_SCD_INTERRUPT_MASK,
  359. IWL_MASK(0, priv->hw_params.max_txq_num));
  360. /* Activate all Tx DMA/FIFO channels */
  361. priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7));
  362. iwlagn_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
  363. /* make sure all queue are not stopped */
  364. memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
  365. for (i = 0; i < 4; i++)
  366. atomic_set(&priv->queue_stop_count[i], 0);
  367. /* reset to 0 to enable all the queue first */
  368. priv->txq_ctx_active_msk = 0;
  369. /* map qos queues to fifos one-to-one */
  370. BUILD_BUG_ON(ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo) != 10);
  371. for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) {
  372. int ac = iwl5000_default_queue_to_tx_fifo[i];
  373. iwl_txq_ctx_activate(priv, i);
  374. if (ac == IWL_TX_FIFO_UNUSED)
  375. continue;
  376. iwlagn_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
  377. }
  378. spin_unlock_irqrestore(&priv->lock, flags);
  379. iwl_send_wimax_coex(priv);
  380. iwl5000_set_Xtal_calib(priv);
  381. iwl_send_calib_results(priv);
  382. return 0;
  383. }
  384. int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
  385. {
  386. if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
  387. priv->cfg->mod_params->num_of_queues <= IWL50_NUM_QUEUES)
  388. priv->cfg->num_of_queues =
  389. priv->cfg->mod_params->num_of_queues;
  390. priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
  391. priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
  392. priv->hw_params.scd_bc_tbls_size =
  393. priv->cfg->num_of_queues *
  394. sizeof(struct iwl5000_scd_bc_tbl);
  395. priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
  396. priv->hw_params.max_stations = IWL5000_STATION_COUNT;
  397. priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
  398. priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
  399. priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
  400. priv->hw_params.max_bsm_size = 0;
  401. priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
  402. BIT(IEEE80211_BAND_5GHZ);
  403. priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
  404. priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
  405. priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
  406. priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
  407. priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
  408. if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
  409. priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
  410. /* Set initial sensitivity parameters */
  411. /* Set initial calibration set */
  412. switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
  413. case CSR_HW_REV_TYPE_5150:
  414. priv->hw_params.sens = &iwl5150_sensitivity;
  415. priv->hw_params.calib_init_cfg =
  416. BIT(IWL_CALIB_DC) |
  417. BIT(IWL_CALIB_LO) |
  418. BIT(IWL_CALIB_TX_IQ) |
  419. BIT(IWL_CALIB_BASE_BAND);
  420. break;
  421. default:
  422. priv->hw_params.sens = &iwl5000_sensitivity;
  423. priv->hw_params.calib_init_cfg =
  424. BIT(IWL_CALIB_XTAL) |
  425. BIT(IWL_CALIB_LO) |
  426. BIT(IWL_CALIB_TX_IQ) |
  427. BIT(IWL_CALIB_TX_IQ_PERD) |
  428. BIT(IWL_CALIB_BASE_BAND);
  429. break;
  430. }
  431. return 0;
  432. }
  433. static inline u32 iwl5000_get_scd_ssn(struct iwl5000_tx_resp *tx_resp)
  434. {
  435. return le32_to_cpup((__le32 *)&tx_resp->status +
  436. tx_resp->frame_count) & MAX_SN;
  437. }
  438. static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
  439. struct iwl_ht_agg *agg,
  440. struct iwl5000_tx_resp *tx_resp,
  441. int txq_id, u16 start_idx)
  442. {
  443. u16 status;
  444. struct agg_tx_status *frame_status = &tx_resp->status;
  445. struct ieee80211_tx_info *info = NULL;
  446. struct ieee80211_hdr *hdr = NULL;
  447. u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
  448. int i, sh, idx;
  449. u16 seq;
  450. if (agg->wait_for_ba)
  451. IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n");
  452. agg->frame_count = tx_resp->frame_count;
  453. agg->start_idx = start_idx;
  454. agg->rate_n_flags = rate_n_flags;
  455. agg->bitmap = 0;
  456. /* # frames attempted by Tx command */
  457. if (agg->frame_count == 1) {
  458. /* Only one frame was attempted; no block-ack will arrive */
  459. status = le16_to_cpu(frame_status[0].status);
  460. idx = start_idx;
  461. /* FIXME: code repetition */
  462. IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
  463. agg->frame_count, agg->start_idx, idx);
  464. info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
  465. info->status.rates[0].count = tx_resp->failure_frame + 1;
  466. info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  467. info->flags |= iwl_tx_status_to_mac80211(status);
  468. iwl_hwrate_to_tx_control(priv, rate_n_flags, info);
  469. /* FIXME: code repetition end */
  470. IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
  471. status & 0xff, tx_resp->failure_frame);
  472. IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
  473. agg->wait_for_ba = 0;
  474. } else {
  475. /* Two or more frames were attempted; expect block-ack */
  476. u64 bitmap = 0;
  477. int start = agg->start_idx;
  478. /* Construct bit-map of pending frames within Tx window */
  479. for (i = 0; i < agg->frame_count; i++) {
  480. u16 sc;
  481. status = le16_to_cpu(frame_status[i].status);
  482. seq = le16_to_cpu(frame_status[i].sequence);
  483. idx = SEQ_TO_INDEX(seq);
  484. txq_id = SEQ_TO_QUEUE(seq);
  485. if (status & (AGG_TX_STATE_FEW_BYTES_MSK |
  486. AGG_TX_STATE_ABORT_MSK))
  487. continue;
  488. IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
  489. agg->frame_count, txq_id, idx);
  490. hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
  491. if (!hdr) {
  492. IWL_ERR(priv,
  493. "BUG_ON idx doesn't point to valid skb"
  494. " idx=%d, txq_id=%d\n", idx, txq_id);
  495. return -1;
  496. }
  497. sc = le16_to_cpu(hdr->seq_ctrl);
  498. if (idx != (SEQ_TO_SN(sc) & 0xff)) {
  499. IWL_ERR(priv,
  500. "BUG_ON idx doesn't match seq control"
  501. " idx=%d, seq_idx=%d, seq=%d\n",
  502. idx, SEQ_TO_SN(sc),
  503. hdr->seq_ctrl);
  504. return -1;
  505. }
  506. IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
  507. i, idx, SEQ_TO_SN(sc));
  508. sh = idx - start;
  509. if (sh > 64) {
  510. sh = (start - idx) + 0xff;
  511. bitmap = bitmap << sh;
  512. sh = 0;
  513. start = idx;
  514. } else if (sh < -64)
  515. sh = 0xff - (start - idx);
  516. else if (sh < 0) {
  517. sh = start - idx;
  518. start = idx;
  519. bitmap = bitmap << sh;
  520. sh = 0;
  521. }
  522. bitmap |= 1ULL << sh;
  523. IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
  524. start, (unsigned long long)bitmap);
  525. }
  526. agg->bitmap = bitmap;
  527. agg->start_idx = start;
  528. IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
  529. agg->frame_count, agg->start_idx,
  530. (unsigned long long)agg->bitmap);
  531. if (bitmap)
  532. agg->wait_for_ba = 1;
  533. }
  534. return 0;
  535. }
  536. static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
  537. struct iwl_rx_mem_buffer *rxb)
  538. {
  539. struct iwl_rx_packet *pkt = rxb_addr(rxb);
  540. u16 sequence = le16_to_cpu(pkt->hdr.sequence);
  541. int txq_id = SEQ_TO_QUEUE(sequence);
  542. int index = SEQ_TO_INDEX(sequence);
  543. struct iwl_tx_queue *txq = &priv->txq[txq_id];
  544. struct ieee80211_tx_info *info;
  545. struct iwl5000_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
  546. u32 status = le16_to_cpu(tx_resp->status.status);
  547. int tid;
  548. int sta_id;
  549. int freed;
  550. if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
  551. IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
  552. "is out of range [0-%d] %d %d\n", txq_id,
  553. index, txq->q.n_bd, txq->q.write_ptr,
  554. txq->q.read_ptr);
  555. return;
  556. }
  557. info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
  558. memset(&info->status, 0, sizeof(info->status));
  559. tid = (tx_resp->ra_tid & IWL50_TX_RES_TID_MSK) >> IWL50_TX_RES_TID_POS;
  560. sta_id = (tx_resp->ra_tid & IWL50_TX_RES_RA_MSK) >> IWL50_TX_RES_RA_POS;
  561. if (txq->sched_retry) {
  562. const u32 scd_ssn = iwl5000_get_scd_ssn(tx_resp);
  563. struct iwl_ht_agg *agg = NULL;
  564. agg = &priv->stations[sta_id].tid[tid].agg;
  565. iwl5000_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index);
  566. /* check if BAR is needed */
  567. if ((tx_resp->frame_count == 1) && !iwl_is_tx_success(status))
  568. info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
  569. if (txq->q.read_ptr != (scd_ssn & 0xff)) {
  570. index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
  571. IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim "
  572. "scd_ssn=%d idx=%d txq=%d swq=%d\n",
  573. scd_ssn , index, txq_id, txq->swq_id);
  574. freed = iwl_tx_queue_reclaim(priv, txq_id, index);
  575. iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
  576. if (priv->mac80211_registered &&
  577. (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
  578. (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) {
  579. if (agg->state == IWL_AGG_OFF)
  580. iwl_wake_queue(priv, txq_id);
  581. else
  582. iwl_wake_queue(priv, txq->swq_id);
  583. }
  584. }
  585. } else {
  586. BUG_ON(txq_id != txq->swq_id);
  587. info->status.rates[0].count = tx_resp->failure_frame + 1;
  588. info->flags |= iwl_tx_status_to_mac80211(status);
  589. iwl_hwrate_to_tx_control(priv,
  590. le32_to_cpu(tx_resp->rate_n_flags),
  591. info);
  592. IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
  593. "0x%x retries %d\n",
  594. txq_id,
  595. iwl_get_tx_fail_reason(status), status,
  596. le32_to_cpu(tx_resp->rate_n_flags),
  597. tx_resp->failure_frame);
  598. freed = iwl_tx_queue_reclaim(priv, txq_id, index);
  599. iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
  600. if (priv->mac80211_registered &&
  601. (iwl_queue_space(&txq->q) > txq->q.low_mark))
  602. iwl_wake_queue(priv, txq_id);
  603. }
  604. iwl_txq_check_empty(priv, sta_id, tid, txq_id);
  605. if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
  606. IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
  607. }
  608. void iwl5000_setup_deferred_work(struct iwl_priv *priv)
  609. {
  610. /* in 5000 the tx power calibration is done in uCode */
  611. priv->disable_tx_power_cal = 1;
  612. }
  613. void iwl5000_rx_handler_setup(struct iwl_priv *priv)
  614. {
  615. /* init calibration handlers */
  616. priv->rx_handlers[CALIBRATION_RES_NOTIFICATION] =
  617. iwl5000_rx_calib_result;
  618. priv->rx_handlers[CALIBRATION_COMPLETE_NOTIFICATION] =
  619. iwl5000_rx_calib_complete;
  620. priv->rx_handlers[REPLY_TX] = iwl5000_rx_reply_tx;
  621. }
  622. int iwl5000_hw_valid_rtc_data_addr(u32 addr)
  623. {
  624. return (addr >= IWL50_RTC_DATA_LOWER_BOUND) &&
  625. (addr < IWL50_RTC_DATA_UPPER_BOUND);
  626. }
  627. int iwl5000_send_tx_power(struct iwl_priv *priv)
  628. {
  629. struct iwl5000_tx_power_dbm_cmd tx_power_cmd;
  630. u8 tx_ant_cfg_cmd;
  631. /* half dBm need to multiply */
  632. tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
  633. if (priv->tx_power_lmt_in_half_dbm &&
  634. priv->tx_power_lmt_in_half_dbm < tx_power_cmd.global_lmt) {
  635. /*
  636. * For the newer devices which using enhanced/extend tx power
  637. * table in EEPROM, the format is in half dBm. driver need to
  638. * convert to dBm format before report to mac80211.
  639. * By doing so, there is a possibility of 1/2 dBm resolution
  640. * lost. driver will perform "round-up" operation before
  641. * reporting, but it will cause 1/2 dBm tx power over the
  642. * regulatory limit. Perform the checking here, if the
  643. * "tx_power_user_lmt" is higher than EEPROM value (in
  644. * half-dBm format), lower the tx power based on EEPROM
  645. */
  646. tx_power_cmd.global_lmt = priv->tx_power_lmt_in_half_dbm;
  647. }
  648. tx_power_cmd.flags = IWL50_TX_POWER_NO_CLOSED;
  649. tx_power_cmd.srv_chan_lmt = IWL50_TX_POWER_AUTO;
  650. if (IWL_UCODE_API(priv->ucode_ver) == 1)
  651. tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
  652. else
  653. tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
  654. return iwl_send_cmd_pdu_async(priv, tx_ant_cfg_cmd,
  655. sizeof(tx_power_cmd), &tx_power_cmd,
  656. NULL);
  657. }
  658. void iwl5000_temperature(struct iwl_priv *priv)
  659. {
  660. /* store temperature from statistics (in Celsius) */
  661. priv->temperature = le32_to_cpu(priv->statistics.general.temperature);
  662. iwl_tt_handler(priv);
  663. }
  664. static void iwl5150_temperature(struct iwl_priv *priv)
  665. {
  666. u32 vt = 0;
  667. s32 offset = iwl_temp_calib_to_offset(priv);
  668. vt = le32_to_cpu(priv->statistics.general.temperature);
  669. vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
  670. /* now vt hold the temperature in Kelvin */
  671. priv->temperature = KELVIN_TO_CELSIUS(vt);
  672. iwl_tt_handler(priv);
  673. }
  674. static int iwl5000_hw_channel_switch(struct iwl_priv *priv, u16 channel)
  675. {
  676. struct iwl5000_channel_switch_cmd cmd;
  677. const struct iwl_channel_info *ch_info;
  678. struct iwl_host_cmd hcmd = {
  679. .id = REPLY_CHANNEL_SWITCH,
  680. .len = sizeof(cmd),
  681. .flags = CMD_SIZE_HUGE,
  682. .data = &cmd,
  683. };
  684. IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
  685. priv->active_rxon.channel, channel);
  686. cmd.band = priv->band == IEEE80211_BAND_2GHZ;
  687. cmd.channel = cpu_to_le16(channel);
  688. cmd.rxon_flags = priv->staging_rxon.flags;
  689. cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
  690. cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
  691. ch_info = iwl_get_channel_info(priv, priv->band, channel);
  692. if (ch_info)
  693. cmd.expect_beacon = is_channel_radar(ch_info);
  694. else {
  695. IWL_ERR(priv, "invalid channel switch from %u to %u\n",
  696. priv->active_rxon.channel, channel);
  697. return -EFAULT;
  698. }
  699. priv->switch_rxon.channel = cpu_to_le16(channel);
  700. priv->switch_rxon.switch_in_progress = true;
  701. return iwl_send_cmd_sync(priv, &hcmd);
  702. }
  703. struct iwl_lib_ops iwl5000_lib = {
  704. .set_hw_params = iwl5000_hw_set_hw_params,
  705. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  706. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  707. .txq_set_sched = iwlagn_txq_set_sched,
  708. .txq_agg_enable = iwlagn_txq_agg_enable,
  709. .txq_agg_disable = iwlagn_txq_agg_disable,
  710. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  711. .txq_free_tfd = iwl_hw_txq_free_tfd,
  712. .txq_init = iwl_hw_tx_queue_init,
  713. .rx_handler_setup = iwl5000_rx_handler_setup,
  714. .setup_deferred_work = iwl5000_setup_deferred_work,
  715. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  716. .dump_nic_event_log = iwl_dump_nic_event_log,
  717. .dump_nic_error_log = iwl_dump_nic_error_log,
  718. .dump_csr = iwl_dump_csr,
  719. .dump_fh = iwl_dump_fh,
  720. .load_ucode = iwlagn_load_ucode,
  721. .init_alive_start = iwl5000_init_alive_start,
  722. .alive_notify = iwl5000_alive_notify,
  723. .send_tx_power = iwl5000_send_tx_power,
  724. .update_chain_flags = iwl_update_chain_flags,
  725. .set_channel_switch = iwl5000_hw_channel_switch,
  726. .apm_ops = {
  727. .init = iwl_apm_init,
  728. .stop = iwl_apm_stop,
  729. .config = iwl5000_nic_config,
  730. .set_pwr_src = iwl_set_pwr_src,
  731. },
  732. .eeprom_ops = {
  733. .regulatory_bands = {
  734. EEPROM_5000_REG_BAND_1_CHANNELS,
  735. EEPROM_5000_REG_BAND_2_CHANNELS,
  736. EEPROM_5000_REG_BAND_3_CHANNELS,
  737. EEPROM_5000_REG_BAND_4_CHANNELS,
  738. EEPROM_5000_REG_BAND_5_CHANNELS,
  739. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  740. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  741. },
  742. .verify_signature = iwlcore_eeprom_verify_signature,
  743. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  744. .release_semaphore = iwlcore_eeprom_release_semaphore,
  745. .calib_version = iwl5000_eeprom_calib_version,
  746. .query_addr = iwl5000_eeprom_query_addr,
  747. },
  748. .post_associate = iwl_post_associate,
  749. .isr = iwl_isr_ict,
  750. .config_ap = iwl_config_ap,
  751. .temp_ops = {
  752. .temperature = iwl5000_temperature,
  753. .set_ct_kill = iwl5000_set_ct_threshold,
  754. },
  755. .add_bcast_station = iwl_add_bcast_station,
  756. .recover_from_tx_stall = iwl_bg_monitor_recover,
  757. .check_plcp_health = iwl_good_plcp_health,
  758. .check_ack_health = iwl_good_ack_health,
  759. };
  760. static struct iwl_lib_ops iwl5150_lib = {
  761. .set_hw_params = iwl5000_hw_set_hw_params,
  762. .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
  763. .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
  764. .txq_set_sched = iwlagn_txq_set_sched,
  765. .txq_agg_enable = iwlagn_txq_agg_enable,
  766. .txq_agg_disable = iwlagn_txq_agg_disable,
  767. .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
  768. .txq_free_tfd = iwl_hw_txq_free_tfd,
  769. .txq_init = iwl_hw_tx_queue_init,
  770. .rx_handler_setup = iwl5000_rx_handler_setup,
  771. .setup_deferred_work = iwl5000_setup_deferred_work,
  772. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  773. .dump_nic_event_log = iwl_dump_nic_event_log,
  774. .dump_nic_error_log = iwl_dump_nic_error_log,
  775. .dump_csr = iwl_dump_csr,
  776. .load_ucode = iwlagn_load_ucode,
  777. .init_alive_start = iwl5000_init_alive_start,
  778. .alive_notify = iwl5000_alive_notify,
  779. .send_tx_power = iwl5000_send_tx_power,
  780. .update_chain_flags = iwl_update_chain_flags,
  781. .set_channel_switch = iwl5000_hw_channel_switch,
  782. .apm_ops = {
  783. .init = iwl_apm_init,
  784. .stop = iwl_apm_stop,
  785. .config = iwl5000_nic_config,
  786. .set_pwr_src = iwl_set_pwr_src,
  787. },
  788. .eeprom_ops = {
  789. .regulatory_bands = {
  790. EEPROM_5000_REG_BAND_1_CHANNELS,
  791. EEPROM_5000_REG_BAND_2_CHANNELS,
  792. EEPROM_5000_REG_BAND_3_CHANNELS,
  793. EEPROM_5000_REG_BAND_4_CHANNELS,
  794. EEPROM_5000_REG_BAND_5_CHANNELS,
  795. EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
  796. EEPROM_5000_REG_BAND_52_HT40_CHANNELS
  797. },
  798. .verify_signature = iwlcore_eeprom_verify_signature,
  799. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  800. .release_semaphore = iwlcore_eeprom_release_semaphore,
  801. .calib_version = iwl5000_eeprom_calib_version,
  802. .query_addr = iwl5000_eeprom_query_addr,
  803. },
  804. .post_associate = iwl_post_associate,
  805. .isr = iwl_isr_ict,
  806. .config_ap = iwl_config_ap,
  807. .temp_ops = {
  808. .temperature = iwl5150_temperature,
  809. .set_ct_kill = iwl5150_set_ct_threshold,
  810. },
  811. .add_bcast_station = iwl_add_bcast_station,
  812. .recover_from_tx_stall = iwl_bg_monitor_recover,
  813. .check_plcp_health = iwl_good_plcp_health,
  814. .check_ack_health = iwl_good_ack_health,
  815. };
  816. static const struct iwl_ops iwl5000_ops = {
  817. .ucode = &iwlagn_ucode,
  818. .lib = &iwl5000_lib,
  819. .hcmd = &iwlagn_hcmd,
  820. .utils = &iwlagn_hcmd_utils,
  821. .led = &iwlagn_led_ops,
  822. };
  823. static const struct iwl_ops iwl5150_ops = {
  824. .ucode = &iwlagn_ucode,
  825. .lib = &iwl5150_lib,
  826. .hcmd = &iwlagn_hcmd,
  827. .utils = &iwlagn_hcmd_utils,
  828. .led = &iwlagn_led_ops,
  829. };
  830. struct iwl_mod_params iwl50_mod_params = {
  831. .amsdu_size_8K = 1,
  832. .restart_fw = 1,
  833. /* the rest are 0 by default */
  834. };
  835. struct iwl_cfg iwl5300_agn_cfg = {
  836. .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
  837. .fw_name_pre = IWL5000_FW_PRE,
  838. .ucode_api_max = IWL5000_UCODE_API_MAX,
  839. .ucode_api_min = IWL5000_UCODE_API_MIN,
  840. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  841. .ops = &iwl5000_ops,
  842. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  843. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  844. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  845. .num_of_queues = IWL50_NUM_QUEUES,
  846. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  847. .mod_params = &iwl50_mod_params,
  848. .valid_tx_ant = ANT_ABC,
  849. .valid_rx_ant = ANT_ABC,
  850. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  851. .set_l0s = true,
  852. .use_bsm = false,
  853. .ht_greenfield_support = true,
  854. .led_compensation = 51,
  855. .use_rts_for_ht = true, /* use rts/cts protection */
  856. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  857. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  858. .chain_noise_scale = 1000,
  859. .monitor_recover_period = IWL_MONITORING_PERIOD,
  860. };
  861. struct iwl_cfg iwl5100_bgn_cfg = {
  862. .name = "Intel(R) WiFi Link 5100 BGN",
  863. .fw_name_pre = IWL5000_FW_PRE,
  864. .ucode_api_max = IWL5000_UCODE_API_MAX,
  865. .ucode_api_min = IWL5000_UCODE_API_MIN,
  866. .sku = IWL_SKU_G|IWL_SKU_N,
  867. .ops = &iwl5000_ops,
  868. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  869. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  870. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  871. .num_of_queues = IWL50_NUM_QUEUES,
  872. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  873. .mod_params = &iwl50_mod_params,
  874. .valid_tx_ant = ANT_B,
  875. .valid_rx_ant = ANT_AB,
  876. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  877. .set_l0s = true,
  878. .use_bsm = false,
  879. .ht_greenfield_support = true,
  880. .led_compensation = 51,
  881. .use_rts_for_ht = true, /* use rts/cts protection */
  882. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  883. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  884. .chain_noise_scale = 1000,
  885. .monitor_recover_period = IWL_MONITORING_PERIOD,
  886. };
  887. struct iwl_cfg iwl5100_abg_cfg = {
  888. .name = "Intel(R) WiFi Link 5100 ABG",
  889. .fw_name_pre = IWL5000_FW_PRE,
  890. .ucode_api_max = IWL5000_UCODE_API_MAX,
  891. .ucode_api_min = IWL5000_UCODE_API_MIN,
  892. .sku = IWL_SKU_A|IWL_SKU_G,
  893. .ops = &iwl5000_ops,
  894. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  895. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  896. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  897. .num_of_queues = IWL50_NUM_QUEUES,
  898. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  899. .mod_params = &iwl50_mod_params,
  900. .valid_tx_ant = ANT_B,
  901. .valid_rx_ant = ANT_AB,
  902. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  903. .set_l0s = true,
  904. .use_bsm = false,
  905. .led_compensation = 51,
  906. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  907. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  908. .chain_noise_scale = 1000,
  909. .monitor_recover_period = IWL_MONITORING_PERIOD,
  910. };
  911. struct iwl_cfg iwl5100_agn_cfg = {
  912. .name = "Intel(R) WiFi Link 5100 AGN",
  913. .fw_name_pre = IWL5000_FW_PRE,
  914. .ucode_api_max = IWL5000_UCODE_API_MAX,
  915. .ucode_api_min = IWL5000_UCODE_API_MIN,
  916. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  917. .ops = &iwl5000_ops,
  918. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  919. .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
  920. .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
  921. .num_of_queues = IWL50_NUM_QUEUES,
  922. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  923. .mod_params = &iwl50_mod_params,
  924. .valid_tx_ant = ANT_B,
  925. .valid_rx_ant = ANT_AB,
  926. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  927. .set_l0s = true,
  928. .use_bsm = false,
  929. .ht_greenfield_support = true,
  930. .led_compensation = 51,
  931. .use_rts_for_ht = true, /* use rts/cts protection */
  932. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  933. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  934. .chain_noise_scale = 1000,
  935. .monitor_recover_period = IWL_MONITORING_PERIOD,
  936. };
  937. struct iwl_cfg iwl5350_agn_cfg = {
  938. .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
  939. .fw_name_pre = IWL5000_FW_PRE,
  940. .ucode_api_max = IWL5000_UCODE_API_MAX,
  941. .ucode_api_min = IWL5000_UCODE_API_MIN,
  942. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  943. .ops = &iwl5000_ops,
  944. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  945. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  946. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  947. .num_of_queues = IWL50_NUM_QUEUES,
  948. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  949. .mod_params = &iwl50_mod_params,
  950. .valid_tx_ant = ANT_ABC,
  951. .valid_rx_ant = ANT_ABC,
  952. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  953. .set_l0s = true,
  954. .use_bsm = false,
  955. .ht_greenfield_support = true,
  956. .led_compensation = 51,
  957. .use_rts_for_ht = true, /* use rts/cts protection */
  958. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  959. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  960. .chain_noise_scale = 1000,
  961. .monitor_recover_period = IWL_MONITORING_PERIOD,
  962. };
  963. struct iwl_cfg iwl5150_agn_cfg = {
  964. .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
  965. .fw_name_pre = IWL5150_FW_PRE,
  966. .ucode_api_max = IWL5150_UCODE_API_MAX,
  967. .ucode_api_min = IWL5150_UCODE_API_MIN,
  968. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  969. .ops = &iwl5150_ops,
  970. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  971. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  972. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  973. .num_of_queues = IWL50_NUM_QUEUES,
  974. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  975. .mod_params = &iwl50_mod_params,
  976. .valid_tx_ant = ANT_A,
  977. .valid_rx_ant = ANT_AB,
  978. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  979. .set_l0s = true,
  980. .use_bsm = false,
  981. .ht_greenfield_support = true,
  982. .led_compensation = 51,
  983. .use_rts_for_ht = true, /* use rts/cts protection */
  984. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  985. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  986. .chain_noise_scale = 1000,
  987. .monitor_recover_period = IWL_MONITORING_PERIOD,
  988. };
  989. struct iwl_cfg iwl5150_abg_cfg = {
  990. .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
  991. .fw_name_pre = IWL5150_FW_PRE,
  992. .ucode_api_max = IWL5150_UCODE_API_MAX,
  993. .ucode_api_min = IWL5150_UCODE_API_MIN,
  994. .sku = IWL_SKU_A|IWL_SKU_G,
  995. .ops = &iwl5150_ops,
  996. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  997. .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
  998. .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
  999. .num_of_queues = IWL50_NUM_QUEUES,
  1000. .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
  1001. .mod_params = &iwl50_mod_params,
  1002. .valid_tx_ant = ANT_A,
  1003. .valid_rx_ant = ANT_AB,
  1004. .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
  1005. .set_l0s = true,
  1006. .use_bsm = false,
  1007. .led_compensation = 51,
  1008. .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
  1009. .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
  1010. .chain_noise_scale = 1000,
  1011. .monitor_recover_period = IWL_MONITORING_PERIOD,
  1012. };
  1013. MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
  1014. MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
  1015. module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, S_IRUGO);
  1016. MODULE_PARM_DESC(swcrypto50,
  1017. "using software crypto engine (default 0 [hardware])\n");
  1018. module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, S_IRUGO);
  1019. MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
  1020. module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, S_IRUGO);
  1021. MODULE_PARM_DESC(11n_disable50, "disable 50XX 11n functionality");
  1022. module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K,
  1023. int, S_IRUGO);
  1024. MODULE_PARM_DESC(amsdu_size_8K50, "enable 8K amsdu size in 50XX series");
  1025. module_param_named(fw_restart50, iwl50_mod_params.restart_fw, int, S_IRUGO);
  1026. MODULE_PARM_DESC(fw_restart50, "restart firmware in case of error");