1 /*- 2 * Copyright (c) 2013 Cedric GROSS <cg@cgross.info> 3 * Copyright (c) 2011 Intel Corporation 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * 17 * $FreeBSD$ 18 */ 19 20 #ifndef __IF_IWN_CHIP_CFG_H__ 21 #define __IF_IWN_CHIP_CFG_H__ 22 23 /* ========================================================================== 24 * NIC PARAMETERS 25 * 26 * ========================================================================== 27 */ 28 29 /* 30 * Flags for managing calibration result. See calib_need 31 * in iwn_base_params struct 32 * 33 * These are bitmasks that determine which indexes in the calibcmd 34 * array are pushed up. 35 */ 36 #define IWN_FLG_NEED_PHY_CALIB_DC (1<<0) 37 #define IWN_FLG_NEED_PHY_CALIB_LO (1<<1) 38 #define IWN_FLG_NEED_PHY_CALIB_TX_IQ (1<<2) 39 #define IWN_FLG_NEED_PHY_CALIB_TX_IQ_PERIODIC (1<<3) 40 #define IWN_FLG_NEED_PHY_CALIB_BASE_BAND (1<<4) 41 /* 42 * These aren't (yet) included in the calibcmd array, but 43 * are used as flags for which calibrations to use. 44 * 45 * XXX I think they should be named differently and 46 * stuffed in a different member in the config struct! 47 */ 48 #define IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSET (1<<5) 49 #define IWN_FLG_NEED_PHY_CALIB_CRYSTAL (1<<6) 50 #define IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSETv2 (1<<7) 51 52 /* 53 * Each chip has a different threshold for PLCP errors that should trigger a 54 * retune. 55 */ 56 #define IWN_PLCP_ERR_DEFAULT_THRESHOLD 50 57 #define IWN_PLCP_ERR_LONG_THRESHOLD 100 58 #define IWN_PLCP_ERR_EXT_LONG_THRESHOLD 200 59 60 /* 61 * Define some parameters for managing different NIC. 62 * Refer to linux specific file like iwl-xxxx.c to determine correct value 63 * for NIC. 64 * 65 * @max_ll_items: max number of OTP blocks 66 * @shadow_ram_support: shadow support for OTP memory 67 * @shadow_reg_enable: HW shadhow register bit 68 * @no_idle_support: do not support idle mode 69 * @advanced_bt_coexist : Advanced BT management 70 * @bt_session_2 : NIC need a new struct for configure BT coexistence. Needed 71 * only if advanced_bt_coexist is true 72 * @bt_sco_disable : 73 * @additional_nic_config: For 6005 series 74 * @iq_invert : ? But need it for N 2000 series 75 * @regulatory_bands : XXX 76 * @enhanced_TX_power : EEPROM Has advanced TX power options. Set 'True' 77 * if update_enhanced_txpower = iwl_eeprom_enhanced_txpower. 78 * See iwl-agn-devices.c file to determine that(enhanced_txpower) 79 * @need_temp_offset_calib : Need to compute some temp offset for calibration. 80 * @calib_need : Use IWN_FLG_NEED_PHY_CALIB_* flags to specify which 81 * calibration data ucode need. See calib_init_cfg in iwl-xxxx.c 82 * linux kernel file 83 * @support_hostap: Define IEEE80211_C_HOSTAP for ic_caps 84 * @no_multi_vaps: See iwn_vap_create 85 * @additional_gp_drv_bit : Specific bit to defined during nic_config 86 * @bt_mode: BT configuration mode 87 */ 88 enum bt_mode_enum { 89 IWN_BT_NONE, 90 IWN_BT_SIMPLE, 91 IWN_BT_ADVANCED 92 }; 93 94 struct iwn_base_params { 95 uint32_t pll_cfg_val; 96 const uint16_t max_ll_items; 97 #define IWN_OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */ 98 #define IWN_OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */ 99 #define IWN_OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */ 100 #define IWN_OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */ 101 const bool shadow_ram_support; 102 const bool shadow_reg_enable; 103 const bool bt_session_2; 104 const bool bt_sco_disable; 105 const bool additional_nic_config; 106 const uint32_t *regulatory_bands; 107 const bool enhanced_TX_power; 108 const uint16_t calib_need; 109 const bool support_hostap; 110 const bool no_multi_vaps; 111 uint8_t additional_gp_drv_bit; 112 enum bt_mode_enum bt_mode; 113 uint32_t plcp_err_threshold; 114 }; 115 116 static const struct iwn_base_params iwn5000_base_params = { 117 .pll_cfg_val = IWN_ANA_PLL_INIT, /* pll_cfg_val; */ 118 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, /* max_ll_items */ 119 .shadow_ram_support = true, /* shadow_ram_support */ 120 .shadow_reg_enable = false, /* shadow_reg_enable */ 121 .bt_session_2 = false, /* bt_session_2 */ 122 .bt_sco_disable = true, /* bt_sco_disable */ 123 .additional_nic_config = false, /* additional_nic_config */ 124 .regulatory_bands = iwn5000_regulatory_bands, /* regulatory_bands */ 125 .enhanced_TX_power = false, /* enhanced_TX_power */ 126 .calib_need = 127 ( IWN_FLG_NEED_PHY_CALIB_LO 128 | IWN_FLG_NEED_PHY_CALIB_TX_IQ_PERIODIC 129 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 130 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 131 .support_hostap = false, /* support_hostap */ 132 .no_multi_vaps = true, /* no_multi_vaps */ 133 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, /* additional_gp_drv_bit */ 134 .bt_mode = IWN_BT_NONE, /* bt_mode */ 135 .plcp_err_threshold = IWN_PLCP_ERR_LONG_THRESHOLD, 136 }; 137 138 /* 139 * 4965 support 140 */ 141 static const struct iwn_base_params iwn4965_base_params = { 142 .pll_cfg_val = 0, /* pll_cfg_val; */ 143 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, /* max_ll_items - ignored for 4965 */ 144 .shadow_ram_support = true, /* shadow_ram_support */ 145 .shadow_reg_enable = false, /* shadow_reg_enable */ 146 .bt_session_2 = false, /* bt_session_2 XXX unknown? */ 147 .bt_sco_disable = true, /* bt_sco_disable XXX unknown? */ 148 .additional_nic_config = false, /* additional_nic_config - not for 4965 */ 149 .regulatory_bands = iwn5000_regulatory_bands, /* regulatory_bands */ 150 .enhanced_TX_power = false, /* enhanced_TX_power - not for 4965 */ 151 .calib_need = 152 (IWN_FLG_NEED_PHY_CALIB_DC 153 | IWN_FLG_NEED_PHY_CALIB_LO 154 | IWN_FLG_NEED_PHY_CALIB_TX_IQ_PERIODIC 155 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 156 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 157 .support_hostap = false, /* support_hostap - XXX should work on fixing! */ 158 .no_multi_vaps = true, /* no_multi_vaps - XXX should work on fixing! */ 159 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, /* additional_gp_drv_bit */ 160 .bt_mode = IWN_BT_SIMPLE, /* bt_mode */ 161 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 162 }; 163 164 165 static const struct iwn_base_params iwn2000_base_params = { 166 .pll_cfg_val = 0, 167 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_2x00, 168 .shadow_ram_support = true, 169 .shadow_reg_enable = false, 170 .bt_session_2 = false, 171 .bt_sco_disable = true, 172 .additional_nic_config = false, 173 .regulatory_bands = iwn2030_regulatory_bands, 174 .enhanced_TX_power = true, 175 .calib_need = 176 (IWN_FLG_NEED_PHY_CALIB_DC 177 | IWN_FLG_NEED_PHY_CALIB_LO 178 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 179 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND 180 | IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSETv2 ), 181 .support_hostap = true, 182 .no_multi_vaps = false, 183 .additional_gp_drv_bit = IWN_GP_DRIVER_REG_BIT_RADIO_IQ_INVERT, 184 .bt_mode = IWN_BT_NONE, 185 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 186 }; 187 188 static const struct iwn_base_params iwn2030_base_params = { 189 .pll_cfg_val = 0, 190 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_2x00, 191 .shadow_ram_support = true, 192 .shadow_reg_enable = false, /* XXX check? */ 193 .bt_session_2 = true, 194 .bt_sco_disable = true, 195 .additional_nic_config = false, 196 .regulatory_bands = iwn2030_regulatory_bands, 197 .enhanced_TX_power = true, 198 .calib_need = 199 (IWN_FLG_NEED_PHY_CALIB_DC 200 | IWN_FLG_NEED_PHY_CALIB_LO 201 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 202 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND 203 | IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSETv2 ), 204 .support_hostap = true, 205 .no_multi_vaps = false, 206 .additional_gp_drv_bit = IWN_GP_DRIVER_REG_BIT_RADIO_IQ_INVERT, 207 .bt_mode = IWN_BT_ADVANCED, 208 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 209 }; 210 211 static const struct iwn_base_params iwn1000_base_params = { 212 .pll_cfg_val = IWN_ANA_PLL_INIT, 213 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_1000, 214 .shadow_ram_support = false, 215 .shadow_reg_enable = false, /* XXX check? */ 216 .bt_session_2 = false, 217 .bt_sco_disable = false, 218 .additional_nic_config = false, 219 .regulatory_bands = iwn5000_regulatory_bands, 220 .enhanced_TX_power = false, 221 .calib_need = 222 ( IWN_FLG_NEED_PHY_CALIB_DC 223 | IWN_FLG_NEED_PHY_CALIB_LO 224 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 225 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 226 .support_hostap = false, 227 .no_multi_vaps = true, 228 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 229 .bt_mode = IWN_BT_NONE, 230 .plcp_err_threshold = IWN_PLCP_ERR_EXT_LONG_THRESHOLD, 231 }; 232 static const struct iwn_base_params iwn_6000_base_params = { 233 .pll_cfg_val = 0, 234 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 235 .shadow_ram_support = true, 236 .shadow_reg_enable = true, 237 .bt_session_2 = false, 238 .bt_sco_disable = false, 239 .additional_nic_config = false, 240 .regulatory_bands = iwn6000_regulatory_bands, 241 .enhanced_TX_power = true, 242 .calib_need = 243 (IWN_FLG_NEED_PHY_CALIB_DC 244 | IWN_FLG_NEED_PHY_CALIB_LO 245 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 246 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 247 .support_hostap = false, 248 .no_multi_vaps = true, 249 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 250 .bt_mode = IWN_BT_SIMPLE, 251 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 252 }; 253 static const struct iwn_base_params iwn_6000i_base_params = { 254 .pll_cfg_val = 0, 255 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 256 .shadow_ram_support = true, 257 .shadow_reg_enable = true, 258 .bt_session_2 = false, 259 .bt_sco_disable = true, 260 .additional_nic_config = false, 261 .regulatory_bands = iwn6000_regulatory_bands, 262 .enhanced_TX_power = true, 263 .calib_need = 264 (IWN_FLG_NEED_PHY_CALIB_DC 265 | IWN_FLG_NEED_PHY_CALIB_LO 266 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 267 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 268 .support_hostap = false, 269 .no_multi_vaps = true, 270 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 271 .bt_mode = IWN_BT_SIMPLE, 272 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 273 }; 274 static const struct iwn_base_params iwn_6000g2_base_params = { 275 .pll_cfg_val = 0, 276 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 277 .shadow_ram_support = true, 278 .shadow_reg_enable = true, 279 .bt_session_2 = false, 280 .bt_sco_disable = true, 281 .additional_nic_config = false, 282 .regulatory_bands = iwn6000_regulatory_bands, 283 .enhanced_TX_power = true, 284 .calib_need = 285 (IWN_FLG_NEED_PHY_CALIB_DC 286 | IWN_FLG_NEED_PHY_CALIB_LO 287 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 288 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND 289 | IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSET ), 290 .support_hostap = false, 291 .no_multi_vaps = true, 292 .additional_gp_drv_bit = 0, 293 .bt_mode = IWN_BT_SIMPLE, 294 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 295 }; 296 297 static const struct iwn_base_params iwn_6050_base_params = { 298 .pll_cfg_val = 0, 299 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x50, 300 .shadow_ram_support = true, 301 .shadow_reg_enable = true, 302 .bt_session_2 = false, 303 .bt_sco_disable = true, 304 .additional_nic_config = true, 305 .regulatory_bands = iwn6000_regulatory_bands, 306 .enhanced_TX_power = true, 307 .calib_need = 308 (IWN_FLG_NEED_PHY_CALIB_LO 309 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 310 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 311 .support_hostap = false, 312 .no_multi_vaps = true, 313 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 314 .bt_mode = IWN_BT_SIMPLE, 315 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 316 }; 317 static const struct iwn_base_params iwn_6150_base_params = { 318 .pll_cfg_val = 0, 319 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x50, 320 .shadow_ram_support = true, 321 .shadow_reg_enable = true, 322 .bt_session_2 = false, 323 .bt_sco_disable = true, 324 .additional_nic_config = true, 325 .regulatory_bands = iwn6000_regulatory_bands, 326 .enhanced_TX_power = true, 327 .calib_need = 328 (IWN_FLG_NEED_PHY_CALIB_LO 329 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 330 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND), 331 .support_hostap = false, 332 .no_multi_vaps = true, 333 .additional_gp_drv_bit = IWN_GP_DRIVER_6050_1X2, 334 .bt_mode = IWN_BT_SIMPLE, 335 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 336 }; 337 338 /* IWL_DEVICE_6035 & IWL_DEVICE_6030 */ 339 static const struct iwn_base_params iwn_6000g2b_base_params = { 340 .pll_cfg_val = 0, 341 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 342 .shadow_ram_support = true, 343 .shadow_reg_enable = true, 344 .bt_session_2 = false, 345 .bt_sco_disable = true, 346 .additional_nic_config = false, 347 .regulatory_bands = iwn6000_regulatory_bands, 348 .enhanced_TX_power = true, 349 .calib_need = 350 (IWN_FLG_NEED_PHY_CALIB_DC 351 | IWN_FLG_NEED_PHY_CALIB_LO 352 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 353 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND 354 | IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSET ), 355 .support_hostap = false, 356 .no_multi_vaps = true, 357 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 358 .bt_mode = IWN_BT_ADVANCED, 359 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 360 }; 361 362 /* 363 * 6235 series NICs. 364 */ 365 static const struct iwn_base_params iwn_6235_base_params = { 366 .pll_cfg_val = 0, 367 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 368 .shadow_ram_support = true, 369 .shadow_reg_enable = true, 370 .bt_session_2 = false, 371 .bt_sco_disable = true, 372 .additional_nic_config = true, 373 .regulatory_bands = iwn6000_regulatory_bands, 374 .enhanced_TX_power = true, 375 .calib_need = 376 (IWN_FLG_NEED_PHY_CALIB_DC 377 | IWN_FLG_NEED_PHY_CALIB_LO 378 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 379 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND 380 | IWN_FLG_NEED_PHY_CALIB_TEMP_OFFSET ), 381 .support_hostap = false, 382 .no_multi_vaps = true, 383 /* XXX 1x2? This NIC is 2x2, right? */ 384 .additional_gp_drv_bit = IWN_GP_DRIVER_6050_1X2, 385 .bt_mode = IWN_BT_ADVANCED, 386 .plcp_err_threshold = IWN_PLCP_ERR_DEFAULT_THRESHOLD, 387 }; 388 389 static const struct iwn_base_params iwn_5x50_base_params = { 390 .pll_cfg_val = IWN_ANA_PLL_INIT, 391 .max_ll_items = IWN_OTP_MAX_LL_ITEMS_6x00, 392 .shadow_ram_support = true, 393 .shadow_reg_enable = false, 394 .bt_session_2 = false, 395 .bt_sco_disable = true, 396 .additional_nic_config = false, 397 .regulatory_bands = iwn5000_regulatory_bands, 398 .enhanced_TX_power =false, 399 .calib_need = 400 (IWN_FLG_NEED_PHY_CALIB_DC 401 | IWN_FLG_NEED_PHY_CALIB_LO 402 | IWN_FLG_NEED_PHY_CALIB_TX_IQ 403 | IWN_FLG_NEED_PHY_CALIB_BASE_BAND ), 404 .support_hostap = false, 405 .no_multi_vaps = true, 406 .additional_gp_drv_bit = IWN_GP_DRIVER_NONE, 407 .bt_mode = IWN_BT_SIMPLE, 408 .plcp_err_threshold = IWN_PLCP_ERR_LONG_THRESHOLD, 409 }; 410 411 #endif /* __IF_IWN_CHIP_CFG_H__ */ 412