iwl-7000.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  9. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  10. * Copyright(c) 2015 Intel Deutschland GmbH
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  24. * USA
  25. *
  26. * The full GNU General Public License is included in this distribution
  27. * in the file called COPYING.
  28. *
  29. * Contact Information:
  30. * Intel Linux Wireless <linuxwifi@intel.com>
  31. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  32. *
  33. * BSD LICENSE
  34. *
  35. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  36. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  37. * Copyright(c) 2015 Intel Deutschland GmbH
  38. * All rights reserved.
  39. *
  40. * Redistribution and use in source and binary forms, with or without
  41. * modification, are permitted provided that the following conditions
  42. * are met:
  43. *
  44. * * Redistributions of source code must retain the above copyright
  45. * notice, this list of conditions and the following disclaimer.
  46. * * Redistributions in binary form must reproduce the above copyright
  47. * notice, this list of conditions and the following disclaimer in
  48. * the documentation and/or other materials provided with the
  49. * distribution.
  50. * * Neither the name Intel Corporation nor the names of its
  51. * contributors may be used to endorse or promote products derived
  52. * from this software without specific prior written permission.
  53. *
  54. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  55. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  56. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  57. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  58. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  59. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  60. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  61. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  62. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  63. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  64. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  65. *
  66. *****************************************************************************/
  67. #include <linux/module.h>
  68. #include <linux/stringify.h>
  69. #include "iwl-config.h"
  70. #include "iwl-agn-hw.h"
  71. /* Highest firmware API version supported */
  72. #define IWL7260_UCODE_API_MAX 17
  73. #define IWL7265_UCODE_API_MAX 17
  74. #define IWL7265D_UCODE_API_MAX 26
  75. #define IWL3168_UCODE_API_MAX 26
  76. /* Lowest firmware API version supported */
  77. #define IWL7260_UCODE_API_MIN 17
  78. #define IWL7265_UCODE_API_MIN 17
  79. #define IWL7265D_UCODE_API_MIN 17
  80. #define IWL3168_UCODE_API_MIN 20
  81. /* NVM versions */
  82. #define IWL7260_NVM_VERSION 0x0a1d
  83. #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */
  84. #define IWL3160_NVM_VERSION 0x709
  85. #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */
  86. #define IWL3165_NVM_VERSION 0x709
  87. #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */
  88. #define IWL3168_NVM_VERSION 0xd01
  89. #define IWL3168_TX_POWER_VERSION 0xffff /* meaningless */
  90. #define IWL7265_NVM_VERSION 0x0a1d
  91. #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
  92. #define IWL7265D_NVM_VERSION 0x0c11
  93. #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
  94. /* DCCM offsets and lengths */
  95. #define IWL7000_DCCM_OFFSET 0x800000
  96. #define IWL7260_DCCM_LEN 0x14000
  97. #define IWL3160_DCCM_LEN 0x10000
  98. #define IWL7265_DCCM_LEN 0x17A00
  99. #define IWL7260_FW_PRE "iwlwifi-7260-"
  100. #define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode"
  101. #define IWL3160_FW_PRE "iwlwifi-3160-"
  102. #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
  103. #define IWL3168_FW_PRE "iwlwifi-3168-"
  104. #define IWL3168_MODULE_FIRMWARE(api) IWL3168_FW_PRE __stringify(api) ".ucode"
  105. #define IWL7265_FW_PRE "iwlwifi-7265-"
  106. #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
  107. #define IWL7265D_FW_PRE "iwlwifi-7265D-"
  108. #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode"
  109. #define NVM_HW_SECTION_NUM_FAMILY_7000 0
  110. static const struct iwl_base_params iwl7000_base_params = {
  111. .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000,
  112. .num_of_queues = 31,
  113. .shadow_ram_support = true,
  114. .led_compensation = 57,
  115. .wd_timeout = IWL_LONG_WD_TIMEOUT,
  116. .max_event_log_size = 512,
  117. .shadow_reg_enable = true,
  118. .pcie_l1_allowed = true,
  119. .apmg_wake_up_wa = true,
  120. };
  121. static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
  122. .ct_kill_entry = 118,
  123. .ct_kill_exit = 96,
  124. .ct_kill_duration = 5,
  125. .dynamic_smps_entry = 114,
  126. .dynamic_smps_exit = 110,
  127. .tx_protection_entry = 114,
  128. .tx_protection_exit = 108,
  129. .tx_backoff = {
  130. {.temperature = 112, .backoff = 300},
  131. {.temperature = 113, .backoff = 800},
  132. {.temperature = 114, .backoff = 1500},
  133. {.temperature = 115, .backoff = 3000},
  134. {.temperature = 116, .backoff = 5000},
  135. {.temperature = 117, .backoff = 10000},
  136. },
  137. .support_ct_kill = true,
  138. .support_dynamic_smps = true,
  139. .support_tx_protection = true,
  140. .support_tx_backoff = true,
  141. };
  142. static const struct iwl_ht_params iwl7000_ht_params = {
  143. .stbc = true,
  144. .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
  145. };
  146. #define IWL_DEVICE_7000_COMMON \
  147. .device_family = IWL_DEVICE_FAMILY_7000, \
  148. .max_inst_size = IWL60_RTC_INST_SIZE, \
  149. .max_data_size = IWL60_RTC_DATA_SIZE, \
  150. .base_params = &iwl7000_base_params, \
  151. .led_mode = IWL_LED_RF_STATE, \
  152. .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_7000, \
  153. .non_shared_ant = ANT_A, \
  154. .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \
  155. .dccm_offset = IWL7000_DCCM_OFFSET
  156. #define IWL_DEVICE_7000 \
  157. IWL_DEVICE_7000_COMMON, \
  158. .ucode_api_max = IWL7260_UCODE_API_MAX, \
  159. .ucode_api_min = IWL7260_UCODE_API_MIN
  160. #define IWL_DEVICE_7005 \
  161. IWL_DEVICE_7000_COMMON, \
  162. .ucode_api_max = IWL7265_UCODE_API_MAX, \
  163. .ucode_api_min = IWL7265_UCODE_API_MIN
  164. #define IWL_DEVICE_3008 \
  165. IWL_DEVICE_7000_COMMON, \
  166. .ucode_api_max = IWL3168_UCODE_API_MAX, \
  167. .ucode_api_min = IWL3168_UCODE_API_MIN
  168. #define IWL_DEVICE_7005D \
  169. IWL_DEVICE_7000_COMMON, \
  170. .ucode_api_max = IWL7265D_UCODE_API_MAX, \
  171. .ucode_api_min = IWL7265D_UCODE_API_MIN
  172. const struct iwl_cfg iwl7260_2ac_cfg = {
  173. .name = "Intel(R) Dual Band Wireless AC 7260",
  174. .fw_name_pre = IWL7260_FW_PRE,
  175. IWL_DEVICE_7000,
  176. .ht_params = &iwl7000_ht_params,
  177. .nvm_ver = IWL7260_NVM_VERSION,
  178. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  179. .host_interrupt_operation_mode = true,
  180. .lp_xtal_workaround = true,
  181. .dccm_len = IWL7260_DCCM_LEN,
  182. };
  183. const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
  184. .name = "Intel(R) Dual Band Wireless AC 7260",
  185. .fw_name_pre = IWL7260_FW_PRE,
  186. IWL_DEVICE_7000,
  187. .ht_params = &iwl7000_ht_params,
  188. .nvm_ver = IWL7260_NVM_VERSION,
  189. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  190. .high_temp = true,
  191. .host_interrupt_operation_mode = true,
  192. .lp_xtal_workaround = true,
  193. .dccm_len = IWL7260_DCCM_LEN,
  194. .thermal_params = &iwl7000_high_temp_tt_params,
  195. };
  196. const struct iwl_cfg iwl7260_2n_cfg = {
  197. .name = "Intel(R) Dual Band Wireless N 7260",
  198. .fw_name_pre = IWL7260_FW_PRE,
  199. IWL_DEVICE_7000,
  200. .ht_params = &iwl7000_ht_params,
  201. .nvm_ver = IWL7260_NVM_VERSION,
  202. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  203. .host_interrupt_operation_mode = true,
  204. .lp_xtal_workaround = true,
  205. .dccm_len = IWL7260_DCCM_LEN,
  206. };
  207. const struct iwl_cfg iwl7260_n_cfg = {
  208. .name = "Intel(R) Wireless N 7260",
  209. .fw_name_pre = IWL7260_FW_PRE,
  210. IWL_DEVICE_7000,
  211. .ht_params = &iwl7000_ht_params,
  212. .nvm_ver = IWL7260_NVM_VERSION,
  213. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  214. .host_interrupt_operation_mode = true,
  215. .lp_xtal_workaround = true,
  216. .dccm_len = IWL7260_DCCM_LEN,
  217. };
  218. const struct iwl_cfg iwl3160_2ac_cfg = {
  219. .name = "Intel(R) Dual Band Wireless AC 3160",
  220. .fw_name_pre = IWL3160_FW_PRE,
  221. IWL_DEVICE_7000,
  222. .ht_params = &iwl7000_ht_params,
  223. .nvm_ver = IWL3160_NVM_VERSION,
  224. .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
  225. .host_interrupt_operation_mode = true,
  226. .dccm_len = IWL3160_DCCM_LEN,
  227. };
  228. const struct iwl_cfg iwl3160_2n_cfg = {
  229. .name = "Intel(R) Dual Band Wireless N 3160",
  230. .fw_name_pre = IWL3160_FW_PRE,
  231. IWL_DEVICE_7000,
  232. .ht_params = &iwl7000_ht_params,
  233. .nvm_ver = IWL3160_NVM_VERSION,
  234. .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
  235. .host_interrupt_operation_mode = true,
  236. .dccm_len = IWL3160_DCCM_LEN,
  237. };
  238. const struct iwl_cfg iwl3160_n_cfg = {
  239. .name = "Intel(R) Wireless N 3160",
  240. .fw_name_pre = IWL3160_FW_PRE,
  241. IWL_DEVICE_7000,
  242. .ht_params = &iwl7000_ht_params,
  243. .nvm_ver = IWL3160_NVM_VERSION,
  244. .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
  245. .host_interrupt_operation_mode = true,
  246. .dccm_len = IWL3160_DCCM_LEN,
  247. };
  248. static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
  249. {.pwr = 1600, .backoff = 0},
  250. {.pwr = 1300, .backoff = 467},
  251. {.pwr = 900, .backoff = 1900},
  252. {.pwr = 800, .backoff = 2630},
  253. {.pwr = 700, .backoff = 3720},
  254. {.pwr = 600, .backoff = 5550},
  255. {.pwr = 500, .backoff = 9350},
  256. {0},
  257. };
  258. static const struct iwl_ht_params iwl7265_ht_params = {
  259. .stbc = true,
  260. .ldpc = true,
  261. .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
  262. };
  263. const struct iwl_cfg iwl3165_2ac_cfg = {
  264. .name = "Intel(R) Dual Band Wireless AC 3165",
  265. .fw_name_pre = IWL7265D_FW_PRE,
  266. IWL_DEVICE_7005D,
  267. .ht_params = &iwl7000_ht_params,
  268. .nvm_ver = IWL3165_NVM_VERSION,
  269. .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
  270. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  271. .dccm_len = IWL7265_DCCM_LEN,
  272. };
  273. const struct iwl_cfg iwl3168_2ac_cfg = {
  274. .name = "Intel(R) Dual Band Wireless AC 3168",
  275. .fw_name_pre = IWL3168_FW_PRE,
  276. IWL_DEVICE_3008,
  277. .ht_params = &iwl7000_ht_params,
  278. .nvm_ver = IWL3168_NVM_VERSION,
  279. .nvm_calib_ver = IWL3168_TX_POWER_VERSION,
  280. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  281. .dccm_len = IWL7265_DCCM_LEN,
  282. };
  283. const struct iwl_cfg iwl7265_2ac_cfg = {
  284. .name = "Intel(R) Dual Band Wireless AC 7265",
  285. .fw_name_pre = IWL7265_FW_PRE,
  286. IWL_DEVICE_7005,
  287. .ht_params = &iwl7265_ht_params,
  288. .nvm_ver = IWL7265_NVM_VERSION,
  289. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  290. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  291. .dccm_len = IWL7265_DCCM_LEN,
  292. };
  293. const struct iwl_cfg iwl7265_2n_cfg = {
  294. .name = "Intel(R) Dual Band Wireless N 7265",
  295. .fw_name_pre = IWL7265_FW_PRE,
  296. IWL_DEVICE_7005,
  297. .ht_params = &iwl7265_ht_params,
  298. .nvm_ver = IWL7265_NVM_VERSION,
  299. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  300. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  301. .dccm_len = IWL7265_DCCM_LEN,
  302. };
  303. const struct iwl_cfg iwl7265_n_cfg = {
  304. .name = "Intel(R) Wireless N 7265",
  305. .fw_name_pre = IWL7265_FW_PRE,
  306. IWL_DEVICE_7005,
  307. .ht_params = &iwl7265_ht_params,
  308. .nvm_ver = IWL7265_NVM_VERSION,
  309. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  310. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  311. .dccm_len = IWL7265_DCCM_LEN,
  312. };
  313. const struct iwl_cfg iwl7265d_2ac_cfg = {
  314. .name = "Intel(R) Dual Band Wireless AC 7265",
  315. .fw_name_pre = IWL7265D_FW_PRE,
  316. IWL_DEVICE_7005D,
  317. .ht_params = &iwl7265_ht_params,
  318. .nvm_ver = IWL7265D_NVM_VERSION,
  319. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  320. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  321. .dccm_len = IWL7265_DCCM_LEN,
  322. };
  323. const struct iwl_cfg iwl7265d_2n_cfg = {
  324. .name = "Intel(R) Dual Band Wireless N 7265",
  325. .fw_name_pre = IWL7265D_FW_PRE,
  326. IWL_DEVICE_7005D,
  327. .ht_params = &iwl7265_ht_params,
  328. .nvm_ver = IWL7265D_NVM_VERSION,
  329. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  330. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  331. .dccm_len = IWL7265_DCCM_LEN,
  332. };
  333. const struct iwl_cfg iwl7265d_n_cfg = {
  334. .name = "Intel(R) Wireless N 7265",
  335. .fw_name_pre = IWL7265D_FW_PRE,
  336. IWL_DEVICE_7005D,
  337. .ht_params = &iwl7265_ht_params,
  338. .nvm_ver = IWL7265D_NVM_VERSION,
  339. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  340. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  341. .dccm_len = IWL7265_DCCM_LEN,
  342. };
  343. MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
  344. MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
  345. MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_MAX));
  346. MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_MAX));
  347. MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_MAX));