Lines Matching refs:mvm
13 #include "mvm.h"
35 static int iwl_nvm_write_chunk(struct iwl_mvm *mvm, u16 section,
56 ret = iwl_mvm_send_cmd(mvm, &cmd);
64 IWL_ERR(mvm,
74 static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section,
95 ret = iwl_mvm_send_cmd(mvm, &cmd);
118 IWL_DEBUG_EEPROM(mvm->trans->dev,
123 IWL_DEBUG_EEPROM(mvm->trans->dev,
125 ret, mvm->trans->name);
132 IWL_ERR(mvm, "NVM ACCESS response with invalid offset %d\n",
147 static int iwl_nvm_write_section(struct iwl_mvm *mvm, u16 section,
160 ret = iwl_nvm_write_chunk(mvm, section, offset,
181 static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section,
196 mvm->trans->trans_cfg->base_params->eeprom_size) {
197 IWL_ERR(mvm, "EEPROM size is too small for NVM\n");
201 ret = iwl_nvm_read_chunk(mvm, section, offset, length, data);
203 IWL_DEBUG_EEPROM(mvm->trans->dev,
211 iwl_nvm_fixups(mvm->trans->hw_id, section, data, offset);
213 IWL_DEBUG_EEPROM(mvm->trans->dev,
219 iwl_parse_nvm_sections(struct iwl_mvm *mvm)
221 struct iwl_nvm_section *sections = mvm->nvm_sections;
224 u8 tx_ant = mvm->fw->valid_tx_ant;
225 u8 rx_ant = mvm->fw->valid_rx_ant;
229 if (mvm->trans->cfg->nvm_type == IWL_NVM) {
230 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data ||
231 !mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data) {
232 IWL_ERR(mvm, "Can't parse empty OTP/NVM sections\n");
236 if (mvm->trans->cfg->nvm_type == IWL_NVM_SDP)
242 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data ||
243 !mvm->nvm_sections[regulatory_type].data) {
244 IWL_ERR(mvm,
249 if (!mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data &&
250 !mvm->nvm_sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data) {
251 IWL_ERR(mvm,
257 if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT &&
258 !mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) {
259 IWL_ERR(mvm,
265 hw = (const __be16 *)sections[mvm->cfg->nvm_hw_section_num].data;
272 regulatory = mvm->trans->cfg->nvm_type == IWL_NVM_SDP ?
276 if (mvm->set_tx_ant)
277 tx_ant &= mvm->set_tx_ant;
279 if (mvm->set_rx_ant)
280 rx_ant &= mvm->set_rx_ant;
282 return iwl_parse_nvm_data(mvm->trans, mvm->cfg, mvm->fw, hw, sw, calib,
287 /* Loads the NVM data stored in mvm->nvm_sections into the NIC */
288 int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm)
291 struct iwl_nvm_section *sections = mvm->nvm_sections;
293 IWL_DEBUG_EEPROM(mvm->trans->dev, "'Write to NVM\n");
295 for (i = 0; i < ARRAY_SIZE(mvm->nvm_sections); i++) {
296 if (!mvm->nvm_sections[i].data || !mvm->nvm_sections[i].length)
298 ret = iwl_nvm_write_section(mvm, i, sections[i].data,
301 IWL_ERR(mvm, "iwl_mvm_send_cmd failed: %d\n", ret);
308 int iwl_nvm_init(struct iwl_mvm *mvm)
313 const char *nvm_file_C = mvm->cfg->default_nvm_file_C_step;
315 if (WARN_ON_ONCE(mvm->cfg->nvm_hw_section_num >= NVM_MAX_NUM_SECTIONS))
320 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from NVM\n");
322 nvm_buffer = kmalloc(mvm->trans->trans_cfg->base_params->eeprom_size,
328 ret = iwl_nvm_read_section(mvm, section, nvm_buffer,
343 iwl_nvm_fixups(mvm->trans->hw_id, section, temp, ret);
345 mvm->nvm_sections[section].data = temp;
346 mvm->nvm_sections[section].length = ret;
351 mvm->nvm_sw_blob.data = temp;
352 mvm->nvm_sw_blob.size = ret;
355 mvm->nvm_calib_blob.data = temp;
356 mvm->nvm_calib_blob.size = ret;
359 mvm->nvm_prod_blob.data = temp;
360 mvm->nvm_prod_blob.size = ret;
363 mvm->nvm_phy_sku_blob.data = temp;
364 mvm->nvm_phy_sku_blob.size = ret;
368 mvm->nvm_reg_blob.data = temp;
369 mvm->nvm_reg_blob.size = ret;
372 if (section == mvm->cfg->nvm_hw_section_num) {
373 mvm->nvm_hw_blob.data = temp;
374 mvm->nvm_hw_blob.size = ret;
381 IWL_ERR(mvm, "OTP is blank\n");
385 if (mvm->nvm_file_name) {
387 ret = iwl_read_external_nvm(mvm->trans, mvm->nvm_file_name,
388 mvm->nvm_sections);
390 mvm->nvm_file_name = nvm_file_C;
393 mvm->nvm_file_name) {
395 ret = iwl_read_external_nvm(mvm->trans,
396 mvm->nvm_file_name,
397 mvm->nvm_sections);
407 mvm->nvm_data = iwl_parse_nvm_sections(mvm);
408 if (!mvm->nvm_data)
410 IWL_DEBUG_EEPROM(mvm->trans->dev, "nvm version = %x\n",
411 mvm->nvm_data->nvm_version);
417 iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
437 if (WARN_ON_ONCE(!iwl_mvm_is_lar_supported(mvm)))
442 IWL_DEBUG_LAR(mvm, "send MCC update to FW with '%c%c' src = %d\n",
445 ret = iwl_mvm_send_cmd(mvm, &cmd);
451 resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP,
479 } else if (fw_has_capa(&mvm->fw->ucode_capa,
542 IWL_DEBUG_LAR(mvm,
551 int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
559 if (mvm->cfg->nvm_type == IWL_NVM_EXT) {
560 tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
562 nvm_lar = mvm->nvm_data->lar_enabled;
564 IWL_INFO(mvm,
570 if (!iwl_mvm_is_lar_supported(mvm))
577 retval = iwl_mvm_init_fw_regd(mvm, true);
587 mvm->lar_regdom_set = false;
589 regd = iwl_mvm_get_current_regdomain(mvm, NULL);
593 if (iwl_mvm_is_wifi_mcc_supported(mvm) &&
594 !iwl_bios_get_mcc(&mvm->fwrt, mcc)) {
596 regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, mcc,
602 retval = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd);
607 void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,
617 lockdep_assert_held(&mvm->mutex);
619 if (iwl_mvm_is_vif_assoc(mvm) && notif->source_id == MCC_SOURCE_WIFI) {
620 IWL_DEBUG_LAR(mvm, "Ignore mcc update while associated\n");
624 if (WARN_ON_ONCE(!iwl_mvm_is_lar_supported(mvm)))
632 IWL_DEBUG_LAR(mvm,
635 regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, mcc, src, NULL);
639 wgds_tbl_idx = iwl_mvm_get_sar_geo_profile(mvm);
641 IWL_DEBUG_INFO(mvm,
645 IWL_DEBUG_INFO(mvm, "SAR WGDS: geo profile %d is configured\n",
648 regulatory_set_wiphy_regd(mvm->hw->wiphy, regd);