1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2018 - 2019 Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * The full GNU General Public License is included in this distribution in the
16  * file called LICENSE.
17  *
18  * Contact Information:
19  *  Intel Linux Wireless <linuxwifi@intel.com>
20  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
21  *
22  *****************************************************************************/
23 
24 #include <linux/module.h>
25 #include <linux/stringify.h>
26 #include "iwl-config.h"
27 #include "iwl-agn-hw.h"
28 
29 /* Highest firmware API version supported */
30 #define IWL5000_UCODE_API_MAX 5
31 #define IWL5150_UCODE_API_MAX 2
32 
33 /* Lowest firmware API version supported */
34 #define IWL5000_UCODE_API_MIN 1
35 #define IWL5150_UCODE_API_MIN 1
36 
37 /* EEPROM versions */
38 #define EEPROM_5000_TX_POWER_VERSION	(4)
39 #define EEPROM_5000_EEPROM_VERSION	(0x11A)
40 #define EEPROM_5050_TX_POWER_VERSION	(4)
41 #define EEPROM_5050_EEPROM_VERSION	(0x21E)
42 
43 #define IWL5000_FW_PRE "iwlwifi-5000-"
44 #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
45 
46 #define IWL5150_FW_PRE "iwlwifi-5150-"
47 #define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
48 
49 static const struct iwl_base_params iwl5000_base_params = {
50 	.eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
51 	.num_of_queues = IWLAGN_NUM_QUEUES,
52 	.max_tfd_queue_size = 256,
53 	.pll_cfg = true,
54 	.led_compensation = 51,
55 	.wd_timeout = IWL_WATCHDOG_DISABLED,
56 	.max_event_log_size = 512,
57 	.scd_chain_ext_wa = true,
58 };
59 
60 static const struct iwl_ht_params iwl5000_ht_params = {
61 	.ht_greenfield_support = true,
62 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
63 };
64 
65 static const struct iwl_eeprom_params iwl5000_eeprom_params = {
66 	.regulatory_bands = {
67 		EEPROM_REG_BAND_1_CHANNELS,
68 		EEPROM_REG_BAND_2_CHANNELS,
69 		EEPROM_REG_BAND_3_CHANNELS,
70 		EEPROM_REG_BAND_4_CHANNELS,
71 		EEPROM_REG_BAND_5_CHANNELS,
72 		EEPROM_REG_BAND_24_HT40_CHANNELS,
73 		EEPROM_REG_BAND_52_HT40_CHANNELS
74 	},
75 };
76 
77 #define IWL_DEVICE_5000						\
78 	.fw_name_pre = IWL5000_FW_PRE,				\
79 	.ucode_api_max = IWL5000_UCODE_API_MAX,			\
80 	.ucode_api_min = IWL5000_UCODE_API_MIN,			\
81 	.device_family = IWL_DEVICE_FAMILY_5000,		\
82 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
83 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
84 	.nvm_ver = EEPROM_5000_EEPROM_VERSION,		\
85 	.nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION,	\
86 	.base_params = &iwl5000_base_params,			\
87 	.eeprom_params = &iwl5000_eeprom_params,		\
88 	.led_mode = IWL_LED_BLINK,				\
89 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
90 	.csr = &iwl_csr_v1
91 
92 const struct iwl_cfg iwl5300_agn_cfg = {
93 	.name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
94 	IWL_DEVICE_5000,
95 	/* at least EEPROM 0x11A has wrong info */
96 	.valid_tx_ant = ANT_ABC,	/* .cfg overwrite */
97 	.valid_rx_ant = ANT_ABC,	/* .cfg overwrite */
98 	.ht_params = &iwl5000_ht_params,
99 };
100 
101 const struct iwl_cfg iwl5100_bgn_cfg = {
102 	.name = "Intel(R) WiFi Link 5100 BGN",
103 	IWL_DEVICE_5000,
104 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
105 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
106 	.ht_params = &iwl5000_ht_params,
107 };
108 
109 const struct iwl_cfg iwl5100_abg_cfg = {
110 	.name = "Intel(R) WiFi Link 5100 ABG",
111 	IWL_DEVICE_5000,
112 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
113 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
114 };
115 
116 const struct iwl_cfg iwl5100_agn_cfg = {
117 	.name = "Intel(R) WiFi Link 5100 AGN",
118 	IWL_DEVICE_5000,
119 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
120 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
121 	.ht_params = &iwl5000_ht_params,
122 };
123 
124 const struct iwl_cfg iwl5350_agn_cfg = {
125 	.name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
126 	.fw_name_pre = IWL5000_FW_PRE,
127 	.ucode_api_max = IWL5000_UCODE_API_MAX,
128 	.ucode_api_min = IWL5000_UCODE_API_MIN,
129 	.device_family = IWL_DEVICE_FAMILY_5000,
130 	.max_inst_size = IWLAGN_RTC_INST_SIZE,
131 	.max_data_size = IWLAGN_RTC_DATA_SIZE,
132 	.nvm_ver = EEPROM_5050_EEPROM_VERSION,
133 	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
134 	.base_params = &iwl5000_base_params,
135 	.eeprom_params = &iwl5000_eeprom_params,
136 	.ht_params = &iwl5000_ht_params,
137 	.led_mode = IWL_LED_BLINK,
138 	.internal_wimax_coex = true,
139 	.csr = &iwl_csr_v1,
140 };
141 
142 #define IWL_DEVICE_5150						\
143 	.fw_name_pre = IWL5150_FW_PRE,				\
144 	.ucode_api_max = IWL5150_UCODE_API_MAX,			\
145 	.ucode_api_min = IWL5150_UCODE_API_MIN,			\
146 	.device_family = IWL_DEVICE_FAMILY_5150,		\
147 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
148 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
149 	.nvm_ver = EEPROM_5050_EEPROM_VERSION,		\
150 	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,	\
151 	.base_params = &iwl5000_base_params,			\
152 	.eeprom_params = &iwl5000_eeprom_params,		\
153 	.led_mode = IWL_LED_BLINK,				\
154 	.internal_wimax_coex = true,				\
155 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
156 	.csr = &iwl_csr_v1
157 
158 const struct iwl_cfg iwl5150_agn_cfg = {
159 	.name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
160 	IWL_DEVICE_5150,
161 	.ht_params = &iwl5000_ht_params,
162 
163 };
164 
165 const struct iwl_cfg iwl5150_abg_cfg = {
166 	.name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
167 	IWL_DEVICE_5150,
168 };
169 
170 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
171 MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
172