iwlwifi fix for 2.6.37
cover iwlwifi fix for 2.6.37
The original method used to parsing EEPROM Tx Power Table was hardcode and not forward compatible with newer devices. Fix it here to be layout agnostic
John, we split EEPROM reading patches to two stage, for .37 release, the existing devices will not change, only the newer devices will use the new EEPROM reading method; we will remove the old EEPROM reading method all together in separated patch for .38 release. Please let me know if this is ok
Johannes Berg (1):
iwlagn: rename enhanced txpower fields
Wey-Yi Guy (1):
iwlagn: implement layout-agnostic EEPROM reading
these patches are also available from wireless-2.6 branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6.git
drivers/net/wireless/iwlwifi/iwl-1000.c | 2 + drivers/net/wireless/iwlwifi/iwl-6000.c | 12 ++++ drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | 88 ++++++++++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 6 ++ drivers/net/wireless/iwlwifi/iwl-core.h | 1 + drivers/net/wireless/iwlwifi/iwl-eeprom.h | 25 ++++++- 6 files changed, 128 insertions(+), 6 deletions(-)
PATCH 1/2 iwlagn: rename enhanced txpower fields
From: Johannes Berg <[email protected]>
Some fields we didn't previously use from the enhanced TX power structure will be needed in the next patch, so rename them to their correct names to be able to use them and change code reading them accordingly.
--- drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | 3 ++- drivers/net/wireless/iwlwifi/iwl-eeprom.h | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c +2 -1
@@ -419,7 +419,8 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv)* always check for valid entry before process * the information */ -if (!enhanced_txpower->common || enhanced_txpower->reserved) +if (!(enhanced_txpower->flags || enhanced_txpower->channel) || + enhanced_txpower->delta_20_in_40)continue ;for (element =0 ; element < eeprom_section_count; element++) {
drivers/net/wireless/iwlwifi/iwl-eeprom.h +6 -4
@@ -127,21 +127,23 @@ struct iwl_eeprom_channel {* 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 -* @common: (desc + channel) not used by driver, should _NOT_ be "zero" +* @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 -* @reserved: not used, should be "zero" +* @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 { -__le16 common; +u8 flags; +u8 channel;s8 chain_a_max;s8 chain_b_max;s8 chain_c_max; -s8 reserved; +u8 delta_20_in_40;s8 mimo2_max;s8 mimo3_max; } __packed;
Signature · 1 line
1.7.0.4
PATCH 2/2 iwlagn: implement layout-agnostic EEPROM reading
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
The current EEPROM reading code has some layout assumptions that now turned out to be false with some newer versions of the EEPROM. Luckily, we can avoid all such assumptions by using data in the EEPROM itself, so implement using that.
However, for risk mitigation purposes, keep the old reading code for current hardware for now.
--- drivers/net/wireless/iwlwifi/iwl-1000.c | 2 + drivers/net/wireless/iwlwifi/iwl-6000.c | 12 ++++ drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | 85 ++++++++++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 6 ++ drivers/net/wireless/iwlwifi/iwl-core.h | 1 + drivers/net/wireless/iwlwifi/iwl-eeprom.h | 15 +++++ 6 files changed, 120 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +2 -0
@@ -315,6 +315,7 @@ struct iwl_cfg iwl100_bgn_cfg = { .mod_params = &iwlagn_mod_params, .base_params = &iwl1000_base_params, .ht_params = &iwl1000_ht_params, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl100_bg_cfg = {
@@ -330,6 +331,7 @@ struct iwl_cfg iwl100_bg_cfg = { .ops = &iwl1000_ops, .mod_params = &iwlagn_mod_params, .base_params = &iwl1000_base_params, + .use_new_eeprom_reading = true, };MODULE_FIRMWARE (IWL1000_MODULE_FIRMWARE (IWL1000_UCODE_API_MAX ));
drivers/net/wireless/iwlwifi/iwl-6000.c +12 -0
@@ -561,6 +561,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = { .ht_params = &iwl6000_ht_params, .need_dc_calib = true, .need_temp_offset_calib = true, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2a_2abg_cfg = {
@@ -578,6 +579,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = { .base_params = &iwl6000_base_params, .need_dc_calib = true, .need_temp_offset_calib = true, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2a_2bg_cfg = {
@@ -595,6 +597,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = { .base_params = &iwl6000_base_params, .need_dc_calib = true, .need_temp_offset_calib = true, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_2agn_cfg = {
@@ -616,6 +619,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_2abg_cfg = {
@@ -636,6 +640,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_2bgn_cfg = {
@@ -657,6 +662,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_2bg_cfg = {
@@ -677,6 +683,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_bgn_cfg = {
@@ -698,6 +705,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6000g2b_bg_cfg = {
@@ -718,6 +726,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { .need_temp_offset_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };/*
@@ -804,6 +813,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = { .base_params = &iwl6050_base_params, .ht_params = &iwl6000_ht_params, .need_dc_calib = true, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl6050_2abg_cfg = {
@@ -857,6 +867,7 @@ struct iwl_cfg iwl130_bgn_cfg = { .need_dc_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };struct iwl_cfg iwl130_bg_cfg = {
@@ -876,6 +887,7 @@ struct iwl_cfg iwl130_bg_cfg = { .need_dc_calib = true, /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, + .use_new_eeprom_reading = true, };MODULE_FIRMWARE (IWL6000_MODULE_FIRMWARE (IWL6000_UCODE_API_MAX ));
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c +84 -1
94 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-agn-lib.c +6 -0
@@ -569,6 +569,12 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)case INDIRECT_REGULATORY : offset =iwl_eeprom_query16 (priv,EEPROM_LINK_REGULATORY );break ; +case INDIRECT_TXP_LIMIT : + offset =iwl_eeprom_query16 (priv,EEPROM_LINK_TXP_LIMIT ); +break ; +case INDIRECT_TXP_LIMIT_SIZE : + offset =iwl_eeprom_query16 (priv,EEPROM_LINK_TXP_LIMIT_SIZE ); +break ;case INDIRECT_CALIBRATION : offset =iwl_eeprom_query16 (priv,EEPROM_LINK_CALIBRATION );break ;
drivers/net/wireless/iwlwifi/iwl-core.h +1 -0
@@ -390,6 +390,7 @@ struct iwl_cfg {const bool need_temp_offset_calib;/* if used set to true */ u8 scan_rx_antennas[IEEE80211_NUM_BANDS ];u8 scan_tx_antennas[IEEE80211_NUM_BANDS ]; +const bool use_new_eeprom_reading;/* temporary, remove later */ };/***************************
drivers/net/wireless/iwlwifi/iwl-eeprom.h +15 -0
@@ -120,6 +120,17 @@ struct iwl_eeprom_channel {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
@@ -188,6 +199,8 @@ struct iwl_eeprom_enhanced_txpwr {#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)\
@@ -391,6 +404,8 @@ struct iwl_eeprom_calib_info {#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 */
Signature · 1 line
1.7.0.4
Quoted 8 lines · Wey-Yi Guy
The original method used to parsing EEPROM Tx Power Table was hardcode and not forward compatible with newer devices. Fix it here to be layout agnostic
John, we split EEPROM reading patches to two stage, for .37 release, the existing devices will not change, only the newer devices will use the new EEPROM reading method; we will remove the old EEPROM reading method all together in separated patch for .38 release. Please let me know if this is ok
OK, I think this will do.
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 4 lines · John W. Linville
Quoted 3 lines · Wey-Yi Guy
The original method used to parsing EEPROM Tx Power Table was hardcode and not forward compatible with newer devices. Fix it here to be layout agnostic
Quoted 8 lines
Quoted 5 lines
John, we split EEPROM reading patches to two stage, for .37 release, the existing devices will not change, only the newer devices will use the new EEPROM reading method; we will remove the old EEPROM reading method all together in separated patch for .38 release. Please let me know if this is ok
OK, I think this will do.
Thanks for taking it
Wey