mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
iwlwifi: move eeprom pointer from iwl_priv to iwl_shared
The eeprom image is a device level component, move from iwl_priv to iwl_shared, with associated code changes. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
This commit is contained in:
parent
b8deb4925f
commit
ab36eab24e
12 changed files with 78 additions and 72 deletions
|
@ -134,10 +134,10 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
|
||||||
|
|
||||||
#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5)
|
#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5)
|
||||||
|
|
||||||
static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
|
static s32 iwl_temp_calib_to_offset(struct iwl_shared *shrd)
|
||||||
{
|
{
|
||||||
u16 temperature, voltage;
|
u16 temperature, voltage;
|
||||||
__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv,
|
__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(shrd,
|
||||||
EEPROM_KELVIN_TEMPERATURE);
|
EEPROM_KELVIN_TEMPERATURE);
|
||||||
|
|
||||||
temperature = le16_to_cpu(temp_calib[0]);
|
temperature = le16_to_cpu(temp_calib[0]);
|
||||||
|
@ -151,7 +151,7 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
|
const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
|
||||||
s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
|
s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
|
||||||
iwl_temp_calib_to_offset(priv);
|
iwl_temp_calib_to_offset(priv->shrd);
|
||||||
|
|
||||||
hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
|
hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
|
||||||
static void iwl5150_temperature(struct iwl_priv *priv)
|
static void iwl5150_temperature(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
u32 vt = 0;
|
u32 vt = 0;
|
||||||
s32 offset = iwl_temp_calib_to_offset(priv);
|
s32 offset = iwl_temp_calib_to_offset(priv->shrd);
|
||||||
|
|
||||||
vt = le32_to_cpu(priv->statistics.common.temperature);
|
vt = le32_to_cpu(priv->statistics.common.temperature);
|
||||||
vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
|
vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset;
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
|
||||||
static void iwl6050_additional_nic_config(struct iwl_priv *priv)
|
static void iwl6050_additional_nic_config(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
/* Indicate calibration version to uCode. */
|
/* Indicate calibration version to uCode. */
|
||||||
if (iwlagn_eeprom_calib_version(priv) >= 6)
|
if (iwl_eeprom_calib_version(priv->shrd) >= 6)
|
||||||
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
||||||
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
|
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ static void iwl6050_additional_nic_config(struct iwl_priv *priv)
|
||||||
static void iwl6150_additional_nic_config(struct iwl_priv *priv)
|
static void iwl6150_additional_nic_config(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
/* Indicate calibration version to uCode. */
|
/* Indicate calibration version to uCode. */
|
||||||
if (iwlagn_eeprom_calib_version(priv) >= 6)
|
if (iwl_eeprom_calib_version(priv->shrd) >= 6)
|
||||||
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
||||||
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
|
CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
|
||||||
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
iwl_set_bit(bus(priv), CSR_GP_DRIVER_REG,
|
||||||
|
|
|
@ -92,11 +92,11 @@ void iwlagn_temperature(struct iwl_priv *priv)
|
||||||
iwl_tt_handler(priv);
|
iwl_tt_handler(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
|
u16 iwl_eeprom_calib_version(struct iwl_shared *shrd)
|
||||||
{
|
{
|
||||||
struct iwl_eeprom_calib_hdr *hdr;
|
struct iwl_eeprom_calib_hdr *hdr;
|
||||||
|
|
||||||
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
|
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(shrd,
|
||||||
EEPROM_CALIB_ALL);
|
EEPROM_CALIB_ALL);
|
||||||
return hdr->version;
|
return hdr->version;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
|
||||||
/*
|
/*
|
||||||
* EEPROM
|
* EEPROM
|
||||||
*/
|
*/
|
||||||
static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
|
static u32 eeprom_indirect_address(const struct iwl_shared *shrd, u32 address)
|
||||||
{
|
{
|
||||||
u16 offset = 0;
|
u16 offset = 0;
|
||||||
|
|
||||||
|
@ -114,31 +114,31 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
|
||||||
|
|
||||||
switch (address & INDIRECT_TYPE_MSK) {
|
switch (address & INDIRECT_TYPE_MSK) {
|
||||||
case INDIRECT_HOST:
|
case INDIRECT_HOST:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_HOST);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_HOST);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_GENERAL:
|
case INDIRECT_GENERAL:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_GENERAL);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_GENERAL);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_REGULATORY:
|
case INDIRECT_REGULATORY:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_REGULATORY);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_TXP_LIMIT:
|
case INDIRECT_TXP_LIMIT:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_TXP_LIMIT_SIZE:
|
case INDIRECT_TXP_LIMIT_SIZE:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT_SIZE);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_CALIBRATION:
|
case INDIRECT_CALIBRATION:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_CALIBRATION);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_PROCESS_ADJST:
|
case INDIRECT_PROCESS_ADJST:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_PROCESS_ADJST);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_PROCESS_ADJST);
|
||||||
break;
|
break;
|
||||||
case INDIRECT_OTHERS:
|
case INDIRECT_OTHERS:
|
||||||
offset = iwl_eeprom_query16(priv, EEPROM_LINK_OTHERS);
|
offset = iwl_eeprom_query16(shrd, EEPROM_LINK_OTHERS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
IWL_ERR(priv, "illegal indirect type: 0x%X\n",
|
IWL_ERR(shrd->trans, "illegal indirect type: 0x%X\n",
|
||||||
address & INDIRECT_TYPE_MSK);
|
address & INDIRECT_TYPE_MSK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
|
||||||
return (address & ADDRESS_MSK) + (offset << 1);
|
return (address & ADDRESS_MSK) + (offset << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset)
|
const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset)
|
||||||
{
|
{
|
||||||
u32 address = eeprom_indirect_address(priv, offset);
|
u32 address = eeprom_indirect_address(shrd, offset);
|
||||||
BUG_ON(address >= priv->cfg->base_params->eeprom_size);
|
BUG_ON(address >= shrd->priv->cfg->base_params->eeprom_size);
|
||||||
return &priv->eeprom[address];
|
return &shrd->eeprom[address];
|
||||||
}
|
}
|
||||||
|
|
||||||
struct iwl_mod_params iwlagn_mod_params = {
|
struct iwl_mod_params iwlagn_mod_params = {
|
||||||
|
|
|
@ -1822,11 +1822,11 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
|
||||||
goto out_free_eeprom;
|
goto out_free_eeprom;
|
||||||
|
|
||||||
/* extract MAC Address */
|
/* extract MAC Address */
|
||||||
iwl_eeprom_get_mac(priv, priv->addresses[0].addr);
|
iwl_eeprom_get_mac(priv->shrd, priv->addresses[0].addr);
|
||||||
IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
|
IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
|
||||||
priv->hw->wiphy->addresses = priv->addresses;
|
priv->hw->wiphy->addresses = priv->addresses;
|
||||||
priv->hw->wiphy->n_addresses = 1;
|
priv->hw->wiphy->n_addresses = 1;
|
||||||
num_mac = iwl_eeprom_query16(priv, EEPROM_NUM_MAC_ADDRESS);
|
num_mac = iwl_eeprom_query16(priv->shrd, EEPROM_NUM_MAC_ADDRESS);
|
||||||
if (num_mac > 1) {
|
if (num_mac > 1) {
|
||||||
memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
|
memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
|
||||||
ETH_ALEN);
|
ETH_ALEN);
|
||||||
|
@ -1891,7 +1891,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
|
||||||
priv->shrd->workqueue = NULL;
|
priv->shrd->workqueue = NULL;
|
||||||
iwl_uninit_drv(priv);
|
iwl_uninit_drv(priv);
|
||||||
out_free_eeprom:
|
out_free_eeprom:
|
||||||
iwl_eeprom_free(priv);
|
iwl_eeprom_free(priv->shrd);
|
||||||
out_free_trans:
|
out_free_trans:
|
||||||
iwl_trans_free(trans(priv));
|
iwl_trans_free(trans(priv));
|
||||||
out_free_traffic_mem:
|
out_free_traffic_mem:
|
||||||
|
@ -1930,7 +1930,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
|
||||||
|
|
||||||
iwl_dealloc_ucode(trans(priv));
|
iwl_dealloc_ucode(trans(priv));
|
||||||
|
|
||||||
iwl_eeprom_free(priv);
|
iwl_eeprom_free(priv->shrd);
|
||||||
|
|
||||||
/*netif_stop_queue(dev); */
|
/*netif_stop_queue(dev); */
|
||||||
flush_workqueue(priv->shrd->workqueue);
|
flush_workqueue(priv->shrd->workqueue);
|
||||||
|
|
|
@ -117,7 +117,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
|
||||||
/* lib */
|
/* lib */
|
||||||
int iwlagn_send_tx_power(struct iwl_priv *priv);
|
int iwlagn_send_tx_power(struct iwl_priv *priv);
|
||||||
void iwlagn_temperature(struct iwl_priv *priv);
|
void iwlagn_temperature(struct iwl_priv *priv);
|
||||||
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv);
|
u16 iwl_eeprom_calib_version(struct iwl_shared *shrd);
|
||||||
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
|
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
|
||||||
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
|
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control);
|
||||||
int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
|
int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
|
||||||
|
@ -354,7 +354,7 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
|
||||||
|
|
||||||
/* eeprom */
|
/* eeprom */
|
||||||
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
|
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
|
||||||
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);
|
void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac);
|
||||||
|
|
||||||
extern int iwlagn_init_alive_start(struct iwl_priv *priv);
|
extern int iwlagn_init_alive_start(struct iwl_priv *priv);
|
||||||
extern int iwl_alive_start(struct iwl_priv *priv);
|
extern int iwl_alive_start(struct iwl_priv *priv);
|
||||||
|
|
|
@ -416,7 +416,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = priv->eeprom;
|
ptr = priv->shrd->eeprom;
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
|
IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -428,7 +428,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
|
||||||
IWL_ERR(priv, "Can not allocate Buffer\n");
|
IWL_ERR(priv, "Can not allocate Buffer\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
|
eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION);
|
||||||
pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
|
pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
|
||||||
"version: 0x%x\n",
|
"version: 0x%x\n",
|
||||||
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
||||||
|
|
|
@ -903,10 +903,6 @@ struct iwl_priv {
|
||||||
/* Indication if ieee80211_ops->open has been called */
|
/* Indication if ieee80211_ops->open has been called */
|
||||||
u8 is_open;
|
u8 is_open;
|
||||||
|
|
||||||
/* eeprom -- this is in the card's little endian byte order */
|
|
||||||
u8 *eeprom;
|
|
||||||
struct iwl_eeprom_calib_info *calib_info;
|
|
||||||
|
|
||||||
enum nl80211_iftype iw_mode;
|
enum nl80211_iftype iw_mode;
|
||||||
|
|
||||||
/* Last Rx'd beacon timestamp */
|
/* Last Rx'd beacon timestamp */
|
||||||
|
|
|
@ -215,11 +215,11 @@ static int iwl_eeprom_verify_signature(struct iwl_trans *trans)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset)
|
u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset)
|
||||||
{
|
{
|
||||||
if (!priv->eeprom)
|
if (!shrd->eeprom)
|
||||||
return 0;
|
return 0;
|
||||||
return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8);
|
return (u16)shrd->eeprom[offset] | ((u16)shrd->eeprom[offset + 1] << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
int iwl_eeprom_check_version(struct iwl_priv *priv)
|
int iwl_eeprom_check_version(struct iwl_priv *priv)
|
||||||
|
@ -227,8 +227,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
|
||||||
u16 eeprom_ver;
|
u16 eeprom_ver;
|
||||||
u16 calib_ver;
|
u16 calib_ver;
|
||||||
|
|
||||||
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
|
eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION);
|
||||||
calib_ver = iwlagn_eeprom_calib_version(priv);
|
calib_ver = iwl_eeprom_calib_version(priv->shrd);
|
||||||
|
|
||||||
if (eeprom_ver < priv->cfg->eeprom_ver ||
|
if (eeprom_ver < priv->cfg->eeprom_ver ||
|
||||||
calib_ver < priv->cfg->eeprom_calib_ver)
|
calib_ver < priv->cfg->eeprom_calib_ver)
|
||||||
|
@ -249,11 +249,12 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
|
||||||
|
|
||||||
int iwl_eeprom_check_sku(struct iwl_priv *priv)
|
int iwl_eeprom_check_sku(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
|
struct iwl_shared *shrd = priv->shrd;
|
||||||
u16 radio_cfg;
|
u16 radio_cfg;
|
||||||
|
|
||||||
if (!priv->cfg->sku) {
|
if (!priv->cfg->sku) {
|
||||||
/* not using sku overwrite */
|
/* not using sku overwrite */
|
||||||
priv->cfg->sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP);
|
priv->cfg->sku = iwl_eeprom_query16(shrd, EEPROM_SKU_CAP);
|
||||||
if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE &&
|
if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE &&
|
||||||
!priv->cfg->ht_params) {
|
!priv->cfg->ht_params) {
|
||||||
IWL_ERR(priv, "Invalid 11n configuration\n");
|
IWL_ERR(priv, "Invalid 11n configuration\n");
|
||||||
|
@ -269,7 +270,7 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
|
||||||
|
|
||||||
if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) {
|
if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) {
|
||||||
/* not using .cfg overwrite */
|
/* not using .cfg overwrite */
|
||||||
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
|
radio_cfg = iwl_eeprom_query16(shrd, EEPROM_RADIO_CONFIG);
|
||||||
priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
|
priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
|
||||||
priv->cfg->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
|
priv->cfg->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
|
||||||
if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) {
|
if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) {
|
||||||
|
@ -289,9 +290,9 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac)
|
void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac)
|
||||||
{
|
{
|
||||||
const u8 *addr = iwl_eeprom_query_addr(priv,
|
const u8 *addr = iwl_eeprom_query_addr(shrd,
|
||||||
EEPROM_MAC_ADDRESS);
|
EEPROM_MAC_ADDRESS);
|
||||||
memcpy(mac, addr, ETH_ALEN);
|
memcpy(mac, addr, ETH_ALEN);
|
||||||
}
|
}
|
||||||
|
@ -582,6 +583,7 @@ iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv,
|
||||||
|
|
||||||
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
|
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
|
struct iwl_shared *shrd = priv->shrd;
|
||||||
struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
|
struct iwl_eeprom_enhanced_txpwr *txp_array, *txp;
|
||||||
int idx, entries;
|
int idx, entries;
|
||||||
__le16 *txp_len;
|
__le16 *txp_len;
|
||||||
|
@ -590,10 +592,10 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
|
||||||
BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8);
|
BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8);
|
||||||
|
|
||||||
/* the length is in 16-bit words, but we want entries */
|
/* the length is in 16-bit words, but we want entries */
|
||||||
txp_len = (__le16 *) iwl_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS);
|
txp_len = (__le16 *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_SZ_OFFS);
|
||||||
entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
|
entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN;
|
||||||
|
|
||||||
txp_array = (void *) iwl_eeprom_query_addr(priv, EEPROM_TXP_OFFS);
|
txp_array = (void *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_OFFS);
|
||||||
|
|
||||||
for (idx = 0; idx < entries; idx++) {
|
for (idx = 0; idx < entries; idx++) {
|
||||||
txp = &txp_array[idx];
|
txp = &txp_array[idx];
|
||||||
|
@ -646,12 +648,13 @@ void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv)
|
||||||
/**
|
/**
|
||||||
* iwl_eeprom_init - read EEPROM contents
|
* iwl_eeprom_init - read EEPROM contents
|
||||||
*
|
*
|
||||||
* Load the EEPROM contents from adapter into priv->eeprom
|
* Load the EEPROM contents from adapter into shrd->eeprom
|
||||||
*
|
*
|
||||||
* NOTE: This routine uses the non-debug IO access functions.
|
* NOTE: This routine uses the non-debug IO access functions.
|
||||||
*/
|
*/
|
||||||
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
|
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
|
||||||
{
|
{
|
||||||
|
struct iwl_shared *shrd = priv->shrd;
|
||||||
__le16 *e;
|
__le16 *e;
|
||||||
u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP);
|
u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP);
|
||||||
int sz;
|
int sz;
|
||||||
|
@ -666,12 +669,12 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
|
||||||
/* allocate eeprom */
|
/* allocate eeprom */
|
||||||
sz = priv->cfg->base_params->eeprom_size;
|
sz = priv->cfg->base_params->eeprom_size;
|
||||||
IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
|
IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz);
|
||||||
priv->eeprom = kzalloc(sz, GFP_KERNEL);
|
shrd->eeprom = kzalloc(sz, GFP_KERNEL);
|
||||||
if (!priv->eeprom) {
|
if (!shrd->eeprom) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto alloc_err;
|
goto alloc_err;
|
||||||
}
|
}
|
||||||
e = (__le16 *)priv->eeprom;
|
e = (__le16 *)shrd->eeprom;
|
||||||
|
|
||||||
iwl_apm_init(priv);
|
iwl_apm_init(priv);
|
||||||
|
|
||||||
|
@ -746,7 +749,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
|
||||||
IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
|
IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n",
|
||||||
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
(trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
|
||||||
? "OTP" : "EEPROM",
|
? "OTP" : "EEPROM",
|
||||||
iwl_eeprom_query16(priv, EEPROM_VERSION));
|
iwl_eeprom_query16(shrd, EEPROM_VERSION));
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
|
@ -754,17 +757,17 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (ret)
|
if (ret)
|
||||||
iwl_eeprom_free(priv);
|
iwl_eeprom_free(priv->shrd);
|
||||||
/* Reset chip to save power until we load uCode during "up". */
|
/* Reset chip to save power until we load uCode during "up". */
|
||||||
iwl_apm_stop(priv);
|
iwl_apm_stop(priv);
|
||||||
alloc_err:
|
alloc_err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iwl_eeprom_free(struct iwl_priv *priv)
|
void iwl_eeprom_free(struct iwl_shared *shrd)
|
||||||
{
|
{
|
||||||
kfree(priv->eeprom);
|
kfree(shrd->eeprom);
|
||||||
priv->eeprom = NULL;
|
shrd->eeprom = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iwl_init_band_reference(const struct iwl_priv *priv,
|
static void iwl_init_band_reference(const struct iwl_priv *priv,
|
||||||
|
@ -772,49 +775,50 @@ static void iwl_init_band_reference(const struct iwl_priv *priv,
|
||||||
const struct iwl_eeprom_channel **eeprom_ch_info,
|
const struct iwl_eeprom_channel **eeprom_ch_info,
|
||||||
const u8 **eeprom_ch_index)
|
const u8 **eeprom_ch_index)
|
||||||
{
|
{
|
||||||
|
struct iwl_shared *shrd = priv->shrd;
|
||||||
u32 offset = priv->cfg->lib->
|
u32 offset = priv->cfg->lib->
|
||||||
eeprom_ops.regulatory_bands[eep_band - 1];
|
eeprom_ops.regulatory_bands[eep_band - 1];
|
||||||
switch (eep_band) {
|
switch (eep_band) {
|
||||||
case 1: /* 2.4GHz band */
|
case 1: /* 2.4GHz band */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_1;
|
*eeprom_ch_index = iwl_eeprom_band_1;
|
||||||
break;
|
break;
|
||||||
case 2: /* 4.9GHz band */
|
case 2: /* 4.9GHz band */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_2;
|
*eeprom_ch_index = iwl_eeprom_band_2;
|
||||||
break;
|
break;
|
||||||
case 3: /* 5.2GHz band */
|
case 3: /* 5.2GHz band */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_3;
|
*eeprom_ch_index = iwl_eeprom_band_3;
|
||||||
break;
|
break;
|
||||||
case 4: /* 5.5GHz band */
|
case 4: /* 5.5GHz band */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_4;
|
*eeprom_ch_index = iwl_eeprom_band_4;
|
||||||
break;
|
break;
|
||||||
case 5: /* 5.7GHz band */
|
case 5: /* 5.7GHz band */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_5;
|
*eeprom_ch_index = iwl_eeprom_band_5;
|
||||||
break;
|
break;
|
||||||
case 6: /* 2.4GHz ht40 channels */
|
case 6: /* 2.4GHz ht40 channels */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_6;
|
*eeprom_ch_index = iwl_eeprom_band_6;
|
||||||
break;
|
break;
|
||||||
case 7: /* 5 GHz ht40 channels */
|
case 7: /* 5 GHz ht40 channels */
|
||||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7);
|
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7);
|
||||||
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
*eeprom_ch_info = (struct iwl_eeprom_channel *)
|
||||||
iwl_eeprom_query_addr(priv, offset);
|
iwl_eeprom_query_addr(shrd, offset);
|
||||||
*eeprom_ch_index = iwl_eeprom_band_7;
|
*eeprom_ch_index = iwl_eeprom_band_7;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1064,7 +1068,7 @@ void iwl_rf_config(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
u16 radio_cfg;
|
u16 radio_cfg;
|
||||||
|
|
||||||
radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
|
radio_cfg = iwl_eeprom_query16(priv->shrd, EEPROM_RADIO_CONFIG);
|
||||||
|
|
||||||
/* write radio config values to register */
|
/* write radio config values to register */
|
||||||
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
|
if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#include <net/mac80211.h>
|
#include <net/mac80211.h>
|
||||||
|
|
||||||
struct iwl_priv;
|
struct iwl_priv;
|
||||||
|
struct iwl_shared;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EEPROM access time values:
|
* EEPROM access time values:
|
||||||
|
@ -305,11 +306,11 @@ struct iwl_eeprom_ops {
|
||||||
|
|
||||||
|
|
||||||
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev);
|
int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev);
|
||||||
void iwl_eeprom_free(struct iwl_priv *priv);
|
void iwl_eeprom_free(struct iwl_shared *shrd);
|
||||||
int iwl_eeprom_check_version(struct iwl_priv *priv);
|
int iwl_eeprom_check_version(struct iwl_priv *priv);
|
||||||
int iwl_eeprom_check_sku(struct iwl_priv *priv);
|
int iwl_eeprom_check_sku(struct iwl_priv *priv);
|
||||||
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset);
|
const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset);
|
||||||
u16 iwl_eeprom_query16(const struct iwl_priv *priv, size_t offset);
|
u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset);
|
||||||
int iwl_init_channel_map(struct iwl_priv *priv);
|
int iwl_init_channel_map(struct iwl_priv *priv);
|
||||||
void iwl_free_channel_map(struct iwl_priv *priv);
|
void iwl_free_channel_map(struct iwl_priv *priv);
|
||||||
const struct iwl_channel_info *iwl_get_channel_info(
|
const struct iwl_channel_info *iwl_get_channel_info(
|
||||||
|
|
|
@ -351,6 +351,9 @@ struct iwl_shared {
|
||||||
|
|
||||||
wait_queue_head_t wait_command_queue;
|
wait_queue_head_t wait_command_queue;
|
||||||
|
|
||||||
|
/* eeprom -- this is in the card's little endian byte order */
|
||||||
|
u8 *eeprom;
|
||||||
|
|
||||||
/* ucode related variables */
|
/* ucode related variables */
|
||||||
enum iwl_ucode_type ucode_type;
|
enum iwl_ucode_type ucode_type;
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IWL_TM_CMD_APP2DEV_GET_EEPROM:
|
case IWL_TM_CMD_APP2DEV_GET_EEPROM:
|
||||||
if (priv->eeprom) {
|
if (priv->shrd->eeprom) {
|
||||||
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
||||||
priv->cfg->base_params->eeprom_size + 20);
|
priv->cfg->base_params->eeprom_size + 20);
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
|
@ -497,7 +497,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
|
||||||
IWL_TM_CMD_DEV2APP_EEPROM_RSP);
|
IWL_TM_CMD_DEV2APP_EEPROM_RSP);
|
||||||
NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
|
NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
|
||||||
priv->cfg->base_params->eeprom_size,
|
priv->cfg->base_params->eeprom_size,
|
||||||
priv->eeprom);
|
priv->shrd->eeprom);
|
||||||
status = cfg80211_testmode_reply(skb);
|
status = cfg80211_testmode_reply(skb);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
IWL_DEBUG_INFO(priv,
|
IWL_DEBUG_INFO(priv,
|
||||||
|
|
|
@ -217,7 +217,7 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
struct iwl_calib_xtal_freq_cmd cmd;
|
struct iwl_calib_xtal_freq_cmd cmd;
|
||||||
__le16 *xtal_calib =
|
__le16 *xtal_calib =
|
||||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL);
|
(__le16 *)iwl_eeprom_query_addr(priv->shrd, EEPROM_XTAL);
|
||||||
|
|
||||||
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
|
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
|
||||||
cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
|
cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
|
||||||
|
@ -229,7 +229,8 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
struct iwl_calib_temperature_offset_cmd cmd;
|
struct iwl_calib_temperature_offset_cmd cmd;
|
||||||
__le16 *offset_calib =
|
__le16 *offset_calib =
|
||||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
|
(__le16 *)iwl_eeprom_query_addr(priv->shrd,
|
||||||
|
EEPROM_RAW_TEMPERATURE);
|
||||||
|
|
||||||
memset(&cmd, 0, sizeof(cmd));
|
memset(&cmd, 0, sizeof(cmd));
|
||||||
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
||||||
|
@ -245,15 +246,16 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
|
||||||
static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
|
static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
|
||||||
{
|
{
|
||||||
struct iwl_calib_temperature_offset_v2_cmd cmd;
|
struct iwl_calib_temperature_offset_v2_cmd cmd;
|
||||||
__le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv,
|
__le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv->shrd,
|
||||||
EEPROM_KELVIN_TEMPERATURE);
|
EEPROM_KELVIN_TEMPERATURE);
|
||||||
__le16 *offset_calib_low =
|
__le16 *offset_calib_low =
|
||||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
|
(__le16 *)iwl_eeprom_query_addr(priv->shrd,
|
||||||
|
EEPROM_RAW_TEMPERATURE);
|
||||||
struct iwl_eeprom_calib_hdr *hdr;
|
struct iwl_eeprom_calib_hdr *hdr;
|
||||||
|
|
||||||
memset(&cmd, 0, sizeof(cmd));
|
memset(&cmd, 0, sizeof(cmd));
|
||||||
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
||||||
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
|
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv->shrd,
|
||||||
EEPROM_CALIB_ALL);
|
EEPROM_CALIB_ALL);
|
||||||
memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
|
memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
|
||||||
sizeof(*offset_calib_high));
|
sizeof(*offset_calib_high));
|
||||||
|
|
Loading…
Reference in a new issue