Commit b9545b48 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Johannes Berg

iwlwifi: mvm: MVM op_mode is supported on 7000 only

The code removed in this patch was used for bring up on
older NICs. No MVM capable fw will ever be released for
older NICs, so remove that code.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 25b9ea5c
...@@ -278,38 +278,7 @@ enum { ...@@ -278,38 +278,7 @@ enum {
NVM_ACCESS_TARGET_EEPROM = 2, NVM_ACCESS_TARGET_EEPROM = 2,
}; };
/** /* Section types for NVM_ACCESS_CMD */
* struct iwl_nvm_access_cmd_ver1 - Request the device to send the NVM.
* @op_code: 0 - read, 1 - write.
* @target: NVM_ACCESS_TARGET_*. should be 0 for read.
* @cache_refresh: 0 - None, 1- NVM.
* @offset: offset in the nvm data.
* @length: of the chunk.
* @data: empty on read, the NVM chunk on write
*/
struct iwl_nvm_access_cmd_ver1 {
u8 op_code;
u8 target;
u8 cache_refresh;
u8 reserved;
__le16 offset;
__le16 length;
u8 data[];
} __packed; /* NVM_ACCESS_CMD_API_S_VER_1 */
/**
* struct iwl_nvm_access_resp_ver1 - response to NVM_ACCESS_CMD
* @offset: the offset in the nvm data
* @length: of the chunk
* @data: the nvm chunk on when NVM_ACCESS_CMD was read, nothing on write
*/
struct iwl_nvm_access_resp_ver1 {
__le16 offset;
__le16 length;
u8 data[];
} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_1 */
/* Section types for NVM_ACCESS_CMD version 2 */
enum { enum {
NVM_SECTION_TYPE_HW = 0, NVM_SECTION_TYPE_HW = 0,
NVM_SECTION_TYPE_SW, NVM_SECTION_TYPE_SW,
...@@ -330,7 +299,7 @@ enum { ...@@ -330,7 +299,7 @@ enum {
* @length: in bytes, to read/write * @length: in bytes, to read/write
* @data: if write operation, the data to write. On read its empty * @data: if write operation, the data to write. On read its empty
*/ */
struct iwl_nvm_access_cmd_ver2 { struct iwl_nvm_access_cmd {
u8 op_code; u8 op_code;
u8 target; u8 target;
__le16 type; __le16 type;
...@@ -347,7 +316,7 @@ struct iwl_nvm_access_cmd_ver2 { ...@@ -347,7 +316,7 @@ struct iwl_nvm_access_cmd_ver2 {
* @status: 0 for success, fail otherwise * @status: 0 for success, fail otherwise
* @data: if read operation, the data returned. Empty on write. * @data: if read operation, the data returned. Empty on write.
*/ */
struct iwl_nvm_access_resp_ver2 { struct iwl_nvm_access_resp {
__le16 offset; __le16 offset;
__le16 length; __le16 length;
__le16 type; __le16 type;
......
...@@ -330,12 +330,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) ...@@ -330,12 +330,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
if (ret) if (ret)
goto error; goto error;
/* WkP doesn't have all calibrations, need to set default values */ /* need to set default values */
if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { ret = iwl_set_default_calibrations(mvm);
ret = iwl_set_default_calibrations(mvm); if (ret)
if (ret) goto error;
goto error;
}
/* /*
* Send phy configurations command to init uCode * Send phy configurations command to init uCode
......
...@@ -281,10 +281,7 @@ struct iwl_mvm { ...@@ -281,10 +281,7 @@ struct iwl_mvm {
atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
struct iwl_nvm_data *nvm_data; struct iwl_nvm_data *nvm_data;
/* eeprom blob for debugfs/testmode */ /* NVM sections */
u8 *eeprom_blob;
size_t eeprom_blob_size;
/* NVM sections for 7000 family */
struct iwl_nvm_section nvm_sections[NVM_NUM_OF_SECTIONS]; struct iwl_nvm_section nvm_sections[NVM_NUM_OF_SECTIONS];
/* EEPROM MAC addresses */ /* EEPROM MAC addresses */
......
...@@ -77,26 +77,8 @@ static const int nvm_to_read[] = { ...@@ -77,26 +77,8 @@ static const int nvm_to_read[] = {
/* Default NVM size to read */ /* Default NVM size to read */
#define IWL_NVM_DEFAULT_CHUNK_SIZE (2*1024); #define IWL_NVM_DEFAULT_CHUNK_SIZE (2*1024);
/* used to simplify the shared operations on NCM_ACCESS_CMD versions */ static inline void iwl_nvm_fill_read(struct iwl_nvm_access_cmd *cmd,
union iwl_nvm_access_cmd { u16 offset, u16 length, u16 section)
struct iwl_nvm_access_cmd_ver1 ver1;
struct iwl_nvm_access_cmd_ver2 ver2;
};
union iwl_nvm_access_resp {
struct iwl_nvm_access_resp_ver1 ver1;
struct iwl_nvm_access_resp_ver2 ver2;
};
static inline void iwl_nvm_fill_read_ver1(struct iwl_nvm_access_cmd_ver1 *cmd,
u16 offset, u16 length)
{
cmd->offset = cpu_to_le16(offset);
cmd->length = cpu_to_le16(length);
cmd->cache_refresh = 1;
}
static inline void iwl_nvm_fill_read_ver2(struct iwl_nvm_access_cmd_ver2 *cmd,
u16 offset, u16 length, u16 section)
{ {
cmd->offset = cpu_to_le16(offset); cmd->offset = cpu_to_le16(offset);
cmd->length = cpu_to_le16(length); cmd->length = cpu_to_le16(length);
...@@ -106,8 +88,8 @@ static inline void iwl_nvm_fill_read_ver2(struct iwl_nvm_access_cmd_ver2 *cmd, ...@@ -106,8 +88,8 @@ static inline void iwl_nvm_fill_read_ver2(struct iwl_nvm_access_cmd_ver2 *cmd,
static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
u16 offset, u16 length, u8 *data) u16 offset, u16 length, u8 *data)
{ {
union iwl_nvm_access_cmd nvm_access_cmd; struct iwl_nvm_access_cmd nvm_access_cmd = {};
union iwl_nvm_access_resp *nvm_resp; struct iwl_nvm_access_resp *nvm_resp;
struct iwl_rx_packet *pkt; struct iwl_rx_packet *pkt;
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
.id = NVM_ACCESS_CMD, .id = NVM_ACCESS_CMD,
...@@ -117,18 +99,8 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, ...@@ -117,18 +99,8 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
int ret, bytes_read, offset_read; int ret, bytes_read, offset_read;
u8 *resp_data; u8 *resp_data;
memset(&nvm_access_cmd, 0, sizeof(nvm_access_cmd)); iwl_nvm_fill_read(&nvm_access_cmd, offset, length, section);
cmd.len[0] = sizeof(struct iwl_nvm_access_cmd);
/* TODO: not sure family should be the decider, maybe FW version? */
if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
iwl_nvm_fill_read_ver2(&(nvm_access_cmd.ver2),
offset, length, section);
cmd.len[0] = sizeof(struct iwl_nvm_access_cmd_ver2);
} else {
iwl_nvm_fill_read_ver1(&(nvm_access_cmd.ver1),
offset, length);
cmd.len[0] = sizeof(struct iwl_nvm_access_cmd_ver1);
}
ret = iwl_mvm_send_cmd(mvm, &cmd); ret = iwl_mvm_send_cmd(mvm, &cmd);
if (ret) if (ret)
...@@ -144,17 +116,10 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, ...@@ -144,17 +116,10 @@ static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
/* Extract NVM response */ /* Extract NVM response */
nvm_resp = (void *)pkt->data; nvm_resp = (void *)pkt->data;
if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { ret = le16_to_cpu(nvm_resp->status);
ret = le16_to_cpu(nvm_resp->ver2.status); bytes_read = le16_to_cpu(nvm_resp->length);
bytes_read = le16_to_cpu(nvm_resp->ver2.length); offset_read = le16_to_cpu(nvm_resp->offset);
offset_read = le16_to_cpu(nvm_resp->ver2.offset); resp_data = nvm_resp->data;
resp_data = nvm_resp->ver2.data;
} else {
ret = le16_to_cpu(nvm_resp->ver1.length) <= 0;
bytes_read = le16_to_cpu(nvm_resp->ver1.length);
offset_read = le16_to_cpu(nvm_resp->ver1.offset);
resp_data = nvm_resp->ver1.data;
}
if (ret) { if (ret) {
IWL_ERR(mvm, IWL_ERR(mvm,
"NVM access command failed with status %d (device: %s)\n", "NVM access command failed with status %d (device: %s)\n",
...@@ -194,17 +159,10 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section, ...@@ -194,17 +159,10 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,
{ {
u16 length, offset = 0; u16 length, offset = 0;
int ret; int ret;
bool old_eeprom = mvm->cfg->device_family != IWL_DEVICE_FAMILY_7000;
/* Set nvm section read length */ /* Set nvm section read length */
length = IWL_NVM_DEFAULT_CHUNK_SIZE; length = IWL_NVM_DEFAULT_CHUNK_SIZE;
/*
* if length is greater than EEPROM size, truncate it because uCode
* doesn't check it by itself, and exit the loop when reached.
*/
if (old_eeprom && length > mvm->cfg->base_params->eeprom_size)
length = mvm->cfg->base_params->eeprom_size;
ret = length; ret = length;
/* Read the NVM until exhausted (reading less than requested) */ /* Read the NVM until exhausted (reading less than requested) */
...@@ -217,8 +175,6 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section, ...@@ -217,8 +175,6 @@ static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,
return ret; return ret;
} }
offset += ret; offset += ret;
if (old_eeprom && offset == mvm->cfg->base_params->eeprom_size)
break;
} }
IWL_INFO(mvm, "NVM section %d read completed\n", section); IWL_INFO(mvm, "NVM section %d read completed\n", section);
...@@ -252,63 +208,31 @@ int iwl_nvm_init(struct iwl_mvm *mvm) ...@@ -252,63 +208,31 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
int ret, i, section; int ret, i, section;
u8 *nvm_buffer, *temp; u8 *nvm_buffer, *temp;
if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { /* TODO: find correct NVM max size for a section */
/* TODO: find correct NVM max size for a section */ nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size,
nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, GFP_KERNEL);
GFP_KERNEL); if (!nvm_buffer)
if (!nvm_buffer) return -ENOMEM;
return -ENOMEM; for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) {
for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) { section = nvm_to_read[i];
section = nvm_to_read[i]; /* we override the constness for initial read */
/* we override the constness for initial read */ ret = iwl_nvm_read_section(mvm, section, nvm_buffer);
ret = iwl_nvm_read_section(mvm, section, nvm_buffer);
if (ret < 0)
break;
temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
if (!temp) {
ret = -ENOMEM;
break;
}
mvm->nvm_sections[section].data = temp;
mvm->nvm_sections[section].length = ret;
}
kfree(nvm_buffer);
if (ret < 0) if (ret < 0)
return ret; break;
} else { temp = kmemdup(nvm_buffer, ret, GFP_KERNEL);
/* allocate eeprom */ if (!temp) {
mvm->eeprom_blob_size = mvm->cfg->base_params->eeprom_size; ret = -ENOMEM;
IWL_DEBUG_EEPROM(mvm->trans->dev, "NVM size = %zd\n", break;
mvm->eeprom_blob_size);
mvm->eeprom_blob = kzalloc(mvm->eeprom_blob_size, GFP_KERNEL);
if (!mvm->eeprom_blob)
return -ENOMEM;
ret = iwl_nvm_read_section(mvm, 0, mvm->eeprom_blob);
if (ret != mvm->eeprom_blob_size) {
IWL_ERR(mvm, "Read partial NVM %d/%zd\n",
ret, mvm->eeprom_blob_size);
kfree(mvm->eeprom_blob);
mvm->eeprom_blob = NULL;
return -EINVAL;
} }
mvm->nvm_sections[section].data = temp;
mvm->nvm_sections[section].length = ret;
} }
kfree(nvm_buffer);
if (ret < 0)
return ret;
ret = 0; ret = 0;
if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) mvm->nvm_data = iwl_parse_nvm_sections(mvm);
mvm->nvm_data = iwl_parse_nvm_sections(mvm);
else
mvm->nvm_data =
iwl_parse_eeprom_data(mvm->trans->dev,
mvm->cfg,
mvm->eeprom_blob,
mvm->eeprom_blob_size);
if (!mvm->nvm_data) {
kfree(mvm->eeprom_blob);
mvm->eeprom_blob = NULL;
ret = -ENOMEM;
}
return ret; return ret;
} }
...@@ -319,16 +319,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -319,16 +319,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
}; };
int err, scan_size; int err, scan_size;
switch (cfg->device_family) {
case IWL_DEVICE_FAMILY_6030:
case IWL_DEVICE_FAMILY_6005:
case IWL_DEVICE_FAMILY_7000:
break;
default:
IWL_ERR(trans, "Trying to load mvm on an unsupported device\n");
return NULL;
}
/******************************** /********************************
* 1. Allocating and configuring HW data * 1. Allocating and configuring HW data
********************************/ ********************************/
...@@ -444,7 +434,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, ...@@ -444,7 +434,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
out_free: out_free:
iwl_phy_db_free(mvm->phy_db); iwl_phy_db_free(mvm->phy_db);
kfree(mvm->scan_cmd); kfree(mvm->scan_cmd);
kfree(mvm->eeprom_blob);
iwl_trans_stop_hw(trans, true); iwl_trans_stop_hw(trans, true);
ieee80211_free_hw(mvm->hw); ieee80211_free_hw(mvm->hw);
return NULL; return NULL;
...@@ -466,7 +455,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) ...@@ -466,7 +455,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
iwl_phy_db_free(mvm->phy_db); iwl_phy_db_free(mvm->phy_db);
mvm->phy_db = NULL; mvm->phy_db = NULL;
kfree(mvm->eeprom_blob);
iwl_free_nvm_data(mvm->nvm_data); iwl_free_nvm_data(mvm->nvm_data);
for (i = 0; i < NVM_NUM_OF_SECTIONS; i++) for (i = 0; i < NVM_NUM_OF_SECTIONS; i++)
kfree(mvm->nvm_sections[i].data); kfree(mvm->nvm_sections[i].data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment