dect
/
linux-2.6
Archived
13
0
Fork 0

iwlagn: move nvm_device_type from iwl_priv to iwl_trans

The nvm_device_type is eeprom related and does not need to be part
of the iwl_priv structure.  Move it and eliminate access to the iwl_priv
structure.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Don Fry 2011-11-10 06:55:27 -08:00 committed by John W. Linville
parent 1431b2166a
commit 97b52cfd1a
4 changed files with 18 additions and 16 deletions

View File

@ -430,7 +430,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); eeprom_ver = iwl_eeprom_query16(priv, 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",
(priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP)
? "OTP" : "EEPROM", eeprom_ver); ? "OTP" : "EEPROM", eeprom_ver);
for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);

View File

@ -944,7 +944,6 @@ struct iwl_priv {
/* eeprom -- this is in the card's little endian byte order */ /* eeprom -- this is in the card's little endian byte order */
u8 *eeprom; u8 *eeprom;
int nvm_device_type;
struct iwl_eeprom_calib_info *calib_info; struct iwl_eeprom_calib_info *calib_info;
enum nl80211_iftype iw_mode; enum nl80211_iftype iw_mode;

View File

@ -182,32 +182,32 @@ static void iwl_eeprom_release_semaphore(struct iwl_bus *bus)
} }
static int iwl_eeprom_verify_signature(struct iwl_priv *priv) static int iwl_eeprom_verify_signature(struct iwl_trans *trans)
{ {
u32 gp = iwl_read32(bus(priv), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; u32 gp = iwl_read32(bus(trans), CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
int ret = 0; int ret = 0;
IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); IWL_DEBUG_EEPROM(trans, "EEPROM signature=0x%08x\n", gp);
switch (gp) { switch (gp) {
case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP: case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP:
if (priv->nvm_device_type != NVM_DEVICE_TYPE_OTP) { if (trans->nvm_device_type != NVM_DEVICE_TYPE_OTP) {
IWL_ERR(priv, "EEPROM with bad signature: 0x%08x\n", IWL_ERR(trans, "EEPROM with bad signature: 0x%08x\n",
gp); gp);
ret = -ENOENT; ret = -ENOENT;
} }
break; break;
case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K:
case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K:
if (priv->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) { if (trans->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) {
IWL_ERR(priv, "OTP with bad signature: 0x%08x\n", gp); IWL_ERR(trans, "OTP with bad signature: 0x%08x\n", gp);
ret = -ENOENT; ret = -ENOENT;
} }
break; break;
case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP: case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP:
default: default:
IWL_ERR(priv, "bad EEPROM/OTP signature, type=%s, " IWL_ERR(trans, "bad EEPROM/OTP signature, type=%s, "
"EEPROM_GP=0x%08x\n", "EEPROM_GP=0x%08x\n",
(priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP)
? "OTP" : "EEPROM", gp); ? "OTP" : "EEPROM", gp);
ret = -ENOENT; ret = -ENOENT;
break; break;
@ -660,8 +660,8 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
u16 validblockaddr = 0; u16 validblockaddr = 0;
u16 cache_addr = 0; u16 cache_addr = 0;
priv->nvm_device_type = iwl_get_nvm_type(bus(priv), hw_rev); trans(priv)->nvm_device_type = iwl_get_nvm_type(bus(priv), hw_rev);
if (priv->nvm_device_type == -ENOENT) if (trans(priv)->nvm_device_type == -ENOENT)
return -ENOENT; return -ENOENT;
/* allocate eeprom */ /* allocate eeprom */
sz = priv->cfg->base_params->eeprom_size; sz = priv->cfg->base_params->eeprom_size;
@ -675,7 +675,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
iwl_apm_init(priv); iwl_apm_init(priv);
ret = iwl_eeprom_verify_signature(priv); ret = iwl_eeprom_verify_signature(trans(priv));
if (ret < 0) { if (ret < 0) {
IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
ret = -ENOENT; ret = -ENOENT;
@ -690,7 +690,7 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev)
goto err; goto err;
} }
if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { if (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) {
ret = iwl_init_otp_access(bus(priv)); ret = iwl_init_otp_access(bus(priv));
if (ret) { if (ret) {
@ -744,7 +744,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",
(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(priv, EEPROM_VERSION));

View File

@ -247,6 +247,9 @@ struct iwl_trans {
struct fw_img ucode_init; struct fw_img ucode_init;
struct fw_img ucode_wowlan; struct fw_img ucode_wowlan;
/* eeprom related variables */
int nvm_device_type;
/* pointer to trans specific struct */ /* pointer to trans specific struct */
/*Ensure that this pointer will always be aligned to sizeof pointer */ /*Ensure that this pointer will always be aligned to sizeof pointer */
char trans_specific[0] __attribute__((__aligned__(sizeof(void *)))); char trans_specific[0] __attribute__((__aligned__(sizeof(void *))));