Skip to content

Commit

Permalink
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/iwlwifi/iwlwifi-next
  • Loading branch information
linvjw committed Jun 20, 2012
2 parents ce77903 + 8d40f4e commit 324640e
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 85 deletions.
2 changes: 0 additions & 2 deletions drivers/net/wireless/iwlwifi/dvm/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ enum iwl_scan_type {
*
* @tx_chains_num: Number of TX chains
* @rx_chains_num: Number of RX chains
* @sku: sku read from EEPROM
* @ct_kill_threshold: temperature threshold - in hw dependent unit
* @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
* relevant for 1000, 6000 and up
Expand All @@ -579,7 +578,6 @@ struct iwl_hw_params {
u8 tx_chains_num;
u8 rx_chains_num;
bool use_rts_for_aggregation;
u16 sku;
u32 ct_kill_threshold;
u32 ct_kill_exit_threshold;

Expand Down
13 changes: 0 additions & 13 deletions drivers/net/wireless/iwlwifi/dvm/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,6 @@ struct iwl_lib_ops iwl2030_lib = {
*/

/* NIC configuration for 5000 series */
static void iwl5000_nic_config(struct iwl_priv *priv)
{
/* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted),
* causing ME FW to lose ownership and not being able to obtain it back.
*/
iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG,
APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
}

static const struct iwl_sensitivity_ranges iwl5000_sensitivity = {
.min_nrg_cck = 100,
.auto_corr_min_ofdm = 90,
Expand Down Expand Up @@ -433,14 +422,12 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
struct iwl_lib_ops iwl5000_lib = {
.set_hw_params = iwl5000_hw_set_hw_params,
.set_channel_switch = iwl5000_hw_channel_switch,
.nic_config = iwl5000_nic_config,
.temperature = iwlagn_temperature,
};

struct iwl_lib_ops iwl5150_lib = {
.set_hw_params = iwl5150_hw_set_hw_params,
.set_channel_switch = iwl5000_hw_channel_switch,
.nic_config = iwl5000_nic_config,
.temperature = iwl5150_temperature,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/dvm/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK |
IWL_PAN_SCD_MULTICAST_MSK;

if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE)
if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK;

IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n",
Expand Down
18 changes: 14 additions & 4 deletions drivers/net/wireless/iwlwifi/dvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
*/

if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE)
if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE)
hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
IEEE80211_HW_SUPPORTS_STATIC_SMPS;

Expand Down Expand Up @@ -649,7 +649,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
sta->addr, tid);

if (!(priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE))
if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE))
return -EACCES;

IWL_DEBUG_MAC80211(priv, "enter\n");
Expand Down Expand Up @@ -1036,8 +1036,18 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
mutex_lock(&priv->mutex);

if (test_bit(STATUS_SCAN_HW, &priv->status)) {
err = -EBUSY;
goto out;
/* mac80211 should not scan while ROC or ROC while scanning */
if (WARN_ON_ONCE(priv->scan_type != IWL_SCAN_RADIO_RESET)) {
err = -EBUSY;
goto out;
}

iwl_scan_cancel_timeout(priv, 100);

if (test_bit(STATUS_SCAN_HW, &priv->status)) {
err = -EBUSY;
goto out;
}
}

priv->hw_roc_channel = channel;
Expand Down
29 changes: 20 additions & 9 deletions drivers/net/wireless/iwlwifi/dvm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@
#include "iwl-op-mode.h"
#include "iwl-drv.h"
#include "iwl-modparams.h"
#include "iwl-prph.h"

#include "dev.h"
#include "calib.h"
#include "agn.h"


/******************************************************************************
*
* module boiler plate
Expand Down Expand Up @@ -1185,9 +1187,6 @@ static void iwl_set_hw_params(struct iwl_priv *priv)
priv->hw_params.use_rts_for_aggregation =
priv->cfg->ht_params->use_rts_for_aggregation;

if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
priv->hw_params.sku &= ~EEPROM_SKU_CAP_11N_ENABLE;

/* Device-specific setup */
priv->lib->set_hw_params(priv);
}
Expand Down Expand Up @@ -1232,20 +1231,20 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
{
u16 radio_cfg;

priv->hw_params.sku = priv->eeprom_data->sku;
priv->eeprom_data->sku = priv->eeprom_data->sku;

if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE &&
if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE &&
!priv->cfg->ht_params) {
IWL_ERR(priv, "Invalid 11n configuration\n");
return -EINVAL;
}

if (!priv->hw_params.sku) {
if (!priv->eeprom_data->sku) {
IWL_ERR(priv, "Invalid device sku\n");
return -EINVAL;
}

IWL_INFO(priv, "Device SKU: 0x%X\n", priv->hw_params.sku);
IWL_INFO(priv, "Device SKU: 0x%X\n", priv->eeprom_data->sku);

radio_cfg = priv->eeprom_data->radio_cfg;

Expand Down Expand Up @@ -1352,6 +1351,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED;
trans_cfg.command_names = iwl_dvm_cmd_strings;

WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE <
priv->cfg->base_params->num_of_queues);

ucode_flags = fw->ucode_capa.flags;

#ifndef CONFIG_IWLWIFI_P2P
Expand Down Expand Up @@ -1448,7 +1450,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
************************/
iwl_set_hw_params(priv);

