Merge tag 'wireless-next-2022-03-11' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / net / wireless / intel / iwlwifi / iwl-nvm-parse.c
index 04addf9..9040da3 100644 (file)
@@ -375,10 +375,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
 
                if (v4)
                        ch_flags =
-                               __le32_to_cpup((__le32 *)nvm_ch_flags + ch_idx);
+                               __le32_to_cpup((const __le32 *)nvm_ch_flags + ch_idx);
                else
                        ch_flags =
-                               __le16_to_cpup((__le16 *)nvm_ch_flags + ch_idx);
+                               __le16_to_cpup((const __le16 *)nvm_ch_flags + ch_idx);
 
                if (band == NL80211_BAND_5GHZ &&
                    !data->sku_cap_band_52ghz_enable)
@@ -583,9 +583,9 @@ static const struct ieee80211_sband_iftype_data iwl_he_capa[] = {
                                        IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US |
                                        IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ,
                                .phy_cap_info[3] =
-                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM |
+                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK |
                                        IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 |
-                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM |
+                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK |
                                        IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1,
                                .phy_cap_info[4] =
                                        IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE |
@@ -653,9 +653,9 @@ static const struct ieee80211_sband_iftype_data iwl_he_capa[] = {
                                        IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ |
                                        IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US,
                                .phy_cap_info[3] =
-                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM |
+                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK |
                                        IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 |
-                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM |
+                                       IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK |
                                        IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1,
                                .phy_cap_info[6] =
                                        IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT,
@@ -731,7 +731,7 @@ static void iwl_init_he_6ghz_capa(struct iwl_trans *trans,
        IWL_DEBUG_EEPROM(trans->dev, "he_6ghz_capa=0x%x\n", he_6ghz_capa);
 
        /* we know it's writable - we set it before ourselves */
-       iftype_data = (void *)sband->iftype_data;
+       iftype_data = (void *)(uintptr_t)sband->iftype_data;
        for (i = 0; i < sband->n_iftype_data; i++)
                iftype_data[i].he_6ghz_capa.capa = cpu_to_le16(he_6ghz_capa);
 }
@@ -783,6 +783,7 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans,
        switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) {
        case IWL_CFG_RF_TYPE_GF:
        case IWL_CFG_RF_TYPE_MR:
+       case IWL_CFG_RF_TYPE_MS:
                iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |=
                        IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU;
                if (!is_ap)
@@ -911,7 +912,7 @@ static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
        if (cfg->nvm_type != IWL_NVM_EXT)
                return le16_to_cpup(nvm_sw + SKU);
 
-       return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000));
+       return le32_to_cpup((const __le32 *)(phy_sku + SKU_FAMILY_8000));
 }
 
 static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
@@ -919,8 +920,8 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
        if (cfg->nvm_type != IWL_NVM_EXT)
                return le16_to_cpup(nvm_sw + NVM_VERSION);
        else
-               return le32_to_cpup((__le32 *)(nvm_sw +
-                                              NVM_VERSION_EXT_NVM));
+               return le32_to_cpup((const __le32 *)(nvm_sw +
+                                                    NVM_VERSION_EXT_NVM));
 }
 
 static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
@@ -929,7 +930,7 @@ static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
        if (cfg->nvm_type != IWL_NVM_EXT)
                return le16_to_cpup(nvm_sw + RADIO_CFG);
 
-       return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM));
+       return le32_to_cpup((const __le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM));
 
 }
 
@@ -940,7 +941,7 @@ static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
        if (cfg->nvm_type != IWL_NVM_EXT)
                return le16_to_cpup(nvm_sw + N_HW_ADDRS);
 
-       n_hw_addr = le32_to_cpup((__le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000));
+       n_hw_addr = le32_to_cpup((const __le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000));
 
        return n_hw_addr & N_HW_ADDR_MASK;
 }
@@ -1079,7 +1080,9 @@ static int iwl_set_hw_address(struct iwl_trans *trans,
                return -EINVAL;
        }
 
-       IWL_INFO(trans, "base HW address: %pM\n", data->hw_addr);
+       if (!trans->csme_own)
+               IWL_INFO(trans, "base HW address: %pM, OTP minor version: 0x%x\n",
+                        data->hw_addr, iwl_read_prph(trans, REG_OTP_MINOR));
 
        return 0;
 }
@@ -1384,8 +1387,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
                nvm_chan = iwl_nvm_channels;
        }
 
-       if (WARN_ON(num_of_ch > max_num_ch))
+       if (num_of_ch > max_num_ch) {
+               IWL_DEBUG_DEV(dev, IWL_DL_LAR,
+                             "Num of channels (%d) is greater than expected. Truncating to %d\n",
+                             num_of_ch, max_num_ch);
                num_of_ch = max_num_ch;
+       }
 
        if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
                return ERR_PTR(-EINVAL);
@@ -1591,7 +1598,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
        }
 
        eof = fw_entry->data + fw_entry->size;
-       dword_buff = (__le32 *)fw_entry->data;
+       dword_buff = (const __le32 *)fw_entry->data;
 
        /* some NVM file will contain a header.
         * The header is identified by 2 dwords header as follow:
@@ -1603,7 +1610,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
        if (fw_entry->size > NVM_HEADER_SIZE &&
            dword_buff[0] == cpu_to_le32(NVM_HEADER_0) &&
            dword_buff[1] == cpu_to_le32(NVM_HEADER_1)) {
-               file_sec = (void *)(fw_entry->data + NVM_HEADER_SIZE);
+               file_sec = (const void *)(fw_entry->data + NVM_HEADER_SIZE);
                IWL_INFO(trans, "NVM Version %08X\n", le32_to_cpu(dword_buff[2]));
                IWL_INFO(trans, "NVM Manufacturing date %08X\n",
                         le32_to_cpu(dword_buff[3]));
@@ -1616,7 +1623,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
                        goto out;
                }
        } else {
-               file_sec = (void *)fw_entry->data;
+               file_sec = (const void *)fw_entry->data;
        }
 
        while (true) {
@@ -1684,7 +1691,7 @@ int iwl_read_external_nvm(struct iwl_trans *trans,
                nvm_sections[section_id].length = section_size;
 
                /* advance to the next section */
-               file_sec = (void *)(file_sec->data + section_size);
+               file_sec = (const void *)(file_sec->data + section_size);
        }
 out:
        release_firmware(fw_entry);