Lines Matching +full:fw +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
14 #include "iwl-drv.h"
15 #include "iwl-modparams.h"
16 #include "iwl-nvm-parse.h"
17 #include "iwl-prph.h"
18 #include "iwl-io.h"
19 #include "iwl-csr.h"
20 #include "fw/acpi.h"
21 #include "fw/api/nvm-reg.h"
22 #include "fw/api/commands.h"
23 #include "fw/api/cmdhdr.h"
24 #include "fw/img.h"
25 #include "mei/iwl-mei.h"
29 /* NVM HW-Section offset (in words) definitions */
33 /* NVM SW-Section offset (in words) definitions */
39 NVM_CHANNELS = 0x1E0 - NVM_SW_SECTION,
41 /* NVM REGULATORY -Section offset (in words) definitions */
46 /* NVM HW-Section offset (in words) definitions */
50 /* NVM SW-Section offset (in words) definitions */
54 /* NVM PHY_SKU-Section offset (in words) definitions */
58 /* NVM REGULATORY -Section offset (in words) definitions */
102 /* 6-7 GHz */
139 #define N_RATES_52 (N_RATES_24 - RATES_52_OFFS)
142 * enum iwl_nvm_channel_flags - channel flags in NVM
177 * enum iwl_reg_capa_flags_v1 - global flags applied for the whole regulatory
179 * @REG_CAPA_V1_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
181 * @REG_CAPA_V1_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
207 * enum iwl_reg_capa_flags_v2 - global flags applied for the whole regulatory
211 * @REG_CAPA_V2_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
213 * @REG_CAPA_V2_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
241 * enum iwl_reg_capa_flags_v4 - global flags applied for the whole regulatory
276 * struct iwl_reg_capa - struct for global regulatory capabilities, Used for
333 u32 nvm_flags, const struct iwl_cfg *cfg) in iwl_get_channel_flags() argument
343 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0) in iwl_get_channel_flags()
395 const struct iwl_fw *fw, in iwl_init_channel_map() argument
400 const struct iwl_cfg *cfg = trans->cfg; in iwl_init_channel_map() local
401 struct device *dev = trans->dev; in iwl_init_channel_map()
409 if (cfg->uhb_supported) { in iwl_init_channel_map()
412 } else if (cfg->nvm_type == IWL_NVM_EXT) { in iwl_init_channel_map()
432 !data->sku_cap_band_52ghz_enable) in iwl_init_channel_map()
444 data->vht160_supported = true; in iwl_init_channel_map()
458 channel = &data->channels[n_channels]; in iwl_init_channel_map()
461 channel->hw_value = nvm_chan[ch_idx]; in iwl_init_channel_map()
462 channel->band = band; in iwl_init_channel_map()
463 channel->center_freq = in iwl_init_channel_map()
465 channel->hw_value, channel->band); in iwl_init_channel_map()
467 /* Initialize regulatory-based run-time data */ in iwl_init_channel_map()
470 * Default value - highest tx power value. max_power in iwl_init_channel_map()
473 channel->max_power = IWL_DEFAULT_MAX_TX_POWER; in iwl_init_channel_map()
477 channel->flags = iwl_get_channel_flags(nvm_chan[ch_idx], in iwl_init_channel_map()
479 ch_flags, cfg); in iwl_init_channel_map()
481 channel->flags = 0; in iwl_init_channel_map()
483 if (fw_has_capa(&fw->ucode_capa, in iwl_init_channel_map()
485 channel->flags |= IEEE80211_CHAN_CAN_MONITOR; in iwl_init_channel_map()
488 channel->hw_value, ch_flags); in iwl_init_channel_map()
490 channel->hw_value, channel->max_power); in iwl_init_channel_map()
501 const struct iwl_cfg *cfg = trans->cfg; in iwl_init_vht_hw_capab() local
505 vht_cap->vht_supported = true; in iwl_init_vht_hw_capab()
507 vht_cap->cap = IEEE80211_VHT_CAP_SHORT_GI_80 | in iwl_init_vht_hw_capab()
514 if (!trans->cfg->ht_params->stbc) in iwl_init_vht_hw_capab()
515 vht_cap->cap &= ~IEEE80211_VHT_CAP_RXSTBC_MASK; in iwl_init_vht_hw_capab()
517 if (data->vht160_supported) in iwl_init_vht_hw_capab()
518 vht_cap->cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | in iwl_init_vht_hw_capab()
521 if (cfg->vht_mu_mimo_supported) in iwl_init_vht_hw_capab()
522 vht_cap->cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in iwl_init_vht_hw_capab()
524 if (cfg->ht_params->ldpc) in iwl_init_vht_hw_capab()
525 vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC; in iwl_init_vht_hw_capab()
527 if (data->sku_cap_mimo_disabled) { in iwl_init_vht_hw_capab()
532 if (trans->cfg->ht_params->stbc && num_tx_ants > 1) in iwl_init_vht_hw_capab()
533 vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC; in iwl_init_vht_hw_capab()
535 vht_cap->cap |= IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; in iwl_init_vht_hw_capab()
539 if (trans->trans_cfg->mq_rx_supported) in iwl_init_vht_hw_capab()
540 vht_cap->cap |= in iwl_init_vht_hw_capab()
543 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; in iwl_init_vht_hw_capab()
546 if (trans->trans_cfg->mq_rx_supported) in iwl_init_vht_hw_capab()
547 vht_cap->cap |= in iwl_init_vht_hw_capab()
553 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895; in iwl_init_vht_hw_capab()
556 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991; in iwl_init_vht_hw_capab()
559 vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454; in iwl_init_vht_hw_capab()
565 vht_cap->vht_mcs.rx_mcs_map = in iwl_init_vht_hw_capab()
575 if (num_rx_ants == 1 || cfg->rx_with_siso_diversity) { in iwl_init_vht_hw_capab()
576 vht_cap->cap |= IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; in iwl_init_vht_hw_capab()
578 vht_cap->vht_mcs.rx_mcs_map |= in iwl_init_vht_hw_capab()
582 vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map; in iwl_init_vht_hw_capab()
584 vht_cap->vht_mcs.tx_highest |= in iwl_init_vht_hw_capab()
726 * Rx - note we don't set the only_20mhz, but due to this
825 * Rx - note we don't set the only_20mhz, but due to this
870 if (sband->band != NL80211_BAND_6GHZ) in iwl_init_he_6ghz_capa()
896 IWL_DEBUG_EEPROM(trans->dev, "he_6ghz_capa=0x%x\n", he_6ghz_capa); in iwl_init_he_6ghz_capa()
898 /* we know it's writable - we set it before ourselves */ in iwl_init_he_6ghz_capa()
899 iftype_data = (void *)(uintptr_t)sband->iftype_data; in iwl_init_he_6ghz_capa()
900 for (i = 0; i < sband->n_iftype_data; i++) in iwl_init_he_6ghz_capa()
910 const struct iwl_fw *fw) in iwl_nvm_fixup_sband_iftd() argument
912 bool is_ap = iftype_data->types_mask & (BIT(NL80211_IFTYPE_AP) | in iwl_nvm_fixup_sband_iftd()
916 no_320 = (!trans->trans_cfg->integrated && in iwl_nvm_fixup_sband_iftd()
917 trans->pcie_link_speed < PCI_EXP_LNKSTA_CLS_8_0GB) || in iwl_nvm_fixup_sband_iftd()
918 trans->reduced_cap_sku; in iwl_nvm_fixup_sband_iftd()
920 if (!data->sku_cap_11be_enable || iwlwifi_mod_params.disable_11be) in iwl_nvm_fixup_sband_iftd()
921 iftype_data->eht_cap.has_eht = false; in iwl_nvm_fixup_sband_iftd()
923 /* Advertise an A-MPDU exponent extension based on in iwl_nvm_fixup_sband_iftd()
926 if (sband->band == NL80211_BAND_6GHZ && iftype_data->eht_cap.has_eht) in iwl_nvm_fixup_sband_iftd()
927 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |= in iwl_nvm_fixup_sband_iftd()
929 else if (sband->band != NL80211_BAND_2GHZ) in iwl_nvm_fixup_sband_iftd()
930 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |= in iwl_nvm_fixup_sband_iftd()
933 iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |= in iwl_nvm_fixup_sband_iftd()
936 switch (sband->band) { in iwl_nvm_fixup_sband_iftd()
938 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |= in iwl_nvm_fixup_sband_iftd()
940 iftype_data->eht_cap.eht_cap_elem.mac_cap_info[0] |= in iwl_nvm_fixup_sband_iftd()
946 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[0] |= in iwl_nvm_fixup_sband_iftd()
948 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[1] |= in iwl_nvm_fixup_sband_iftd()
953 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |= in iwl_nvm_fixup_sband_iftd()
963 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |= in iwl_nvm_fixup_sband_iftd()
965 iftype_data->he_cap.he_cap_elem.phy_cap_info[5] |= in iwl_nvm_fixup_sband_iftd()
969 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] |= in iwl_nvm_fixup_sband_iftd()
972 if (iftype_data->eht_cap.has_eht) { in iwl_nvm_fixup_sband_iftd()
978 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] |= 0x49; in iwl_nvm_fixup_sband_iftd()
984 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[4] |= 0x10; in iwl_nvm_fixup_sband_iftd()
989 &iftype_data->he_cap.he_mcs_nss_supp; in iwl_nvm_fixup_sband_iftd()
991 if (iftype_data->eht_cap.has_eht) { in iwl_nvm_fixup_sband_iftd()
993 &iftype_data->eht_cap.eht_mcs_nss_supp; in iwl_nvm_fixup_sband_iftd()
1000 * Midamble RX Max NSTS - but not for AP mode in iwl_nvm_fixup_sband_iftd()
1002 iftype_data->he_cap.he_cap_elem.phy_cap_info[1] &= in iwl_nvm_fixup_sband_iftd()
1004 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] &= in iwl_nvm_fixup_sband_iftd()
1006 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] |= in iwl_nvm_fixup_sband_iftd()
1010 he_mcs_nss_supp->rx_mcs_80 |= in iwl_nvm_fixup_sband_iftd()
1012 he_mcs_nss_supp->tx_mcs_80 |= in iwl_nvm_fixup_sband_iftd()
1014 he_mcs_nss_supp->rx_mcs_160 |= in iwl_nvm_fixup_sband_iftd()
1016 he_mcs_nss_supp->tx_mcs_160 |= in iwl_nvm_fixup_sband_iftd()
1018 he_mcs_nss_supp->rx_mcs_80p80 |= in iwl_nvm_fixup_sband_iftd()
1020 he_mcs_nss_supp->tx_mcs_80p80 |= in iwl_nvm_fixup_sband_iftd()
1024 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210 && !is_ap) in iwl_nvm_fixup_sband_iftd()
1025 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |= in iwl_nvm_fixup_sband_iftd()
1028 switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) { in iwl_nvm_fixup_sband_iftd()
1032 iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |= in iwl_nvm_fixup_sband_iftd()
1035 iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |= in iwl_nvm_fixup_sband_iftd()
1040 if (CSR_HW_REV_TYPE(trans->hw_rev) == IWL_CFG_MAC_TYPE_GL && in iwl_nvm_fixup_sband_iftd()
1041 iftype_data->eht_cap.has_eht) { in iwl_nvm_fixup_sband_iftd()
1042 iftype_data->eht_cap.eht_cap_elem.mac_cap_info[0] &= in iwl_nvm_fixup_sband_iftd()
1045 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[3] &= in iwl_nvm_fixup_sband_iftd()
1053 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[4] &= in iwl_nvm_fixup_sband_iftd()
1056 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[5] &= in iwl_nvm_fixup_sband_iftd()
1058 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[6] &= in iwl_nvm_fixup_sband_iftd()
1061 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[5] |= in iwl_nvm_fixup_sband_iftd()
1065 if (fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_BROADCAST_TWT)) in iwl_nvm_fixup_sband_iftd()
1066 iftype_data->he_cap.he_cap_elem.mac_cap_info[2] |= in iwl_nvm_fixup_sband_iftd()
1069 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 && in iwl_nvm_fixup_sband_iftd()
1071 iftype_data->vendor_elems.data = iwl_vendor_caps; in iwl_nvm_fixup_sband_iftd()
1072 iftype_data->vendor_elems.len = ARRAY_SIZE(iwl_vendor_caps); in iwl_nvm_fixup_sband_iftd()
1075 if (!trans->cfg->ht_params->stbc) { in iwl_nvm_fixup_sband_iftd()
1076 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] &= in iwl_nvm_fixup_sband_iftd()
1078 iftype_data->he_cap.he_cap_elem.phy_cap_info[7] &= in iwl_nvm_fixup_sband_iftd()
1082 if (trans->step_urm) { in iwl_nvm_fixup_sband_iftd()
1083 iftype_data->eht_cap.eht_mcs_nss_supp.bw._320.rx_tx_mcs11_max_nss = 0; in iwl_nvm_fixup_sband_iftd()
1084 iftype_data->eht_cap.eht_mcs_nss_supp.bw._320.rx_tx_mcs13_max_nss = 0; in iwl_nvm_fixup_sband_iftd()
1087 if (trans->no_160) in iwl_nvm_fixup_sband_iftd()
1088 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] &= in iwl_nvm_fixup_sband_iftd()
1091 if (trans->reduced_cap_sku) { in iwl_nvm_fixup_sband_iftd()
1092 memset(&iftype_data->eht_cap.eht_mcs_nss_supp.bw._320, 0, in iwl_nvm_fixup_sband_iftd()
1093 sizeof(iftype_data->eht_cap.eht_mcs_nss_supp.bw._320)); in iwl_nvm_fixup_sband_iftd()
1094 iftype_data->eht_cap.eht_mcs_nss_supp.bw._80.rx_tx_mcs13_max_nss = 0; in iwl_nvm_fixup_sband_iftd()
1095 iftype_data->eht_cap.eht_mcs_nss_supp.bw._160.rx_tx_mcs13_max_nss = 0; in iwl_nvm_fixup_sband_iftd()
1096 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[8] &= in iwl_nvm_fixup_sband_iftd()
1098 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] &= in iwl_nvm_fixup_sband_iftd()
1107 const struct iwl_fw *fw) in iwl_init_he_hw_capab() argument
1112 BUILD_BUG_ON(sizeof(data->iftd.low) != sizeof(iwl_he_eht_capa)); in iwl_init_he_hw_capab()
1113 BUILD_BUG_ON(sizeof(data->iftd.high) != sizeof(iwl_he_eht_capa)); in iwl_init_he_hw_capab()
1114 BUILD_BUG_ON(sizeof(data->iftd.uhb) != sizeof(iwl_he_eht_capa)); in iwl_init_he_hw_capab()
1116 switch (sband->band) { in iwl_init_he_hw_capab()
1118 iftype_data = data->iftd.low; in iwl_init_he_hw_capab()
1121 iftype_data = data->iftd.high; in iwl_init_he_hw_capab()
1124 iftype_data = data->iftd.uhb; in iwl_init_he_hw_capab()
1136 for (i = 0; i < sband->n_iftype_data; i++) in iwl_init_he_hw_capab()
1138 tx_chains, rx_chains, fw); in iwl_init_he_hw_capab()
1144 u8 tx_chains, u8 rx_chains, const struct iwl_fw *fw) in iwl_reinit_cab() argument
1148 sband = &data->bands[NL80211_BAND_2GHZ]; in iwl_reinit_cab()
1149 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ, in iwl_reinit_cab()
1152 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_reinit_cab()
1154 fw); in iwl_reinit_cab()
1156 sband = &data->bands[NL80211_BAND_5GHZ]; in iwl_reinit_cab()
1157 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ, in iwl_reinit_cab()
1159 if (data->sku_cap_11ac_enable && !iwlwifi_mod_params.disable_11ac) in iwl_reinit_cab()
1160 iwl_init_vht_hw_capab(trans, data, &sband->vht_cap, in iwl_reinit_cab()
1163 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_reinit_cab()
1165 fw); in iwl_reinit_cab()
1167 sband = &data->bands[NL80211_BAND_6GHZ]; in iwl_reinit_cab()
1168 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_reinit_cab()
1170 fw); in iwl_reinit_cab()
1178 const struct iwl_fw *fw) in iwl_init_sbands() argument
1180 struct device *dev = trans->dev; in iwl_init_sbands()
1185 n_channels = iwl_init_channel_map(trans, fw, data, nvm_ch_flags, in iwl_init_sbands()
1187 sband = &data->bands[NL80211_BAND_2GHZ]; in iwl_init_sbands()
1188 sband->band = NL80211_BAND_2GHZ; in iwl_init_sbands()
1189 sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS]; in iwl_init_sbands()
1190 sband->n_bitrates = N_RATES_24; in iwl_init_sbands()
1193 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ, in iwl_init_sbands()
1196 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_init_sbands()
1198 fw); in iwl_init_sbands()
1200 sband = &data->bands[NL80211_BAND_5GHZ]; in iwl_init_sbands()
1201 sband->band = NL80211_BAND_5GHZ; in iwl_init_sbands()
1202 sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS]; in iwl_init_sbands()
1203 sband->n_bitrates = N_RATES_52; in iwl_init_sbands()
1206 iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ, in iwl_init_sbands()
1208 if (data->sku_cap_11ac_enable && !iwlwifi_mod_params.disable_11ac) in iwl_init_sbands()
1209 iwl_init_vht_hw_capab(trans, data, &sband->vht_cap, in iwl_init_sbands()
1212 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_init_sbands()
1214 fw); in iwl_init_sbands()
1217 sband = &data->bands[NL80211_BAND_6GHZ]; in iwl_init_sbands()
1218 sband->band = NL80211_BAND_6GHZ; in iwl_init_sbands()
1220 sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS]; in iwl_init_sbands()
1221 sband->n_bitrates = N_RATES_52; in iwl_init_sbands()
1225 if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax) in iwl_init_sbands()
1227 fw); in iwl_init_sbands()
1229 sband->n_channels = 0; in iwl_init_sbands()
1235 static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw, in iwl_get_sku() argument
1238 if (cfg->nvm_type != IWL_NVM_EXT) in iwl_get_sku()
1244 static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw) in iwl_get_nvm_version() argument
1246 if (cfg->nvm_type != IWL_NVM_EXT) in iwl_get_nvm_version()
1253 static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw, in iwl_get_radio_cfg() argument
1256 if (cfg->nvm_type != IWL_NVM_EXT) in iwl_get_radio_cfg()
1263 static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw) in iwl_get_n_hw_addrs() argument
1267 if (cfg->nvm_type != IWL_NVM_EXT) in iwl_get_n_hw_addrs()
1275 static void iwl_set_radio_cfg(const struct iwl_cfg *cfg, in iwl_set_radio_cfg() argument
1279 if (cfg->nvm_type != IWL_NVM_EXT) { in iwl_set_radio_cfg()
1280 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg); in iwl_set_radio_cfg()
1281 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg); in iwl_set_radio_cfg()
1282 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg); in iwl_set_radio_cfg()
1283 data->radio_cfg_pnum = NVM_RF_CFG_PNUM_MSK(radio_cfg); in iwl_set_radio_cfg()
1288 data->radio_cfg_type = EXT_NVM_RF_CFG_TYPE_MSK(radio_cfg); in iwl_set_radio_cfg()
1289 data->radio_cfg_step = EXT_NVM_RF_CFG_STEP_MSK(radio_cfg); in iwl_set_radio_cfg()
1290 data->radio_cfg_dash = EXT_NVM_RF_CFG_DASH_MSK(radio_cfg); in iwl_set_radio_cfg()
1291 data->radio_cfg_pnum = EXT_NVM_RF_CFG_FLAVOR_MSK(radio_cfg); in iwl_set_radio_cfg()
1292 data->valid_tx_ant = EXT_NVM_RF_CFG_TX_ANT_MSK(radio_cfg); in iwl_set_radio_cfg()
1293 data->valid_rx_ant = EXT_NVM_RF_CFG_RX_ANT_MSK(radio_cfg); in iwl_set_radio_cfg()
1319 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr); in iwl_set_hw_address_from_csr()
1324 if (is_valid_ether_addr(data->hw_addr)) in iwl_set_hw_address_from_csr()
1330 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr); in iwl_set_hw_address_from_csr()
1334 const struct iwl_cfg *cfg, in iwl_set_hw_address_family_8000() argument
1353 memcpy(data->hw_addr, hw_addr, ETH_ALEN); in iwl_set_hw_address_family_8000()
1359 if (is_valid_ether_addr(data->hw_addr) && in iwl_set_hw_address_family_8000()
1374 iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr); in iwl_set_hw_address_family_8000()
1383 const struct iwl_cfg *cfg, in iwl_set_hw_address() argument
1387 if (cfg->mac_addr_from_csr) { in iwl_set_hw_address()
1389 } else if (cfg->nvm_type != IWL_NVM_EXT) { in iwl_set_hw_address()
1393 data->hw_addr[0] = hw_addr[1]; in iwl_set_hw_address()
1394 data->hw_addr[1] = hw_addr[0]; in iwl_set_hw_address()
1395 data->hw_addr[2] = hw_addr[3]; in iwl_set_hw_address()
1396 data->hw_addr[3] = hw_addr[2]; in iwl_set_hw_address()
1397 data->hw_addr[4] = hw_addr[5]; in iwl_set_hw_address()
1398 data->hw_addr[5] = hw_addr[4]; in iwl_set_hw_address()
1400 iwl_set_hw_address_family_8000(trans, cfg, data, in iwl_set_hw_address()
1404 if (!is_valid_ether_addr(data->hw_addr)) { in iwl_set_hw_address()
1406 return -EINVAL; in iwl_set_hw_address()
1409 if (!trans->csme_own) in iwl_set_hw_address()
1411 data->hw_addr, iwl_read_prph(trans, REG_OTP_MINOR)); in iwl_set_hw_address()
1417 iwl_nvm_no_wide_in_5ghz(struct iwl_trans *trans, const struct iwl_cfg *cfg, in iwl_nvm_no_wide_in_5ghz() argument
1422 * some 7000-family OTPs erroneously allow wide channels in in iwl_nvm_no_wide_in_5ghz()
1424 * bits 1-4 in the subsystem ID and check if it is either 5 or in iwl_nvm_no_wide_in_5ghz()
1425 * 9. In those cases, we need to force-disable wide channels in iwl_nvm_no_wide_in_5ghz()
1426 * in 5GHz otherwise the FW will throw a sysassert when we try in iwl_nvm_no_wide_in_5ghz()
1429 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_7000) { in iwl_nvm_no_wide_in_5ghz()
1432 * section uses big-endian. in iwl_nvm_no_wide_in_5ghz()
1438 IWL_DEBUG_EEPROM(trans->dev, in iwl_nvm_no_wide_in_5ghz()
1449 iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, in iwl_parse_mei_nvm_data() argument
1451 const struct iwl_fw *fw, u8 tx_ant, u8 rx_ant) in iwl_parse_mei_nvm_data() argument
1455 u8 rx_chains = fw->valid_rx_ant; in iwl_parse_mei_nvm_data()
1456 u8 tx_chains = fw->valid_rx_ant; in iwl_parse_mei_nvm_data()
1458 if (cfg->uhb_supported) in iwl_parse_mei_nvm_data()
1469 BUILD_BUG_ON(ARRAY_SIZE(mei_nvm->channels) != in iwl_parse_mei_nvm_data()
1471 data->nvm_version = mei_nvm->nvm_version; in iwl_parse_mei_nvm_data()
1473 iwl_set_radio_cfg(cfg, data, mei_nvm->radio_cfg); in iwl_parse_mei_nvm_data()
1474 if (data->valid_tx_ant) in iwl_parse_mei_nvm_data()
1475 tx_chains &= data->valid_tx_ant; in iwl_parse_mei_nvm_data()
1476 if (data->valid_rx_ant) in iwl_parse_mei_nvm_data()
1477 rx_chains &= data->valid_rx_ant; in iwl_parse_mei_nvm_data()
1483 data->sku_cap_mimo_disabled = false; in iwl_parse_mei_nvm_data()
1484 data->sku_cap_band_24ghz_enable = true; in iwl_parse_mei_nvm_data()
1485 data->sku_cap_band_52ghz_enable = true; in iwl_parse_mei_nvm_data()
1486 data->sku_cap_11n_enable = in iwl_parse_mei_nvm_data()
1488 data->sku_cap_11ac_enable = true; in iwl_parse_mei_nvm_data()
1489 data->sku_cap_11ax_enable = in iwl_parse_mei_nvm_data()
1490 mei_nvm->caps & MEI_NVM_CAPS_11AX_SUPPORT; in iwl_parse_mei_nvm_data()
1492 data->lar_enabled = mei_nvm->caps & MEI_NVM_CAPS_LARI_SUPPORT; in iwl_parse_mei_nvm_data()
1494 data->n_hw_addrs = mei_nvm->n_hw_addrs; in iwl_parse_mei_nvm_data()
1495 /* If no valid mac address was found - bail out */ in iwl_parse_mei_nvm_data()
1496 if (iwl_set_hw_address(trans, cfg, data, NULL, NULL)) { in iwl_parse_mei_nvm_data()
1501 if (data->lar_enabled && in iwl_parse_mei_nvm_data()
1502 fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_LAR_SUPPORT)) in iwl_parse_mei_nvm_data()
1505 iwl_init_sbands(trans, data, mei_nvm->channels, tx_chains, rx_chains, in iwl_parse_mei_nvm_data()
1506 sbands_flags, true, fw); in iwl_parse_mei_nvm_data()
1513 iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, in iwl_parse_nvm_data() argument
1514 const struct iwl_fw *fw, in iwl_parse_nvm_data() argument
1527 if (cfg->uhb_supported) in iwl_parse_nvm_data()
1531 else if (cfg->nvm_type != IWL_NVM_EXT) in iwl_parse_nvm_data()
1542 data->nvm_version = iwl_get_nvm_version(cfg, nvm_sw); in iwl_parse_nvm_data()
1544 radio_cfg = iwl_get_radio_cfg(cfg, nvm_sw, phy_sku); in iwl_parse_nvm_data()
1545 iwl_set_radio_cfg(cfg, data, radio_cfg); in iwl_parse_nvm_data()
1546 if (data->valid_tx_ant) in iwl_parse_nvm_data()
1547 tx_chains &= data->valid_tx_ant; in iwl_parse_nvm_data()
1548 if (data->valid_rx_ant) in iwl_parse_nvm_data()
1549 rx_chains &= data->valid_rx_ant; in iwl_parse_nvm_data()
1551 sku = iwl_get_sku(cfg, nvm_sw, phy_sku); in iwl_parse_nvm_data()
1552 data->sku_cap_band_24ghz_enable = sku & NVM_SKU_CAP_BAND_24GHZ; in iwl_parse_nvm_data()
1553 data->sku_cap_band_52ghz_enable = sku & NVM_SKU_CAP_BAND_52GHZ; in iwl_parse_nvm_data()
1554 data->sku_cap_11n_enable = sku & NVM_SKU_CAP_11N_ENABLE; in iwl_parse_nvm_data()
1556 data->sku_cap_11n_enable = false; in iwl_parse_nvm_data()
1557 data->sku_cap_11ac_enable = data->sku_cap_11n_enable && in iwl_parse_nvm_data()
1559 data->sku_cap_mimo_disabled = sku & NVM_SKU_CAP_MIMO_DISABLE; in iwl_parse_nvm_data()
1561 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw); in iwl_parse_nvm_data()
1563 if (cfg->nvm_type != IWL_NVM_EXT) { in iwl_parse_nvm_data()
1572 ch_section = cfg->nvm_type == IWL_NVM_SDP ? in iwl_parse_nvm_data()
1578 u16 lar_offset = data->nvm_version < 0xE39 ? in iwl_parse_nvm_data()
1583 data->lar_enabled = !!(lar_config & in iwl_parse_nvm_data()
1585 lar_enabled = data->lar_enabled; in iwl_parse_nvm_data()
1589 /* If no valid mac address was found - bail out */ in iwl_parse_nvm_data()
1590 if (iwl_set_hw_address(trans, cfg, data, nvm_hw, mac_override)) { in iwl_parse_nvm_data()
1596 fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_LAR_SUPPORT)) in iwl_parse_nvm_data()
1599 if (iwl_nvm_no_wide_in_5ghz(trans, cfg, nvm_hw)) in iwl_parse_nvm_data()
1603 sbands_flags, false, fw); in iwl_parse_nvm_data()
1604 data->calib_version = 255; in iwl_parse_nvm_data()
1613 const struct iwl_cfg *cfg) in iwl_nvm_get_regdom_bw_flags() argument
1625 if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0) in iwl_nvm_get_regdom_bw_flags()
1657 * however, once marked as DFS no-ir is not needed. in iwl_nvm_get_regdom_bw_flags()
1724 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, in iwl_parse_nvm_mcc_info() argument
1740 if (cfg->uhb_supported) { in iwl_parse_nvm_mcc_info()
1743 } else if (cfg->nvm_type == IWL_NVM_EXT) { in iwl_parse_nvm_mcc_info()
1759 return ERR_PTR(-EINVAL); in iwl_parse_nvm_mcc_info()
1767 return ERR_PTR(-ENOMEM); in iwl_parse_nvm_mcc_info()
1769 /* set alpha2 from FW. */ in iwl_parse_nvm_mcc_info()
1770 regd->alpha2[0] = fw_mcc >> 8; in iwl_parse_nvm_mcc_info()
1771 regd->alpha2[1] = fw_mcc & 0xff; in iwl_parse_nvm_mcc_info()
1793 cfg); in iwl_parse_nvm_mcc_info()
1797 center_freq - prev_center_freq > 20) { in iwl_parse_nvm_mcc_info()
1802 rule = &regd->reg_rules[valid_rules - 1]; in iwl_parse_nvm_mcc_info()
1805 rule->freq_range.start_freq_khz = in iwl_parse_nvm_mcc_info()
1806 MHZ_TO_KHZ(center_freq - 10); in iwl_parse_nvm_mcc_info()
1808 rule->freq_range.end_freq_khz = MHZ_TO_KHZ(center_freq + 10); in iwl_parse_nvm_mcc_info()
1810 /* this doesn't matter - not used by FW */ in iwl_parse_nvm_mcc_info()
1811 rule->power_rule.max_antenna_gain = DBI_TO_MBI(6); in iwl_parse_nvm_mcc_info()
1812 rule->power_rule.max_eirp = in iwl_parse_nvm_mcc_info()
1815 rule->flags = reg_rule_flags; in iwl_parse_nvm_mcc_info()
1817 /* rely on auto-calculation to merge BW of contiguous chans */ in iwl_parse_nvm_mcc_info()
1818 rule->flags |= NL80211_RRF_AUTO_BW; in iwl_parse_nvm_mcc_info()
1819 rule->freq_range.max_bandwidth_khz = 0; in iwl_parse_nvm_mcc_info()
1831 reg_query_regdb_wmm(regd->alpha2, center_freq, rule); in iwl_parse_nvm_mcc_info()
1836 * if booted in RF-kill, i.e. not all calibrations etc. are in iwl_parse_nvm_mcc_info()
1844 rule = &regd->reg_rules[valid_rules - 1]; in iwl_parse_nvm_mcc_info()
1845 rule->freq_range.start_freq_khz = MHZ_TO_KHZ(2412); in iwl_parse_nvm_mcc_info()
1846 rule->freq_range.end_freq_khz = MHZ_TO_KHZ(2413); in iwl_parse_nvm_mcc_info()
1847 rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(1); in iwl_parse_nvm_mcc_info()
1848 rule->power_rule.max_antenna_gain = DBI_TO_MBI(6); in iwl_parse_nvm_mcc_info()
1849 rule->power_rule.max_eirp = in iwl_parse_nvm_mcc_info()
1853 regd->n_reg_rules = valid_rules; in iwl_parse_nvm_mcc_info()
1862 copy_rd = ERR_PTR(-ENOMEM); in iwl_parse_nvm_mcc_info()
1888 * Reads external NVM from a file into mvm->nvm_sections
1891 * ------------------------------
1893 * 3800 -> header
1894 * 0000 -> header
1895 * 5a40 -> data
1897 * rev - 6 bit (word1)
1898 * len - 10 bit (word1)
1899 * id - 4 bit (word2)
1900 * rsv - 12 bit (word2)
1933 IWL_DEBUG_EEPROM(trans->dev, "Read from external NVM\n"); in iwl_read_external_nvm()
1936 if (trans->cfg->nvm_type != IWL_NVM_EXT) in iwl_read_external_nvm()
1947 ret = request_firmware(&fw_entry, nvm_file_name, trans->dev); in iwl_read_external_nvm()
1955 nvm_file_name, fw_entry->size); in iwl_read_external_nvm()
1957 if (fw_entry->size > MAX_NVM_FILE_LEN) { in iwl_read_external_nvm()
1959 ret = -EINVAL; in iwl_read_external_nvm()
1963 eof = fw_entry->data + fw_entry->size; in iwl_read_external_nvm()
1964 dword_buff = (const __le32 *)fw_entry->data; in iwl_read_external_nvm()
1971 * This header must be skipped when providing the NVM data to the FW. in iwl_read_external_nvm()
1973 if (fw_entry->size > NVM_HEADER_SIZE && in iwl_read_external_nvm()
1976 file_sec = (const void *)(fw_entry->data + NVM_HEADER_SIZE); in iwl_read_external_nvm()
1982 if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_8000 && in iwl_read_external_nvm()
1983 trans->hw_rev_step == SILICON_C_STEP && in iwl_read_external_nvm()
1985 ret = -EFAULT; in iwl_read_external_nvm()
1989 file_sec = (const void *)fw_entry->data; in iwl_read_external_nvm()
1993 if (file_sec->data > eof) { in iwl_read_external_nvm()
1995 "ERROR - NVM file too short for section header\n"); in iwl_read_external_nvm()
1996 ret = -EINVAL; in iwl_read_external_nvm()
2001 if (!file_sec->word1 && !file_sec->word2) { in iwl_read_external_nvm()
2006 if (trans->cfg->nvm_type != IWL_NVM_EXT) { in iwl_read_external_nvm()
2008 2 * NVM_WORD1_LEN(le16_to_cpu(file_sec->word1)); in iwl_read_external_nvm()
2009 section_id = NVM_WORD2_ID(le16_to_cpu(file_sec->word2)); in iwl_read_external_nvm()
2012 le16_to_cpu(file_sec->word2)); in iwl_read_external_nvm()
2014 le16_to_cpu(file_sec->word1)); in iwl_read_external_nvm()
2018 IWL_ERR(trans, "ERROR - section too large (%d)\n", in iwl_read_external_nvm()
2020 ret = -EINVAL; in iwl_read_external_nvm()
2025 IWL_ERR(trans, "ERROR - section empty\n"); in iwl_read_external_nvm()
2026 ret = -EINVAL; in iwl_read_external_nvm()
2030 if (file_sec->data + section_size > eof) { in iwl_read_external_nvm()
2032 "ERROR - NVM file too short for section (%d bytes)\n", in iwl_read_external_nvm()
2034 ret = -EINVAL; in iwl_read_external_nvm()
2040 ret = -EINVAL; in iwl_read_external_nvm()
2044 temp = kmemdup(file_sec->data, section_size, GFP_KERNEL); in iwl_read_external_nvm()
2046 ret = -ENOMEM; in iwl_read_external_nvm()
2050 iwl_nvm_fixups(trans->hw_id, section_id, temp, section_size); in iwl_read_external_nvm()
2057 file_sec = (const void *)(file_sec->data + section_size); in iwl_read_external_nvm()
2066 const struct iwl_fw *fw, in iwl_get_nvm() argument
2092 bool v4 = fw_has_api(&fw->ucode_capa, in iwl_get_nvm()
2102 "Invalid payload len in NVM response from FW %d", in iwl_get_nvm()
2104 ret = -EINVAL; in iwl_get_nvm()
2108 rsp = (void *)hcmd.resp_pkt->data; in iwl_get_nvm()
2109 empty_otp = !!(le32_to_cpu(rsp->general.flags) & in iwl_get_nvm()
2116 ret = -ENOMEM; in iwl_get_nvm()
2121 /* TODO: if platform NVM has MAC address - override it here */ in iwl_get_nvm()
2123 if (!is_valid_ether_addr(nvm->hw_addr)) { in iwl_get_nvm()
2125 ret = -EINVAL; in iwl_get_nvm()
2129 IWL_INFO(trans, "base HW address: %pM\n", nvm->hw_addr); in iwl_get_nvm()
2132 nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version); in iwl_get_nvm()
2133 nvm->n_hw_addrs = rsp->general.n_hw_addrs; in iwl_get_nvm()
2134 if (nvm->n_hw_addrs == 0) in iwl_get_nvm()
2140 mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags); in iwl_get_nvm()
2141 nvm->sku_cap_11ac_enable = in iwl_get_nvm()
2143 nvm->sku_cap_11n_enable = in iwl_get_nvm()
2145 nvm->sku_cap_11ax_enable = in iwl_get_nvm()
2147 nvm->sku_cap_band_24ghz_enable = in iwl_get_nvm()
2149 nvm->sku_cap_band_52ghz_enable = in iwl_get_nvm()
2151 nvm->sku_cap_mimo_disabled = in iwl_get_nvm()
2153 if (CSR_HW_RFID_TYPE(trans->hw_rf_id) >= IWL_CFG_RF_TYPE_FM) in iwl_get_nvm()
2154 nvm->sku_cap_11be_enable = true; in iwl_get_nvm()
2157 nvm->valid_tx_ant = (u8)le32_to_cpu(rsp->phy_sku.tx_chains); in iwl_get_nvm()
2158 nvm->valid_rx_ant = (u8)le32_to_cpu(rsp->phy_sku.rx_chains); in iwl_get_nvm()
2160 if (le32_to_cpu(rsp->regulatory.lar_enabled) && in iwl_get_nvm()
2161 fw_has_capa(&fw->ucode_capa, in iwl_get_nvm()
2163 nvm->lar_enabled = true; in iwl_get_nvm()
2168 channel_profile = v4 ? (void *)rsp->regulatory.channel_profile : in iwl_get_nvm()
2169 (void *)rsp_v3->regulatory.channel_profile; in iwl_get_nvm()
2171 tx_ant = nvm->valid_tx_ant & fw->valid_tx_ant; in iwl_get_nvm()
2172 rx_ant = nvm->valid_rx_ant & fw->valid_rx_ant; in iwl_get_nvm()
2180 sbands_flags, v4, fw); in iwl_get_nvm()