Merge tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd...
[cascardo/linux.git] / drivers / net / wireless / intel / iwlwifi / iwl-9000.c
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) 2015 Intel Deutschland GmbH
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of version 2 of the GNU General Public License as
12  * published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * BSD LICENSE
20  *
21  * Copyright(c) 2015 Intel Deutschland GmbH
22  * All rights reserved.
23  *
24  * Redistribution and use in source and binary forms, with or without
25  * modification, are permitted provided that the following conditions
26  * are met:
27  *
28  *  * Redistributions of source code must retain the above copyright
29  *    notice, this list of conditions and the following disclaimer.
30  *  * Redistributions in binary form must reproduce the above copyright
31  *    notice, this list of conditions and the following disclaimer in
32  *    the documentation and/or other materials provided with the
33  *    distribution.
34  *  * Neither the name Intel Corporation nor the names of its
35  *    contributors may be used to endorse or promote products derived
36  *    from this software without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49  *
50  *****************************************************************************/
51
52 #include <linux/module.h>
53 #include <linux/stringify.h>
54 #include "iwl-config.h"
55 #include "iwl-agn-hw.h"
56
57 /* Highest firmware API version supported */
58 #define IWL9000_UCODE_API_MAX   21
59
60 /* Oldest version we won't warn about */
61 #define IWL9000_UCODE_API_OK    13
62
63 /* Lowest firmware API version supported */
64 #define IWL9000_UCODE_API_MIN   13
65
66 /* NVM versions */
67 #define IWL9000_NVM_VERSION             0x0a1d
68 #define IWL9000_TX_POWER_VERSION        0xffff /* meaningless */
69
70 /* Memory offsets and lengths */
71 #define IWL9000_DCCM_OFFSET             0x800000
72 #define IWL9000_DCCM_LEN                0x18000
73 #define IWL9000_DCCM2_OFFSET            0x880000
74 #define IWL9000_DCCM2_LEN               0x8000
75 #define IWL9000_SMEM_OFFSET             0x400000
76 #define IWL9000_SMEM_LEN                0x68000
77
78 #define  IWL9000_FW_PRE "iwlwifi-9000-"
79 #define IWL9000_MODULE_FIRMWARE(api) \
80         IWL9000_FW_PRE "-" __stringify(api) ".ucode"
81
82 #define NVM_HW_SECTION_NUM_FAMILY_9000          10
83
84 static const struct iwl_base_params iwl9000_base_params = {
85         .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_9000,
86         .num_of_queues = 31,
87         .pll_cfg_val = 0,
88         .shadow_ram_support = true,
89         .led_compensation = 57,
90         .wd_timeout = IWL_LONG_WD_TIMEOUT,
91         .max_event_log_size = 512,
92         .shadow_reg_enable = true,
93         .pcie_l1_allowed = true,
94 };
95
96 static const struct iwl_ht_params iwl9000_ht_params = {
97         .stbc = true,
98         .ldpc = true,
99         .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
100 };
101
102 static const struct iwl_tt_params iwl9000_tt_params = {
103         .ct_kill_entry = 115,
104         .ct_kill_exit = 93,
105         .ct_kill_duration = 5,
106         .dynamic_smps_entry = 111,
107         .dynamic_smps_exit = 107,
108         .tx_protection_entry = 112,
109         .tx_protection_exit = 105,
110         .tx_backoff = {
111                 {.temperature = 110, .backoff = 200},
112                 {.temperature = 111, .backoff = 600},
113                 {.temperature = 112, .backoff = 1200},
114                 {.temperature = 113, .backoff = 2000},
115                 {.temperature = 114, .backoff = 4000},
116         },
117         .support_ct_kill = true,
118         .support_dynamic_smps = true,
119         .support_tx_protection = true,
120         .support_tx_backoff = true,
121 };
122
123 #define IWL_DEVICE_9000                                                 \
124         .ucode_api_max = IWL9000_UCODE_API_MAX,                         \
125         .ucode_api_ok = IWL9000_UCODE_API_OK,                           \
126         .ucode_api_min = IWL9000_UCODE_API_MIN,                         \
127         .device_family = IWL_DEVICE_FAMILY_8000,                        \
128         .max_inst_size = IWL60_RTC_INST_SIZE,                           \
129         .max_data_size = IWL60_RTC_DATA_SIZE,                           \
130         .base_params = &iwl9000_base_params,                            \
131         .led_mode = IWL_LED_RF_STATE,                                   \
132         .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_9000,           \
133         .non_shared_ant = ANT_A,                                        \
134         .dccm_offset = IWL9000_DCCM_OFFSET,                             \
135         .dccm_len = IWL9000_DCCM_LEN,                                   \
136         .dccm2_offset = IWL9000_DCCM2_OFFSET,                           \
137         .dccm2_len = IWL9000_DCCM2_LEN,                                 \
138         .smem_offset = IWL9000_SMEM_OFFSET,                             \
139         .smem_len = IWL9000_SMEM_LEN,                                   \
140         .thermal_params = &iwl9000_tt_params,                           \
141         .apmg_not_supported = true,                                     \
142         .mq_rx_supported = true,                                        \
143         .vht_mu_mimo_supported = true,                                  \
144         .mac_addr_from_csr = true
145
146 const struct iwl_cfg iwl9260_2ac_cfg = {
147                 .name = "Intel(R) Dual Band Wireless AC 9260",
148                 .fw_name_pre = IWL9000_FW_PRE,
149                 IWL_DEVICE_9000,
150                 .ht_params = &iwl9000_ht_params,
151                 .nvm_ver = IWL9000_NVM_VERSION,
152                 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
153                 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
154 };
155
156 const struct iwl_cfg iwl5165_2ac_cfg = {
157                 .name = "Intel(R) Dual Band Wireless AC 5165",
158                 .fw_name_pre = IWL9000_FW_PRE,
159                 IWL_DEVICE_9000,
160                 .ht_params = &iwl9000_ht_params,
161                 .nvm_ver = IWL9000_NVM_VERSION,
162                 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
163                 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
164 };
165
166 MODULE_FIRMWARE(IWL9000_MODULE_FIRMWARE(IWL9000_UCODE_API_OK));