Commit 26a7ca9a authored by Johannes Berg's avatar Johannes Berg

iwlwifi: refactor EEPROM reading/parsing

The EEPROM reading/parsing code is all mixed in
the driver today, and the EEPROM is parsed only
when we access data from it. This is problematic
because the NVM needs to be parsed and that is
independent of reading it. Also, the NVM format
for new devices will be different and probably
require a new parser.

Therefore refactor the reading and parsing and
create two independent components. Reading the
EEPROM requires direct hardware accesses and
therefore access to the transport, but parsing
is independent and can be done on an NVM blob.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 08838cde
...@@ -8,6 +8,7 @@ iwlwifi-objs += iwl-io.o ...@@ -8,6 +8,7 @@ iwlwifi-objs += iwl-io.o
iwlwifi-objs += iwl-drv.o iwlwifi-objs += iwl-drv.o
iwlwifi-objs += iwl-debug.o iwlwifi-objs += iwl-debug.o
iwlwifi-objs += iwl-notif-wait.o iwlwifi-objs += iwl-notif-wait.o
iwlwifi-objs += iwl-eeprom-read.o iwl-eeprom-parse.o
iwlwifi-objs += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o iwlwifi-objs += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o
iwlwifi-objs += pcie/1000.o pcie/2000.o pcie/5000.o pcie/6000.o iwlwifi-objs += pcie/1000.o pcie/2000.o pcie/5000.o pcie/6000.o
......
...@@ -3,7 +3,7 @@ obj-$(CONFIG_IWLDVM) += iwldvm.o ...@@ -3,7 +3,7 @@ obj-$(CONFIG_IWLDVM) += iwldvm.o
iwldvm-objs += main.o rs.o mac80211.o ucode.o tx.o iwldvm-objs += main.o rs.o mac80211.o ucode.o tx.o
iwldvm-objs += lib.o calib.o tt.o sta.o rx.o iwldvm-objs += lib.o calib.o tt.o sta.o rx.o
iwldvm-objs += eeprom.o power.o iwldvm-objs += power.o
iwldvm-objs += scan.o led.o iwldvm-objs += scan.o led.o
iwldvm-objs += rxon.o devices.o iwldvm-objs += rxon.o devices.o
......
...@@ -92,7 +92,6 @@ extern struct iwl_lib_ops iwl6030_lib; ...@@ -92,7 +92,6 @@ extern struct iwl_lib_ops iwl6030_lib;
#define STATUS_CT_KILL 1 #define STATUS_CT_KILL 1
#define STATUS_ALIVE 2 #define STATUS_ALIVE 2
#define STATUS_READY 3 #define STATUS_READY 3
#define STATUS_GEO_CONFIGURED 4
#define STATUS_EXIT_PENDING 5 #define STATUS_EXIT_PENDING 5
#define STATUS_STATISTICS 6 #define STATUS_STATISTICS 6
#define STATUS_SCANNING 7 #define STATUS_SCANNING 7
...@@ -443,10 +442,8 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, ...@@ -443,10 +442,8 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
static inline int iwl_is_ready(struct iwl_priv *priv) static inline int iwl_is_ready(struct iwl_priv *priv)
{ {
/* The adapter is 'ready' if READY and GEO_CONFIGURED bits are /* The adapter is 'ready' if READY EXIT_PENDING is not set */
* set but EXIT_PENDING is not */
return test_bit(STATUS_READY, &priv->status) && return test_bit(STATUS_READY, &priv->status) &&
test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
!test_bit(STATUS_EXIT_PENDING, &priv->status); !test_bit(STATUS_EXIT_PENDING, &priv->status);
} }
......
...@@ -833,14 +833,14 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, ...@@ -833,14 +833,14 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
* To be safe, simply mask out any chains that we know * To be safe, simply mask out any chains that we know
* are not on the device. * are not on the device.
*/ */
active_chains &= priv->hw_params.valid_rx_ant; active_chains &= priv->eeprom_data->valid_rx_ant;
num_tx_chains = 0; num_tx_chains = 0;
for (i = 0; i < NUM_RX_CHAINS; i++) { for (i = 0; i < NUM_RX_CHAINS; i++) {
/* loops on all the bits of /* loops on all the bits of
* priv->hw_setting.valid_tx_ant */ * priv->hw_setting.valid_tx_ant */
u8 ant_msk = (1 << i); u8 ant_msk = (1 << i);
if (!(priv->hw_params.valid_tx_ant & ant_msk)) if (!(priv->eeprom_data->valid_tx_ant & ant_msk))
continue; continue;
num_tx_chains++; num_tx_chains++;
...@@ -854,7 +854,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, ...@@ -854,7 +854,7 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
* connect the first valid tx chain * connect the first valid tx chain
*/ */
first_chain = first_chain =
find_first_chain(priv->hw_params.valid_tx_ant); find_first_chain(priv->eeprom_data->valid_tx_ant);
data->disconn_array[first_chain] = 0; data->disconn_array[first_chain] = 0;
active_chains |= BIT(first_chain); active_chains |= BIT(first_chain);
IWL_DEBUG_CALIB(priv, IWL_DEBUG_CALIB(priv,
...@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, ...@@ -864,13 +864,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
} }
} }
if (active_chains != priv->hw_params.valid_rx_ant && if (active_chains != priv->eeprom_data->valid_rx_ant &&
active_chains != priv->chain_noise_data.active_chains) active_chains != priv->chain_noise_data.active_chains)
IWL_DEBUG_CALIB(priv, IWL_DEBUG_CALIB(priv,
"Detected that not all antennas are connected! " "Detected that not all antennas are connected! "
"Connected: %#x, valid: %#x.\n", "Connected: %#x, valid: %#x.\n",
active_chains, active_chains,
priv->hw_params.valid_rx_ant); priv->eeprom_data->valid_rx_ant);
/* Save for use within RXON, TX, SCAN commands, etc. */ /* Save for use within RXON, TX, SCAN commands, etc. */
data->active_chains = active_chains; data->active_chains = active_chains;
...@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -1055,7 +1055,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
priv->cfg->bt_params->advanced_bt_coexist) { priv->cfg->bt_params->advanced_bt_coexist) {
/* Disable disconnected antenna algorithm for advanced /* Disable disconnected antenna algorithm for advanced
bt coex, assuming valid antennas are connected */ bt coex, assuming valid antennas are connected */
data->active_chains = priv->hw_params.valid_rx_ant; data->active_chains = priv->eeprom_data->valid_rx_ant;
for (i = 0; i < NUM_RX_CHAINS; i++) for (i = 0; i < NUM_RX_CHAINS; i++)
if (!(data->active_chains & (1<<i))) if (!(data->active_chains & (1<<i)))
data->disconn_array[i] = 1; data->disconn_array[i] = 1;
...@@ -1084,8 +1084,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv) ...@@ -1084,8 +1084,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
min_average_noise, min_average_noise_antenna_i); min_average_noise, min_average_noise_antenna_i);
iwlagn_gain_computation(priv, average_noise, iwlagn_gain_computation(
find_first_chain(priv->hw_params.valid_rx_ant)); priv, average_noise,
find_first_chain(priv->eeprom_data->valid_rx_ant));
/* Some power changes may have been made during the calibration. /* Some power changes may have been made during the calibration.
* Update and commit the RXON * Update and commit the RXON
......
...@@ -303,13 +303,13 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, ...@@ -303,13 +303,13 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
const u8 *ptr; const u8 *ptr;
char *buf; char *buf;
u16 eeprom_ver; u16 eeprom_ver;
size_t eeprom_len = priv->cfg->base_params->eeprom_size; size_t eeprom_len = priv->eeprom_blob_size;
buf_size = 4 * eeprom_len + 256; buf_size = 4 * eeprom_len + 256;
if (eeprom_len % 16) if (eeprom_len % 16)
return -ENODATA; return -ENODATA;
ptr = priv->eeprom; ptr = priv->eeprom_blob;
if (!ptr) if (!ptr)
return -ENOMEM; return -ENOMEM;
...@@ -318,11 +318,9 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, ...@@ -318,11 +318,9 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = priv->eeprom_data->eeprom_version;
pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " pos += scnprintf(buf + pos, buf_size - pos,
"version: 0x%x\n", "NVM version: 0x%x\n", eeprom_ver);
(priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
? "OTP" : "EEPROM", eeprom_ver);
for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
...@@ -347,9 +345,6 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, ...@@ -347,9 +345,6 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
char *buf; char *buf;
ssize_t ret; ssize_t ret;
if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
return -EAGAIN;
buf = kzalloc(bufsz, GFP_KERNEL); buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -422,8 +417,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file, ...@@ -422,8 +417,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
test_bit(STATUS_ALIVE, &priv->status)); test_bit(STATUS_ALIVE, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
test_bit(STATUS_READY, &priv->status)); test_bit(STATUS_READY, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
test_bit(STATUS_GEO_CONFIGURED, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
test_bit(STATUS_EXIT_PENDING, &priv->status)); test_bit(STATUS_EXIT_PENDING, &priv->status));
pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
...@@ -1337,17 +1330,17 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, ...@@ -1337,17 +1330,17 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) { if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) {
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
"tx power: (1/2 dB step)\n"); "tx power: (1/2 dB step)\n");
if ((priv->hw_params.valid_tx_ant & ANT_A) && if ((priv->eeprom_data->valid_tx_ant & ANT_A) &&
tx->tx_power.ant_a) tx->tx_power.ant_a)
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
fmt_hex, "antenna A:", fmt_hex, "antenna A:",
tx->tx_power.ant_a); tx->tx_power.ant_a);
if ((priv->hw_params.valid_tx_ant & ANT_B) && if ((priv->eeprom_data->valid_tx_ant & ANT_B) &&
tx->tx_power.ant_b) tx->tx_power.ant_b)
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
fmt_hex, "antenna B:", fmt_hex, "antenna B:",
tx->tx_power.ant_b); tx->tx_power.ant_b);
if ((priv->hw_params.valid_tx_ant & ANT_C) && if ((priv->eeprom_data->valid_tx_ant & ANT_C) &&
tx->tx_power.ant_c) tx->tx_power.ant_c)
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
fmt_hex, "antenna C:", fmt_hex, "antenna C:",
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include "iwl-fw.h" #include "iwl-fw.h"
#include "iwl-eeprom-parse.h"
#include "iwl-csr.h" #include "iwl-csr.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-agn-hw.h" #include "iwl-agn-hw.h"
...@@ -46,7 +47,6 @@ ...@@ -46,7 +47,6 @@
#include "iwl-notif-wait.h" #include "iwl-notif-wait.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "eeprom.h"
#include "led.h" #include "led.h"
#include "power.h" #include "power.h"
#include "rs.h" #include "rs.h"
...@@ -88,33 +88,6 @@ ...@@ -88,33 +88,6 @@
#define IWL_NUM_SCAN_RATES (2) #define IWL_NUM_SCAN_RATES (2)
/*
* One for each channel, holds all channel setup data
* Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
* with one another!
*/
struct iwl_channel_info {
struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for
* HT40 channel */
u8 channel; /* channel number */
u8 flags; /* flags copied from EEPROM */
s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) limit */
s8 min_power; /* always 0 */
s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
enum ieee80211_band band;
/* HT40 channel info */
s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
u8 ht40_flags; /* flags copied from EEPROM */
u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */
};
/* /*
* Minimum number of queues. MAX_NUM is defined in hw specific files. * Minimum number of queues. MAX_NUM is defined in hw specific files.
* Set the minimum to accommodate * Set the minimum to accommodate
...@@ -154,29 +127,6 @@ union iwl_ht_rate_supp { ...@@ -154,29 +127,6 @@ union iwl_ht_rate_supp {
}; };
}; };
#define CFG_HT_RX_AMPDU_FACTOR_8K (0x0)
#define CFG_HT_RX_AMPDU_FACTOR_16K (0x1)
#define CFG_HT_RX_AMPDU_FACTOR_32K (0x2)
#define CFG_HT_RX_AMPDU_FACTOR_64K (0x3)
#define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K
#define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K
#define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K
/*
* Maximal MPDU density for TX aggregation
* 4 - 2us density
* 5 - 4us density
* 6 - 8us density
* 7 - 16us density
*/
#define CFG_HT_MPDU_DENSITY_2USEC (0x4)
#define CFG_HT_MPDU_DENSITY_4USEC (0x5)
#define CFG_HT_MPDU_DENSITY_8USEC (0x6)
#define CFG_HT_MPDU_DENSITY_16USEC (0x7)
#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
#define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC
#define CFG_HT_MPDU_DENSITY_MIN (0x1)
struct iwl_ht_config { struct iwl_ht_config {
bool single_chain_sufficient; bool single_chain_sufficient;
enum ieee80211_smps_mode smps; /* current smps mode */ enum ieee80211_smps_mode smps; /* current smps mode */
...@@ -446,23 +396,6 @@ enum { ...@@ -446,23 +396,6 @@ enum {
MEASUREMENT_ACTIVE = (1 << 1), MEASUREMENT_ACTIVE = (1 << 1),
}; };
enum iwl_nvm_type {
NVM_DEVICE_TYPE_EEPROM = 0,
NVM_DEVICE_TYPE_OTP,
};
/*
* Two types of OTP memory access modes
* IWL_OTP_ACCESS_ABSOLUTE - absolute address mode,
* based on physical memory addressing
* IWL_OTP_ACCESS_RELATIVE - relative address mode,
* based on logical memory addressing
*/
enum iwl_access_mode {
IWL_OTP_ACCESS_ABSOLUTE,
IWL_OTP_ACCESS_RELATIVE,
};
/* reply_tx_statistics (for _agn devices) */ /* reply_tx_statistics (for _agn devices) */
struct reply_tx_error_statistics { struct reply_tx_error_statistics {
u32 pp_delay; u32 pp_delay;
...@@ -633,8 +566,6 @@ enum iwl_scan_type { ...@@ -633,8 +566,6 @@ enum iwl_scan_type {
* *
* @tx_chains_num: Number of TX chains * @tx_chains_num: Number of TX chains
* @rx_chains_num: Number of RX chains * @rx_chains_num: Number of RX chains
* @valid_tx_ant: usable antennas for TX
* @valid_rx_ant: usable antennas for RX
* @sku: sku read from EEPROM * @sku: sku read from EEPROM
* @ct_kill_threshold: temperature threshold - in hw dependent unit * @ct_kill_threshold: temperature threshold - in hw dependent unit
* @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
...@@ -645,8 +576,6 @@ enum iwl_scan_type { ...@@ -645,8 +576,6 @@ enum iwl_scan_type {
struct iwl_hw_params { struct iwl_hw_params {
u8 tx_chains_num; u8 tx_chains_num;
u8 rx_chains_num; u8 rx_chains_num;
u8 valid_tx_ant;
u8 valid_rx_ant;
bool use_rts_for_aggregation; bool use_rts_for_aggregation;
u16 sku; u16 sku;
u32 ct_kill_threshold; u32 ct_kill_threshold;
...@@ -663,9 +592,6 @@ struct iwl_lib_ops { ...@@ -663,9 +592,6 @@ struct iwl_lib_ops {
/* device specific configuration */ /* device specific configuration */
void (*nic_config)(struct iwl_priv *priv); void (*nic_config)(struct iwl_priv *priv);
/* eeprom operations (as defined in eeprom.h) */
struct iwl_eeprom_ops eeprom_ops;
/* temperature */ /* temperature */
void (*temperature)(struct iwl_priv *priv); void (*temperature)(struct iwl_priv *priv);
}; };
...@@ -734,8 +660,6 @@ struct iwl_priv { ...@@ -734,8 +660,6 @@ struct iwl_priv {
/* ieee device used by generic ieee processing code */ /* ieee device used by generic ieee processing code */
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct ieee80211_channel *ieee_channels;
struct ieee80211_rate *ieee_rates;
struct list_head calib_results; struct list_head calib_results;
...@@ -754,8 +678,6 @@ struct iwl_priv { ...@@ -754,8 +678,6 @@ struct iwl_priv {
struct iwl_notif_wait_data notif_wait; struct iwl_notif_wait_data notif_wait;
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
/* spectrum measurement report caching */ /* spectrum measurement report caching */
struct iwl_spectrum_notification measure_report; struct iwl_spectrum_notification measure_report;
u8 measurement_status; u8 measurement_status;
...@@ -786,11 +708,6 @@ struct iwl_priv { ...@@ -786,11 +708,6 @@ struct iwl_priv {
bool ucode_loaded; bool ucode_loaded;
bool init_ucode_run; /* Don't run init uCode again */ bool init_ucode_run; /* Don't run init uCode again */
/* we allocate array of iwl_channel_info for NIC's valid channels.
* Access via channel # using indirect index array */
struct iwl_channel_info *channel_info; /* channel info array */
u8 channel_count; /* # of channels */
u8 plcp_delta_threshold; u8 plcp_delta_threshold;
/* thermal calibration */ /* thermal calibration */
...@@ -950,10 +867,8 @@ struct iwl_priv { ...@@ -950,10 +867,8 @@ struct iwl_priv {
struct delayed_work scan_check; struct delayed_work scan_check;
/* TX Power */ /* TX Power settings */
s8 tx_power_user_lmt; s8 tx_power_user_lmt;
s8 tx_power_device_lmt;
s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */
s8 tx_power_next; s8 tx_power_next;
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
...@@ -964,9 +879,10 @@ struct iwl_priv { ...@@ -964,9 +879,10 @@ struct iwl_priv {
void *wowlan_sram; void *wowlan_sram;
#endif /* CONFIG_IWLWIFI_DEBUGFS */ #endif /* CONFIG_IWLWIFI_DEBUGFS */
/* eeprom -- this is in the card's little endian byte order */ struct iwl_eeprom_data *eeprom_data;
u8 *eeprom; /* eeprom blob for debugfs/testmode */
enum iwl_nvm_type nvm_device_type; u8 *eeprom_blob;
size_t eeprom_blob_size;
struct work_struct txpower_work; struct work_struct txpower_work;
u32 calib_disabled; u32 calib_disabled;
...@@ -1034,36 +950,4 @@ static inline int iwl_is_any_associated(struct iwl_priv *priv) ...@@ -1034,36 +950,4 @@ static inline int iwl_is_any_associated(struct iwl_priv *priv)
return false; return false;
} }
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
{
if (ch_info == NULL)
return 0;
return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
}
static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
{
return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
}
static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
{
return ch_info->band == IEEE80211_BAND_5GHZ;
}
static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
{
return ch_info->band == IEEE80211_BAND_2GHZ;
}
static inline int is_channel_passive(const struct iwl_channel_info *ch)
{
return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
}
static inline int is_channel_ibss(const struct iwl_channel_info *ch)
{
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
}
#endif /* __iwl_dev_h__ */ #endif /* __iwl_dev_h__ */
...@@ -29,11 +29,48 @@ ...@@ -29,11 +29,48 @@
*/ */
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-prph.h" #include "iwl-prph.h"
#include "iwl-eeprom-parse.h"
#include "agn.h" #include "agn.h"
#include "dev.h" #include "dev.h"
#include "commands.h" #include "commands.h"
#define EEPROM_RF_CONFIG_TYPE_MAX 0x3
static void iwl_rf_config(struct iwl_priv *priv)
{
u16 radio_cfg = priv->eeprom_data->radio_cfg;
/* write radio config values to register */
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
u32 reg_val =
EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <<
CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE |
EEPROM_RF_CFG_STEP_MSK(radio_cfg) <<
CSR_HW_IF_CONFIG_REG_POS_PHY_STEP |
EEPROM_RF_CFG_DASH_MSK(radio_cfg) <<
CSR_HW_IF_CONFIG_REG_POS_PHY_DASH;
iwl_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE |
CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP |
CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH, reg_val);
IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n",
EEPROM_RF_CFG_TYPE_MSK(radio_cfg),
EEPROM_RF_CFG_STEP_MSK(radio_cfg),
EEPROM_RF_CFG_DASH_MSK(radio_cfg));
} else {
WARN_ON(1);
}
/* set CSR_HW_CONFIG_REG for uCode use */
iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
}
/* /*
* 1000 series * 1000 series
* =========== * ===========
...@@ -180,17 +217,6 @@ static void iwl1000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -180,17 +217,6 @@ static void iwl1000_hw_set_hw_params(struct iwl_priv *priv)
struct iwl_lib_ops iwl1000_lib = { struct iwl_lib_ops iwl1000_lib = {
.set_hw_params = iwl1000_hw_set_hw_params, .set_hw_params = iwl1000_hw_set_hw_params,
.nic_config = iwl1000_nic_config, .nic_config = iwl1000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -251,36 +277,12 @@ static void iwl2000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -251,36 +277,12 @@ static void iwl2000_hw_set_hw_params(struct iwl_priv *priv)
struct iwl_lib_ops iwl2000_lib = { struct iwl_lib_ops iwl2000_lib = {
.set_hw_params = iwl2000_hw_set_hw_params, .set_hw_params = iwl2000_hw_set_hw_params,
.nic_config = iwl2000_nic_config, .nic_config = iwl2000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
.enhanced_txpower = true,
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
struct iwl_lib_ops iwl2030_lib = { struct iwl_lib_ops iwl2030_lib = {
.set_hw_params = iwl2000_hw_set_hw_params, .set_hw_params = iwl2000_hw_set_hw_params,
.nic_config = iwl2000_nic_config, .nic_config = iwl2000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
.enhanced_txpower = true,
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -357,11 +359,9 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = { ...@@ -357,11 +359,9 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
{ {
u16 temperature, voltage; u16 temperature, voltage;
__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv,
EEPROM_KELVIN_TEMPERATURE);
temperature = le16_to_cpu(temp_calib[0]); temperature = le16_to_cpu(priv->eeprom_data->kelvin_temperature);
voltage = le16_to_cpu(temp_calib[1]); voltage = le16_to_cpu(priv->eeprom_data->kelvin_voltage);
/* offset = temp - volt / coeff */ /* offset = temp - volt / coeff */
return (s32)(temperature - return (s32)(temperature -
...@@ -478,17 +478,6 @@ struct iwl_lib_ops iwl5000_lib = { ...@@ -478,17 +478,6 @@ struct iwl_lib_ops iwl5000_lib = {
.set_hw_params = iwl5000_hw_set_hw_params, .set_hw_params = iwl5000_hw_set_hw_params,
.set_channel_switch = iwl5000_hw_channel_switch, .set_channel_switch = iwl5000_hw_channel_switch,
.nic_config = iwl5000_nic_config, .nic_config = iwl5000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -496,17 +485,6 @@ struct iwl_lib_ops iwl5150_lib = { ...@@ -496,17 +485,6 @@ struct iwl_lib_ops iwl5150_lib = {
.set_hw_params = iwl5150_hw_set_hw_params, .set_hw_params = iwl5150_hw_set_hw_params,
.set_channel_switch = iwl5000_hw_channel_switch, .set_channel_switch = iwl5000_hw_channel_switch,
.nic_config = iwl5000_nic_config, .nic_config = iwl5000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
},
.temperature = iwl5150_temperature, .temperature = iwl5150_temperature,
}; };
...@@ -541,13 +519,13 @@ static void iwl6000_nic_config(struct iwl_priv *priv) ...@@ -541,13 +519,13 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
break; break;
case IWL_DEVICE_FAMILY_6050: case IWL_DEVICE_FAMILY_6050:
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwl_eeprom_calib_version(priv) >= 6) if (priv->eeprom_data->calib_version >= 6)
iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
break; break;
case IWL_DEVICE_FAMILY_6150: case IWL_DEVICE_FAMILY_6150:
/* Indicate calibration version to uCode. */ /* Indicate calibration version to uCode. */
if (iwl_eeprom_calib_version(priv) >= 6) if (priv->eeprom_data->calib_version >= 6)
iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG,
...@@ -658,18 +636,6 @@ struct iwl_lib_ops iwl6000_lib = { ...@@ -658,18 +636,6 @@ struct iwl_lib_ops iwl6000_lib = {
.set_hw_params = iwl6000_hw_set_hw_params, .set_hw_params = iwl6000_hw_set_hw_params,
.set_channel_switch = iwl6000_hw_channel_switch, .set_channel_switch = iwl6000_hw_channel_switch,
.nic_config = iwl6000_nic_config, .nic_config = iwl6000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
.enhanced_txpower = true,
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
...@@ -677,17 +643,5 @@ struct iwl_lib_ops iwl6030_lib = { ...@@ -677,17 +643,5 @@ struct iwl_lib_ops iwl6030_lib = {
.set_hw_params = iwl6000_hw_set_hw_params, .set_hw_params = iwl6000_hw_set_hw_params,
.set_channel_switch = iwl6000_hw_channel_switch, .set_channel_switch = iwl6000_hw_channel_switch,
.nic_config = iwl6000_nic_config, .nic_config = iwl6000_nic_config,
.eeprom_ops = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
.enhanced_txpower = true,
},
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}; };
This diff is collapsed.
...@@ -59,8 +59,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv) ...@@ -59,8 +59,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
/* half dBm need to multiply */ /* half dBm need to multiply */
tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
if (priv->tx_power_lmt_in_half_dbm && if (tx_power_cmd.global_lmt > priv->eeprom_data->max_tx_pwr_half_dbm) {
priv->tx_power_lmt_in_half_dbm < tx_power_cmd.global_lmt) {
/* /*
* For the newer devices which using enhanced/extend tx power * For the newer devices which using enhanced/extend tx power
* table in EEPROM, the format is in half dBm. driver need to * table in EEPROM, the format is in half dBm. driver need to
...@@ -72,7 +71,8 @@ int iwlagn_send_tx_power(struct iwl_priv *priv) ...@@ -72,7 +71,8 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
* "tx_power_user_lmt" is higher than EEPROM value (in * "tx_power_user_lmt" is higher than EEPROM value (in
* half-dBm format), lower the tx power based on EEPROM * half-dBm format), lower the tx power based on EEPROM
*/ */
tx_power_cmd.global_lmt = priv->tx_power_lmt_in_half_dbm; tx_power_cmd.global_lmt =
priv->eeprom_data->max_tx_pwr_half_dbm;
} }
tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED; tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED;
tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO; tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO;
...@@ -824,7 +824,7 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -824,7 +824,7 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
if (priv->chain_noise_data.active_chains) if (priv->chain_noise_data.active_chains)
active_chains = priv->chain_noise_data.active_chains; active_chains = priv->chain_noise_data.active_chains;
else else
active_chains = priv->hw_params.valid_rx_ant; active_chains = priv->eeprom_data->valid_rx_ant;
if (priv->cfg->bt_params && if (priv->cfg->bt_params &&
priv->cfg->bt_params->advanced_bt_coexist && priv->cfg->bt_params->advanced_bt_coexist &&
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "iwl-op-mode.h" #include "iwl-op-mode.h"
#include "iwl-modparams.h" #include "iwl-modparams.h"
#include "eeprom.h"
#include "dev.h" #include "dev.h"
#include "calib.h" #include "calib.h"
#include "agn.h" #include "agn.h"
...@@ -238,12 +237,12 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ...@@ -238,12 +237,12 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) if (priv->eeprom_data->bands[IEEE80211_BAND_2GHZ].n_channels)
priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
&priv->bands[IEEE80211_BAND_2GHZ]; &priv->eeprom_data->bands[IEEE80211_BAND_2GHZ];
if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) if (priv->eeprom_data->bands[IEEE80211_BAND_5GHZ].n_channels)
priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&priv->bands[IEEE80211_BAND_5GHZ]; &priv->eeprom_data->bands[IEEE80211_BAND_5GHZ];
hw->wiphy->hw_version = priv->trans->hw_id; hw->wiphy->hw_version = priv->trans->hw_id;
......
This diff is collapsed.
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "iwl-debug.h" #include "iwl-debug.h"
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-modparams.h" #include "iwl-modparams.h"
#include "eeprom.h"
#include "dev.h" #include "dev.h"
#include "agn.h" #include "agn.h"
#include "commands.h" #include "commands.h"
......
...@@ -817,7 +817,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, ...@@ -817,7 +817,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
if (num_of_ant(tbl->ant_type) > 1) if (num_of_ant(tbl->ant_type) > 1)
tbl->ant_type = tbl->ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
tbl->is_ht40 = 0; tbl->is_ht40 = 0;
tbl->is_SGI = 0; tbl->is_SGI = 0;
...@@ -1445,7 +1445,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1445,7 +1445,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = priv->hw_params.tx_chains_num;
int ret = 0; int ret = 0;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
...@@ -1463,7 +1463,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1463,7 +1463,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
/* avoid antenna B and MIMO */ /* avoid antenna B and MIMO */
valid_tx_ant = valid_tx_ant =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 &&
tbl->action != IWL_LEGACY_SWITCH_SISO) tbl->action != IWL_LEGACY_SWITCH_SISO)
tbl->action = IWL_LEGACY_SWITCH_SISO; tbl->action = IWL_LEGACY_SWITCH_SISO;
...@@ -1487,7 +1487,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, ...@@ -1487,7 +1487,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
tbl->action = IWL_LEGACY_SWITCH_SISO; tbl->action = IWL_LEGACY_SWITCH_SISO;
valid_tx_ant = valid_tx_ant =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
} }
start_action = tbl->action; start_action = tbl->action;
...@@ -1621,7 +1621,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1621,7 +1621,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = priv->hw_params.tx_chains_num;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
int ret; int ret;
...@@ -1639,7 +1639,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1639,7 +1639,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
/* avoid antenna B and MIMO */ /* avoid antenna B and MIMO */
valid_tx_ant = valid_tx_ant =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) if (tbl->action != IWL_SISO_SWITCH_ANTENNA1)
tbl->action = IWL_SISO_SWITCH_ANTENNA1; tbl->action = IWL_SISO_SWITCH_ANTENNA1;
break; break;
...@@ -1657,7 +1657,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, ...@@ -1657,7 +1657,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
/* configure as 1x1 if bt full concurrency */ /* configure as 1x1 if bt full concurrency */
if (priv->bt_full_concurrent) { if (priv->bt_full_concurrent) {
valid_tx_ant = valid_tx_ant =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
tbl->action = IWL_SISO_SWITCH_ANTENNA1; tbl->action = IWL_SISO_SWITCH_ANTENNA1;
} }
...@@ -1793,7 +1793,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv, ...@@ -1793,7 +1793,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = priv->hw_params.tx_chains_num;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
int ret; int ret;
...@@ -1963,7 +1963,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv, ...@@ -1963,7 +1963,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
u32 sz = (sizeof(struct iwl_scale_tbl_info) - u32 sz = (sizeof(struct iwl_scale_tbl_info) -
(sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action; u8 start_action;
u8 valid_tx_ant = priv->hw_params.valid_tx_ant; u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
u8 tx_chains_num = priv->hw_params.tx_chains_num; u8 tx_chains_num = priv->hw_params.tx_chains_num;
int ret; int ret;
u8 update_search_tbl_counter = 0; u8 update_search_tbl_counter = 0;
...@@ -2697,7 +2697,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, ...@@ -2697,7 +2697,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
i = lq_sta->last_txrate_idx; i = lq_sta->last_txrate_idx;
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = priv->eeprom_data->valid_tx_ant;
if (!lq_sta->search_better_tbl) if (!lq_sta->search_better_tbl)
active_tbl = lq_sta->active_tbl; active_tbl = lq_sta->active_tbl;
...@@ -2891,15 +2891,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i ...@@ -2891,15 +2891,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
/* These values will be overridden later */ /* These values will be overridden later */
lq_sta->lq.general_params.single_stream_ant_msk = lq_sta->lq.general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
lq_sta->lq.general_params.dual_stream_ant_msk = lq_sta->lq.general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant & priv->eeprom_data->valid_tx_ant &
~first_antenna(priv->hw_params.valid_tx_ant); ~first_antenna(priv->eeprom_data->valid_tx_ant);
if (!lq_sta->lq.general_params.dual_stream_ant_msk) { if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
} else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { } else if (num_of_ant(priv->eeprom_data->valid_tx_ant) == 2) {
lq_sta->lq.general_params.dual_stream_ant_msk = lq_sta->lq.general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant; priv->eeprom_data->valid_tx_ant;
} }
/* as default allow aggregation for all tids */ /* as default allow aggregation for all tids */
...@@ -2945,7 +2945,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -2945,7 +2945,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv && priv->bt_full_concurrent) { if (priv && priv->bt_full_concurrent) {
/* 1x1 only */ /* 1x1 only */
tbl_type.ant_type = tbl_type.ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
} }
/* How many times should we repeat the initial rate? */ /* How many times should we repeat the initial rate? */
...@@ -2977,7 +2977,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -2977,7 +2977,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv->bt_full_concurrent) if (priv->bt_full_concurrent)
valid_tx_ant = ANT_A; valid_tx_ant = ANT_A;
else else
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = priv->eeprom_data->valid_tx_ant;
} }
/* Fill rest of rate table */ /* Fill rest of rate table */
...@@ -3011,7 +3011,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, ...@@ -3011,7 +3011,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
if (priv && priv->bt_full_concurrent) { if (priv && priv->bt_full_concurrent) {
/* 1x1 only */ /* 1x1 only */
tbl_type.ant_type = tbl_type.ant_type =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
} }
/* Indicate to uCode which entries might be MIMO. /* Indicate to uCode which entries might be MIMO.
...@@ -3098,7 +3098,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, ...@@ -3098,7 +3098,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
u8 ant_sel_tx; u8 ant_sel_tx;
priv = lq_sta->drv; priv = lq_sta->drv;
valid_tx_ant = priv->hw_params.valid_tx_ant; valid_tx_ant = priv->eeprom_data->valid_tx_ant;
if (lq_sta->dbg_fixed_rate) { if (lq_sta->dbg_fixed_rate) {
ant_sel_tx = ant_sel_tx =
((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK)
...@@ -3169,9 +3169,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, ...@@ -3169,9 +3169,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
desc += sprintf(buff+desc, "fixed rate 0x%X\n", desc += sprintf(buff+desc, "fixed rate 0x%X\n",
lq_sta->dbg_fixed_rate); lq_sta->dbg_fixed_rate);
desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
(priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", (priv->eeprom_data->valid_tx_ant & ANT_A) ? "ANT_A," : "",
(priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", (priv->eeprom_data->valid_tx_ant & ANT_B) ? "ANT_B," : "",
(priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); (priv->eeprom_data->valid_tx_ant & ANT_C) ? "ANT_C" : "");
desc += sprintf(buff+desc, "lq type %s\n", desc += sprintf(buff+desc, "lq type %s\n",
(is_legacy(tbl->lq_type)) ? "legacy" : "HT"); (is_legacy(tbl->lq_type)) ? "legacy" : "HT");
if (is_Ht(tbl->lq_type)) { if (is_Ht(tbl->lq_type)) {
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "iwl-io.h" #include "iwl-io.h"
#include "eeprom.h"
#include "dev.h" #include "dev.h"
#include "calib.h" #include "calib.h"
#include "agn.h" #include "agn.h"
......
...@@ -420,10 +420,10 @@ static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) ...@@ -420,10 +420,10 @@ static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
return -EINVAL; return -EINVAL;
} }
if (tx_power > priv->tx_power_device_lmt) { if (tx_power > DIV_ROUND_UP(priv->eeprom_data->max_tx_pwr_half_dbm, 2)) {
IWL_WARN(priv, IWL_WARN(priv,
"Requested user TXPOWER %d above upper limit %d.\n", "Requested user TXPOWER %d above upper limit %d.\n",
tx_power, priv->tx_power_device_lmt); tx_power, priv->eeprom_data->max_tx_pwr_half_dbm);
return -EINVAL; return -EINVAL;
} }
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include "eeprom.h"
#include "dev.h" #include "dev.h"
#include "agn.h" #include "agn.h"
...@@ -65,7 +64,6 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) ...@@ -65,7 +64,6 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
* to receive scan abort command or it does not perform * to receive scan abort command or it does not perform
* hardware scan currently */ * hardware scan currently */
if (!test_bit(STATUS_READY, &priv->status) || if (!test_bit(STATUS_READY, &priv->status) ||
!test_bit(STATUS_GEO_CONFIGURED, &priv->status) ||
!test_bit(STATUS_SCAN_HW, &priv->status) || !test_bit(STATUS_SCAN_HW, &priv->status) ||
test_bit(STATUS_FW_ERROR, &priv->status)) test_bit(STATUS_FW_ERROR, &priv->status))
return -EIO; return -EIO;
...@@ -648,12 +646,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -648,12 +646,12 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
u16 rx_chain = 0; u16 rx_chain = 0;
enum ieee80211_band band; enum ieee80211_band band;
u8 n_probes = 0; u8 n_probes = 0;
u8 rx_ant = priv->hw_params.valid_rx_ant; u8 rx_ant = priv->eeprom_data->valid_rx_ant;
u8 rate; u8 rate;
bool is_active = false; bool is_active = false;
int chan_mod; int chan_mod;
u8 active_chains; u8 active_chains;
u8 scan_tx_antennas = priv->hw_params.valid_tx_ant; u8 scan_tx_antennas = priv->eeprom_data->valid_tx_ant;
int ret; int ret;
int scan_cmd_size = sizeof(struct iwl_scan_cmd) + int scan_cmd_size = sizeof(struct iwl_scan_cmd) +
MAX_SCAN_CHANNEL * sizeof(struct iwl_scan_channel) + MAX_SCAN_CHANNEL * sizeof(struct iwl_scan_channel) +
...@@ -863,7 +861,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -863,7 +861,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
/* MIMO is not used here, but value is required */ /* MIMO is not used here, but value is required */
rx_chain |= rx_chain |=
priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; priv->eeprom_data->valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
...@@ -980,7 +978,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -980,7 +978,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
void iwl_init_scan_params(struct iwl_priv *priv) void iwl_init_scan_params(struct iwl_priv *priv)
{ {
u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; u8 ant_idx = fls(priv->eeprom_data->valid_tx_ant) - 1;
if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
......
...@@ -177,17 +177,23 @@ bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, ...@@ -177,17 +177,23 @@ bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
if (!ctx->ht.enabled || !ctx->ht.is_40mhz) if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
return false; return false;
#ifdef CONFIG_IWLWIFI_DEBUGFS
if (priv->disable_ht40)
return false;
#endif
/* /*
* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40 * Remainder of this function checks ht_cap, but if it's
* the bit will not set if it is pure 40MHz case * NULL then we can do HT40 (special case for RXON)
*/ */
if (ht_cap && !ht_cap->ht_supported) if (!ht_cap)
return true;
if (!ht_cap->ht_supported)
return false; return false;
#ifdef CONFIG_IWLWIFI_DEBUGFS if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
if (priv->disable_ht40)
return false; return false;
#endif
return true; return true;
} }
...@@ -627,23 +633,23 @@ static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -627,23 +633,23 @@ static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK; rate_flags |= RATE_MCS_CCK_MSK;
rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << rate_flags |= first_antenna(priv->eeprom_data->valid_tx_ant) <<
RATE_MCS_ANT_POS; RATE_MCS_ANT_POS;
rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
link_cmd->rs_table[i].rate_n_flags = rate_n_flags; link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
link_cmd->general_params.single_stream_ant_msk = link_cmd->general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant); first_antenna(priv->eeprom_data->valid_tx_ant);
link_cmd->general_params.dual_stream_ant_msk = link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant & priv->eeprom_data->valid_tx_ant &
~first_antenna(priv->hw_params.valid_tx_ant); ~first_antenna(priv->eeprom_data->valid_tx_ant);
if (!link_cmd->general_params.dual_stream_ant_msk) { if (!link_cmd->general_params.dual_stream_ant_msk) {
link_cmd->general_params.dual_stream_ant_msk = ANT_AB; link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
} else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { } else if (num_of_ant(priv->eeprom_data->valid_tx_ant) == 2) {
link_cmd->general_params.dual_stream_ant_msk = link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant; priv->eeprom_data->valid_tx_ant;
} }
link_cmd->agg_params.agg_dis_start_th = link_cmd->agg_params.agg_dis_start_th =
......
...@@ -534,9 +534,9 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -534,9 +534,9 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
break; break;
case IWL_TM_CMD_APP2DEV_GET_EEPROM: case IWL_TM_CMD_APP2DEV_GET_EEPROM:
if (priv->eeprom) { if (priv->eeprom_blob) {
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
priv->cfg->base_params->eeprom_size + 20); priv->eeprom_blob_size + 20);
if (!skb) { if (!skb) {
IWL_ERR(priv, "Memory allocation fail\n"); IWL_ERR(priv, "Memory allocation fail\n");
return -ENOMEM; return -ENOMEM;
...@@ -544,15 +544,15 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) ...@@ -544,15 +544,15 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND,
IWL_TM_CMD_DEV2APP_EEPROM_RSP) || IWL_TM_CMD_DEV2APP_EEPROM_RSP) ||
nla_put(skb, IWL_TM_ATTR_EEPROM, nla_put(skb, IWL_TM_ATTR_EEPROM,
priv->cfg->base_params->eeprom_size, priv->eeprom_blob_size,
priv->eeprom)) priv->eeprom_blob))
goto nla_put_failure; goto nla_put_failure;
status = cfg80211_testmode_reply(skb); status = cfg80211_testmode_reply(skb);
if (status < 0) if (status < 0)
IWL_ERR(priv, "Error sending msg : %d\n", IWL_ERR(priv, "Error sending msg : %d\n",
status); status);
} else } else
return -EFAULT; return -ENODATA;
break; break;
case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "iwl-modparams.h" #include "iwl-modparams.h"
#include "iwl-debug.h" #include "iwl-debug.h"
#include "agn.h" #include "agn.h"
#include "eeprom.h"
#include "dev.h" #include "dev.h"
#include "commands.h" #include "commands.h"
#include "tt.h" #include "tt.h"
......
...@@ -186,7 +186,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, ...@@ -186,7 +186,8 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
rate_idx = info->control.rates[0].idx; rate_idx = info->control.rates[0].idx;
if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS ||
(rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY))
rate_idx = rate_lowest_index(&priv->bands[info->band], rate_idx = rate_lowest_index(
&priv->eeprom_data->bands[info->band],
info->control.sta); info->control.sta);
/* For 5 GHZ band, remap mac80211 rate indices into driver indices */ /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
if (info->band == IEEE80211_BAND_5GHZ) if (info->band == IEEE80211_BAND_5GHZ)
...@@ -206,10 +207,11 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, ...@@ -206,10 +207,11 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
priv->bt_full_concurrent) { priv->bt_full_concurrent) {
/* operated as 1x1 in full concurrency mode */ /* operated as 1x1 in full concurrency mode */
priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
first_antenna(priv->hw_params.valid_tx_ant)); first_antenna(priv->eeprom_data->valid_tx_ant));
} else } else
priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, priv->mgmt_tx_ant = iwl_toggle_tx_ant(
priv->hw_params.valid_tx_ant); priv, priv->mgmt_tx_ant,
priv->eeprom_data->valid_tx_ant);
rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
/* Set the rate in the TX cmd */ /* Set the rate in the TX cmd */
......
...@@ -61,8 +61,7 @@ iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type) ...@@ -61,8 +61,7 @@ iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type)
static int iwl_set_Xtal_calib(struct iwl_priv *priv) static int iwl_set_Xtal_calib(struct iwl_priv *priv)
{ {
struct iwl_calib_xtal_freq_cmd cmd; struct iwl_calib_xtal_freq_cmd cmd;
__le16 *xtal_calib = __le16 *xtal_calib = priv->eeprom_data->xtal_calib;
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL);
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
...@@ -73,12 +72,10 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv) ...@@ -73,12 +72,10 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv)
static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
{ {
struct iwl_calib_temperature_offset_cmd cmd; struct iwl_calib_temperature_offset_cmd cmd;
__le16 *offset_calib =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
memcpy(&cmd.radio_sensor_offset, offset_calib, sizeof(*offset_calib)); cmd.radio_sensor_offset = priv->eeprom_data->raw_temperature;
if (!(cmd.radio_sensor_offset)) if (!(cmd.radio_sensor_offset))
cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET;
...@@ -90,27 +87,17 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) ...@@ -90,27 +87,17 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
{ {
struct iwl_calib_temperature_offset_v2_cmd cmd; struct iwl_calib_temperature_offset_v2_cmd cmd;
__le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv,
EEPROM_KELVIN_TEMPERATURE);
__le16 *offset_calib_low =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
struct iwl_eeprom_calib_hdr *hdr;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, cmd.radio_sensor_offset_high = priv->eeprom_data->kelvin_temperature;
EEPROM_CALIB_ALL); cmd.radio_sensor_offset_low = priv->eeprom_data->raw_temperature;
memcpy(&cmd.radio_sensor_offset_high, offset_calib_high, if (!cmd.radio_sensor_offset_low) {
sizeof(*offset_calib_high));
memcpy(&cmd.radio_sensor_offset_low, offset_calib_low,
sizeof(*offset_calib_low));
if (!(cmd.radio_sensor_offset_low)) {
IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n"); IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET; cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET; cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET;
} }
memcpy(&cmd.burntVoltageRef, &hdr->voltage, cmd.burntVoltageRef = priv->eeprom_data->calib_voltage;
sizeof(hdr->voltage));
IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n", IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
le16_to_cpu(cmd.radio_sensor_offset_high)); le16_to_cpu(cmd.radio_sensor_offset_high));
......
...@@ -194,6 +194,24 @@ struct iwl_ht_params { ...@@ -194,6 +194,24 @@ struct iwl_ht_params {
u8 ht40_bands; u8 ht40_bands;
}; };
/*
* information on how to parse the EEPROM
*/
#define EEPROM_REG_BAND_1_CHANNELS 0x08
#define EEPROM_REG_BAND_2_CHANNELS 0x26
#define EEPROM_REG_BAND_3_CHANNELS 0x42
#define EEPROM_REG_BAND_4_CHANNELS 0x5C
#define EEPROM_REG_BAND_5_CHANNELS 0x74
#define EEPROM_REG_BAND_24_HT40_CHANNELS 0x82
#define EEPROM_REG_BAND_52_HT40_CHANNELS 0x92
#define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80
#define EEPROM_REGULATORY_BAND_NO_HT40 0
struct iwl_eeprom_params {
const u8 regulatory_bands[7];
bool enhanced_txpower;
};
/** /**
* struct iwl_cfg * struct iwl_cfg
* @name: Offical name of the device * @name: Offical name of the device
...@@ -246,6 +264,7 @@ struct iwl_cfg { ...@@ -246,6 +264,7 @@ struct iwl_cfg {
/* params likely to change within a device family */ /* params likely to change within a device family */
const struct iwl_ht_params *ht_params; const struct iwl_ht_params *ht_params;
const struct iwl_bt_params *bt_params; const struct iwl_bt_params *bt_params;
const struct iwl_eeprom_params *eeprom_params;
const bool need_temp_offset_calib; /* if used set to true */ const bool need_temp_offset_calib; /* if used set to true */
const bool no_xtal_calib; const bool no_xtal_calib;
enum iwl_led_mode led_mode; enum iwl_led_mode led_mode;
......
...@@ -45,6 +45,7 @@ void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); ...@@ -45,6 +45,7 @@ void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3);
/* No matter what is m (priv, bus, trans), this will work */ /* No matter what is m (priv, bus, trans), this will work */
#define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) #define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a)
#define IWL_ERR_DEV(d, f, a...) __iwl_err((d), false, false, f, ## a)
#define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) #define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a)
#define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) #define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a)
#define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) #define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a)
...@@ -69,6 +70,8 @@ do { \ ...@@ -69,6 +70,8 @@ do { \
#define IWL_DEBUG(m, level, fmt, args...) \ #define IWL_DEBUG(m, level, fmt, args...) \
__iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args)
#define IWL_DEBUG_DEV(dev, level, fmt, args...) \
__iwl_dbg((dev), level, false, __func__, fmt, ##args)
#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ #define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
__iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args)
...@@ -153,7 +156,7 @@ do { \ ...@@ -153,7 +156,7 @@ do { \
#define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a) #define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a)
#define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a) #define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a)
#define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a) #define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a)
#define IWL_DEBUG_EEPROM(p, f, a...) IWL_DEBUG(p, IWL_DL_EEPROM, f, ## a) #define IWL_DEBUG_EEPROM(d, f, a...) IWL_DEBUG_DEV(d, IWL_DL_EEPROM, f, ## a)
#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) #define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a)
#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) #define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a)
#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) #define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a)
......
This diff is collapsed.
...@@ -59,181 +59,21 @@ ...@@ -59,181 +59,21 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
#ifndef __iwl_eeprom_parse_h__
#define __iwl_eeprom_parse_h__
#ifndef __iwl_eeprom_h__ #include <linux/types.h>
#define __iwl_eeprom_h__ #include <linux/if_ether.h>
#include "iwl-trans.h"
#include <net/mac80211.h> /* SKU Capabilities (actual values from EEPROM definition) */
struct iwl_priv;
/*
* EEPROM access time values:
*
* Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG.
* Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1).
* When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
* Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
*/
#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
#define IWL_EEPROM_SEM_TIMEOUT 10 /* microseconds */
#define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
/*
* Regulatory channel usage flags in EEPROM struct iwl4965_eeprom_channel.flags.
*
* IBSS and/or AP operation is allowed *only* on those channels with
* (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because
* RADAR detection is not supported by the 4965 driver, but is a
* requirement for establishing a new network for legal operation on channels
* requiring RADAR detection or restricting ACTIVE scanning.
*
* NOTE: "WIDE" flag does not indicate anything about "HT40" 40 MHz channels.
* It only indicates that 20 MHz channel use is supported; HT40 channel
* usage is indicated by a separate set of regulatory flags for each
* HT40 channel pair.
*
* NOTE: Using a channel inappropriately will result in a uCode error!
*/
#define IWL_NUM_TX_CALIB_GROUPS 5
enum {
EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
/* Bit 2 Reserved */
EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */
EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */
EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */
/* Bit 6 Reserved (was Narrow Channel) */
EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */
};
/* SKU Capabilities */
#define EEPROM_SKU_CAP_BAND_24GHZ (1 << 4) #define EEPROM_SKU_CAP_BAND_24GHZ (1 << 4)
#define EEPROM_SKU_CAP_BAND_52GHZ (1 << 5) #define EEPROM_SKU_CAP_BAND_52GHZ (1 << 5)
#define EEPROM_SKU_CAP_11N_ENABLE (1 << 6) #define EEPROM_SKU_CAP_11N_ENABLE (1 << 6)
#define EEPROM_SKU_CAP_AMT_ENABLE (1 << 7) #define EEPROM_SKU_CAP_AMT_ENABLE (1 << 7)
#define EEPROM_SKU_CAP_IPAN_ENABLE (1 << 8) #define EEPROM_SKU_CAP_IPAN_ENABLE (1 << 8)
/* *regulatory* channel data format in eeprom, one for each channel. /* radio config bits (actual values from EEPROM definition) */
* There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */
struct iwl_eeprom_channel {
u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */
s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
} __packed;
enum iwl_eeprom_enhanced_txpwr_flags {
IWL_EEPROM_ENH_TXP_FL_VALID = BIT(0),
IWL_EEPROM_ENH_TXP_FL_BAND_52G = BIT(1),
IWL_EEPROM_ENH_TXP_FL_OFDM = BIT(2),
IWL_EEPROM_ENH_TXP_FL_40MHZ = BIT(3),
IWL_EEPROM_ENH_TXP_FL_HT_AP = BIT(4),
IWL_EEPROM_ENH_TXP_FL_RES1 = BIT(5),
IWL_EEPROM_ENH_TXP_FL_RES2 = BIT(6),
IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE = BIT(7),
};
/**
* iwl_eeprom_enhanced_txpwr structure
* This structure presents the enhanced regulatory tx power limit layout
* in eeprom image
* Enhanced regulatory tx power portion of eeprom image can be broken down
* into individual structures; each one is 8 bytes in size and contain the
* following information
* @flags: entry flags
* @channel: channel number
* @chain_a_max_pwr: chain a max power in 1/2 dBm
* @chain_b_max_pwr: chain b max power in 1/2 dBm
* @chain_c_max_pwr: chain c max power in 1/2 dBm
* @delta_20_in_40: 20-in-40 deltas (hi/lo)
* @mimo2_max_pwr: mimo2 max power in 1/2 dBm
* @mimo3_max_pwr: mimo3 max power in 1/2 dBm
*
*/
struct iwl_eeprom_enhanced_txpwr {
u8 flags;
u8 channel;
s8 chain_a_max;
s8 chain_b_max;
s8 chain_c_max;
u8 delta_20_in_40;
s8 mimo2_max;
s8 mimo3_max;
} __packed;
/* calibration */
struct iwl_eeprom_calib_hdr {
u8 version;
u8 pa_type;
__le16 voltage;
} __packed;
#define EEPROM_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION)
#define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL)
/* temperature */
#define EEPROM_KELVIN_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
#define EEPROM_RAW_TEMPERATURE ((2*0x12B) | EEPROM_CALIB_ALL)
/* agn links */
#define EEPROM_LINK_HOST (2*0x64)
#define EEPROM_LINK_GENERAL (2*0x65)
#define EEPROM_LINK_REGULATORY (2*0x66)
#define EEPROM_LINK_CALIBRATION (2*0x67)
#define EEPROM_LINK_PROCESS_ADJST (2*0x68)
#define EEPROM_LINK_OTHERS (2*0x69)
#define EEPROM_LINK_TXP_LIMIT (2*0x6a)
#define EEPROM_LINK_TXP_LIMIT_SIZE (2*0x6b)
/* agn regulatory - indirect access */
#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 28 bytes */
#define EEPROM_REG_BAND_2_CHANNELS ((0x26)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 26 bytes */
#define EEPROM_REG_BAND_3_CHANNELS ((0x42)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */
#define EEPROM_REG_BAND_4_CHANNELS ((0x5C)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */
#define EEPROM_REG_BAND_5_CHANNELS ((0x74)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 12 bytes */
#define EEPROM_REG_BAND_24_HT40_CHANNELS ((0x82)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */
#define EEPROM_REG_BAND_52_HT40_CHANNELS ((0x92)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 22 bytes */
/* 6000 regulatory - indirect access */
#define EEPROM_6000_REG_BAND_24_HT40_CHANNELS ((0x80)\
| INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 14 bytes */
/* 2.4 GHz */
extern const u8 iwl_eeprom_band_1[14];
#define ADDRESS_MSK 0x0000FFFF
#define INDIRECT_TYPE_MSK 0x000F0000
#define INDIRECT_HOST 0x00010000
#define INDIRECT_GENERAL 0x00020000
#define INDIRECT_REGULATORY 0x00030000
#define INDIRECT_CALIBRATION 0x00040000
#define INDIRECT_PROCESS_ADJST 0x00050000
#define INDIRECT_OTHERS 0x00060000
#define INDIRECT_TXP_LIMIT 0x00070000
#define INDIRECT_TXP_LIMIT_SIZE 0x00080000
#define INDIRECT_ADDRESS 0x00100000
/* General */
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
#define EEPROM_SUBSYSTEM_ID (2*0x0A) /* 2 bytes */
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
#define EEPROM_VERSION (2*0x44) /* 2 bytes */
#define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */
#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */
/* The following masks are to be applied on EEPROM_RADIO_CONFIG */
#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ #define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */
#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ #define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */
#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ #define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */
...@@ -241,29 +81,58 @@ extern const u8 iwl_eeprom_band_1[14]; ...@@ -241,29 +81,58 @@ extern const u8 iwl_eeprom_band_1[14];
#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ #define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */
#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ #define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */
#define EEPROM_RF_CONFIG_TYPE_MAX 0x3 struct iwl_eeprom_data {
int n_hw_addrs;
u8 hw_addr[ETH_ALEN];
u16 radio_config;
#define EEPROM_REGULATORY_BAND_NO_HT40 (0) u8 calib_version;
__le16 calib_voltage;
struct iwl_eeprom_ops { __le16 raw_temperature;
const u32 regulatory_bands[7]; __le16 kelvin_temperature;
bool enhanced_txpower; __le16 kelvin_voltage;
__le16 xtal_calib[2];
u16 sku;
u16 radio_cfg;
u16 eeprom_version;
s8 max_tx_pwr_half_dbm;
u8 valid_tx_ant, valid_rx_ant;
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
struct ieee80211_channel channels[];
}; };
/**
* iwl_parse_eeprom_data - parse EEPROM data and return values
*
* @dev: device pointer we're parsing for, for debug only
* @cfg: device configuration for parsing and overrides
* @eeprom: the EEPROM data
* @eeprom_size: length of the EEPROM data
*
* This function parses all EEPROM values we need and then
* returns a (newly allocated) struct containing all the
* relevant values for driver use. The struct must be freed
* later with iwl_free_eeprom_data().
*/
struct iwl_eeprom_data *
iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
const u8 *eeprom, size_t eeprom_size);
/**
* iwl_free_eeprom_data - free EEPROM data
* @data: the data to free
*/
static inline void iwl_free_eeprom_data(struct iwl_eeprom_data *data)
{
kfree(data);
}
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev); int iwl_eeprom_check_version(struct iwl_eeprom_data *data,
void iwl_eeprom_free(struct iwl_priv *priv); struct iwl_trans *trans);
int iwl_eeprom_check_version(struct iwl_priv *priv);
int iwl_eeprom_init_hw_params(struct iwl_priv *priv);
u16 iwl_eeprom_calib_version(struct iwl_priv *priv);
const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset);
u16 iwl_eeprom_query16(struct iwl_priv *priv, size_t offset);
void iwl_eeprom_get_mac(struct iwl_priv *priv, u8 *mac);
int iwl_init_channel_map(struct iwl_priv *priv);
void iwl_free_channel_map(struct iwl_priv *priv);
const struct iwl_channel_info *iwl_get_channel_info(
const struct iwl_priv *priv,
enum ieee80211_band band, u16 channel);
void iwl_rf_config(struct iwl_priv *priv);
#endif /* __iwl_eeprom_h__ */ #endif /* __iwl_eeprom_parse_h__ */
This diff is collapsed.
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef __iwl_eeprom_h__
#define __iwl_eeprom_h__
#include "iwl-trans.h"
int iwl_read_eeprom(struct iwl_trans *trans, u8 **eeprom, size_t *eeprom_size);
#endif /* __iwl_eeprom_h__ */
...@@ -74,6 +74,18 @@ static const struct iwl_ht_params iwl1000_ht_params = { ...@@ -74,6 +74,18 @@ static const struct iwl_ht_params iwl1000_ht_params = {
.ht40_bands = BIT(IEEE80211_BAND_2GHZ), .ht40_bands = BIT(IEEE80211_BAND_2GHZ),
}; };
static const struct iwl_eeprom_params iwl1000_eeprom_params = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
}
};
#define IWL_DEVICE_1000 \ #define IWL_DEVICE_1000 \
.fw_name_pre = IWL1000_FW_PRE, \ .fw_name_pre = IWL1000_FW_PRE, \
.ucode_api_max = IWL1000_UCODE_API_MAX, \ .ucode_api_max = IWL1000_UCODE_API_MAX, \
...@@ -85,6 +97,7 @@ static const struct iwl_ht_params iwl1000_ht_params = { ...@@ -85,6 +97,7 @@ static const struct iwl_ht_params iwl1000_ht_params = {
.eeprom_ver = EEPROM_1000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
.base_params = &iwl1000_base_params, \ .base_params = &iwl1000_base_params, \
.eeprom_params = &iwl1000_eeprom_params, \
.led_mode = IWL_LED_BLINK .led_mode = IWL_LED_BLINK
const struct iwl_cfg iwl1000_bgn_cfg = { const struct iwl_cfg iwl1000_bgn_cfg = {
...@@ -109,6 +122,7 @@ const struct iwl_cfg iwl1000_bg_cfg = { ...@@ -109,6 +122,7 @@ const struct iwl_cfg iwl1000_bg_cfg = {
.eeprom_ver = EEPROM_1000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
.base_params = &iwl1000_base_params, \ .base_params = &iwl1000_base_params, \
.eeprom_params = &iwl1000_eeprom_params, \
.led_mode = IWL_LED_RF_STATE, \ .led_mode = IWL_LED_RF_STATE, \
.rx_with_siso_diversity = true .rx_with_siso_diversity = true
......
...@@ -117,6 +117,19 @@ static const struct iwl_bt_params iwl2030_bt_params = { ...@@ -117,6 +117,19 @@ static const struct iwl_bt_params iwl2030_bt_params = {
.bt_session_2 = true, .bt_session_2 = true,
}; };
static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REGULATORY_BAND_NO_HT40,
},
.enhanced_txpower = true,
};
#define IWL_DEVICE_2000 \ #define IWL_DEVICE_2000 \
.fw_name_pre = IWL2000_FW_PRE, \ .fw_name_pre = IWL2000_FW_PRE, \
.ucode_api_max = IWL2000_UCODE_API_MAX, \ .ucode_api_max = IWL2000_UCODE_API_MAX, \
...@@ -128,6 +141,7 @@ static const struct iwl_bt_params iwl2030_bt_params = { ...@@ -128,6 +141,7 @@ static const struct iwl_bt_params iwl2030_bt_params = {
.eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
.base_params = &iwl2000_base_params, \ .base_params = &iwl2000_base_params, \
.eeprom_params = &iwl20x0_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.temp_offset_v2 = true, \ .temp_offset_v2 = true, \
.led_mode = IWL_LED_RF_STATE .led_mode = IWL_LED_RF_STATE
...@@ -156,6 +170,7 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = { ...@@ -156,6 +170,7 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = {
.eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
.base_params = &iwl2030_base_params, \ .base_params = &iwl2030_base_params, \
.bt_params = &iwl2030_bt_params, \ .bt_params = &iwl2030_bt_params, \
.eeprom_params = &iwl20x0_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.temp_offset_v2 = true, \ .temp_offset_v2 = true, \
.led_mode = IWL_LED_RF_STATE, \ .led_mode = IWL_LED_RF_STATE, \
...@@ -178,6 +193,7 @@ const struct iwl_cfg iwl2030_2bgn_cfg = { ...@@ -178,6 +193,7 @@ const struct iwl_cfg iwl2030_2bgn_cfg = {
.eeprom_ver = EEPROM_2000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_2000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
.base_params = &iwl2000_base_params, \ .base_params = &iwl2000_base_params, \
.eeprom_params = &iwl20x0_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.temp_offset_v2 = true, \ .temp_offset_v2 = true, \
.led_mode = IWL_LED_RF_STATE, \ .led_mode = IWL_LED_RF_STATE, \
...@@ -208,6 +224,7 @@ const struct iwl_cfg iwl105_bgn_d_cfg = { ...@@ -208,6 +224,7 @@ const struct iwl_cfg iwl105_bgn_d_cfg = {
.eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
.base_params = &iwl2030_base_params, \ .base_params = &iwl2030_base_params, \
.bt_params = &iwl2030_bt_params, \ .bt_params = &iwl2030_bt_params, \
.eeprom_params = &iwl20x0_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.temp_offset_v2 = true, \ .temp_offset_v2 = true, \
.led_mode = IWL_LED_RF_STATE, \ .led_mode = IWL_LED_RF_STATE, \
......
...@@ -72,6 +72,18 @@ static const struct iwl_ht_params iwl5000_ht_params = { ...@@ -72,6 +72,18 @@ static const struct iwl_ht_params iwl5000_ht_params = {
.ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
}; };
static const struct iwl_eeprom_params iwl5000_eeprom_params = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
};
#define IWL_DEVICE_5000 \ #define IWL_DEVICE_5000 \
.fw_name_pre = IWL5000_FW_PRE, \ .fw_name_pre = IWL5000_FW_PRE, \
.ucode_api_max = IWL5000_UCODE_API_MAX, \ .ucode_api_max = IWL5000_UCODE_API_MAX, \
...@@ -83,6 +95,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { ...@@ -83,6 +95,7 @@ static const struct iwl_ht_params iwl5000_ht_params = {
.eeprom_ver = EEPROM_5000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_5000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \
.base_params = &iwl5000_base_params, \ .base_params = &iwl5000_base_params, \
.eeprom_params = &iwl5000_eeprom_params, \
.led_mode = IWL_LED_BLINK .led_mode = IWL_LED_BLINK
const struct iwl_cfg iwl5300_agn_cfg = { const struct iwl_cfg iwl5300_agn_cfg = {
...@@ -129,6 +142,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { ...@@ -129,6 +142,7 @@ const struct iwl_cfg iwl5350_agn_cfg = {
.eeprom_ver = EEPROM_5050_EEPROM_VERSION, .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
.eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
.base_params = &iwl5000_base_params, .base_params = &iwl5000_base_params,
.eeprom_params = &iwl5000_eeprom_params,
.ht_params = &iwl5000_ht_params, .ht_params = &iwl5000_ht_params,
.led_mode = IWL_LED_BLINK, .led_mode = IWL_LED_BLINK,
.internal_wimax_coex = true, .internal_wimax_coex = true,
...@@ -145,6 +159,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { ...@@ -145,6 +159,7 @@ const struct iwl_cfg iwl5350_agn_cfg = {
.eeprom_ver = EEPROM_5050_EEPROM_VERSION, \ .eeprom_ver = EEPROM_5050_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \
.base_params = &iwl5000_base_params, \ .base_params = &iwl5000_base_params, \
.eeprom_params = &iwl5000_eeprom_params, \
.no_xtal_calib = true, \ .no_xtal_calib = true, \
.led_mode = IWL_LED_BLINK, \ .led_mode = IWL_LED_BLINK, \
.internal_wimax_coex = true .internal_wimax_coex = true
......
...@@ -136,6 +136,19 @@ static const struct iwl_bt_params iwl6000_bt_params = { ...@@ -136,6 +136,19 @@ static const struct iwl_bt_params iwl6000_bt_params = {
.bt_sco_disable = true, .bt_sco_disable = true,
}; };
static const struct iwl_eeprom_params iwl6000_eeprom_params = {
.regulatory_bands = {
EEPROM_REG_BAND_1_CHANNELS,
EEPROM_REG_BAND_2_CHANNELS,
EEPROM_REG_BAND_3_CHANNELS,
EEPROM_REG_BAND_4_CHANNELS,
EEPROM_REG_BAND_5_CHANNELS,
EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
EEPROM_REG_BAND_52_HT40_CHANNELS
},
.enhanced_txpower = true,
};
#define IWL_DEVICE_6005 \ #define IWL_DEVICE_6005 \
.fw_name_pre = IWL6005_FW_PRE, \ .fw_name_pre = IWL6005_FW_PRE, \
.ucode_api_max = IWL6000G2_UCODE_API_MAX, \ .ucode_api_max = IWL6000G2_UCODE_API_MAX, \
...@@ -147,6 +160,7 @@ static const struct iwl_bt_params iwl6000_bt_params = { ...@@ -147,6 +160,7 @@ static const struct iwl_bt_params iwl6000_bt_params = {
.eeprom_ver = EEPROM_6005_EEPROM_VERSION, \ .eeprom_ver = EEPROM_6005_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \
.base_params = &iwl6000_g2_base_params, \ .base_params = &iwl6000_g2_base_params, \
.eeprom_params = &iwl6000_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.led_mode = IWL_LED_RF_STATE .led_mode = IWL_LED_RF_STATE
...@@ -202,6 +216,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { ...@@ -202,6 +216,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
.eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \
.base_params = &iwl6000_g2_base_params, \ .base_params = &iwl6000_g2_base_params, \
.bt_params = &iwl6000_bt_params, \ .bt_params = &iwl6000_bt_params, \
.eeprom_params = &iwl6000_eeprom_params, \
.need_temp_offset_calib = true, \ .need_temp_offset_calib = true, \
.led_mode = IWL_LED_RF_STATE, \ .led_mode = IWL_LED_RF_STATE, \
.adv_pm = true \ .adv_pm = true \
...@@ -274,6 +289,7 @@ const struct iwl_cfg iwl130_bg_cfg = { ...@@ -274,6 +289,7 @@ const struct iwl_cfg iwl130_bg_cfg = {
.eeprom_ver = EEPROM_6000_EEPROM_VERSION, \ .eeprom_ver = EEPROM_6000_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, \
.base_params = &iwl6000_base_params, \ .base_params = &iwl6000_base_params, \
.eeprom_params = &iwl6000_eeprom_params, \
.led_mode = IWL_LED_BLINK .led_mode = IWL_LED_BLINK
const struct iwl_cfg iwl6000i_2agn_cfg = { const struct iwl_cfg iwl6000i_2agn_cfg = {
...@@ -304,6 +320,7 @@ const struct iwl_cfg iwl6000i_2bg_cfg = { ...@@ -304,6 +320,7 @@ const struct iwl_cfg iwl6000i_2bg_cfg = {
.eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \
.base_params = &iwl6050_base_params, \ .base_params = &iwl6050_base_params, \
.eeprom_params = &iwl6000_eeprom_params, \
.led_mode = IWL_LED_BLINK, \ .led_mode = IWL_LED_BLINK, \
.internal_wimax_coex = true .internal_wimax_coex = true
...@@ -328,6 +345,7 @@ const struct iwl_cfg iwl6050_2abg_cfg = { ...@@ -328,6 +345,7 @@ const struct iwl_cfg iwl6050_2abg_cfg = {
.eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \
.eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \
.base_params = &iwl6050_base_params, \ .base_params = &iwl6050_base_params, \
.eeprom_params = &iwl6000_eeprom_params, \
.led_mode = IWL_LED_BLINK, \ .led_mode = IWL_LED_BLINK, \
.internal_wimax_coex = true .internal_wimax_coex = true
...@@ -354,6 +372,7 @@ const struct iwl_cfg iwl6000_3agn_cfg = { ...@@ -354,6 +372,7 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
.eeprom_ver = EEPROM_6000_EEPROM_VERSION, .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
.eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
.base_params = &iwl6000_base_params, .base_params = &iwl6000_base_params,
.eeprom_params = &iwl6000_eeprom_params,
.ht_params = &iwl6000_ht_params, .ht_params = &iwl6000_ht_params,
.led_mode = IWL_LED_BLINK, .led_mode = IWL_LED_BLINK,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment