xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /******************************************************************************
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * This file is provided under a dual BSD/GPLv2 license.  When using or
4*4882a593Smuzhiyun  * redistributing this file, you may do so under either license.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * GPL LICENSE SUMMARY
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9*4882a593Smuzhiyun  * Copyright(c) 2015 Intel Mobile Communications GmbH
10*4882a593Smuzhiyun  * Copyright (C) 2018 Intel Corporation
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify
13*4882a593Smuzhiyun  * it under the terms of version 2 of the GNU General Public License as
14*4882a593Smuzhiyun  * published by the Free Software Foundation.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful, but
17*4882a593Smuzhiyun  * WITHOUT ANY WARRANTY; without even the implied warranty of
18*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19*4882a593Smuzhiyun  * General Public License for more details.
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * The full GNU General Public License is included in this distribution
22*4882a593Smuzhiyun  * in the file called COPYING.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * Contact Information:
25*4882a593Smuzhiyun  *  Intel Linux Wireless <linuxwifi@intel.com>
26*4882a593Smuzhiyun  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * BSD LICENSE
29*4882a593Smuzhiyun  *
30*4882a593Smuzhiyun  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
31*4882a593Smuzhiyun  * Copyright(c) 2015 Intel Mobile Communications GmbH
32*4882a593Smuzhiyun  * Copyright (C) 2018 Intel Corporation
33*4882a593Smuzhiyun  * All rights reserved.
34*4882a593Smuzhiyun  *
35*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
36*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
37*4882a593Smuzhiyun  * are met:
38*4882a593Smuzhiyun  *
39*4882a593Smuzhiyun  *  * Redistributions of source code must retain the above copyright
40*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer.
41*4882a593Smuzhiyun  *  * Redistributions in binary form must reproduce the above copyright
42*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer in
43*4882a593Smuzhiyun  *    the documentation and/or other materials provided with the
44*4882a593Smuzhiyun  *    distribution.
45*4882a593Smuzhiyun  *  * Neither the name Intel Corporation nor the names of its
46*4882a593Smuzhiyun  *    contributors may be used to endorse or promote products derived
47*4882a593Smuzhiyun  *    from this software without specific prior written permission.
48*4882a593Smuzhiyun  *
49*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50*4882a593Smuzhiyun  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51*4882a593Smuzhiyun  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52*4882a593Smuzhiyun  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53*4882a593Smuzhiyun  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54*4882a593Smuzhiyun  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55*4882a593Smuzhiyun  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56*4882a593Smuzhiyun  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57*4882a593Smuzhiyun  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58*4882a593Smuzhiyun  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59*4882a593Smuzhiyun  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60*4882a593Smuzhiyun  *****************************************************************************/
61*4882a593Smuzhiyun #ifndef __iwl_eeprom_parse_h__
62*4882a593Smuzhiyun #define __iwl_eeprom_parse_h__
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #include <linux/types.h>
65*4882a593Smuzhiyun #include <linux/if_ether.h>
66*4882a593Smuzhiyun #include <net/cfg80211.h>
67*4882a593Smuzhiyun #include "iwl-trans.h"
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun struct iwl_nvm_data {
70*4882a593Smuzhiyun 	int n_hw_addrs;
71*4882a593Smuzhiyun 	u8 hw_addr[ETH_ALEN];
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun 	u8 calib_version;
74*4882a593Smuzhiyun 	__le16 calib_voltage;
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun 	__le16 raw_temperature;
77*4882a593Smuzhiyun 	__le16 kelvin_temperature;
78*4882a593Smuzhiyun 	__le16 kelvin_voltage;
79*4882a593Smuzhiyun 	__le16 xtal_calib[2];
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun 	bool sku_cap_band_24ghz_enable;
82*4882a593Smuzhiyun 	bool sku_cap_band_52ghz_enable;
83*4882a593Smuzhiyun 	bool sku_cap_11n_enable;
84*4882a593Smuzhiyun 	bool sku_cap_11ac_enable;
85*4882a593Smuzhiyun 	bool sku_cap_11ax_enable;
86*4882a593Smuzhiyun 	bool sku_cap_amt_enable;
87*4882a593Smuzhiyun 	bool sku_cap_ipan_enable;
88*4882a593Smuzhiyun 	bool sku_cap_mimo_disabled;
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun 	u16 radio_cfg_type;
91*4882a593Smuzhiyun 	u8 radio_cfg_step;
92*4882a593Smuzhiyun 	u8 radio_cfg_dash;
93*4882a593Smuzhiyun 	u8 radio_cfg_pnum;
94*4882a593Smuzhiyun 	u8 valid_tx_ant, valid_rx_ant;
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun 	u32 nvm_version;
97*4882a593Smuzhiyun 	s8 max_tx_pwr_half_dbm;
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun 	bool lar_enabled;
100*4882a593Smuzhiyun 	bool vht160_supported;
101*4882a593Smuzhiyun 	struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
102*4882a593Smuzhiyun 	struct ieee80211_channel channels[];
103*4882a593Smuzhiyun };
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun /**
106*4882a593Smuzhiyun  * iwl_parse_eeprom_data - parse EEPROM data and return values
107*4882a593Smuzhiyun  *
108*4882a593Smuzhiyun  * @dev: device pointer we're parsing for, for debug only
109*4882a593Smuzhiyun  * @cfg: device configuration for parsing and overrides
110*4882a593Smuzhiyun  * @eeprom: the EEPROM data
111*4882a593Smuzhiyun  * @eeprom_size: length of the EEPROM data
112*4882a593Smuzhiyun  *
113*4882a593Smuzhiyun  * This function parses all EEPROM values we need and then
114*4882a593Smuzhiyun  * returns a (newly allocated) struct containing all the
115*4882a593Smuzhiyun  * relevant values for driver use. The struct must be freed
116*4882a593Smuzhiyun  * later with iwl_free_nvm_data().
117*4882a593Smuzhiyun  */
118*4882a593Smuzhiyun struct iwl_nvm_data *
119*4882a593Smuzhiyun iwl_parse_eeprom_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
120*4882a593Smuzhiyun 		      const u8 *eeprom, size_t eeprom_size);
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun int iwl_init_sband_channels(struct iwl_nvm_data *data,
123*4882a593Smuzhiyun 			    struct ieee80211_supported_band *sband,
124*4882a593Smuzhiyun 			    int n_channels, enum nl80211_band band);
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun void iwl_init_ht_hw_capab(struct iwl_trans *trans,
127*4882a593Smuzhiyun 			  struct iwl_nvm_data *data,
128*4882a593Smuzhiyun 			  struct ieee80211_sta_ht_cap *ht_info,
129*4882a593Smuzhiyun 			  enum nl80211_band band,
130*4882a593Smuzhiyun 			  u8 tx_chains, u8 rx_chains);
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun #endif /* __iwl_eeprom_parse_h__ */
133