if (!(priv->hw_params.sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
if (!(priv->eeprom_data->sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN;
/*
Expand Down Expand Up @@ -2073,7 +2075,16 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);

priv->lib->nic_config(priv);
/* W/A : NIC is stuck in a reset state after Early PCIe power off
* (PCIe power is lost before PERST# is asserted),
* causing ME FW to lose ownership and not being able to obtain it back.
*/
iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG,
APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);

if (priv->lib->nic_config)
priv->lib->nic_config(priv);
}

static void iwl_wimax_active(struct iwl_op_mode *op_mode)
Expand Down
41 changes: 19 additions & 22 deletions drivers/net/wireless/iwlwifi/dvm/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
#define IWL_CHANNEL_TUNE_TIME 5
#define MAX_SCAN_CHANNEL 50

/* For reset radio, need minimal dwell time only */
#define IWL_RADIO_RESET_DWELL_TIME 5

static int iwl_send_scan_abort(struct iwl_priv *priv)
{
int ret;
Expand Down Expand Up @@ -469,45 +472,39 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
return 0;
}

static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
struct ieee80211_vif *vif,
enum ieee80211_band band,
struct iwl_scan_channel *scan_ch)
static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
struct ieee80211_vif *vif,
enum ieee80211_band band,
struct iwl_scan_channel *scan_ch)
{
const struct ieee80211_supported_band *sband;
u16 passive_dwell = 0;
u16 active_dwell = 0;
int added = 0;
u16 channel = 0;
u16 channel;

sband = iwl_get_hw_mode(priv, band);
if (!sband) {
IWL_ERR(priv, "invalid band\n");
return added;
return 0;
}

active_dwell = iwl_get_active_dwell_time(priv, band, 0);
passive_dwell = iwl_get_passive_dwell_time(priv, band);

if (passive_dwell <= active_dwell)
passive_dwell = active_dwell + 1;

channel = iwl_get_single_channel_number(priv, band);
if (channel) {
scan_ch->channel = cpu_to_le16(channel);
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
scan_ch->active_dwell = cpu_to_le16(active_dwell);
scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
scan_ch->active_dwell =
cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
scan_ch->passive_dwell =
cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
/* Set txpower levels to defaults */
scan_ch->dsp_atten = 110;
if (band == IEEE80211_BAND_5GHZ)
scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
else
scan_ch->tx_gain = ((1 << 5) | (5 << 3));
added++;
} else
IWL_ERR(priv, "no valid channel found\n");
return added;
return 1;
}

IWL_ERR(priv, "no valid channel found\n");
return 0;
}

static int iwl_get_channels_for_scan(struct iwl_priv *priv,
Expand Down Expand Up @@ -896,7 +893,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
switch (priv->scan_type) {
case IWL_SCAN_RADIO_RESET:
scan->channel_count =
iwl_get_single_channel_for_scan(priv, vif, band,
iwl_get_channel_for_reset_scan(priv, vif, band,
(void *)&scan->data[cmd_len]);
break;
case IWL_SCAN_NORMAL:
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,9 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
EEPROM_RADIO_CONFIG);
data->sku = iwl_eeprom_query16(eeprom, eeprom_size,
EEPROM_SKU_CAP);
if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL)
data->sku &= ~EEPROM_SKU_CAP_11N_ENABLE;

data->eeprom_version = iwl_eeprom_query16(eeprom, eeprom_size,
EEPROM_VERSION);

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/wireless/iwlwifi/iwl-notif-wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,12 @@ EXPORT_SYMBOL_GPL(iwl_notification_wait_notify);

void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait)
{
unsigned long flags;
struct iwl_notification_wait *wait_entry;

spin_lock_irqsave(&notif_wait->notif_wait_lock, flags);
spin_lock(&notif_wait->notif_wait_lock);
list_for_each_entry(wait_entry, &notif_wait->notif_waits, list)
wait_entry->aborted = true;
spin_unlock_irqrestore(&notif_wait->notif_wait_lock, flags);
spin_unlock(&notif_wait->notif_wait_lock);

wake_up_all(&notif_wait->notif_waitq);
}
Expand Down
16 changes: 9 additions & 7 deletions drivers/net/wireless/iwlwifi/iwl-op-mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,25 @@ struct iwl_cfg;
* May sleep
* @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the
* HCMD the this Rx responds to.
* Must be atomic.
* Must be atomic and called with BH disabled.
* @queue_full: notifies that a HW queue is full.
* Must be atomic
* Must be atomic and called with BH disabled.
* @queue_not_full: notifies that a HW queue is not full any more.
* Must be atomic
* Must be atomic and called with BH disabled.
* @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that
* the radio is killed. Must be atomic.
* @free_skb: allows the transport layer to free skbs that haven't been
* reclaimed by the op_mode. This can happen when the driver is freed and
* there are Tx packets pending in the transport layer.
* Must be atomic
* @nic_error: error notification. Must be atomic
* @cmd_queue_full: Called when the command queue gets full. Must be atomic.
* @nic_error: error notification. Must be atomic and must be called with BH
* disabled.
* @cmd_queue_full: Called when the command queue gets full. Must be atomic and
* called with BH disabled.
* @nic_config: configure NIC, called before firmware is started.
* May sleep
* @wimax_active: invoked when WiMax becomes active. Must be atomic.
* @wimax_active: invoked when WiMax becomes active. Must be atomic and called
* with BH disabled.
*/
struct iwl_op_mode_ops {
struct iwl_op_mode *(*start)(struct iwl_trans *trans,
Expand Down Expand Up @@ -165,7 +168,6 @@ struct iwl_op_mode {
static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode)
{
might_sleep();

op_mode->ops->stop(op_mode);
}

Expand Down
Loading

0 comments on commit 324640e

Please sign in to comment.