aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>2017-09-04 07:40:06 -0400
committerLuca Coelho <luciano.coelho@intel.com>2017-10-06 06:59:44 -0400
commit44fd09dad5d2b78efbabbbbf623774e561e36cca (patch)
tree4a4fe25e07e97c4c0b8fb6807d573923e3404008
parentd8c73e455d7b973d1346bb5632b4a41819b090c9 (diff)
iwlwifi: nvm: set the correct offsets to 3168 series
The driver currently handles two NVM formats, one for 7000 family and below, and one for 8000 family and above. The 3168 series uses something in between, so currently the driver uses incorrect offsets for it. Fix the incorrect offsets. Fixes: c4836b056d83 ("iwlwifi: Add PCI IDs for the new 3168 series") Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/7000.c1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/8000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/9000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/a000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h16
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c39
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/nvm.c21
9 files changed, 59 insertions, 28 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/7000.c b/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
index 45e2efc70d19..ce741beec1fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
@@ -309,6 +309,7 @@ const struct iwl_cfg iwl3168_2ac_cfg = {
309 .nvm_calib_ver = IWL3168_TX_POWER_VERSION, 309 .nvm_calib_ver = IWL3168_TX_POWER_VERSION,
310 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 310 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
311 .dccm_len = IWL7265_DCCM_LEN, 311 .dccm_len = IWL7265_DCCM_LEN,
312 .nvm_type = IWL_NVM_SDP,
312}; 313};
313 314
314const struct iwl_cfg iwl7265_2ac_cfg = { 315const struct iwl_cfg iwl7265_2ac_cfg = {
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
index 2e6c52664cee..c2a5936ccede 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
@@ -164,7 +164,7 @@ static const struct iwl_tt_params iwl8000_tt_params = {
164 .default_nvm_file_C_step = DEFAULT_NVM_FILE_FAMILY_8000C, \ 164 .default_nvm_file_C_step = DEFAULT_NVM_FILE_FAMILY_8000C, \
165 .thermal_params = &iwl8000_tt_params, \ 165 .thermal_params = &iwl8000_tt_params, \
166 .apmg_not_supported = true, \ 166 .apmg_not_supported = true, \
167 .ext_nvm = true, \ 167 .nvm_type = IWL_NVM_EXT, \
168 .dbgc_supported = true 168 .dbgc_supported = true
169 169
170#define IWL_DEVICE_8000 \ 170#define IWL_DEVICE_8000 \
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index 2babe0a1f18b..e8b5ff42f5a8 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -148,7 +148,7 @@ static const struct iwl_tt_params iwl9000_tt_params = {
148 .vht_mu_mimo_supported = true, \ 148 .vht_mu_mimo_supported = true, \
149 .mac_addr_from_csr = true, \ 149 .mac_addr_from_csr = true, \
150 .rf_id = true, \ 150 .rf_id = true, \
151 .ext_nvm = true, \ 151 .nvm_type = IWL_NVM_EXT, \
152 .dbgc_supported = true 152 .dbgc_supported = true
153 153
154const struct iwl_cfg iwl9160_2ac_cfg = { 154const struct iwl_cfg iwl9160_2ac_cfg = {
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/a000.c b/drivers/net/wireless/intel/iwlwifi/cfg/a000.c
index 76ba1f8bc72f..a440140ed8dd 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/a000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/a000.c
@@ -133,7 +133,7 @@ static const struct iwl_ht_params iwl_a000_ht_params = {
133 .use_tfh = true, \ 133 .use_tfh = true, \
134 .rf_id = true, \ 134 .rf_id = true, \
135 .gen2 = true, \ 135 .gen2 = true, \
136 .ext_nvm = true, \ 136 .nvm_type = IWL_NVM_EXT, \
137 .dbgc_supported = true 137 .dbgc_supported = true
138 138
139const struct iwl_cfg iwla000_2ac_cfg_hr = { 139const struct iwl_cfg iwla000_2ac_cfg_hr = {
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
index 00bc7a25dece..3fd07bc80f54 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
@@ -108,6 +108,7 @@ enum iwl_nvm_access_target {
108 * @NVM_SECTION_TYPE_REGULATORY: regulatory section 108 * @NVM_SECTION_TYPE_REGULATORY: regulatory section
109 * @NVM_SECTION_TYPE_CALIBRATION: calibration section 109 * @NVM_SECTION_TYPE_CALIBRATION: calibration section
110 * @NVM_SECTION_TYPE_PRODUCTION: production section 110 * @NVM_SECTION_TYPE_PRODUCTION: production section
111 * @NVM_SECTION_TYPE_REGULATORY_SDP: regulatory section used by 3168 series
111 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section 112 * @NVM_SECTION_TYPE_MAC_OVERRIDE: MAC override section
112 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section 113 * @NVM_SECTION_TYPE_PHY_SKU: PHY SKU section
113 * @NVM_MAX_NUM_SECTIONS: number of sections 114 * @NVM_MAX_NUM_SECTIONS: number of sections
@@ -117,6 +118,7 @@ enum iwl_nvm_section_type {
117 NVM_SECTION_TYPE_REGULATORY = 3, 118 NVM_SECTION_TYPE_REGULATORY = 3,
118 NVM_SECTION_TYPE_CALIBRATION = 4, 119 NVM_SECTION_TYPE_CALIBRATION = 4,
119 NVM_SECTION_TYPE_PRODUCTION = 5, 120 NVM_SECTION_TYPE_PRODUCTION = 5,
121 NVM_SECTION_TYPE_REGULATORY_SDP = 8,
120 NVM_SECTION_TYPE_MAC_OVERRIDE = 11, 122 NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
121 NVM_SECTION_TYPE_PHY_SKU = 12, 123 NVM_SECTION_TYPE_PHY_SKU = 12,
122 NVM_MAX_NUM_SECTIONS = 13, 124 NVM_MAX_NUM_SECTIONS = 13,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 3e057b539d5b..71cb1ecde0f7 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -108,6 +108,18 @@ enum iwl_led_mode {
108 IWL_LED_DISABLE, 108 IWL_LED_DISABLE,
109}; 109};
110 110
111/**
112 * enum iwl_nvm_type - nvm formats
113 * @IWL_NVM: the regular format
114 * @IWL_NVM_EXT: extended NVM format
115 * @IWL_NVM_SDP: NVM format used by 3168 series
116 */
117enum iwl_nvm_type {
118 IWL_NVM,
119 IWL_NVM_EXT,
120 IWL_NVM_SDP,
121};
122
111/* 123/*
112 * This is the threshold value of plcp error rate per 100mSecs. It is 124 * This is the threshold value of plcp error rate per 100mSecs. It is
113 * used to set and check for the validity of plcp_delta. 125 * used to set and check for the validity of plcp_delta.
@@ -320,7 +332,7 @@ struct iwl_pwr_tx_backoff {
320 * @integrated: discrete or integrated 332 * @integrated: discrete or integrated
321 * @gen2: a000 and on transport operation 333 * @gen2: a000 and on transport operation
322 * @cdb: CDB support 334 * @cdb: CDB support
323 * @ext_nvm: extended NVM format 335 * @nvm_type: see &enum iwl_nvm_type
324 * 336 *
325 * We enable the driver to be backward compatible wrt. hardware features. 337 * We enable the driver to be backward compatible wrt. hardware features.
326 * API differences in uCode shouldn't be handled here but through TLVs 338 * API differences in uCode shouldn't be handled here but through TLVs
@@ -342,6 +354,7 @@ struct iwl_cfg {
342 const struct iwl_tt_params *thermal_params; 354 const struct iwl_tt_params *thermal_params;
343 enum iwl_device_family device_family; 355 enum iwl_device_family device_family;
344 enum iwl_led_mode led_mode; 356 enum iwl_led_mode led_mode;
357 enum iwl_nvm_type nvm_type;
345 u32 max_data_size; 358 u32 max_data_size;
346 u32 max_inst_size; 359 u32 max_inst_size;
347 netdev_features_t features; 360 netdev_features_t features;
@@ -369,7 +382,6 @@ struct iwl_cfg {
369 use_tfh:1, 382 use_tfh:1,
370 gen2:1, 383 gen2:1,
371 cdb:1, 384 cdb:1,
372 ext_nvm:1,
373 dbgc_supported:1; 385 dbgc_supported:1;
374 u8 valid_tx_ant; 386 u8 valid_tx_ant;
375 u8 valid_rx_ant; 387 u8 valid_rx_ant;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 35638404c24e..c3a5d8ccc95e 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -77,7 +77,7 @@
77#include "iwl-csr.h" 77#include "iwl-csr.h"
78 78
79/* NVM offsets (in words) definitions */ 79/* NVM offsets (in words) definitions */
80enum wkp_nvm_offsets { 80enum nvm_offsets {
81 /* NVM HW-Section offset (in words) definitions */ 81 /* NVM HW-Section offset (in words) definitions */
82 SUBSYSTEM_ID = 0x0A, 82 SUBSYSTEM_ID = 0x0A,
83 HW_ADDR = 0x15, 83 HW_ADDR = 0x15,
@@ -92,7 +92,10 @@ enum wkp_nvm_offsets {
92 92
93 /* NVM calibration section offset (in words) definitions */ 93 /* NVM calibration section offset (in words) definitions */
94 NVM_CALIB_SECTION = 0x2B8, 94 NVM_CALIB_SECTION = 0x2B8,
95 XTAL_CALIB = 0x316 - NVM_CALIB_SECTION 95 XTAL_CALIB = 0x316 - NVM_CALIB_SECTION,
96
97 /* NVM REGULATORY -Section offset (in words) definitions */
98 NVM_CHANNELS_SDP = 0,
96}; 99};
97 100
98enum ext_nvm_offsets { 101enum ext_nvm_offsets {
@@ -243,7 +246,7 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
243 u32 flags = IEEE80211_CHAN_NO_HT40; 246 u32 flags = IEEE80211_CHAN_NO_HT40;
244 u32 last_5ghz_ht = LAST_5GHZ_HT; 247 u32 last_5ghz_ht = LAST_5GHZ_HT;
245 248
246 if (cfg->ext_nvm) 249 if (cfg->nvm_type == IWL_NVM_EXT)
247 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000; 250 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
248 251
249 if (!is_5ghz && (nvm_flags & NVM_CHANNEL_40MHZ)) { 252 if (!is_5ghz && (nvm_flags & NVM_CHANNEL_40MHZ)) {
@@ -296,7 +299,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
296 int num_of_ch, num_2ghz_channels; 299 int num_of_ch, num_2ghz_channels;
297 const u8 *nvm_chan; 300 const u8 *nvm_chan;
298 301
299 if (!cfg->ext_nvm) { 302 if (cfg->nvm_type != IWL_NVM_EXT) {
300 num_of_ch = IWL_NUM_CHANNELS; 303 num_of_ch = IWL_NUM_CHANNELS;
301 nvm_chan = &iwl_nvm_channels[0]; 304 nvm_chan = &iwl_nvm_channels[0];
302 num_2ghz_channels = NUM_2GHZ_CHANNELS; 305 num_2ghz_channels = NUM_2GHZ_CHANNELS;
@@ -491,7 +494,7 @@ IWL_EXPORT_SYMBOL(iwl_init_sbands);
491static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw, 494static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
492 const __le16 *phy_sku) 495 const __le16 *phy_sku)
493{ 496{
494 if (!cfg->ext_nvm) 497 if (cfg->nvm_type != IWL_NVM_EXT)
495 return le16_to_cpup(nvm_sw + SKU); 498 return le16_to_cpup(nvm_sw + SKU);
496 499
497 return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000)); 500 return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000));
@@ -499,7 +502,7 @@ static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
499 502
500static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw) 503static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
501{ 504{
502 if (!cfg->ext_nvm) 505 if (cfg->nvm_type != IWL_NVM_EXT)
503 return le16_to_cpup(nvm_sw + NVM_VERSION); 506 return le16_to_cpup(nvm_sw + NVM_VERSION);
504 else 507 else
505 return le32_to_cpup((__le32 *)(nvm_sw + 508 return le32_to_cpup((__le32 *)(nvm_sw +
@@ -509,7 +512,7 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
509static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw, 512static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
510 const __le16 *phy_sku) 513 const __le16 *phy_sku)
511{ 514{
512 if (!cfg->ext_nvm) 515 if (cfg->nvm_type != IWL_NVM_EXT)
513 return le16_to_cpup(nvm_sw + RADIO_CFG); 516 return le16_to_cpup(nvm_sw + RADIO_CFG);
514 517
515 return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM)); 518 return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_EXT_NVM));
@@ -520,7 +523,7 @@ static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
520{ 523{
521 int n_hw_addr; 524 int n_hw_addr;
522 525
523 if (!cfg->ext_nvm) 526 if (cfg->nvm_type != IWL_NVM_EXT)
524 return le16_to_cpup(nvm_sw + N_HW_ADDRS); 527 return le16_to_cpup(nvm_sw + N_HW_ADDRS);
525 528
526 n_hw_addr = le32_to_cpup((__le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000)); 529 n_hw_addr = le32_to_cpup((__le32 *)(nvm_sw + N_HW_ADDRS_FAMILY_8000));
@@ -532,7 +535,7 @@ static void iwl_set_radio_cfg(const struct iwl_cfg *cfg,
532 struct iwl_nvm_data *data, 535 struct iwl_nvm_data *data,
533 u32 radio_cfg) 536 u32 radio_cfg)
534{ 537{
535 if (!cfg->ext_nvm) { 538 if (cfg->nvm_type != IWL_NVM_EXT) {
536 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg); 539 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg);
537 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg); 540 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg);
538 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg); 541 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg);
@@ -641,7 +644,7 @@ static int iwl_set_hw_address(struct iwl_trans *trans,
641{ 644{
642 if (cfg->mac_addr_from_csr) { 645 if (cfg->mac_addr_from_csr) {
643 iwl_set_hw_address_from_csr(trans, data); 646 iwl_set_hw_address_from_csr(trans, data);
644 } else if (!cfg->ext_nvm) { 647 } else if (cfg->nvm_type != IWL_NVM_EXT) {
645 const u8 *hw_addr = (const u8 *)(nvm_hw + HW_ADDR); 648 const u8 *hw_addr = (const u8 *)(nvm_hw + HW_ADDR);
646 649
647 /* The byte order is little endian 16 bit, meaning 214365 */ 650 /* The byte order is little endian 16 bit, meaning 214365 */
@@ -713,7 +716,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
713 u16 lar_config; 716 u16 lar_config;
714 const __le16 *ch_section; 717 const __le16 *ch_section;
715 718
716 if (!cfg->ext_nvm) 719 if (cfg->nvm_type != IWL_NVM_EXT)
717 data = kzalloc(sizeof(*data) + 720 data = kzalloc(sizeof(*data) +
718 sizeof(struct ieee80211_channel) * 721 sizeof(struct ieee80211_channel) *
719 IWL_NUM_CHANNELS, 722 IWL_NUM_CHANNELS,
@@ -747,7 +750,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
747 750
748 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw); 751 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw);
749 752
750 if (!cfg->ext_nvm) { 753 if (cfg->nvm_type != IWL_NVM_EXT) {
751 /* Checking for required sections */ 754 /* Checking for required sections */
752 if (!nvm_calib) { 755 if (!nvm_calib) {
753 IWL_ERR(trans, 756 IWL_ERR(trans,
@@ -755,11 +758,15 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
755 kfree(data); 758 kfree(data);
756 return NULL; 759 return NULL;
757 } 760 }
761
762 ch_section = cfg->nvm_type == IWL_NVM_SDP ?
763 &regulatory[NVM_CHANNELS_SDP] :
764 &nvm_sw[NVM_CHANNELS];
765
758 /* in family 8000 Xtal calibration values moved to OTP */ 766 /* in family 8000 Xtal calibration values moved to OTP */
759 data->xtal_calib[0] = *(nvm_calib + XTAL_CALIB); 767 data->xtal_calib[0] = *(nvm_calib + XTAL_CALIB);
760 data->xtal_calib[1] = *(nvm_calib + XTAL_CALIB + 1); 768 data->xtal_calib[1] = *(nvm_calib + XTAL_CALIB + 1);
761 lar_enabled = true; 769 lar_enabled = true;
762 ch_section = &nvm_sw[NVM_CHANNELS];
763 } else { 770 } else {
764 u16 lar_offset = data->nvm_version < 0xE39 ? 771 u16 lar_offset = data->nvm_version < 0xE39 ?
765 NVM_LAR_OFFSET_OLD : 772 NVM_LAR_OFFSET_OLD :
@@ -793,7 +800,7 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u8 *nvm_chan,
793 u32 flags = NL80211_RRF_NO_HT40; 800 u32 flags = NL80211_RRF_NO_HT40;
794 u32 last_5ghz_ht = LAST_5GHZ_HT; 801 u32 last_5ghz_ht = LAST_5GHZ_HT;
795 802
796 if (cfg->ext_nvm) 803 if (cfg->nvm_type == IWL_NVM_EXT)
797 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000; 804 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
798 805
799 if (ch_idx < NUM_2GHZ_CHANNELS && 806 if (ch_idx < NUM_2GHZ_CHANNELS &&
@@ -841,7 +848,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
841 int ch_idx; 848 int ch_idx;
842 u16 ch_flags; 849 u16 ch_flags;
843 u32 reg_rule_flags, prev_reg_rule_flags = 0; 850 u32 reg_rule_flags, prev_reg_rule_flags = 0;
844 const u8 *nvm_chan = cfg->ext_nvm ? 851 const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ?
845 iwl_ext_nvm_channels : iwl_nvm_channels; 852 iwl_ext_nvm_channels : iwl_nvm_channels;
846 struct ieee80211_regdomain *regd; 853 struct ieee80211_regdomain *regd;
847 int size_of_regd; 854 int size_of_regd;
@@ -850,7 +857,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
850 int center_freq, prev_center_freq = 0; 857 int center_freq, prev_center_freq = 0;
851 int valid_rules = 0; 858 int valid_rules = 0;
852 bool new_rule; 859 bool new_rule;
853 int max_num_ch = cfg->ext_nvm ? 860 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
854 IWL_NUM_CHANNELS_EXT : IWL_NUM_CHANNELS; 861 IWL_NUM_CHANNELS_EXT : IWL_NUM_CHANNELS;
855 862
856 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES)) 863 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index d75da37a79f3..949e63418299 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1162,7 +1162,7 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
1162 * Enable LAR only if it is supported by the FW (TLV) && 1162 * Enable LAR only if it is supported by the FW (TLV) &&
1163 * enabled in the NVM 1163 * enabled in the NVM
1164 */ 1164 */
1165 if (mvm->cfg->ext_nvm) 1165 if (mvm->cfg->nvm_type == IWL_NVM_EXT)
1166 return nvm_lar && tlv_lar; 1166 return nvm_lar && tlv_lar;
1167 else 1167 else
1168 return tlv_lar; 1168 return tlv_lar;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
index 422aa6be9932..fb25b6f29323 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
@@ -295,18 +295,24 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
295 const __be16 *hw; 295 const __be16 *hw;
296 const __le16 *sw, *calib, *regulatory, *mac_override, *phy_sku; 296 const __le16 *sw, *calib, *regulatory, *mac_override, *phy_sku;
297 bool lar_enabled; 297 bool lar_enabled;
298 int regulatory_type;
298 299
299 /* Checking for required sections */ 300 /* Checking for required sections */
300 if (!mvm->trans->cfg->ext_nvm) { 301 if (mvm->trans->cfg->nvm_type != IWL_NVM_EXT) {
301 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || 302 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data ||
302 !mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data) { 303 !mvm->nvm_sections[mvm->cfg->nvm_hw_section_num].data) {
303 IWL_ERR(mvm, "Can't parse empty OTP/NVM sections\n"); 304 IWL_ERR(mvm, "Can't parse empty OTP/NVM sections\n");
304 return NULL; 305 return NULL;
305 } 306 }
306 } else { 307 } else {
308 if (mvm->trans->cfg->nvm_type == IWL_NVM_SDP)
309 regulatory_type = NVM_SECTION_TYPE_REGULATORY_SDP;
310 else
311 regulatory_type = NVM_SECTION_TYPE_REGULATORY;
312
307 /* SW and REGULATORY sections are mandatory */ 313 /* SW and REGULATORY sections are mandatory */
308 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || 314 if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data ||
309 !mvm->nvm_sections[NVM_SECTION_TYPE_REGULATORY].data) { 315 !mvm->nvm_sections[regulatory_type].data) {
310 IWL_ERR(mvm, 316 IWL_ERR(mvm,
311 "Can't parse empty family 8000 OTP/NVM sections\n"); 317 "Can't parse empty family 8000 OTP/NVM sections\n");
312 return NULL; 318 return NULL;
@@ -330,11 +336,14 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
330 hw = (const __be16 *)sections[mvm->cfg->nvm_hw_section_num].data; 336 hw = (const __be16 *)sections[mvm->cfg->nvm_hw_section_num].data;
331 sw = (const __le16 *)sections[NVM_SECTION_TYPE_SW].data; 337 sw = (const __le16 *)sections[NVM_SECTION_TYPE_SW].data;
332 calib = (const __le16 *)sections[NVM_SECTION_TYPE_CALIBRATION].data; 338 calib = (const __le16 *)sections[NVM_SECTION_TYPE_CALIBRATION].data;
333 regulatory = (const __le16 *)sections[NVM_SECTION_TYPE_REGULATORY].data;
334 mac_override = 339 mac_override =
335 (const __le16 *)sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data; 340 (const __le16 *)sections[NVM_SECTION_TYPE_MAC_OVERRIDE].data;
336 phy_sku = (const __le16 *)sections[NVM_SECTION_TYPE_PHY_SKU].data; 341 phy_sku = (const __le16 *)sections[NVM_SECTION_TYPE_PHY_SKU].data;
337 342
343 regulatory = mvm->trans->cfg->nvm_type == IWL_NVM_SDP ?
344 (const __le16 *)sections[NVM_SECTION_TYPE_REGULATORY_SDP].data :
345 (const __le16 *)sections[NVM_SECTION_TYPE_REGULATORY].data;
346
338 lar_enabled = !iwlwifi_mod_params.lar_disable && 347 lar_enabled = !iwlwifi_mod_params.lar_disable &&
339 fw_has_capa(&mvm->fw->ucode_capa, 348 fw_has_capa(&mvm->fw->ucode_capa,
340 IWL_UCODE_TLV_CAPA_LAR_SUPPORT); 349 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
@@ -394,7 +403,7 @@ int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm)
394 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from external NVM\n"); 403 IWL_DEBUG_EEPROM(mvm->trans->dev, "Read from external NVM\n");
395 404
396 /* Maximal size depends on NVM version */ 405 /* Maximal size depends on NVM version */
397 if (!mvm->trans->cfg->ext_nvm) 406 if (mvm->trans->cfg->nvm_type != IWL_NVM_EXT)
398 max_section_size = IWL_MAX_NVM_SECTION_SIZE; 407 max_section_size = IWL_MAX_NVM_SECTION_SIZE;
399 else 408 else
400 max_section_size = IWL_MAX_EXT_NVM_SECTION_SIZE; 409 max_section_size = IWL_MAX_EXT_NVM_SECTION_SIZE;
@@ -465,7 +474,7 @@ int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm)
465 break; 474 break;
466 } 475 }
467 476
468 if (!mvm->trans->cfg->ext_nvm) { 477 if (mvm->trans->cfg->nvm_type != IWL_NVM_EXT) {
469 section_size = 478 section_size =
470 2 * NVM_WORD1_LEN(le16_to_cpu(file_sec->word1)); 479 2 * NVM_WORD1_LEN(le16_to_cpu(file_sec->word1));
471 section_id = NVM_WORD2_ID(le16_to_cpu(file_sec->word2)); 480 section_id = NVM_WORD2_ID(le16_to_cpu(file_sec->word2));
@@ -740,7 +749,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
740 struct ieee80211_regdomain *regd; 749 struct ieee80211_regdomain *regd;
741 char mcc[3]; 750 char mcc[3];
742 751
743 if (mvm->cfg->ext_nvm) { 752 if (mvm->cfg->nvm_type == IWL_NVM_EXT) {
744 tlv_lar = fw_has_capa(&mvm->fw->ucode_capa, 753 tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
745 IWL_UCODE_TLV_CAPA_LAR_SUPPORT); 754 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
746 nvm_lar = mvm->nvm_data->lar_enabled; 755 nvm_lar = mvm->nvm_data->lar_enabled;