iwl-7000.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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 21
  75. #define IWL3168_UCODE_API_MAX 21
  76. /* Oldest version we won't warn about */
  77. #define IWL7260_UCODE_API_OK 13
  78. #define IWL7265_UCODE_API_OK 13
  79. #define IWL7265D_UCODE_API_OK 13
  80. #define IWL3168_UCODE_API_OK 20
  81. /* Lowest firmware API version supported */
  82. #define IWL7260_UCODE_API_MIN 13
  83. #define IWL7265_UCODE_API_MIN 13
  84. #define IWL7265D_UCODE_API_MIN 13
  85. #define IWL3168_UCODE_API_MIN 20
  86. /* NVM versions */
  87. #define IWL7260_NVM_VERSION 0x0a1d
  88. #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */
  89. #define IWL3160_NVM_VERSION 0x709
  90. #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */
  91. #define IWL3165_NVM_VERSION 0x709
  92. #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */
  93. #define IWL3168_NVM_VERSION 0xd01
  94. #define IWL3168_TX_POWER_VERSION 0xffff /* meaningless */
  95. #define IWL7265_NVM_VERSION 0x0a1d
  96. #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
  97. #define IWL7265D_NVM_VERSION 0x0c11
  98. #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
  99. /* DCCM offsets and lengths */
  100. #define IWL7000_DCCM_OFFSET 0x800000
  101. #define IWL7260_DCCM_LEN 0x14000
  102. #define IWL3160_DCCM_LEN 0x10000
  103. #define IWL7265_DCCM_LEN 0x17A00
  104. #define IWL7260_FW_PRE "iwlwifi-7260-"
  105. #define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode"
  106. #define IWL3160_FW_PRE "iwlwifi-3160-"
  107. #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
  108. #define IWL3168_FW_PRE "iwlwifi-3168-"
  109. #define IWL3168_MODULE_FIRMWARE(api) IWL3168_FW_PRE __stringify(api) ".ucode"
  110. #define IWL7265_FW_PRE "iwlwifi-7265-"
  111. #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
  112. #define IWL7265D_FW_PRE "iwlwifi-7265D-"
  113. #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode"
  114. #define NVM_HW_SECTION_NUM_FAMILY_7000 0
  115. static const struct iwl_base_params iwl7000_base_params = {
  116. .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000,
  117. .num_of_queues = 31,
  118. .pll_cfg_val = 0,
  119. .shadow_ram_support = true,
  120. .led_compensation = 57,
  121. .wd_timeout = IWL_LONG_WD_TIMEOUT,
  122. .max_event_log_size = 512,
  123. .shadow_reg_enable = true,
  124. .pcie_l1_allowed = true,
  125. .apmg_wake_up_wa = true,
  126. };
  127. static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
  128. .ct_kill_entry = 118,
  129. .ct_kill_exit = 96,
  130. .ct_kill_duration = 5,
  131. .dynamic_smps_entry = 114,
  132. .dynamic_smps_exit = 110,
  133. .tx_protection_entry = 114,
  134. .tx_protection_exit = 108,
  135. .tx_backoff = {
  136. {.temperature = 112, .backoff = 300},
  137. {.temperature = 113, .backoff = 800},
  138. {.temperature = 114, .backoff = 1500},
  139. {.temperature = 115, .backoff = 3000},
  140. {.temperature = 116, .backoff = 5000},
  141. {.temperature = 117, .backoff = 10000},
  142. },
  143. .support_ct_kill = true,
  144. .support_dynamic_smps = true,
  145. .support_tx_protection = true,
  146. .support_tx_backoff = true,
  147. };
  148. static const struct iwl_ht_params iwl7000_ht_params = {
  149. .stbc = true,
  150. .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
  151. };
  152. #define IWL_DEVICE_7000_COMMON \
  153. .device_family = IWL_DEVICE_FAMILY_7000, \
  154. .max_inst_size = IWL60_RTC_INST_SIZE, \
  155. .max_data_size = IWL60_RTC_DATA_SIZE, \
  156. .base_params = &iwl7000_base_params, \
  157. .led_mode = IWL_LED_RF_STATE, \
  158. .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_7000, \
  159. .non_shared_ant = ANT_A, \
  160. .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \
  161. .dccm_offset = IWL7000_DCCM_OFFSET
  162. #define IWL_DEVICE_7000 \
  163. IWL_DEVICE_7000_COMMON, \
  164. .ucode_api_max = IWL7260_UCODE_API_MAX, \
  165. .ucode_api_ok = IWL7260_UCODE_API_OK, \
  166. .ucode_api_min = IWL7260_UCODE_API_MIN
  167. #define IWL_DEVICE_7005 \
  168. IWL_DEVICE_7000_COMMON, \
  169. .ucode_api_max = IWL7265_UCODE_API_MAX, \
  170. .ucode_api_ok = IWL7265_UCODE_API_OK, \
  171. .ucode_api_min = IWL7265_UCODE_API_MIN
  172. #define IWL_DEVICE_3008 \
  173. IWL_DEVICE_7000_COMMON, \
  174. .ucode_api_max = IWL3168_UCODE_API_MAX, \
  175. .ucode_api_ok = IWL3168_UCODE_API_OK, \
  176. .ucode_api_min = IWL3168_UCODE_API_MIN
  177. #define IWL_DEVICE_7005D \
  178. IWL_DEVICE_7000_COMMON, \
  179. .ucode_api_max = IWL7265D_UCODE_API_MAX, \
  180. .ucode_api_ok = IWL7265D_UCODE_API_OK, \
  181. .ucode_api_min = IWL7265D_UCODE_API_MIN
  182. const struct iwl_cfg iwl7260_2ac_cfg = {
  183. .name = "Intel(R) Dual Band Wireless AC 7260",
  184. .fw_name_pre = IWL7260_FW_PRE,
  185. IWL_DEVICE_7000,
  186. .ht_params = &iwl7000_ht_params,
  187. .nvm_ver = IWL7260_NVM_VERSION,
  188. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  189. .host_interrupt_operation_mode = true,
  190. .lp_xtal_workaround = true,
  191. .dccm_len = IWL7260_DCCM_LEN,
  192. };
  193. const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
  194. .name = "Intel(R) Dual Band Wireless AC 7260",
  195. .fw_name_pre = IWL7260_FW_PRE,
  196. IWL_DEVICE_7000,
  197. .ht_params = &iwl7000_ht_params,
  198. .nvm_ver = IWL7260_NVM_VERSION,
  199. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  200. .high_temp = true,
  201. .host_interrupt_operation_mode = true,
  202. .lp_xtal_workaround = true,
  203. .dccm_len = IWL7260_DCCM_LEN,
  204. .thermal_params = &iwl7000_high_temp_tt_params,
  205. };
  206. const struct iwl_cfg iwl7260_2n_cfg = {
  207. .name = "Intel(R) Dual Band Wireless N 7260",
  208. .fw_name_pre = IWL7260_FW_PRE,
  209. IWL_DEVICE_7000,
  210. .ht_params = &iwl7000_ht_params,
  211. .nvm_ver = IWL7260_NVM_VERSION,
  212. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  213. .host_interrupt_operation_mode = true,
  214. .lp_xtal_workaround = true,
  215. .dccm_len = IWL7260_DCCM_LEN,
  216. };
  217. const struct iwl_cfg iwl7260_n_cfg = {
  218. .name = "Intel(R) Wireless N 7260",
  219. .fw_name_pre = IWL7260_FW_PRE,
  220. IWL_DEVICE_7000,
  221. .ht_params = &iwl7000_ht_params,
  222. .nvm_ver = IWL7260_NVM_VERSION,
  223. .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
  224. .host_interrupt_operation_mode = true,
  225. .lp_xtal_workaround = true,
  226. .dccm_len = IWL7260_DCCM_LEN,
  227. };
  228. const struct iwl_cfg iwl3160_2ac_cfg = {
  229. .name = "Intel(R) Dual Band Wireless AC 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_2n_cfg = {
  239. .name = "Intel(R) Dual Band 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. const struct iwl_cfg iwl3160_n_cfg = {
  249. .name = "Intel(R) Wireless N 3160",
  250. .fw_name_pre = IWL3160_FW_PRE,
  251. IWL_DEVICE_7000,
  252. .ht_params = &iwl7000_ht_params,
  253. .nvm_ver = IWL3160_NVM_VERSION,
  254. .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
  255. .host_interrupt_operation_mode = true,
  256. .dccm_len = IWL3160_DCCM_LEN,
  257. };
  258. static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
  259. {.pwr = 1600, .backoff = 0},
  260. {.pwr = 1300, .backoff = 467},
  261. {.pwr = 900, .backoff = 1900},
  262. {.pwr = 800, .backoff = 2630},
  263. {.pwr = 700, .backoff = 3720},
  264. {.pwr = 600, .backoff = 5550},
  265. {.pwr = 500, .backoff = 9350},
  266. {0},
  267. };
  268. static const struct iwl_ht_params iwl7265_ht_params = {
  269. .stbc = true,
  270. .ldpc = true,
  271. .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
  272. };
  273. const struct iwl_cfg iwl3165_2ac_cfg = {
  274. .name = "Intel(R) Dual Band Wireless AC 3165",
  275. .fw_name_pre = IWL7265D_FW_PRE,
  276. IWL_DEVICE_7005D,
  277. .ht_params = &iwl7000_ht_params,
  278. .nvm_ver = IWL3165_NVM_VERSION,
  279. .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
  280. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  281. .dccm_len = IWL7265_DCCM_LEN,
  282. };
  283. const struct iwl_cfg iwl3168_2ac_cfg = {
  284. .name = "Intel(R) Dual Band Wireless AC 3168",
  285. .fw_name_pre = IWL3168_FW_PRE,
  286. IWL_DEVICE_3008,
  287. .ht_params = &iwl7000_ht_params,
  288. .nvm_ver = IWL3168_NVM_VERSION,
  289. .nvm_calib_ver = IWL3168_TX_POWER_VERSION,
  290. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  291. .dccm_len = IWL7265_DCCM_LEN,
  292. };
  293. const struct iwl_cfg iwl7265_2ac_cfg = {
  294. .name = "Intel(R) Dual Band Wireless AC 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_2n_cfg = {
  304. .name = "Intel(R) Dual Band 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 iwl7265_n_cfg = {
  314. .name = "Intel(R) Wireless N 7265",
  315. .fw_name_pre = IWL7265_FW_PRE,
  316. IWL_DEVICE_7005,
  317. .ht_params = &iwl7265_ht_params,
  318. .nvm_ver = IWL7265_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_2ac_cfg = {
  324. .name = "Intel(R) Dual Band Wireless AC 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_2n_cfg = {
  334. .name = "Intel(R) Dual Band 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. const struct iwl_cfg iwl7265d_n_cfg = {
  344. .name = "Intel(R) Wireless N 7265",
  345. .fw_name_pre = IWL7265D_FW_PRE,
  346. IWL_DEVICE_7005D,
  347. .ht_params = &iwl7265_ht_params,
  348. .nvm_ver = IWL7265D_NVM_VERSION,
  349. .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
  350. .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
  351. .dccm_len = IWL7265_DCCM_LEN,
  352. };
  353. MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
  354. MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
  355. MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_OK));
  356. MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_OK));
  357. MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_OK));