iwl-5000.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007-2008 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/version.h>
  28. #include <linux/init.h>
  29. #include <linux/pci.h>
  30. #include <linux/dma-mapping.h>
  31. #include <linux/delay.h>
  32. #include <linux/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-helpers.h"
  43. #include "iwl-5000-hw.h"
  44. #define IWL5000_UCODE_API "-1"
  45. static const u16 iwl5000_default_queue_to_tx_fifo[] = {
  46. IWL_TX_FIFO_AC3,
  47. IWL_TX_FIFO_AC2,
  48. IWL_TX_FIFO_AC1,
  49. IWL_TX_FIFO_AC0,
  50. IWL50_CMD_FIFO_NUM,
  51. IWL_TX_FIFO_HCCA_1,
  52. IWL_TX_FIFO_HCCA_2
  53. };
  54. /* FIXME: same implementation as 4965 */
  55. static int iwl5000_apm_stop_master(struct iwl_priv *priv)
  56. {
  57. int ret = 0;
  58. unsigned long flags;
  59. spin_lock_irqsave(&priv->lock, flags);
  60. /* set stop master bit */
  61. iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
  62. ret = iwl_poll_bit(priv, CSR_RESET,
  63. CSR_RESET_REG_FLAG_MASTER_DISABLED,
  64. CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
  65. if (ret < 0)
  66. goto out;
  67. out:
  68. spin_unlock_irqrestore(&priv->lock, flags);
  69. IWL_DEBUG_INFO("stop master\n");
  70. return ret;
  71. }
  72. static int iwl5000_apm_init(struct iwl_priv *priv)
  73. {
  74. int ret = 0;
  75. iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
  76. CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
  77. /* disable L0s without affecting L1 :don't wait for ICH L0s bug W/A) */
  78. iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
  79. CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
  80. iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
  81. /* set "initialization complete" bit to move adapter
  82. * D0U* --> D0A* state */
  83. iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
  84. /* wait for clock stabilization */
  85. ret = iwl_poll_bit(priv, CSR_GP_CNTRL,
  86. CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
  87. CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
  88. if (ret < 0) {
  89. IWL_DEBUG_INFO("Failed to init the card\n");
  90. return ret;
  91. }
  92. ret = iwl_grab_nic_access(priv);
  93. if (ret)
  94. return ret;
  95. /* enable DMA */
  96. iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT);
  97. udelay(20);
  98. /* disable L1-Active */
  99. iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
  100. APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
  101. iwl_release_nic_access(priv);
  102. return ret;
  103. }
  104. /* FIXME: this is indentical to 4965 */
  105. static void iwl5000_apm_stop(struct iwl_priv *priv)
  106. {
  107. unsigned long flags;
  108. iwl5000_apm_stop_master(priv);
  109. spin_lock_irqsave(&priv->lock, flags);
  110. iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
  111. udelay(10);
  112. iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
  113. spin_unlock_irqrestore(&priv->lock, flags);
  114. }
  115. static int iwl5000_apm_reset(struct iwl_priv *priv)
  116. {
  117. int ret = 0;
  118. unsigned long flags;
  119. iwl5000_apm_stop_master(priv);
  120. spin_lock_irqsave(&priv->lock, flags);
  121. iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
  122. udelay(10);
  123. /* FIXME: put here L1A -L0S w/a */
  124. iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
  125. /* set "initialization complete" bit to move adapter
  126. * D0U* --> D0A* state */
  127. iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
  128. /* wait for clock stabilization */
  129. ret = iwl_poll_bit(priv, CSR_GP_CNTRL,
  130. CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
  131. CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
  132. if (ret < 0) {
  133. IWL_DEBUG_INFO("Failed to init the card\n");
  134. goto out;
  135. }
  136. ret = iwl_grab_nic_access(priv);
  137. if (ret)
  138. goto out;
  139. /* enable DMA */
  140. iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT);
  141. udelay(20);
  142. /* disable L1-Active */
  143. iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
  144. APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
  145. iwl_release_nic_access(priv);
  146. out:
  147. spin_unlock_irqrestore(&priv->lock, flags);
  148. return ret;
  149. }
  150. static void iwl5000_nic_config(struct iwl_priv *priv)
  151. {
  152. unsigned long flags;
  153. u16 radio_cfg;
  154. u8 val_link;
  155. spin_lock_irqsave(&priv->lock, flags);
  156. pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link);
  157. /* L1 is enabled by BIOS */
  158. if ((val_link & PCI_LINK_VAL_L1_EN) == PCI_LINK_VAL_L1_EN)
  159. /* diable L0S disabled L1A enabled */
  160. iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
  161. else
  162. /* L0S enabled L1A disabled */
  163. iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
  164. radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
  165. /* write radio config values to register */
  166. if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_5000_RF_CFG_TYPE_MAX)
  167. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  168. EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
  169. EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
  170. EEPROM_RF_CFG_DASH_MSK(radio_cfg));
  171. /* set CSR_HW_CONFIG_REG for uCode use */
  172. iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
  173. CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
  174. CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
  175. spin_unlock_irqrestore(&priv->lock, flags);
  176. }
  177. /*
  178. * EEPROM
  179. */
  180. static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
  181. {
  182. u16 offset = 0;
  183. if ((address & INDIRECT_ADDRESS) == 0)
  184. return address;
  185. switch (address & INDIRECT_TYPE_MSK) {
  186. case INDIRECT_HOST:
  187. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_HOST);
  188. break;
  189. case INDIRECT_GENERAL:
  190. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_GENERAL);
  191. break;
  192. case INDIRECT_REGULATORY:
  193. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_REGULATORY);
  194. break;
  195. case INDIRECT_CALIBRATION:
  196. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_CALIBRATION);
  197. break;
  198. case INDIRECT_PROCESS_ADJST:
  199. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_PROCESS_ADJST);
  200. break;
  201. case INDIRECT_OTHERS:
  202. offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS);
  203. break;
  204. default:
  205. IWL_ERROR("illegal indirect type: 0x%X\n",
  206. address & INDIRECT_TYPE_MSK);
  207. break;
  208. }
  209. /* translate the offset from words to byte */
  210. return (address & ADDRESS_MSK) + (offset << 1);
  211. }
  212. static int iwl5000_eeprom_check_version(struct iwl_priv *priv)
  213. {
  214. u16 eeprom_ver;
  215. struct iwl_eeprom_calib_hdr {
  216. u8 version;
  217. u8 pa_type;
  218. u16 voltage;
  219. } *hdr;
  220. eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
  221. hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
  222. EEPROM_5000_CALIB_ALL);
  223. if (eeprom_ver < EEPROM_5000_EEPROM_VERSION ||
  224. hdr->version < EEPROM_5000_TX_POWER_VERSION)
  225. goto err;
  226. return 0;
  227. err:
  228. IWL_ERROR("Unsuported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
  229. eeprom_ver, EEPROM_5000_EEPROM_VERSION,
  230. hdr->version, EEPROM_5000_TX_POWER_VERSION);
  231. return -EINVAL;
  232. }
  233. #ifdef CONFIG_IWL5000_RUN_TIME_CALIB
  234. static void iwl5000_gain_computation(struct iwl_priv *priv,
  235. u32 average_noise[NUM_RX_CHAINS],
  236. u16 min_average_noise_antenna_i,
  237. u32 min_average_noise)
  238. {
  239. int i;
  240. s32 delta_g;
  241. struct iwl_chain_noise_data *data = &priv->chain_noise_data;
  242. /* Find Gain Code for the antennas B and C */
  243. for (i = 1; i < NUM_RX_CHAINS; i++) {
  244. if ((data->disconn_array[i])) {
  245. data->delta_gain_code[i] = 0;
  246. continue;
  247. }
  248. delta_g = (1000 * ((s32)average_noise[0] -
  249. (s32)average_noise[i])) / 1500;
  250. /* bound gain by 2 bits value max, 3rd bit is sign */
  251. data->delta_gain_code[i] =
  252. min(abs(delta_g), CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
  253. if (delta_g < 0)
  254. /* set negative sign */
  255. data->delta_gain_code[i] |= (1 << 2);
  256. }
  257. IWL_DEBUG_CALIB("Delta gains: ANT_B = %d ANT_C = %d\n",
  258. data->delta_gain_code[1], data->delta_gain_code[2]);
  259. if (!data->radio_write) {
  260. struct iwl5000_calibration_chain_noise_gain_cmd cmd;
  261. memset(&cmd, 0, sizeof(cmd));
  262. cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD;
  263. cmd.delta_gain_1 = data->delta_gain_code[1];
  264. cmd.delta_gain_2 = data->delta_gain_code[2];
  265. iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD,
  266. sizeof(cmd), &cmd, NULL);
  267. data->radio_write = 1;
  268. data->state = IWL_CHAIN_NOISE_CALIBRATED;
  269. }
  270. data->chain_noise_a = 0;
  271. data->chain_noise_b = 0;
  272. data->chain_noise_c = 0;
  273. data->chain_signal_a = 0;
  274. data->chain_signal_b = 0;
  275. data->chain_signal_c = 0;
  276. data->beacon_count = 0;
  277. }
  278. static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
  279. {
  280. struct iwl_chain_noise_data *data = &priv->chain_noise_data;
  281. if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) {
  282. struct iwl5000_calibration_chain_noise_reset_cmd cmd;
  283. memset(&cmd, 0, sizeof(cmd));
  284. cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD;
  285. if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
  286. sizeof(cmd), &cmd))
  287. IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n");
  288. data->state = IWL_CHAIN_NOISE_ACCUMULATE;
  289. IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
  290. }
  291. }
  292. static struct iwl_sensitivity_ranges iwl5000_sensitivity = {
  293. .min_nrg_cck = 95,
  294. .max_nrg_cck = 0,
  295. .auto_corr_min_ofdm = 90,
  296. .auto_corr_min_ofdm_mrc = 170,
  297. .auto_corr_min_ofdm_x1 = 120,
  298. .auto_corr_min_ofdm_mrc_x1 = 240,
  299. .auto_corr_max_ofdm = 120,
  300. .auto_corr_max_ofdm_mrc = 210,
  301. .auto_corr_max_ofdm_x1 = 155,
  302. .auto_corr_max_ofdm_mrc_x1 = 290,
  303. .auto_corr_min_cck = 125,
  304. .auto_corr_max_cck = 200,
  305. .auto_corr_min_cck_mrc = 170,
  306. .auto_corr_max_cck_mrc = 400,
  307. .nrg_th_cck = 95,
  308. .nrg_th_ofdm = 95,
  309. };
  310. #endif /* CONFIG_IWL5000_RUN_TIME_CALIB */
  311. static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
  312. size_t offset)
  313. {
  314. u32 address = eeprom_indirect_address(priv, offset);
  315. BUG_ON(address >= priv->cfg->eeprom_size);
  316. return &priv->eeprom[address];
  317. }
  318. /*
  319. * Calibration
  320. */
  321. static int iwl5000_send_Xtal_calib(struct iwl_priv *priv)
  322. {
  323. u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
  324. struct iwl5000_calibration cal_cmd = {
  325. .op_code = IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD,
  326. .data = {
  327. (u8)xtal_calib[0],
  328. (u8)xtal_calib[1],
  329. }
  330. };
  331. return iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
  332. sizeof(cal_cmd), &cal_cmd);
  333. }
  334. static int iwl5000_send_calib_results(struct iwl_priv *priv)
  335. {
  336. int ret = 0;
  337. if (priv->calib_results.lo_res)
  338. ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
  339. priv->calib_results.lo_res_len,
  340. priv->calib_results.lo_res);
  341. if (ret)
  342. goto err;
  343. if (priv->calib_results.tx_iq_res)
  344. ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
  345. priv->calib_results.tx_iq_res_len,
  346. priv->calib_results.tx_iq_res);
  347. if (ret)
  348. goto err;
  349. if (priv->calib_results.tx_iq_perd_res)
  350. ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
  351. priv->calib_results.tx_iq_perd_res_len,
  352. priv->calib_results.tx_iq_perd_res);
  353. if (ret)
  354. goto err;
  355. return 0;
  356. err:
  357. IWL_ERROR("Error %d\n", ret);
  358. return ret;
  359. }
  360. static int iwl5000_send_calib_cfg(struct iwl_priv *priv)
  361. {
  362. struct iwl5000_calib_cfg_cmd calib_cfg_cmd;
  363. struct iwl_host_cmd cmd = {
  364. .id = CALIBRATION_CFG_CMD,
  365. .len = sizeof(struct iwl5000_calib_cfg_cmd),
  366. .data = &calib_cfg_cmd,
  367. };
  368. memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
  369. calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
  370. calib_cfg_cmd.ucd_calib_cfg.once.start = IWL_CALIB_INIT_CFG_ALL;
  371. calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL;
  372. calib_cfg_cmd.ucd_calib_cfg.flags = IWL_CALIB_INIT_CFG_ALL;
  373. return iwl_send_cmd(priv, &cmd);
  374. }
  375. static void iwl5000_rx_calib_result(struct iwl_priv *priv,
  376. struct iwl_rx_mem_buffer *rxb)
  377. {
  378. struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
  379. struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw;
  380. int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK;
  381. iwl_free_calib_results(priv);
  382. /* reduce the size of the length field itself */
  383. len -= 4;
  384. switch (hdr->op_code) {
  385. case IWL5000_PHY_CALIBRATE_LO_CMD:
  386. priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC);
  387. priv->calib_results.lo_res_len = len;
  388. memcpy(priv->calib_results.lo_res, pkt->u.raw, len);
  389. break;
  390. case IWL5000_PHY_CALIBRATE_TX_IQ_CMD:
  391. priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC);
  392. priv->calib_results.tx_iq_res_len = len;
  393. memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len);
  394. break;
  395. case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD:
  396. priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC);
  397. priv->calib_results.tx_iq_perd_res_len = len;
  398. memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len);
  399. break;
  400. default:
  401. IWL_ERROR("Unknown calibration notification %d\n",
  402. hdr->op_code);
  403. return;
  404. }
  405. }
  406. static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
  407. struct iwl_rx_mem_buffer *rxb)
  408. {
  409. IWL_DEBUG_INFO("Init. calibration is completed, restarting fw.\n");
  410. queue_work(priv->workqueue, &priv->restart);
  411. }
  412. /*
  413. * ucode
  414. */
  415. static int iwl5000_load_section(struct iwl_priv *priv,
  416. struct fw_desc *image,
  417. u32 dst_addr)
  418. {
  419. int ret = 0;
  420. unsigned long flags;
  421. dma_addr_t phy_addr = image->p_addr;
  422. u32 byte_cnt = image->len;
  423. spin_lock_irqsave(&priv->lock, flags);
  424. ret = iwl_grab_nic_access(priv);
  425. if (ret) {
  426. spin_unlock_irqrestore(&priv->lock, flags);
  427. return ret;
  428. }
  429. iwl_write_direct32(priv,
  430. FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
  431. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
  432. iwl_write_direct32(priv,
  433. FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr);
  434. iwl_write_direct32(priv,
  435. FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
  436. phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
  437. /* FIME: write the MSB of the phy_addr in CTRL1
  438. * iwl_write_direct32(priv,
  439. IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL),
  440. ((phy_addr & MSB_MSK)
  441. << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count);
  442. */
  443. iwl_write_direct32(priv,
  444. FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt);
  445. iwl_write_direct32(priv,
  446. FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
  447. 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
  448. 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |
  449. FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID);
  450. iwl_write_direct32(priv,
  451. FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
  452. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
  453. FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL |
  454. FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
  455. iwl_release_nic_access(priv);
  456. spin_unlock_irqrestore(&priv->lock, flags);
  457. return 0;
  458. }
  459. static int iwl5000_load_given_ucode(struct iwl_priv *priv,
  460. struct fw_desc *inst_image,
  461. struct fw_desc *data_image)
  462. {
  463. int ret = 0;
  464. ret = iwl5000_load_section(
  465. priv, inst_image, RTC_INST_LOWER_BOUND);
  466. if (ret)
  467. return ret;
  468. IWL_DEBUG_INFO("INST uCode section being loaded...\n");
  469. ret = wait_event_interruptible_timeout(priv->wait_command_queue,
  470. priv->ucode_write_complete, 5 * HZ);
  471. if (ret == -ERESTARTSYS) {
  472. IWL_ERROR("Could not load the INST uCode section due "
  473. "to interrupt\n");
  474. return ret;
  475. }
  476. if (!ret) {
  477. IWL_ERROR("Could not load the INST uCode section\n");
  478. return -ETIMEDOUT;
  479. }
  480. priv->ucode_write_complete = 0;
  481. ret = iwl5000_load_section(
  482. priv, data_image, RTC_DATA_LOWER_BOUND);
  483. if (ret)
  484. return ret;
  485. IWL_DEBUG_INFO("DATA uCode section being loaded...\n");
  486. ret = wait_event_interruptible_timeout(priv->wait_command_queue,
  487. priv->ucode_write_complete, 5 * HZ);
  488. if (ret == -ERESTARTSYS) {
  489. IWL_ERROR("Could not load the INST uCode section due "
  490. "to interrupt\n");
  491. return ret;
  492. } else if (!ret) {
  493. IWL_ERROR("Could not load the DATA uCode section\n");
  494. return -ETIMEDOUT;
  495. } else
  496. ret = 0;
  497. priv->ucode_write_complete = 0;
  498. return ret;
  499. }
  500. static int iwl5000_load_ucode(struct iwl_priv *priv)
  501. {
  502. int ret = 0;
  503. /* check whether init ucode should be loaded, or rather runtime ucode */
  504. if (priv->ucode_init.len && (priv->ucode_type == UCODE_NONE)) {
  505. IWL_DEBUG_INFO("Init ucode found. Loading init ucode...\n");
  506. ret = iwl5000_load_given_ucode(priv,
  507. &priv->ucode_init, &priv->ucode_init_data);
  508. if (!ret) {
  509. IWL_DEBUG_INFO("Init ucode load complete.\n");
  510. priv->ucode_type = UCODE_INIT;
  511. }
  512. } else {
  513. IWL_DEBUG_INFO("Init ucode not found, or already loaded. "
  514. "Loading runtime ucode...\n");
  515. ret = iwl5000_load_given_ucode(priv,
  516. &priv->ucode_code, &priv->ucode_data);
  517. if (!ret) {
  518. IWL_DEBUG_INFO("Runtime ucode load complete.\n");
  519. priv->ucode_type = UCODE_RT;
  520. }
  521. }
  522. return ret;
  523. }
  524. static void iwl5000_init_alive_start(struct iwl_priv *priv)
  525. {
  526. int ret = 0;
  527. /* Check alive response for "valid" sign from uCode */
  528. if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
  529. /* We had an error bringing up the hardware, so take it
  530. * all the way back down so we can try again */
  531. IWL_DEBUG_INFO("Initialize Alive failed.\n");
  532. goto restart;
  533. }
  534. /* initialize uCode was loaded... verify inst image.
  535. * This is a paranoid check, because we would not have gotten the
  536. * "initialize" alive if code weren't properly loaded. */
  537. if (iwl_verify_ucode(priv)) {
  538. /* Runtime instruction load was bad;
  539. * take it all the way back down so we can try again */
  540. IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
  541. goto restart;
  542. }
  543. iwlcore_clear_stations_table(priv);
  544. ret = priv->cfg->ops->lib->alive_notify(priv);
  545. if (ret) {
  546. IWL_WARNING("Could not complete ALIVE transition: %d\n", ret);
  547. goto restart;
  548. }
  549. iwl5000_send_calib_cfg(priv);
  550. return;
  551. restart:
  552. /* real restart (first load init_ucode) */
  553. queue_work(priv->workqueue, &priv->restart);
  554. }
  555. static void iwl5000_set_wr_ptrs(struct iwl_priv *priv,
  556. int txq_id, u32 index)
  557. {
  558. iwl_write_direct32(priv, HBUS_TARG_WRPTR,
  559. (index & 0xff) | (txq_id << 8));
  560. iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(txq_id), index);
  561. }
  562. static void iwl5000_tx_queue_set_status(struct iwl_priv *priv,
  563. struct iwl_tx_queue *txq,
  564. int tx_fifo_id, int scd_retry)
  565. {
  566. int txq_id = txq->q.id;
  567. int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0;
  568. iwl_write_prph(priv, IWL50_SCD_QUEUE_STATUS_BITS(txq_id),
  569. (active << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
  570. (tx_fifo_id << IWL50_SCD_QUEUE_STTS_REG_POS_TXF) |
  571. (1 << IWL50_SCD_QUEUE_STTS_REG_POS_WSL) |
  572. IWL50_SCD_QUEUE_STTS_REG_MSK);
  573. txq->sched_retry = scd_retry;
  574. IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n",
  575. active ? "Activate" : "Deactivate",
  576. scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
  577. }
  578. static int iwl5000_send_wimax_coex(struct iwl_priv *priv)
  579. {
  580. struct iwl_wimax_coex_cmd coex_cmd;
  581. memset(&coex_cmd, 0, sizeof(coex_cmd));
  582. return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD,
  583. sizeof(coex_cmd), &coex_cmd);
  584. }
  585. static int iwl5000_alive_notify(struct iwl_priv *priv)
  586. {
  587. u32 a;
  588. int i = 0;
  589. unsigned long flags;
  590. int ret;
  591. spin_lock_irqsave(&priv->lock, flags);
  592. ret = iwl_grab_nic_access(priv);
  593. if (ret) {
  594. spin_unlock_irqrestore(&priv->lock, flags);
  595. return ret;
  596. }
  597. priv->scd_base_addr = iwl_read_prph(priv, IWL50_SCD_SRAM_BASE_ADDR);
  598. a = priv->scd_base_addr + IWL50_SCD_CONTEXT_DATA_OFFSET;
  599. for (; a < priv->scd_base_addr + IWL50_SCD_TX_STTS_BITMAP_OFFSET;
  600. a += 4)
  601. iwl_write_targ_mem(priv, a, 0);
  602. for (; a < priv->scd_base_addr + IWL50_SCD_TRANSLATE_TBL_OFFSET;
  603. a += 4)
  604. iwl_write_targ_mem(priv, a, 0);
  605. for (; a < sizeof(u16) * priv->hw_params.max_txq_num; a += 4)
  606. iwl_write_targ_mem(priv, a, 0);
  607. iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR,
  608. (priv->shared_phys +
  609. offsetof(struct iwl5000_shared, queues_byte_cnt_tbls)) >> 10);
  610. iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL,
  611. IWL50_SCD_QUEUECHAIN_SEL_ALL(
  612. priv->hw_params.max_txq_num));
  613. iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0);
  614. /* initiate the queues */
  615. for (i = 0; i < priv->hw_params.max_txq_num; i++) {
  616. iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(i), 0);
  617. iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
  618. iwl_write_targ_mem(priv, priv->scd_base_addr +
  619. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
  620. iwl_write_targ_mem(priv, priv->scd_base_addr +
  621. IWL50_SCD_CONTEXT_QUEUE_OFFSET(i) +
  622. sizeof(u32),
  623. ((SCD_WIN_SIZE <<
  624. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
  625. IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
  626. ((SCD_FRAME_LIMIT <<
  627. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
  628. IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
  629. }
  630. iwl_write_prph(priv, IWL50_SCD_INTERRUPT_MASK,
  631. IWL_MASK(0, priv->hw_params.max_txq_num));
  632. /* Activate all Tx DMA/FIFO channels */
  633. priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7));
  634. iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
  635. /* map qos queues to fifos one-to-one */
  636. for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) {
  637. int ac = iwl5000_default_queue_to_tx_fifo[i];
  638. iwl_txq_ctx_activate(priv, i);
  639. iwl5000_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
  640. }
  641. /* TODO - need to initialize those FIFOs inside the loop above,
  642. * not only mark them as active */
  643. iwl_txq_ctx_activate(priv, 4);
  644. iwl_txq_ctx_activate(priv, 7);
  645. iwl_txq_ctx_activate(priv, 8);
  646. iwl_txq_ctx_activate(priv, 9);
  647. iwl_release_nic_access(priv);
  648. spin_unlock_irqrestore(&priv->lock, flags);
  649. iwl5000_send_wimax_coex(priv);
  650. iwl5000_send_Xtal_calib(priv);
  651. if (priv->ucode_type == UCODE_RT)
  652. iwl5000_send_calib_results(priv);
  653. return 0;
  654. }
  655. static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
  656. {
  657. if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) ||
  658. (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
  659. IWL_ERROR("invalid queues_num, should be between %d and %d\n",
  660. IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
  661. return -EINVAL;
  662. }
  663. priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues;
  664. priv->hw_params.sw_crypto = priv->cfg->mod_params->sw_crypto;
  665. priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
  666. priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
  667. if (priv->cfg->mod_params->amsdu_size_8K)
  668. priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_8K;
  669. else
  670. priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_4K;
  671. priv->hw_params.max_pkt_size = priv->hw_params.rx_buf_size - 256;
  672. priv->hw_params.max_stations = IWL5000_STATION_COUNT;
  673. priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
  674. priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
  675. priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
  676. priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
  677. priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) |
  678. BIT(IEEE80211_BAND_5GHZ);
  679. #ifdef CONFIG_IWL5000_RUN_TIME_CALIB
  680. priv->hw_params.sens = &iwl5000_sensitivity;
  681. #endif
  682. switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
  683. case CSR_HW_REV_TYPE_5100:
  684. case CSR_HW_REV_TYPE_5150:
  685. priv->hw_params.tx_chains_num = 1;
  686. priv->hw_params.rx_chains_num = 2;
  687. /* FIXME: move to ANT_A, ANT_B, ANT_C enum */
  688. priv->hw_params.valid_tx_ant = ANT_A;
  689. priv->hw_params.valid_rx_ant = ANT_AB;
  690. break;
  691. case CSR_HW_REV_TYPE_5300:
  692. case CSR_HW_REV_TYPE_5350:
  693. priv->hw_params.tx_chains_num = 3;
  694. priv->hw_params.rx_chains_num = 3;
  695. priv->hw_params.valid_tx_ant = ANT_ABC;
  696. priv->hw_params.valid_rx_ant = ANT_ABC;
  697. break;
  698. }
  699. switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
  700. case CSR_HW_REV_TYPE_5100:
  701. case CSR_HW_REV_TYPE_5300:
  702. /* 5X00 wants in Celsius */
  703. priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
  704. break;
  705. case CSR_HW_REV_TYPE_5150:
  706. case CSR_HW_REV_TYPE_5350:
  707. /* 5X50 wants in Kelvin */
  708. priv->hw_params.ct_kill_threshold =
  709. CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD);
  710. break;
  711. }
  712. return 0;
  713. }
  714. static int iwl5000_alloc_shared_mem(struct iwl_priv *priv)
  715. {
  716. priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
  717. sizeof(struct iwl5000_shared),
  718. &priv->shared_phys);
  719. if (!priv->shared_virt)
  720. return -ENOMEM;
  721. memset(priv->shared_virt, 0, sizeof(struct iwl5000_shared));
  722. priv->rb_closed_offset = offsetof(struct iwl5000_shared, rb_closed);
  723. return 0;
  724. }
  725. static void iwl5000_free_shared_mem(struct iwl_priv *priv)
  726. {
  727. if (priv->shared_virt)
  728. pci_free_consistent(priv->pci_dev,
  729. sizeof(struct iwl5000_shared),
  730. priv->shared_virt,
  731. priv->shared_phys);
  732. }
  733. static int iwl5000_shared_mem_rx_idx(struct iwl_priv *priv)
  734. {
  735. struct iwl5000_shared *s = priv->shared_virt;
  736. return le32_to_cpu(s->rb_closed) & 0xFFF;
  737. }
  738. /**
  739. * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
  740. */
  741. static void iwl5000_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
  742. struct iwl_tx_queue *txq,
  743. u16 byte_cnt)
  744. {
  745. struct iwl5000_shared *shared_data = priv->shared_virt;
  746. int txq_id = txq->q.id;
  747. u8 sec_ctl = 0;
  748. u8 sta = 0;
  749. int len;
  750. len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE;
  751. if (txq_id != IWL_CMD_QUEUE_NUM) {
  752. sta = txq->cmd[txq->q.write_ptr].cmd.tx.sta_id;
  753. sec_ctl = txq->cmd[txq->q.write_ptr].cmd.tx.sec_ctl;
  754. switch (sec_ctl & TX_CMD_SEC_MSK) {
  755. case TX_CMD_SEC_CCM:
  756. len += CCMP_MIC_LEN;
  757. break;
  758. case TX_CMD_SEC_TKIP:
  759. len += TKIP_ICV_LEN;
  760. break;
  761. case TX_CMD_SEC_WEP:
  762. len += WEP_IV_LEN + WEP_ICV_LEN;
  763. break;
  764. }
  765. }
  766. IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id].
  767. tfd_offset[txq->q.write_ptr], byte_cnt, len);
  768. IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id].
  769. tfd_offset[txq->q.write_ptr], sta_id, sta);
  770. if (txq->q.write_ptr < IWL50_MAX_WIN_SIZE) {
  771. IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id].
  772. tfd_offset[IWL50_QUEUE_SIZE + txq->q.write_ptr],
  773. byte_cnt, len);
  774. IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id].
  775. tfd_offset[IWL50_QUEUE_SIZE + txq->q.write_ptr],
  776. sta_id, sta);
  777. }
  778. }
  779. static u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
  780. {
  781. u16 size = (u16)sizeof(struct iwl_addsta_cmd);
  782. memcpy(data, cmd, size);
  783. return size;
  784. }
  785. /*
  786. * Activate/Deactivat Tx DMA/FIFO channels according tx fifos mask
  787. * must be called under priv->lock and mac access
  788. */
  789. static void iwl5000_txq_set_sched(struct iwl_priv *priv, u32 mask)
  790. {
  791. iwl_write_prph(priv, IWL50_SCD_TXFACT, mask);
  792. }
  793. /* Currently 5000 is the supperset of everything */
  794. static u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len)
  795. {
  796. return len;
  797. }
  798. static void iwl5000_rx_handler_setup(struct iwl_priv *priv)
  799. {
  800. /* init calibration handlers */
  801. priv->rx_handlers[CALIBRATION_RES_NOTIFICATION] =
  802. iwl5000_rx_calib_result;
  803. priv->rx_handlers[CALIBRATION_COMPLETE_NOTIFICATION] =
  804. iwl5000_rx_calib_complete;
  805. }
  806. static int iwl5000_hw_valid_rtc_data_addr(u32 addr)
  807. {
  808. return (addr >= RTC_DATA_LOWER_BOUND) &&
  809. (addr < IWL50_RTC_DATA_UPPER_BOUND);
  810. }
  811. static struct iwl_hcmd_ops iwl5000_hcmd = {
  812. };
  813. static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
  814. .get_hcmd_size = iwl5000_get_hcmd_size,
  815. .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
  816. #ifdef CONFIG_IWL5000_RUN_TIME_CALIB
  817. .gain_computation = iwl5000_gain_computation,
  818. .chain_noise_reset = iwl5000_chain_noise_reset,
  819. #endif
  820. };
  821. static struct iwl_lib_ops iwl5000_lib = {
  822. .set_hw_params = iwl5000_hw_set_hw_params,
  823. .alloc_shared_mem = iwl5000_alloc_shared_mem,
  824. .free_shared_mem = iwl5000_free_shared_mem,
  825. .shared_mem_rx_idx = iwl5000_shared_mem_rx_idx,
  826. .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
  827. .txq_set_sched = iwl5000_txq_set_sched,
  828. .rx_handler_setup = iwl5000_rx_handler_setup,
  829. .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
  830. .load_ucode = iwl5000_load_ucode,
  831. .init_alive_start = iwl5000_init_alive_start,
  832. .alive_notify = iwl5000_alive_notify,
  833. .apm_ops = {
  834. .init = iwl5000_apm_init,
  835. .reset = iwl5000_apm_reset,
  836. .stop = iwl5000_apm_stop,
  837. .config = iwl5000_nic_config,
  838. .set_pwr_src = iwl4965_set_pwr_src,
  839. },
  840. .eeprom_ops = {
  841. .regulatory_bands = {
  842. EEPROM_5000_REG_BAND_1_CHANNELS,
  843. EEPROM_5000_REG_BAND_2_CHANNELS,
  844. EEPROM_5000_REG_BAND_3_CHANNELS,
  845. EEPROM_5000_REG_BAND_4_CHANNELS,
  846. EEPROM_5000_REG_BAND_5_CHANNELS,
  847. EEPROM_5000_REG_BAND_24_FAT_CHANNELS,
  848. EEPROM_5000_REG_BAND_52_FAT_CHANNELS
  849. },
  850. .verify_signature = iwlcore_eeprom_verify_signature,
  851. .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
  852. .release_semaphore = iwlcore_eeprom_release_semaphore,
  853. .check_version = iwl5000_eeprom_check_version,
  854. .query_addr = iwl5000_eeprom_query_addr,
  855. },
  856. };
  857. static struct iwl_ops iwl5000_ops = {
  858. .lib = &iwl5000_lib,
  859. .hcmd = &iwl5000_hcmd,
  860. .utils = &iwl5000_hcmd_utils,
  861. };
  862. static struct iwl_mod_params iwl50_mod_params = {
  863. .num_of_queues = IWL50_NUM_QUEUES,
  864. .enable_qos = 1,
  865. .amsdu_size_8K = 1,
  866. .restart_fw = 1,
  867. /* the rest are 0 by default */
  868. };
  869. struct iwl_cfg iwl5300_agn_cfg = {
  870. .name = "5300AGN",
  871. .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
  872. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  873. .ops = &iwl5000_ops,
  874. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  875. .mod_params = &iwl50_mod_params,
  876. };
  877. struct iwl_cfg iwl5100_agn_cfg = {
  878. .name = "5100AGN",
  879. .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
  880. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  881. .ops = &iwl5000_ops,
  882. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  883. .mod_params = &iwl50_mod_params,
  884. };
  885. struct iwl_cfg iwl5350_agn_cfg = {
  886. .name = "5350AGN",
  887. .fw_name = "iwlwifi-5000" IWL5000_UCODE_API ".ucode",
  888. .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
  889. .ops = &iwl5000_ops,
  890. .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
  891. .mod_params = &iwl50_mod_params,
  892. };
  893. module_param_named(disable50, iwl50_mod_params.disable, int, 0444);
  894. MODULE_PARM_DESC(disable50,
  895. "manually disable the 50XX radio (default 0 [radio on])");
  896. module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444);
  897. MODULE_PARM_DESC(swcrypto50,
  898. "using software crypto engine (default 0 [hardware])\n");
  899. module_param_named(debug50, iwl50_mod_params.debug, int, 0444);
  900. MODULE_PARM_DESC(debug50, "50XX debug output mask");
  901. module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444);
  902. MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
  903. module_param_named(qos_enable50, iwl50_mod_params.enable_qos, int, 0444);
  904. MODULE_PARM_DESC(qos_enable50, "enable all 50XX QoS functionality");
  905. module_param_named(amsdu_size_8K50, iwl50_mod_params.amsdu_size_8K, int, 0444);
  906. MODULE_PARM_DESC(amsdu_size_8K50, "enable 8K amsdu size in 50XX series");
  907. module_param_named(fw_restart50, iwl50_mod_params.restart_fw, int, 0444);
  908. MODULE_PARM_DESC(fw_restart50, "restart firmware in case of error");