7000.c 13 KB

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