iwlwifi: mvm: take the valid_{rx,tx}_ant from the TLV
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sat, 9 Mar 2013 18:38:19 +0000 (20:38 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 20 Mar 2013 13:17:12 +0000 (14:17 +0100)
This is the right source of information for the valid Tx
antennas, not the NVM.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw.h
drivers/net/wireless/iwlwifi/mvm/fw.c
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
drivers/net/wireless/iwlwifi/mvm/scan.c

index 4e932e04d87ea7b095c02a5ee396b6d6b327e13b..c4c446d41eb081bf0f7eb37034a3137faf5a281e 100644 (file)
@@ -203,4 +203,16 @@ struct iwl_fw {
        bool mvm_fw;
 };
 
+static inline u8 iwl_fw_valid_tx_ant(const struct iwl_fw *fw)
+{
+       return (fw->phy_config & FW_PHY_CFG_TX_CHAIN) >>
+               FW_PHY_CFG_TX_CHAIN_POS;
+}
+
+static inline u8 iwl_fw_valid_rx_ant(const struct iwl_fw *fw)
+{
+       return (fw->phy_config & FW_PHY_CFG_RX_CHAIN) >>
+               FW_PHY_CFG_RX_CHAIN_POS;
+}
+
 #endif  /* __iwl_fw_h__ */
index b497647bf34bfee636b5cc9e0ad1e76212108dc8..e18c92dd60ecdd768c86e23fe6d0f6505f396018 100644 (file)
@@ -114,7 +114,7 @@ static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant)
                .valid = cpu_to_le32(valid_tx_ant),
        };
 
-       IWL_DEBUG_HC(mvm, "select valid tx ant: %u\n", valid_tx_ant);
+       IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant);
        return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, CMD_SYNC,
                                    sizeof(tx_ant_cmd), &tx_ant_cmd);
 }
@@ -327,7 +327,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
        WARN_ON(ret);
 
        /* Send TX valid antennas before triggering calibrations */
-       ret = iwl_send_tx_ant_cfg(mvm, mvm->nvm_data->valid_tx_ant);
+       ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw));
        if (ret)
                goto error;
 
@@ -413,7 +413,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
                goto error;
        }
 
-       ret = iwl_send_tx_ant_cfg(mvm, mvm->nvm_data->valid_tx_ant);
+       ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw));
        if (ret)
                goto error;
 
@@ -467,7 +467,7 @@ int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
                goto error;
        }
 
-       ret = iwl_send_tx_ant_cfg(mvm, mvm->nvm_data->valid_tx_ant);
+       ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw));
        if (ret)
                goto error;
 
index c45822fb937d751cde85198a2d672304424e7c84..86e312a4f6291d53c1bb366ed13e7d2e1a73381d 100644 (file)
@@ -803,7 +803,7 @@ static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
                                             TX_CMD_FLG_TSF);
 
        mvm->mgmt_last_antenna_idx =
-               iwl_mvm_next_antenna(mvm, mvm->nvm_data->valid_tx_ant,
+               iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw),
                                     mvm->mgmt_last_antenna_idx);
 
        beacon_cmd.tx.rate_n_flags =
index 0d537e035ef09848df94a49ec383dbea5546da97..0f0b44eabd937a88ce615e3f6a5fe5ada0fe805f 100644 (file)
@@ -142,7 +142,7 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
                                      struct cfg80211_chan_def *chandef,
                                      u8 chains_static, u8 chains_dynamic)
 {
-       u8 valid_rx_chains, active_cnt, idle_cnt;
+       u8 active_cnt, idle_cnt;
 
        /* Set the channel info data */
        cmd->ci.band = (chandef->chan->band == IEEE80211_BAND_2GHZ ?
@@ -158,17 +158,16 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
         * Need to add on chain noise calibration limitations, and
         * BT coex considerations.
         */
-       valid_rx_chains = mvm->nvm_data->valid_rx_ant;
        idle_cnt = chains_static;
        active_cnt = chains_dynamic;
 
-       cmd->rxchain_info = cpu_to_le32(valid_rx_chains <<
+       cmd->rxchain_info = cpu_to_le32(iwl_fw_valid_rx_ant(mvm->fw) <<
                                        PHY_RX_CHAIN_VALID_POS);
        cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS);
        cmd->rxchain_info |= cpu_to_le32(active_cnt <<
                                         PHY_RX_CHAIN_MIMO_CNT_POS);
 
-       cmd->txchain_info = cpu_to_le32(mvm->nvm_data->valid_tx_ant);
+       cmd->txchain_info = cpu_to_le32(iwl_fw_valid_tx_ant(mvm->fw));
 }
 
 /*
index 0d3c76b29242c6c1b885dcb870cbf5eb90d58aa7..2157b0f8ced5cc7c314a246d758a869128e57c59 100644 (file)
@@ -74,7 +74,7 @@
 static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm)
 {
        u16 rx_chain;
-       u8 rx_ant = mvm->nvm_data->valid_rx_ant;
+       u8 rx_ant = iwl_fw_valid_rx_ant(mvm->fw);
 
        rx_chain = rx_ant << PHY_RX_CHAIN_VALID_POS;
        rx_chain |= rx_ant << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS;
@@ -115,7 +115,7 @@ iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band,
        u32 tx_ant;
 
        mvm->scan_last_antenna_idx =
-               iwl_mvm_next_antenna(mvm, mvm->nvm_data->valid_tx_ant,
+               iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw),
                                     mvm->scan_last_antenna_idx);
        tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS;