Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291238
b: refs/heads/master
c: 0692fe4
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Mar 7, 2012
1 parent 5158f89 commit 9444029
Show file tree
Hide file tree
Showing 20 changed files with 237 additions and 164 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e19918855dc4822a24787a6d0048205b011e5ecb
refs/heads/master: 0692fe41b36159be5d8c7d4eef0699e79c383c85
5 changes: 2 additions & 3 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
#include "iwl-trans.h"
#include "iwl-agn.h"
#include "iwl-wifi.h"
#include "iwl-ucode.h"

/*****************************************************************************
* INIT calibrations framework
Expand Down Expand Up @@ -644,7 +643,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
data->last_bad_plcp_cnt_cck = 0;
data->last_fa_cnt_cck = 0;

if (nic(priv)->fw.enhance_sensitivity_table)
if (priv->fw->enhance_sensitivity_table)
ret |= iwl_enhance_sensitivity_write(priv);
else
ret |= iwl_sensitivity_write(priv);
Expand Down Expand Up @@ -754,7 +753,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv)

iwl_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
iwl_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis);
if (nic(priv)->fw.enhance_sensitivity_table)
if (priv->fw->enhance_sensitivity_table)
iwl_enhance_sensitivity_write(priv);
else
iwl_sensitivity_write(priv);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED;
tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO;

if (IWL_UCODE_API(nic(priv)->fw.ucode_ver) == 1)
if (IWL_UCODE_API(priv->fw->ucode_ver) == 1)
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
else
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

#include <asm/div64.h>

#include "iwl-ucode.h"
#include "iwl-eeprom.h"
#include "iwl-wifi.h"
#include "iwl-dev.h"
Expand Down Expand Up @@ -616,7 +615,7 @@ static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
.valid = cpu_to_le32(valid_tx_ant),
};

if (IWL_UCODE_API(nic(priv)->fw.ucode_ver) > 1) {
if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) {
IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
return iwl_trans_send_cmd_pdu(trans(priv),
TX_ANT_CONFIGURATION_CMD,
Expand Down Expand Up @@ -1174,9 +1173,9 @@ static void iwl_debug_config(struct iwl_priv *priv)
#endif
}

static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans)
static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
const struct iwl_fw *fw)
{
struct iwl_fw *fw = &nic(trans)->fw;
int err = 0;
struct iwl_priv *priv;
struct ieee80211_hw *hw;
Expand All @@ -1200,6 +1199,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans)
priv = IWL_OP_MODE_GET_DVM(op_mode);
priv->shrd = trans->shrd;
priv->shrd->priv = priv;
priv->fw = fw;
/* TODO: remove fw from shared data later */
priv->shrd->fw = fw;

iwl_trans_configure(trans(priv), op_mode);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-agn.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void iwl_nic_error(struct iwl_op_mode *op_mode);
/* MAC80211 */
struct ieee80211_hw *iwl_alloc_all(void);
int iwlagn_mac_setup_register(struct iwl_priv *priv,
struct iwl_ucode_capabilities *capa);
const struct iwl_ucode_capabilities *capa);
void iwlagn_mac_unregister(struct iwl_priv *priv);

/* RXON */
Expand Down
12 changes: 0 additions & 12 deletions trunk/drivers/net/wireless/iwlwifi/iwl-commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@

struct iwl_priv;

/* uCode version contains 4 values: Major/Minor/API/Serial */
#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)


/* Tx rates */
#define IWL_CCK_RATES 4
#define IWL_OFDM_RATES 8
Expand Down Expand Up @@ -3151,8 +3144,6 @@ struct iwl_enhance_sensitivity_cmd {
*/

/* Phy calibration command for series */
/* The default calibrate table size if not specified by firmware */
#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
enum {
IWL_PHY_CALIBRATE_DC_CMD = 8,
IWL_PHY_CALIBRATE_LO_CMD = 9,
Expand All @@ -3161,11 +3152,8 @@ enum {
IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD = 18,
IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
};

#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)

/* This enum defines the bitmap of various calibrations to enable in both
* init ucode and runtime ucode through CALIBRATION_CFG_CMD.
*/
Expand Down
9 changes: 4 additions & 5 deletions trunk/drivers/net/wireless/iwlwifi/iwl-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,11 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,

/* default is to dump the entire data segment */
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
struct iwl_nic *nic = nic(priv);
priv->dbgfs_sram_offset = 0x800000;
if (nic->shrd->ucode_type == IWL_UCODE_INIT)
priv->dbgfs_sram_len = nic->fw.ucode_init.data.len;
if (priv->shrd->ucode_type == IWL_UCODE_INIT)
priv->dbgfs_sram_len = priv->fw->ucode_init.data.len;
else
priv->dbgfs_sram_len = nic->fw.ucode_rt.data.len;
priv->dbgfs_sram_len = priv->fw->ucode_rt.data.len;
}
len = priv->dbgfs_sram_len;

Expand Down Expand Up @@ -343,7 +342,7 @@ static ssize_t iwl_dbgfs_wowlan_sram_read(struct file *file,

return simple_read_from_buffer(user_buf, count, ppos,
priv->wowlan_sram,
nic(priv)->fw.ucode_wowlan.data.len);
priv->fw->ucode_wowlan.data.len);
}
static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ struct iwl_priv {

/*data shared among all the driver's layers */
struct iwl_shared *shrd;
const struct iwl_fw *fw;

spinlock_t sta_lock;

Expand Down
49 changes: 29 additions & 20 deletions trunk/drivers/net/wireless/iwlwifi/iwl-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
#include "iwl-shared.h"
#include "iwl-op-mode.h"

/* private includes */
#include "iwl-ucode.h"

static void iwl_free_fw_desc(struct iwl_nic *nic, struct fw_desc *desc)
{
if (desc->v_addr)
Expand Down Expand Up @@ -641,20 +644,20 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
* for each event, which is of mode 1 (including timestamp) for all
* new microcodes that include this information.
*/
nic->init_evtlog_ptr = pieces.init_evtlog_ptr;
fw->init_evtlog_ptr = pieces.init_evtlog_ptr;
if (pieces.init_evtlog_size)
nic->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
else
nic->init_evtlog_size =
fw->init_evtlog_size =
cfg->base_params->max_event_log_size;
nic->init_errlog_ptr = pieces.init_errlog_ptr;
nic->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
fw->init_errlog_ptr = pieces.init_errlog_ptr;
fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
if (pieces.inst_evtlog_size)
nic->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
else
nic->inst_evtlog_size =
fw->inst_evtlog_size =
cfg->base_params->max_event_log_size;
nic->inst_errlog_ptr = pieces.inst_errlog_ptr;
fw->inst_errlog_ptr = pieces.inst_errlog_ptr;

/*
* figure out the offset of chain noise reset and gain commands
Expand All @@ -669,7 +672,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
release_firmware(ucode_raw);
complete(&nic->request_firmware_complete);

nic->op_mode = iwl_dvm_ops.start(nic->shrd->trans);
nic->op_mode = iwl_dvm_ops.start(nic->shrd->trans, &nic->fw);

if (!nic->op_mode)
goto out_unbind;
Expand All @@ -695,38 +698,44 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
int iwl_drv_start(struct iwl_shared *shrd,
struct iwl_trans *trans, const struct iwl_cfg *cfg)
{
struct iwl_nic *nic;
int ret;

shrd->cfg = cfg;

shrd->nic = kzalloc(sizeof(*shrd->nic), GFP_KERNEL);
if (!shrd->nic) {
nic = kzalloc(sizeof(*nic), GFP_KERNEL);
if (!nic) {
dev_printk(KERN_ERR, trans->dev, "Couldn't allocate iwl_nic");
return -ENOMEM;
}
shrd->nic->shrd = shrd;
nic->shrd = shrd;
shrd->nic = nic;

init_completion(&shrd->nic->request_firmware_complete);
init_completion(&nic->request_firmware_complete);

ret = iwl_request_firmware(shrd->nic, true);
ret = iwl_request_firmware(nic, true);

if (ret) {
dev_printk(KERN_ERR, trans->dev, "Couldn't request the fw");
kfree(shrd->nic);
kfree(nic);
shrd->nic = NULL;
}

return ret;
}

void iwl_drv_stop(struct iwl_shared *shrd)
{
wait_for_completion(&shrd->nic->request_firmware_complete);
struct iwl_nic *nic = shrd->nic;

wait_for_completion(&nic->request_firmware_complete);

/* op_mode can be NULL if its start failed */
if (shrd->nic->op_mode)
iwl_op_mode_stop(shrd->nic->op_mode);
if (nic->op_mode)
iwl_op_mode_stop(nic->op_mode);

iwl_dealloc_ucode(shrd->nic);
iwl_dealloc_ucode(nic);

kfree(shrd->nic);
kfree(nic);
shrd->nic = NULL;
}
Loading

0 comments on commit 9444029

Please sign in to comment.