1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2018 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 IWL1000_UCODE_API_MAX 5
31 #define IWL100_UCODE_API_MAX 5
32 
33 /* Lowest firmware API version supported */
34 #define IWL1000_UCODE_API_MIN 1
35 #define IWL100_UCODE_API_MIN 5
36 
37 /* EEPROM version */
38 #define EEPROM_1000_TX_POWER_VERSION	(4)
39 #define EEPROM_1000_EEPROM_VERSION	(0x15C)
40 
41 #define IWL1000_FW_PRE "iwlwifi-1000-"
42 #define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode"
43 
44 #define IWL100_FW_PRE "iwlwifi-100-"
45 #define IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE __stringify(api) ".ucode"
46 
47 
48 static const struct iwl_base_params iwl1000_base_params = {
49 	.num_of_queues = IWLAGN_NUM_QUEUES,
50 	.max_tfd_queue_size = 256,
51 	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
52 	.pll_cfg = true,
53 	.max_ll_items = OTP_MAX_LL_ITEMS_1000,
54 	.shadow_ram_support = false,
55 	.led_compensation = 51,
56 	.wd_timeout = IWL_WATCHDOG_DISABLED,
57 	.max_event_log_size = 128,
58 	.scd_chain_ext_wa = true,
59 };
60 
61 static const struct iwl_ht_params iwl1000_ht_params = {
62 	.ht_greenfield_support = true,
63 	.use_rts_for_aggregation = true, /* use rts/cts protection */
64 	.ht40_bands = BIT(NL80211_BAND_2GHZ),
65 };
66 
67 static const struct iwl_eeprom_params iwl1000_eeprom_params = {
68 	.regulatory_bands = {
69 		EEPROM_REG_BAND_1_CHANNELS,
70 		EEPROM_REG_BAND_2_CHANNELS,
71 		EEPROM_REG_BAND_3_CHANNELS,
72 		EEPROM_REG_BAND_4_CHANNELS,
73 		EEPROM_REG_BAND_5_CHANNELS,
74 		EEPROM_REG_BAND_24_HT40_CHANNELS,
75 		EEPROM_REGULATORY_BAND_NO_HT40,
76 	}
77 };
78 
79 #define IWL_DEVICE_1000						\
80 	.fw_name_pre = IWL1000_FW_PRE,				\
81 	.ucode_api_max = IWL1000_UCODE_API_MAX,			\
82 	.ucode_api_min = IWL1000_UCODE_API_MIN,			\
83 	.device_family = IWL_DEVICE_FAMILY_1000,		\
84 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
85 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
86 	.nvm_ver = EEPROM_1000_EEPROM_VERSION,		\
87 	.nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION,	\
88 	.base_params = &iwl1000_base_params,			\
89 	.eeprom_params = &iwl1000_eeprom_params,		\
90 	.led_mode = IWL_LED_BLINK,				\
91 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
92 	.csr = &iwl_csr_v1
93 
94 const struct iwl_cfg iwl1000_bgn_cfg = {
95 	.name = "Intel(R) Centrino(R) Wireless-N 1000 BGN",
96 	IWL_DEVICE_1000,
97 	.ht_params = &iwl1000_ht_params,
98 };
99 
100 const struct iwl_cfg iwl1000_bg_cfg = {
101 	.name = "Intel(R) Centrino(R) Wireless-N 1000 BG",
102 	IWL_DEVICE_1000,
103 };
104 
105 #define IWL_DEVICE_100						\
106 	.fw_name_pre = IWL100_FW_PRE,				\
107 	.ucode_api_max = IWL100_UCODE_API_MAX,			\
108 	.ucode_api_min = IWL100_UCODE_API_MIN,			\
109 	.device_family = IWL_DEVICE_FAMILY_100,			\
110 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
111 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
112 	.nvm_ver = EEPROM_1000_EEPROM_VERSION,		\
113 	.nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION,	\
114 	.base_params = &iwl1000_base_params,			\
115 	.eeprom_params = &iwl1000_eeprom_params,		\
116 	.led_mode = IWL_LED_RF_STATE,				\
117 	.rx_with_siso_diversity = true,				\
118 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
119 	.csr = &iwl_csr_v1
120 
121 const struct iwl_cfg iwl100_bgn_cfg = {
122 	.name = "Intel(R) Centrino(R) Wireless-N 100 BGN",
123 	IWL_DEVICE_100,
124 	.ht_params = &iwl1000_ht_params,
125 };
126 
127 const struct iwl_cfg iwl100_bg_cfg = {
128 	.name = "Intel(R) Centrino(R) Wireless-N 100 BG",
129 	IWL_DEVICE_100,
130 };
131 
132 MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
133 MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX));
134