aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/dvm/rs.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-05-21 05:55:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-06 07:24:19 -0400
commit26a7ca9a71a3f7e1826de96b1a1e907123e11b07 (patch)
tree7ab52c58fdd876bacf112c1bfceeac865f196704 /drivers/net/wireless/iwlwifi/dvm/rs.c
parent08838cdeca65e754af5c755a05f6cdb1c632eda8 (diff)
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: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm/rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index af102910e689..6fddd2785e6e 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -817,7 +817,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
817 817
818 if (num_of_ant(tbl->ant_type) > 1) 818 if (num_of_ant(tbl->ant_type) > 1)
819 tbl->ant_type = 819 tbl->ant_type =
820 first_antenna(priv->hw_params.valid_tx_ant); 820 first_antenna(priv->eeprom_data->valid_tx_ant);
821 821
822 tbl->is_ht40 = 0; 822 tbl->is_ht40 = 0;
823 tbl->is_SGI = 0; 823 tbl->is_SGI = 0;
@@ -1445,7 +1445,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1445 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1445 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1446 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1446 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1447 u8 start_action; 1447 u8 start_action;
1448 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1448 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
1449 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1449 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1450 int ret = 0; 1450 int ret = 0;
1451 u8 update_search_tbl_counter = 0; 1451 u8 update_search_tbl_counter = 0;
@@ -1463,7 +1463,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1463 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1463 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1464 /* avoid antenna B and MIMO */ 1464 /* avoid antenna B and MIMO */
1465 valid_tx_ant = 1465 valid_tx_ant =
1466 first_antenna(priv->hw_params.valid_tx_ant); 1466 first_antenna(priv->eeprom_data->valid_tx_ant);
1467 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && 1467 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 &&
1468 tbl->action != IWL_LEGACY_SWITCH_SISO) 1468 tbl->action != IWL_LEGACY_SWITCH_SISO)
1469 tbl->action = IWL_LEGACY_SWITCH_SISO; 1469 tbl->action = IWL_LEGACY_SWITCH_SISO;
@@ -1487,7 +1487,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1487 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1487 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1488 tbl->action = IWL_LEGACY_SWITCH_SISO; 1488 tbl->action = IWL_LEGACY_SWITCH_SISO;
1489 valid_tx_ant = 1489 valid_tx_ant =
1490 first_antenna(priv->hw_params.valid_tx_ant); 1490 first_antenna(priv->eeprom_data->valid_tx_ant);
1491 } 1491 }
1492 1492
1493 start_action = tbl->action; 1493 start_action = tbl->action;
@@ -1621,7 +1621,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1621 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1621 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1622 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1622 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1623 u8 start_action; 1623 u8 start_action;
1624 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1624 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
1625 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1625 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1626 u8 update_search_tbl_counter = 0; 1626 u8 update_search_tbl_counter = 0;
1627 int ret; 1627 int ret;
@@ -1639,7 +1639,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1639 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1639 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1640 /* avoid antenna B and MIMO */ 1640 /* avoid antenna B and MIMO */
1641 valid_tx_ant = 1641 valid_tx_ant =
1642 first_antenna(priv->hw_params.valid_tx_ant); 1642 first_antenna(priv->eeprom_data->valid_tx_ant);
1643 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) 1643 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1)
1644 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1644 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1645 break; 1645 break;
@@ -1657,7 +1657,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1657 /* configure as 1x1 if bt full concurrency */ 1657 /* configure as 1x1 if bt full concurrency */
1658 if (priv->bt_full_concurrent) { 1658 if (priv->bt_full_concurrent) {
1659 valid_tx_ant = 1659 valid_tx_ant =
1660 first_antenna(priv->hw_params.valid_tx_ant); 1660 first_antenna(priv->eeprom_data->valid_tx_ant);
1661 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1661 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1662 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1662 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1663 } 1663 }
@@ -1793,7 +1793,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
1793 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1793 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1794 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1794 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1795 u8 start_action; 1795 u8 start_action;
1796 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1796 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
1797 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1797 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1798 u8 update_search_tbl_counter = 0; 1798 u8 update_search_tbl_counter = 0;
1799 int ret; 1799 int ret;
@@ -1963,7 +1963,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
1963 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1963 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1964 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1964 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1965 u8 start_action; 1965 u8 start_action;
1966 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1966 u8 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
1967 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1967 u8 tx_chains_num = priv->hw_params.tx_chains_num;
1968 int ret; 1968 int ret;
1969 u8 update_search_tbl_counter = 0; 1969 u8 update_search_tbl_counter = 0;
@@ -2697,7 +2697,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2697 2697
2698 i = lq_sta->last_txrate_idx; 2698 i = lq_sta->last_txrate_idx;
2699 2699
2700 valid_tx_ant = priv->hw_params.valid_tx_ant; 2700 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
2701 2701
2702 if (!lq_sta->search_better_tbl) 2702 if (!lq_sta->search_better_tbl)
2703 active_tbl = lq_sta->active_tbl; 2703 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 2891
2892 /* These values will be overridden later */ 2892 /* These values will be overridden later */
2893 lq_sta->lq.general_params.single_stream_ant_msk = 2893 lq_sta->lq.general_params.single_stream_ant_msk =
2894 first_antenna(priv->hw_params.valid_tx_ant); 2894 first_antenna(priv->eeprom_data->valid_tx_ant);
2895 lq_sta->lq.general_params.dual_stream_ant_msk = 2895 lq_sta->lq.general_params.dual_stream_ant_msk =
2896 priv->hw_params.valid_tx_ant & 2896 priv->eeprom_data->valid_tx_ant &
2897 ~first_antenna(priv->hw_params.valid_tx_ant); 2897 ~first_antenna(priv->eeprom_data->valid_tx_ant);
2898 if (!lq_sta->lq.general_params.dual_stream_ant_msk) { 2898 if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
2899 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; 2899 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
2900 } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { 2900 } else if (num_of_ant(priv->eeprom_data->valid_tx_ant) == 2) {
2901 lq_sta->lq.general_params.dual_stream_ant_msk = 2901 lq_sta->lq.general_params.dual_stream_ant_msk =
2902 priv->hw_params.valid_tx_ant; 2902 priv->eeprom_data->valid_tx_ant;
2903 } 2903 }
2904 2904
2905 /* as default allow aggregation for all tids */ 2905 /* as default allow aggregation for all tids */
@@ -2945,7 +2945,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2945 if (priv && priv->bt_full_concurrent) { 2945 if (priv && priv->bt_full_concurrent) {
2946 /* 1x1 only */ 2946 /* 1x1 only */
2947 tbl_type.ant_type = 2947 tbl_type.ant_type =
2948 first_antenna(priv->hw_params.valid_tx_ant); 2948 first_antenna(priv->eeprom_data->valid_tx_ant);
2949 } 2949 }
2950 2950
2951 /* How many times should we repeat the initial rate? */ 2951 /* How many times should we repeat the initial rate? */
@@ -2977,7 +2977,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2977 if (priv->bt_full_concurrent) 2977 if (priv->bt_full_concurrent)
2978 valid_tx_ant = ANT_A; 2978 valid_tx_ant = ANT_A;
2979 else 2979 else
2980 valid_tx_ant = priv->hw_params.valid_tx_ant; 2980 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
2981 } 2981 }
2982 2982
2983 /* Fill rest of rate table */ 2983 /* Fill rest of rate table */
@@ -3011,7 +3011,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
3011 if (priv && priv->bt_full_concurrent) { 3011 if (priv && priv->bt_full_concurrent) {
3012 /* 1x1 only */ 3012 /* 1x1 only */
3013 tbl_type.ant_type = 3013 tbl_type.ant_type =
3014 first_antenna(priv->hw_params.valid_tx_ant); 3014 first_antenna(priv->eeprom_data->valid_tx_ant);
3015 } 3015 }
3016 3016
3017 /* Indicate to uCode which entries might be MIMO. 3017 /* 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 u8 ant_sel_tx; 3098 u8 ant_sel_tx;
3099 3099
3100 priv = lq_sta->drv; 3100 priv = lq_sta->drv;
3101 valid_tx_ant = priv->hw_params.valid_tx_ant; 3101 valid_tx_ant = priv->eeprom_data->valid_tx_ant;
3102 if (lq_sta->dbg_fixed_rate) { 3102 if (lq_sta->dbg_fixed_rate) {
3103 ant_sel_tx = 3103 ant_sel_tx =
3104 ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) 3104 ((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 desc += sprintf(buff+desc, "fixed rate 0x%X\n", 3169 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
3170 lq_sta->dbg_fixed_rate); 3170 lq_sta->dbg_fixed_rate);
3171 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", 3171 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
3172 (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", 3172 (priv->eeprom_data->valid_tx_ant & ANT_A) ? "ANT_A," : "",
3173 (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", 3173 (priv->eeprom_data->valid_tx_ant & ANT_B) ? "ANT_B," : "",
3174 (priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); 3174 (priv->eeprom_data->valid_tx_ant & ANT_C) ? "ANT_C" : "");
3175 desc += sprintf(buff+desc, "lq type %s\n", 3175 desc += sprintf(buff+desc, "lq type %s\n",
3176 (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); 3176 (is_legacy(tbl->lq_type)) ? "legacy" : "HT");
3177 if (is_Ht(tbl->lq_type)) { 3177 if (is_Ht(tbl->lq_type)) {