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