aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c3
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c197
-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/fw/dbg.c7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/dbg.h15
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h16
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c137
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/nvm.c21
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rx.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tt.c2
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c2
18 files changed, 232 insertions, 197 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
index 4eb1e1ce9ace..ef72baf6dd96 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
@@ -429,7 +429,8 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
429 if (code != BRCMF_E_IF && !fweh->evt_handler[code]) 429 if (code != BRCMF_E_IF && !fweh->evt_handler[code])
430 return; 430 return;
431 431
432 if (datalen > BRCMF_DCMD_MAXLEN) 432 if (datalen > BRCMF_DCMD_MAXLEN ||
433 datalen + sizeof(*event_packet) > packet_len)
433 return; 434 return;
434 435
435 if (in_interrupt()) 436 if (in_interrupt())
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
index b3aab2fe96eb..ef685465f80a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
@@ -14764,8 +14764,8 @@ static void wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi)
14764} 14764}
14765 14765
14766static void 14766static void
14767wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys, 14767wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, const u8 *events,
14768 u8 len) 14768 const u8 *dlys, u8 len)
14769{ 14769{
14770 u32 t1_offset, t2_offset; 14770 u32 t1_offset, t2_offset;
14771 u8 ctr; 14771 u8 ctr;
@@ -15240,16 +15240,16 @@ static void wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi)
15240static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi) 15240static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
15241{ 15241{
15242 u16 currband; 15242 u16 currband;
15243 s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 }; 15243 static const s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
15244 s8 *lna1_gain_db = NULL; 15244 const s8 *lna1_gain_db = NULL;
15245 s8 *lna1_gain_db_2 = NULL; 15245 const s8 *lna1_gain_db_2 = NULL;
15246 s8 *lna2_gain_db = NULL; 15246 const s8 *lna2_gain_db = NULL;
15247 s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 }; 15247 static const s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 };
15248 s8 *tia_gain_db; 15248 const s8 *tia_gain_db;
15249 s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 }; 15249 static const s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
15250 s8 *tia_gainbits; 15250 const s8 *tia_gainbits;
15251 u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f }; 15251 static const u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
15252 u16 *rfseq_init_gain; 15252 const u16 *rfseq_init_gain;
15253 u16 init_gaincode; 15253 u16 init_gaincode;
15254 u16 clip1hi_gaincode; 15254 u16 clip1hi_gaincode;
15255 u16 clip1md_gaincode = 0; 15255 u16 clip1md_gaincode = 0;
@@ -15310,10 +15310,9 @@ static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
15310 15310
15311 if ((freq <= 5080) || (freq == 5825)) { 15311 if ((freq <= 5080) || (freq == 5825)) {
15312 15312
15313 s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 }; 15313 static const s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 };
15314 s8 lna1A_gain_db_2_rev7[] = { 15314 static const s8 lna1A_gain_db_2_rev7[] = { 11, 17, 22, 25};
15315 11, 17, 22, 25}; 15315 static const s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
15316 s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
15317 15316
15318 crsminu_th = 0x3e; 15317 crsminu_th = 0x3e;
15319 lna1_gain_db = lna1A_gain_db_rev7; 15318 lna1_gain_db = lna1A_gain_db_rev7;
@@ -15321,10 +15320,9 @@ static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
15321 lna2_gain_db = lna2A_gain_db_rev7; 15320 lna2_gain_db = lna2A_gain_db_rev7;
15322 } else if ((freq >= 5500) && (freq <= 5700)) { 15321 } else if ((freq >= 5500) && (freq <= 5700)) {
15323 15322
15324 s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 }; 15323 static const s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 };
15325 s8 lna1A_gain_db_2_rev7[] = { 15324 static const s8 lna1A_gain_db_2_rev7[] = { 12, 18, 22, 26};
15326 12, 18, 22, 26}; 15325 static const s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
15327 s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
15328 15326
15329 crsminu_th = 0x45; 15327 crsminu_th = 0x45;
15330 clip1md_gaincode_B = 0x14; 15328 clip1md_gaincode_B = 0x14;
@@ -15335,10 +15333,9 @@ static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
15335 lna2_gain_db = lna2A_gain_db_rev7; 15333 lna2_gain_db = lna2A_gain_db_rev7;
15336 } else { 15334 } else {
15337 15335
15338 s8 lna1A_gain_db_rev7[] = { 12, 18, 22, 26 }; 15336 static const s8 lna1A_gain_db_rev7[] = { 12, 18, 22, 26 };
15339 s8 lna1A_gain_db_2_rev7[] = { 15337 static const s8 lna1A_gain_db_2_rev7[] = { 12, 18, 22, 26};
15340 12, 18, 22, 26}; 15338 static const s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
15341 s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
15342 15339
15343 crsminu_th = 0x41; 15340 crsminu_th = 0x41;
15344 lna1_gain_db = lna1A_gain_db_rev7; 15341 lna1_gain_db = lna1A_gain_db_rev7;
@@ -15450,65 +15447,65 @@ static void wlc_phy_workarounds_nphy_gainctrl(struct brcms_phy *pi)
15450 NPHY_RFSEQ_CMD_CLR_HIQ_DIS, 15447 NPHY_RFSEQ_CMD_CLR_HIQ_DIS,
15451 NPHY_RFSEQ_CMD_SET_HPF_BW 15448 NPHY_RFSEQ_CMD_SET_HPF_BW
15452 }; 15449 };
15453 u8 rfseq_updategainu_dlys[] = { 10, 30, 1 }; 15450 static const u8 rfseq_updategainu_dlys[] = { 10, 30, 1 };
15454 s8 lna1G_gain_db[] = { 7, 11, 16, 23 }; 15451 static const s8 lna1G_gain_db[] = { 7, 11, 16, 23 };
15455 s8 lna1G_gain_db_rev4[] = { 8, 12, 17, 25 }; 15452 static const s8 lna1G_gain_db_rev4[] = { 8, 12, 17, 25 };
15456 s8 lna1G_gain_db_rev5[] = { 9, 13, 18, 26 }; 15453 static const s8 lna1G_gain_db_rev5[] = { 9, 13, 18, 26 };
15457 s8 lna1G_gain_db_rev6[] = { 8, 13, 18, 25 }; 15454 static const s8 lna1G_gain_db_rev6[] = { 8, 13, 18, 25 };
15458 s8 lna1G_gain_db_rev6_224B0[] = { 10, 14, 19, 27 }; 15455 static const s8 lna1G_gain_db_rev6_224B0[] = { 10, 14, 19, 27 };
15459 s8 lna1A_gain_db[] = { 7, 11, 17, 23 }; 15456 static const s8 lna1A_gain_db[] = { 7, 11, 17, 23 };
15460 s8 lna1A_gain_db_rev4[] = { 8, 12, 18, 23 }; 15457 static const s8 lna1A_gain_db_rev4[] = { 8, 12, 18, 23 };
15461 s8 lna1A_gain_db_rev5[] = { 6, 10, 16, 21 }; 15458 static const s8 lna1A_gain_db_rev5[] = { 6, 10, 16, 21 };
15462 s8 lna1A_gain_db_rev6[] = { 6, 10, 16, 21 }; 15459 static const s8 lna1A_gain_db_rev6[] = { 6, 10, 16, 21 };
15463 s8 *lna1_gain_db = NULL; 15460 const s8 *lna1_gain_db = NULL;
15464 s8 lna2G_gain_db[] = { -5, 6, 10, 14 }; 15461 static const s8 lna2G_gain_db[] = { -5, 6, 10, 14 };
15465 s8 lna2G_gain_db_rev5[] = { -3, 7, 11, 16 }; 15462 static const s8 lna2G_gain_db_rev5[] = { -3, 7, 11, 16 };
15466 s8 lna2G_gain_db_rev6[] = { -5, 6, 10, 14 }; 15463 static const s8 lna2G_gain_db_rev6[] = { -5, 6, 10, 14 };
15467 s8 lna2G_gain_db_rev6_224B0[] = { -5, 6, 10, 15 }; 15464 static const s8 lna2G_gain_db_rev6_224B0[] = { -5, 6, 10, 15 };
15468 s8 lna2A_gain_db[] = { -6, 2, 6, 10 }; 15465 static const s8 lna2A_gain_db[] = { -6, 2, 6, 10 };
15469 s8 lna2A_gain_db_rev4[] = { -5, 2, 6, 10 }; 15466 static const s8 lna2A_gain_db_rev4[] = { -5, 2, 6, 10 };
15470 s8 lna2A_gain_db_rev5[] = { -7, 0, 4, 8 }; 15467 static const s8 lna2A_gain_db_rev5[] = { -7, 0, 4, 8 };
15471 s8 lna2A_gain_db_rev6[] = { -7, 0, 4, 8 }; 15468 static const s8 lna2A_gain_db_rev6[] = { -7, 0, 4, 8 };
15472 s8 *lna2_gain_db = NULL; 15469 const s8 *lna2_gain_db = NULL;
15473 s8 tiaG_gain_db[] = { 15470 static const s8 tiaG_gain_db[] = {
15474 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }; 15471 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A };
15475 s8 tiaA_gain_db[] = { 15472 static const s8 tiaA_gain_db[] = {
15476 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 }; 15473 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 };
15477 s8 tiaA_gain_db_rev4[] = { 15474 static const s8 tiaA_gain_db_rev4[] = {
15478 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; 15475 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d };
15479 s8 tiaA_gain_db_rev5[] = { 15476 static const s8 tiaA_gain_db_rev5[] = {
15480 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; 15477 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d };
15481 s8 tiaA_gain_db_rev6[] = { 15478 static const s8 tiaA_gain_db_rev6[] = {
15482 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; 15479 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d };
15483 s8 *tia_gain_db; 15480 const s8 *tia_gain_db;
15484 s8 tiaG_gainbits[] = { 15481 static const s8 tiaG_gainbits[] = {
15485 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }; 15482 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 };
15486 s8 tiaA_gainbits[] = { 15483 static const s8 tiaA_gainbits[] = {
15487 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 }; 15484 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 };
15488 s8 tiaA_gainbits_rev4[] = { 15485 static const s8 tiaA_gainbits_rev4[] = {
15489 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; 15486 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };
15490 s8 tiaA_gainbits_rev5[] = { 15487 static const s8 tiaA_gainbits_rev5[] = {
15491 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; 15488 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };
15492 s8 tiaA_gainbits_rev6[] = { 15489 static const s8 tiaA_gainbits_rev6[] = {
15493 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; 15490 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };
15494 s8 *tia_gainbits; 15491 const s8 *tia_gainbits;
15495 s8 lpf_gain_db[] = { 0x00, 0x06, 0x0c, 0x12, 0x12, 0x12 }; 15492 static const s8 lpf_gain_db[] = { 0x00, 0x06, 0x0c, 0x12, 0x12, 0x12 };
15496 s8 lpf_gainbits[] = { 0x00, 0x01, 0x02, 0x03, 0x03, 0x03 }; 15493 static const s8 lpf_gainbits[] = { 0x00, 0x01, 0x02, 0x03, 0x03, 0x03 };
15497 u16 rfseqG_init_gain[] = { 0x613f, 0x613f, 0x613f, 0x613f }; 15494 static const u16 rfseqG_init_gain[] = { 0x613f, 0x613f, 0x613f, 0x613f };
15498 u16 rfseqG_init_gain_rev4[] = { 0x513f, 0x513f, 0x513f, 0x513f }; 15495 static const u16 rfseqG_init_gain_rev4[] = { 0x513f, 0x513f, 0x513f, 0x513f };
15499 u16 rfseqG_init_gain_rev5[] = { 0x413f, 0x413f, 0x413f, 0x413f }; 15496 static const u16 rfseqG_init_gain_rev5[] = { 0x413f, 0x413f, 0x413f, 0x413f };
15500 u16 rfseqG_init_gain_rev5_elna[] = { 15497 static const u16 rfseqG_init_gain_rev5_elna[] = {
15501 0x013f, 0x013f, 0x013f, 0x013f }; 15498 0x013f, 0x013f, 0x013f, 0x013f };
15502 u16 rfseqG_init_gain_rev6[] = { 0x513f, 0x513f }; 15499 static const u16 rfseqG_init_gain_rev6[] = { 0x513f, 0x513f };
15503 u16 rfseqG_init_gain_rev6_224B0[] = { 0x413f, 0x413f }; 15500 static const u16 rfseqG_init_gain_rev6_224B0[] = { 0x413f, 0x413f };
15504 u16 rfseqG_init_gain_rev6_elna[] = { 0x113f, 0x113f }; 15501 static const u16 rfseqG_init_gain_rev6_elna[] = { 0x113f, 0x113f };
15505 u16 rfseqA_init_gain[] = { 0x516f, 0x516f, 0x516f, 0x516f }; 15502 static const u16 rfseqA_init_gain[] = { 0x516f, 0x516f, 0x516f, 0x516f };
15506 u16 rfseqA_init_gain_rev4[] = { 0x614f, 0x614f, 0x614f, 0x614f }; 15503 static const u16 rfseqA_init_gain_rev4[] = { 0x614f, 0x614f, 0x614f, 0x614f };
15507 u16 rfseqA_init_gain_rev4_elna[] = { 15504 static const u16 rfseqA_init_gain_rev4_elna[] = {
15508 0x314f, 0x314f, 0x314f, 0x314f }; 15505 0x314f, 0x314f, 0x314f, 0x314f };
15509 u16 rfseqA_init_gain_rev5[] = { 0x714f, 0x714f, 0x714f, 0x714f }; 15506 static const u16 rfseqA_init_gain_rev5[] = { 0x714f, 0x714f, 0x714f, 0x714f };
15510 u16 rfseqA_init_gain_rev6[] = { 0x714f, 0x714f }; 15507 static const u16 rfseqA_init_gain_rev6[] = { 0x714f, 0x714f };
15511 u16 *rfseq_init_gain; 15508 const u16 *rfseq_init_gain;
15512 u16 initG_gaincode = 0x627e; 15509 u16 initG_gaincode = 0x627e;
15513 u16 initG_gaincode_rev4 = 0x527e; 15510 u16 initG_gaincode_rev4 = 0x527e;
15514 u16 initG_gaincode_rev5 = 0x427e; 15511 u16 initG_gaincode_rev5 = 0x427e;
@@ -15538,10 +15535,10 @@ static void wlc_phy_workarounds_nphy_gainctrl(struct brcms_phy *pi)
15538 u16 clip1mdA_gaincode_rev6 = 0x2084; 15535 u16 clip1mdA_gaincode_rev6 = 0x2084;
15539 u16 clip1md_gaincode = 0; 15536 u16 clip1md_gaincode = 0;
15540 u16 clip1loG_gaincode = 0x0074; 15537 u16 clip1loG_gaincode = 0x0074;
15541 u16 clip1loG_gaincode_rev5[] = { 15538 static const u16 clip1loG_gaincode_rev5[] = {
15542 0x0062, 0x0064, 0x006a, 0x106a, 0x106c, 0x1074, 0x107c, 0x207c 15539 0x0062, 0x0064, 0x006a, 0x106a, 0x106c, 0x1074, 0x107c, 0x207c
15543 }; 15540 };
15544 u16 clip1loG_gaincode_rev6[] = { 15541 static const u16 clip1loG_gaincode_rev6[] = {
15545 0x106a, 0x106c, 0x1074, 0x107c, 0x007e, 0x107e, 0x207e, 0x307e 15542 0x106a, 0x106c, 0x1074, 0x107c, 0x007e, 0x107e, 0x207e, 0x307e
15546 }; 15543 };
15547 u16 clip1loG_gaincode_rev6_224B0 = 0x1074; 15544 u16 clip1loG_gaincode_rev6_224B0 = 0x1074;
@@ -16066,7 +16063,7 @@ static void wlc_phy_workarounds_nphy_gainctrl(struct brcms_phy *pi)
16066 16063
16067static void wlc_phy_workarounds_nphy(struct brcms_phy *pi) 16064static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16068{ 16065{
16069 u8 rfseq_rx2tx_events[] = { 16066 static const u8 rfseq_rx2tx_events[] = {
16070 NPHY_RFSEQ_CMD_NOP, 16067 NPHY_RFSEQ_CMD_NOP,
16071 NPHY_RFSEQ_CMD_RXG_FBW, 16068 NPHY_RFSEQ_CMD_RXG_FBW,
16072 NPHY_RFSEQ_CMD_TR_SWITCH, 16069 NPHY_RFSEQ_CMD_TR_SWITCH,
@@ -16076,7 +16073,7 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16076 NPHY_RFSEQ_CMD_EXT_PA 16073 NPHY_RFSEQ_CMD_EXT_PA
16077 }; 16074 };
16078 u8 rfseq_rx2tx_dlys[] = { 8, 6, 6, 2, 4, 60, 1 }; 16075 u8 rfseq_rx2tx_dlys[] = { 8, 6, 6, 2, 4, 60, 1 };
16079 u8 rfseq_tx2rx_events[] = { 16076 static const u8 rfseq_tx2rx_events[] = {
16080 NPHY_RFSEQ_CMD_NOP, 16077 NPHY_RFSEQ_CMD_NOP,
16081 NPHY_RFSEQ_CMD_EXT_PA, 16078 NPHY_RFSEQ_CMD_EXT_PA,
16082 NPHY_RFSEQ_CMD_TX_GAIN, 16079 NPHY_RFSEQ_CMD_TX_GAIN,
@@ -16085,8 +16082,8 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16085 NPHY_RFSEQ_CMD_RXG_FBW, 16082 NPHY_RFSEQ_CMD_RXG_FBW,
16086 NPHY_RFSEQ_CMD_CLR_HIQ_DIS 16083 NPHY_RFSEQ_CMD_CLR_HIQ_DIS
16087 }; 16084 };
16088 u8 rfseq_tx2rx_dlys[] = { 8, 6, 2, 4, 4, 6, 1 }; 16085 static const u8 rfseq_tx2rx_dlys[] = { 8, 6, 2, 4, 4, 6, 1 };
16089 u8 rfseq_tx2rx_events_rev3[] = { 16086 static const u8 rfseq_tx2rx_events_rev3[] = {
16090 NPHY_REV3_RFSEQ_CMD_EXT_PA, 16087 NPHY_REV3_RFSEQ_CMD_EXT_PA,
16091 NPHY_REV3_RFSEQ_CMD_INT_PA_PU, 16088 NPHY_REV3_RFSEQ_CMD_INT_PA_PU,
16092 NPHY_REV3_RFSEQ_CMD_TX_GAIN, 16089 NPHY_REV3_RFSEQ_CMD_TX_GAIN,
@@ -16096,7 +16093,7 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16096 NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS, 16093 NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS,
16097 NPHY_REV3_RFSEQ_CMD_END 16094 NPHY_REV3_RFSEQ_CMD_END
16098 }; 16095 };
16099 u8 rfseq_tx2rx_dlys_rev3[] = { 8, 4, 2, 2, 4, 4, 6, 1 }; 16096 static const u8 rfseq_tx2rx_dlys_rev3[] = { 8, 4, 2, 2, 4, 4, 6, 1 };
16100 u8 rfseq_rx2tx_events_rev3[] = { 16097 u8 rfseq_rx2tx_events_rev3[] = {
16101 NPHY_REV3_RFSEQ_CMD_NOP, 16098 NPHY_REV3_RFSEQ_CMD_NOP,
16102 NPHY_REV3_RFSEQ_CMD_RXG_FBW, 16099 NPHY_REV3_RFSEQ_CMD_RXG_FBW,
@@ -16110,7 +16107,7 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16110 }; 16107 };
16111 u8 rfseq_rx2tx_dlys_rev3[] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 }; 16108 u8 rfseq_rx2tx_dlys_rev3[] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 };
16112 16109
16113 u8 rfseq_rx2tx_events_rev3_ipa[] = { 16110 static const u8 rfseq_rx2tx_events_rev3_ipa[] = {
16114 NPHY_REV3_RFSEQ_CMD_NOP, 16111 NPHY_REV3_RFSEQ_CMD_NOP,
16115 NPHY_REV3_RFSEQ_CMD_RXG_FBW, 16112 NPHY_REV3_RFSEQ_CMD_RXG_FBW,
16116 NPHY_REV3_RFSEQ_CMD_TR_SWITCH, 16113 NPHY_REV3_RFSEQ_CMD_TR_SWITCH,
@@ -16121,15 +16118,15 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16121 NPHY_REV3_RFSEQ_CMD_INT_PA_PU, 16118 NPHY_REV3_RFSEQ_CMD_INT_PA_PU,
16122 NPHY_REV3_RFSEQ_CMD_END 16119 NPHY_REV3_RFSEQ_CMD_END
16123 }; 16120 };
16124 u8 rfseq_rx2tx_dlys_rev3_ipa[] = { 8, 6, 6, 4, 4, 16, 43, 1, 1 }; 16121 static const u8 rfseq_rx2tx_dlys_rev3_ipa[] = { 8, 6, 6, 4, 4, 16, 43, 1, 1 };
16125 u16 rfseq_rx2tx_dacbufpu_rev7[] = { 0x10f, 0x10f }; 16122 static const u16 rfseq_rx2tx_dacbufpu_rev7[] = { 0x10f, 0x10f };
16126 16123
16127 s16 alpha0, alpha1, alpha2; 16124 s16 alpha0, alpha1, alpha2;
16128 s16 beta0, beta1, beta2; 16125 s16 beta0, beta1, beta2;
16129 u32 leg_data_weights, ht_data_weights, nss1_data_weights, 16126 u32 leg_data_weights, ht_data_weights, nss1_data_weights,
16130 stbc_data_weights; 16127 stbc_data_weights;
16131 u8 chan_freq_range = 0; 16128 u8 chan_freq_range = 0;
16132 u16 dac_control = 0x0002; 16129 static const u16 dac_control = 0x0002;
16133 u16 aux_adc_vmid_rev7_core0[] = { 0x8e, 0x96, 0x96, 0x96 }; 16130 u16 aux_adc_vmid_rev7_core0[] = { 0x8e, 0x96, 0x96, 0x96 };
16134 u16 aux_adc_vmid_rev7_core1[] = { 0x8f, 0x9f, 0x9f, 0x96 }; 16131 u16 aux_adc_vmid_rev7_core1[] = { 0x8f, 0x9f, 0x9f, 0x96 };
16135 u16 aux_adc_vmid_rev4[] = { 0xa2, 0xb4, 0xb4, 0x89 }; 16132 u16 aux_adc_vmid_rev4[] = { 0xa2, 0xb4, 0xb4, 0x89 };
@@ -16139,8 +16136,8 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16139 u16 aux_adc_gain_rev4[] = { 0x02, 0x02, 0x02, 0x00 }; 16136 u16 aux_adc_gain_rev4[] = { 0x02, 0x02, 0x02, 0x00 };
16140 u16 aux_adc_gain_rev3[] = { 0x02, 0x02, 0x02, 0x00 }; 16137 u16 aux_adc_gain_rev3[] = { 0x02, 0x02, 0x02, 0x00 };
16141 u16 *aux_adc_gain; 16138 u16 *aux_adc_gain;
16142 u16 sk_adc_vmid[] = { 0xb4, 0xb4, 0xb4, 0x24 }; 16139 static const u16 sk_adc_vmid[] = { 0xb4, 0xb4, 0xb4, 0x24 };
16143 u16 sk_adc_gain[] = { 0x02, 0x02, 0x02, 0x02 }; 16140 static const u16 sk_adc_gain[] = { 0x02, 0x02, 0x02, 0x02 };
16144 s32 min_nvar_val = 0x18d; 16141 s32 min_nvar_val = 0x18d;
16145 s32 min_nvar_offset_6mbps = 20; 16142 s32 min_nvar_offset_6mbps = 20;
16146 u8 pdetrange; 16143 u8 pdetrange;
@@ -16151,9 +16148,9 @@ static void wlc_phy_workarounds_nphy(struct brcms_phy *pi)
16151 u16 rfseq_rx2tx_lpf_h_hpc_rev7 = 0x77; 16148 u16 rfseq_rx2tx_lpf_h_hpc_rev7 = 0x77;
16152 u16 rfseq_tx2rx_lpf_h_hpc_rev7 = 0x77; 16149 u16 rfseq_tx2rx_lpf_h_hpc_rev7 = 0x77;
16153 u16 rfseq_pktgn_lpf_h_hpc_rev7 = 0x77; 16150 u16 rfseq_pktgn_lpf_h_hpc_rev7 = 0x77;
16154 u16 rfseq_htpktgn_lpf_hpc_rev7[] = { 0x77, 0x11, 0x11 }; 16151 static const u16 rfseq_htpktgn_lpf_hpc_rev7[] = { 0x77, 0x11, 0x11 };
16155 u16 rfseq_pktgn_lpf_hpc_rev7[] = { 0x11, 0x11 }; 16152 static const u16 rfseq_pktgn_lpf_hpc_rev7[] = { 0x11, 0x11 };
16156 u16 rfseq_cckpktgn_lpf_hpc_rev7[] = { 0x11, 0x11 }; 16153 static const u16 rfseq_cckpktgn_lpf_hpc_rev7[] = { 0x11, 0x11 };
16157 u16 ipalvlshift_3p3_war_en = 0; 16154 u16 ipalvlshift_3p3_war_en = 0;
16158 u16 rccal_bcap_val, rccal_scap_val; 16155 u16 rccal_bcap_val, rccal_scap_val;
16159 u16 rccal_tx20_11b_bcap = 0; 16156 u16 rccal_tx20_11b_bcap = 0;
@@ -24291,13 +24288,13 @@ static void wlc_phy_update_txcal_ladder_nphy(struct brcms_phy *pi, u16 core)
24291 u16 bbmult; 24288 u16 bbmult;
24292 u16 tblentry; 24289 u16 tblentry;
24293 24290
24294 struct nphy_txiqcal_ladder ladder_lo[] = { 24291 static const struct nphy_txiqcal_ladder ladder_lo[] = {
24295 {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0}, 24292 {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0},
24296 {25, 0}, {25, 1}, {25, 2}, {25, 3}, {25, 4}, {25, 5}, 24293 {25, 0}, {25, 1}, {25, 2}, {25, 3}, {25, 4}, {25, 5},
24297 {25, 6}, {25, 7}, {35, 7}, {50, 7}, {71, 7}, {100, 7} 24294 {25, 6}, {25, 7}, {35, 7}, {50, 7}, {71, 7}, {100, 7}
24298 }; 24295 };
24299 24296
24300 struct nphy_txiqcal_ladder ladder_iq[] = { 24297 static const struct nphy_txiqcal_ladder ladder_iq[] = {
24301 {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0}, 24298 {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0},
24302 {25, 0}, {35, 0}, {50, 0}, {71, 0}, {100, 0}, {100, 1}, 24299 {25, 0}, {35, 0}, {50, 0}, {71, 0}, {100, 0}, {100, 1},
24303 {100, 2}, {100, 3}, {100, 4}, {100, 5}, {100, 6}, {100, 7} 24300 {100, 2}, {100, 3}, {100, 4}, {100, 5}, {100, 6}, {100, 7}
@@ -25773,67 +25770,67 @@ wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain,
25773 u16 cal_gain[2]; 25770 u16 cal_gain[2];
25774 struct nphy_iqcal_params cal_params[2]; 25771 struct nphy_iqcal_params cal_params[2];
25775 u32 tbl_len; 25772 u32 tbl_len;
25776 void *tbl_ptr; 25773 const void *tbl_ptr;
25777 bool ladder_updated[2]; 25774 bool ladder_updated[2];
25778 u8 mphase_cal_lastphase = 0; 25775 u8 mphase_cal_lastphase = 0;
25779 int bcmerror = 0; 25776 int bcmerror = 0;
25780 bool phyhang_avoid_state = false; 25777 bool phyhang_avoid_state = false;
25781 25778
25782 u16 tbl_tx_iqlo_cal_loft_ladder_20[] = { 25779 static const u16 tbl_tx_iqlo_cal_loft_ladder_20[] = {
25783 0x0300, 0x0500, 0x0700, 0x0900, 0x0d00, 0x1100, 0x1900, 0x1901, 25780 0x0300, 0x0500, 0x0700, 0x0900, 0x0d00, 0x1100, 0x1900, 0x1901,
25784 0x1902, 25781 0x1902,
25785 0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x2407, 0x3207, 0x4607, 25782 0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x2407, 0x3207, 0x4607,
25786 0x6407 25783 0x6407
25787 }; 25784 };
25788 25785
25789 u16 tbl_tx_iqlo_cal_iqimb_ladder_20[] = { 25786 static const u16 tbl_tx_iqlo_cal_iqimb_ladder_20[] = {
25790 0x0200, 0x0300, 0x0600, 0x0900, 0x0d00, 0x1100, 0x1900, 0x2400, 25787 0x0200, 0x0300, 0x0600, 0x0900, 0x0d00, 0x1100, 0x1900, 0x2400,
25791 0x3200, 25788 0x3200,
25792 0x4600, 0x6400, 0x6401, 0x6402, 0x6403, 0x6404, 0x6405, 0x6406, 25789 0x4600, 0x6400, 0x6401, 0x6402, 0x6403, 0x6404, 0x6405, 0x6406,
25793 0x6407 25790 0x6407
25794 }; 25791 };
25795 25792
25796 u16 tbl_tx_iqlo_cal_loft_ladder_40[] = { 25793 static const u16 tbl_tx_iqlo_cal_loft_ladder_40[] = {
25797 0x0200, 0x0300, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1201, 25794 0x0200, 0x0300, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1201,
25798 0x1202, 25795 0x1202,
25799 0x1203, 0x1204, 0x1205, 0x1206, 0x1207, 0x1907, 0x2307, 0x3207, 25796 0x1203, 0x1204, 0x1205, 0x1206, 0x1207, 0x1907, 0x2307, 0x3207,
25800 0x4707 25797 0x4707
25801 }; 25798 };
25802 25799
25803 u16 tbl_tx_iqlo_cal_iqimb_ladder_40[] = { 25800 static const u16 tbl_tx_iqlo_cal_iqimb_ladder_40[] = {
25804 0x0100, 0x0200, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1900, 25801 0x0100, 0x0200, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1900,
25805 0x2300, 25802 0x2300,
25806 0x3200, 0x4700, 0x4701, 0x4702, 0x4703, 0x4704, 0x4705, 0x4706, 25803 0x3200, 0x4700, 0x4701, 0x4702, 0x4703, 0x4704, 0x4705, 0x4706,
25807 0x4707 25804 0x4707
25808 }; 25805 };
25809 25806
25810 u16 tbl_tx_iqlo_cal_startcoefs[] = { 25807 static const u16 tbl_tx_iqlo_cal_startcoefs[] = {
25811 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 25808 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
25812 0x0000 25809 0x0000
25813 }; 25810 };
25814 25811
25815 u16 tbl_tx_iqlo_cal_cmds_fullcal[] = { 25812 static const u16 tbl_tx_iqlo_cal_cmds_fullcal[] = {
25816 0x8123, 0x8264, 0x8086, 0x8245, 0x8056, 25813 0x8123, 0x8264, 0x8086, 0x8245, 0x8056,
25817 0x9123, 0x9264, 0x9086, 0x9245, 0x9056 25814 0x9123, 0x9264, 0x9086, 0x9245, 0x9056
25818 }; 25815 };
25819 25816
25820 u16 tbl_tx_iqlo_cal_cmds_recal[] = { 25817 static const u16 tbl_tx_iqlo_cal_cmds_recal[] = {
25821 0x8101, 0x8253, 0x8053, 0x8234, 0x8034, 25818 0x8101, 0x8253, 0x8053, 0x8234, 0x8034,
25822 0x9101, 0x9253, 0x9053, 0x9234, 0x9034 25819 0x9101, 0x9253, 0x9053, 0x9234, 0x9034
25823 }; 25820 };
25824 25821
25825 u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[] = { 25822 static const u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[] = {
25826 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 25823 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
25827 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 25824 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
25828 0x0000 25825 0x0000
25829 }; 25826 };
25830 25827
25831 u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = { 25828 static const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = {
25832 0x8434, 0x8334, 0x8084, 0x8267, 0x8056, 0x8234, 25829 0x8434, 0x8334, 0x8084, 0x8267, 0x8056, 0x8234,
25833 0x9434, 0x9334, 0x9084, 0x9267, 0x9056, 0x9234 25830 0x9434, 0x9334, 0x9084, 0x9267, 0x9056, 0x9234
25834 }; 25831 };
25835 25832
25836 u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[] = { 25833 static const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[] = {
25837 0x8423, 0x8323, 0x8073, 0x8256, 0x8045, 0x8223, 25834 0x8423, 0x8323, 0x8073, 0x8256, 0x8045, 0x8223,
25838 0x9423, 0x9323, 0x9073, 0x9256, 0x9045, 0x9223 25835 0x9423, 0x9323, 0x9073, 0x9256, 0x9045, 0x9223
25839 }; 25836 };
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/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 6afc7a799892..f5dd7d83cd0a 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -1086,7 +1086,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work)
1086 1086
1087 if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) { 1087 if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
1088 /* stop recording */ 1088 /* stop recording */
1089 iwl_set_bits_prph(fwrt->trans, MON_BUFF_SAMPLE_CTL, 0x100); 1089 iwl_fw_dbg_stop_recording(fwrt);
1090 1090
1091 iwl_fw_error_dump(fwrt); 1091 iwl_fw_error_dump(fwrt);
1092 1092
@@ -1104,10 +1104,7 @@ void iwl_fw_error_dump_wk(struct work_struct *work)
1104 u32 in_sample = iwl_read_prph(fwrt->trans, DBGC_IN_SAMPLE); 1104 u32 in_sample = iwl_read_prph(fwrt->trans, DBGC_IN_SAMPLE);
1105 u32 out_ctrl = iwl_read_prph(fwrt->trans, DBGC_OUT_CTRL); 1105 u32 out_ctrl = iwl_read_prph(fwrt->trans, DBGC_OUT_CTRL);
1106 1106
1107 /* stop recording */ 1107 iwl_fw_dbg_stop_recording(fwrt);
1108 iwl_write_prph(fwrt->trans, DBGC_IN_SAMPLE, 0);
1109 udelay(100);
1110 iwl_write_prph(fwrt->trans, DBGC_OUT_CTRL, 0);
1111 /* wait before we collect the data till the DBGC stop */ 1108 /* wait before we collect the data till the DBGC stop */
1112 udelay(500); 1109 udelay(500);
1113 1110
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
index 0f810ea89d31..9c889a32fe24 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
@@ -68,6 +68,8 @@
68#include <linux/workqueue.h> 68#include <linux/workqueue.h>
69#include <net/cfg80211.h> 69#include <net/cfg80211.h>
70#include "runtime.h" 70#include "runtime.h"
71#include "iwl-prph.h"
72#include "iwl-io.h"
71#include "file.h" 73#include "file.h"
72#include "error-dump.h" 74#include "error-dump.h"
73 75
@@ -194,8 +196,21 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
194 iwl_fw_dbg_get_trigger((fwrt)->fw,\ 196 iwl_fw_dbg_get_trigger((fwrt)->fw,\
195 (trig))) 197 (trig)))
196 198
199static inline void iwl_fw_dbg_stop_recording(struct iwl_fw_runtime *fwrt)
200{
201 if (fwrt->trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
202 iwl_set_bits_prph(fwrt->trans, MON_BUFF_SAMPLE_CTL, 0x100);
203 } else {
204 iwl_write_prph(fwrt->trans, DBGC_IN_SAMPLE, 0);
205 udelay(100);
206 iwl_write_prph(fwrt->trans, DBGC_OUT_CTRL, 0);
207 }
208}
209
197static inline void iwl_fw_dump_conf_clear(struct iwl_fw_runtime *fwrt) 210static inline void iwl_fw_dump_conf_clear(struct iwl_fw_runtime *fwrt)
198{ 211{
212 iwl_fw_dbg_stop_recording(fwrt);
213
199 fwrt->dump.conf = FW_DBG_INVALID; 214 fwrt->dump.conf = FW_DBG_INVALID;
200} 215}
201 216
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 3014beef4873..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 {
@@ -206,8 +209,36 @@ enum iwl_nvm_channel_flags {
206 NVM_CHANNEL_DC_HIGH = BIT(12), 209 NVM_CHANNEL_DC_HIGH = BIT(12),
207}; 210};
208 211
212static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
213 int chan, u16 flags)
214{
209#define CHECK_AND_PRINT_I(x) \ 215#define CHECK_AND_PRINT_I(x) \
210 ((ch_flags & NVM_CHANNEL_##x) ? # x " " : "") 216 ((flags & NVM_CHANNEL_##x) ? " " #x : "")
217
218 if (!(flags & NVM_CHANNEL_VALID)) {
219 IWL_DEBUG_DEV(dev, level, "Ch. %d: 0x%x: No traffic\n",
220 chan, flags);
221 return;
222 }
223
224 /* Note: already can print up to 101 characters, 110 is the limit! */
225 IWL_DEBUG_DEV(dev, level,
226 "Ch. %d: 0x%x:%s%s%s%s%s%s%s%s%s%s%s%s\n",
227 chan, flags,
228 CHECK_AND_PRINT_I(VALID),
229 CHECK_AND_PRINT_I(IBSS),
230 CHECK_AND_PRINT_I(ACTIVE),
231 CHECK_AND_PRINT_I(RADAR),
232 CHECK_AND_PRINT_I(INDOOR_ONLY),
233 CHECK_AND_PRINT_I(GO_CONCURRENT),
234 CHECK_AND_PRINT_I(UNIFORM),
235 CHECK_AND_PRINT_I(20MHZ),
236 CHECK_AND_PRINT_I(40MHZ),
237 CHECK_AND_PRINT_I(80MHZ),
238 CHECK_AND_PRINT_I(160MHZ),
239 CHECK_AND_PRINT_I(DC_HIGH));
240#undef CHECK_AND_PRINT_I
241}
211 242
212static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz, 243static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
213 u16 nvm_flags, const struct iwl_cfg *cfg) 244 u16 nvm_flags, const struct iwl_cfg *cfg)
@@ -215,7 +246,7 @@ static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
215 u32 flags = IEEE80211_CHAN_NO_HT40; 246 u32 flags = IEEE80211_CHAN_NO_HT40;
216 u32 last_5ghz_ht = LAST_5GHZ_HT; 247 u32 last_5ghz_ht = LAST_5GHZ_HT;
217 248
218 if (cfg->ext_nvm) 249 if (cfg->nvm_type == IWL_NVM_EXT)
219 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000; 250 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
220 251
221 if (!is_5ghz && (nvm_flags & NVM_CHANNEL_40MHZ)) { 252 if (!is_5ghz && (nvm_flags & NVM_CHANNEL_40MHZ)) {
@@ -268,7 +299,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
268 int num_of_ch, num_2ghz_channels; 299 int num_of_ch, num_2ghz_channels;
269 const u8 *nvm_chan; 300 const u8 *nvm_chan;
270 301
271 if (!cfg->ext_nvm) { 302 if (cfg->nvm_type != IWL_NVM_EXT) {
272 num_of_ch = IWL_NUM_CHANNELS; 303 num_of_ch = IWL_NUM_CHANNELS;
273 nvm_chan = &iwl_nvm_channels[0]; 304 nvm_chan = &iwl_nvm_channels[0];
274 num_2ghz_channels = NUM_2GHZ_CHANNELS; 305 num_2ghz_channels = NUM_2GHZ_CHANNELS;
@@ -302,12 +333,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
302 * supported, hence we still want to add them to 333 * supported, hence we still want to add them to
303 * the list of supported channels to cfg80211. 334 * the list of supported channels to cfg80211.
304 */ 335 */
305 IWL_DEBUG_EEPROM(dev, 336 iwl_nvm_print_channel_flags(dev, IWL_DL_EEPROM,
306 "Ch. %d Flags %x [%sGHz] - No traffic\n", 337 nvm_chan[ch_idx], ch_flags);
307 nvm_chan[ch_idx],
308 ch_flags,
309 (ch_idx >= num_2ghz_channels) ?
310 "5.2" : "2.4");
311 continue; 338 continue;
312 } 339 }
313 340
@@ -337,27 +364,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
337 else 364 else
338 channel->flags = 0; 365 channel->flags = 0;
339 366
340 IWL_DEBUG_EEPROM(dev, 367 iwl_nvm_print_channel_flags(dev, IWL_DL_EEPROM,
341 "Ch. %d [%sGHz] flags 0x%x %s%s%s%s%s%s%s%s%s%s%s%s(%ddBm): Ad-Hoc %ssupported\n", 368 channel->hw_value, ch_flags);
342 channel->hw_value, 369 IWL_DEBUG_EEPROM(dev, "Ch. %d: %ddBm\n",
343 is_5ghz ? "5.2" : "2.4", 370 channel->hw_value, channel->max_power);
344 ch_flags,
345 CHECK_AND_PRINT_I(VALID),
346 CHECK_AND_PRINT_I(IBSS),
347 CHECK_AND_PRINT_I(ACTIVE),
348 CHECK_AND_PRINT_I(RADAR),
349 CHECK_AND_PRINT_I(INDOOR_ONLY),
350 CHECK_AND_PRINT_I(GO_CONCURRENT),
351 CHECK_AND_PRINT_I(UNIFORM),
352 CHECK_AND_PRINT_I(20MHZ),
353 CHECK_AND_PRINT_I(40MHZ),
354 CHECK_AND_PRINT_I(80MHZ),
355 CHECK_AND_PRINT_I(160MHZ),
356 CHECK_AND_PRINT_I(DC_HIGH),
357 channel->max_power,
358 ((ch_flags & NVM_CHANNEL_IBSS) &&
359 !(ch_flags & NVM_CHANNEL_RADAR))
360 ? "" : "not ");
361 } 371 }
362 372
363 return n_channels; 373 return n_channels;
@@ -484,7 +494,7 @@ IWL_EXPORT_SYMBOL(iwl_init_sbands);
484static 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,
485 const __le16 *phy_sku) 495 const __le16 *phy_sku)
486{ 496{
487 if (!cfg->ext_nvm) 497 if (cfg->nvm_type != IWL_NVM_EXT)
488 return le16_to_cpup(nvm_sw + SKU); 498 return le16_to_cpup(nvm_sw + SKU);
489 499
490 return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000)); 500 return le32_to_cpup((__le32 *)(phy_sku + SKU_FAMILY_8000));
@@ -492,7 +502,7 @@ static int iwl_get_sku(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
492 502
493static 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)
494{ 504{
495 if (!cfg->ext_nvm) 505 if (cfg->nvm_type != IWL_NVM_EXT)
496 return le16_to_cpup(nvm_sw + NVM_VERSION); 506 return le16_to_cpup(nvm_sw + NVM_VERSION);
497 else 507 else
498 return le32_to_cpup((__le32 *)(nvm_sw + 508 return le32_to_cpup((__le32 *)(nvm_sw +
@@ -502,7 +512,7 @@ static int iwl_get_nvm_version(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
502static 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,
503 const __le16 *phy_sku) 513 const __le16 *phy_sku)
504{ 514{
505 if (!cfg->ext_nvm) 515 if (cfg->nvm_type != IWL_NVM_EXT)
506 return le16_to_cpup(nvm_sw + RADIO_CFG); 516 return le16_to_cpup(nvm_sw + RADIO_CFG);
507 517
508 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));
@@ -513,7 +523,7 @@ static int iwl_get_n_hw_addrs(const struct iwl_cfg *cfg, const __le16 *nvm_sw)
513{ 523{
514 int n_hw_addr; 524 int n_hw_addr;
515 525
516 if (!cfg->ext_nvm) 526 if (cfg->nvm_type != IWL_NVM_EXT)
517 return le16_to_cpup(nvm_sw + N_HW_ADDRS); 527 return le16_to_cpup(nvm_sw + N_HW_ADDRS);
518 528
519 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));
@@ -525,7 +535,7 @@ static void iwl_set_radio_cfg(const struct iwl_cfg *cfg,
525 struct iwl_nvm_data *data, 535 struct iwl_nvm_data *data,
526 u32 radio_cfg) 536 u32 radio_cfg)
527{ 537{
528 if (!cfg->ext_nvm) { 538 if (cfg->nvm_type != IWL_NVM_EXT) {
529 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg); 539 data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg);
530 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg); 540 data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg);
531 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg); 541 data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg);
@@ -634,7 +644,7 @@ static int iwl_set_hw_address(struct iwl_trans *trans,
634{ 644{
635 if (cfg->mac_addr_from_csr) { 645 if (cfg->mac_addr_from_csr) {
636 iwl_set_hw_address_from_csr(trans, data); 646 iwl_set_hw_address_from_csr(trans, data);
637 } else if (!cfg->ext_nvm) { 647 } else if (cfg->nvm_type != IWL_NVM_EXT) {
638 const u8 *hw_addr = (const u8 *)(nvm_hw + HW_ADDR); 648 const u8 *hw_addr = (const u8 *)(nvm_hw + HW_ADDR);
639 649
640 /* The byte order is little endian 16 bit, meaning 214365 */ 650 /* The byte order is little endian 16 bit, meaning 214365 */
@@ -706,7 +716,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
706 u16 lar_config; 716 u16 lar_config;
707 const __le16 *ch_section; 717 const __le16 *ch_section;
708 718
709 if (!cfg->ext_nvm) 719 if (cfg->nvm_type != IWL_NVM_EXT)
710 data = kzalloc(sizeof(*data) + 720 data = kzalloc(sizeof(*data) +
711 sizeof(struct ieee80211_channel) * 721 sizeof(struct ieee80211_channel) *
712 IWL_NUM_CHANNELS, 722 IWL_NUM_CHANNELS,
@@ -740,7 +750,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
740 750
741 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);
742 752
743 if (!cfg->ext_nvm) { 753 if (cfg->nvm_type != IWL_NVM_EXT) {
744 /* Checking for required sections */ 754 /* Checking for required sections */
745 if (!nvm_calib) { 755 if (!nvm_calib) {
746 IWL_ERR(trans, 756 IWL_ERR(trans,
@@ -748,11 +758,15 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
748 kfree(data); 758 kfree(data);
749 return NULL; 759 return NULL;
750 } 760 }
761
762 ch_section = cfg->nvm_type == IWL_NVM_SDP ?
763 &regulatory[NVM_CHANNELS_SDP] :
764 &nvm_sw[NVM_CHANNELS];
765
751 /* in family 8000 Xtal calibration values moved to OTP */ 766 /* in family 8000 Xtal calibration values moved to OTP */
752 data->xtal_calib[0] = *(nvm_calib + XTAL_CALIB); 767 data->xtal_calib[0] = *(nvm_calib + XTAL_CALIB);
753 data->xtal_calib[1] = *(nvm_calib + XTAL_CALIB + 1); 768 data->xtal_calib[1] = *(nvm_calib + XTAL_CALIB + 1);
754 lar_enabled = true; 769 lar_enabled = true;
755 ch_section = &nvm_sw[NVM_CHANNELS];
756 } else { 770 } else {
757 u16 lar_offset = data->nvm_version < 0xE39 ? 771 u16 lar_offset = data->nvm_version < 0xE39 ?
758 NVM_LAR_OFFSET_OLD : 772 NVM_LAR_OFFSET_OLD :
@@ -786,7 +800,7 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u8 *nvm_chan,
786 u32 flags = NL80211_RRF_NO_HT40; 800 u32 flags = NL80211_RRF_NO_HT40;
787 u32 last_5ghz_ht = LAST_5GHZ_HT; 801 u32 last_5ghz_ht = LAST_5GHZ_HT;
788 802
789 if (cfg->ext_nvm) 803 if (cfg->nvm_type == IWL_NVM_EXT)
790 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000; 804 last_5ghz_ht = LAST_5GHZ_HT_FAMILY_8000;
791 805
792 if (ch_idx < NUM_2GHZ_CHANNELS && 806 if (ch_idx < NUM_2GHZ_CHANNELS &&
@@ -834,7 +848,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
834 int ch_idx; 848 int ch_idx;
835 u16 ch_flags; 849 u16 ch_flags;
836 u32 reg_rule_flags, prev_reg_rule_flags = 0; 850 u32 reg_rule_flags, prev_reg_rule_flags = 0;
837 const u8 *nvm_chan = cfg->ext_nvm ? 851 const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ?
838 iwl_ext_nvm_channels : iwl_nvm_channels; 852 iwl_ext_nvm_channels : iwl_nvm_channels;
839 struct ieee80211_regdomain *regd; 853 struct ieee80211_regdomain *regd;
840 int size_of_regd; 854 int size_of_regd;
@@ -843,7 +857,7 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
843 int center_freq, prev_center_freq = 0; 857 int center_freq, prev_center_freq = 0;
844 int valid_rules = 0; 858 int valid_rules = 0;
845 bool new_rule; 859 bool new_rule;
846 int max_num_ch = cfg->ext_nvm ? 860 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
847 IWL_NUM_CHANNELS_EXT : IWL_NUM_CHANNELS; 861 IWL_NUM_CHANNELS_EXT : IWL_NUM_CHANNELS;
848 862
849 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))
@@ -873,12 +887,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
873 new_rule = false; 887 new_rule = false;
874 888
875 if (!(ch_flags & NVM_CHANNEL_VALID)) { 889 if (!(ch_flags & NVM_CHANNEL_VALID)) {
876 IWL_DEBUG_DEV(dev, IWL_DL_LAR, 890 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR,
877 "Ch. %d Flags %x [%sGHz] - No traffic\n", 891 nvm_chan[ch_idx], ch_flags);
878 nvm_chan[ch_idx],
879 ch_flags,
880 (ch_idx >= NUM_2GHZ_CHANNELS) ?
881 "5.2" : "2.4");
882 continue; 892 continue;
883 } 893 }
884 894
@@ -914,31 +924,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
914 prev_center_freq = center_freq; 924 prev_center_freq = center_freq;
915 prev_reg_rule_flags = reg_rule_flags; 925 prev_reg_rule_flags = reg_rule_flags;
916 926
917 IWL_DEBUG_DEV(dev, IWL_DL_LAR, 927 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR,
918 "Ch. %d [%sGHz] %s%s%s%s%s%s%s%s%s%s%s%s(0x%02x)\n", 928 nvm_chan[ch_idx], ch_flags);
919 center_freq,
920 band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
921 CHECK_AND_PRINT_I(VALID),
922 CHECK_AND_PRINT_I(IBSS),
923 CHECK_AND_PRINT_I(ACTIVE),
924 CHECK_AND_PRINT_I(RADAR),
925 CHECK_AND_PRINT_I(INDOOR_ONLY),
926 CHECK_AND_PRINT_I(GO_CONCURRENT),
927 CHECK_AND_PRINT_I(UNIFORM),
928 CHECK_AND_PRINT_I(20MHZ),
929 CHECK_AND_PRINT_I(40MHZ),
930 CHECK_AND_PRINT_I(80MHZ),
931 CHECK_AND_PRINT_I(160MHZ),
932 CHECK_AND_PRINT_I(DC_HIGH),
933 ch_flags);
934 IWL_DEBUG_DEV(dev, IWL_DL_LAR,
935 "Ch. %d [%sGHz] reg_flags 0x%x: %s\n",
936 center_freq,
937 band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
938 reg_rule_flags,
939 ((ch_flags & NVM_CHANNEL_ACTIVE) &&
940 !(ch_flags & NVM_CHANNEL_RADAR))
941 ? "Ad-Hoc" : "");
942 } 929 }
943 930
944 regd->n_reg_rules = valid_rules; 931 regd->n_reg_rules = valid_rules;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 3bcaa82f59b2..a9ac872226fd 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1077,6 +1077,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
1077 mvm->vif_count = 0; 1077 mvm->vif_count = 0;
1078 mvm->rx_ba_sessions = 0; 1078 mvm->rx_ba_sessions = 0;
1079 mvm->fwrt.dump.conf = FW_DBG_INVALID; 1079 mvm->fwrt.dump.conf = FW_DBG_INVALID;
1080 mvm->monitor_on = false;
1080 1081
1081 /* keep statistics ticking */ 1082 /* keep statistics ticking */
1082 iwl_mvm_accu_radio_stats(mvm); 1083 iwl_mvm_accu_radio_stats(mvm);
@@ -1437,6 +1438,9 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
1437 mvm->p2p_device_vif = vif; 1438 mvm->p2p_device_vif = vif;
1438 } 1439 }
1439 1440
1441 if (vif->type == NL80211_IFTYPE_MONITOR)
1442 mvm->monitor_on = true;
1443
1440 iwl_mvm_vif_dbgfs_register(mvm, vif); 1444 iwl_mvm_vif_dbgfs_register(mvm, vif);
1441 goto out_unlock; 1445 goto out_unlock;
1442 1446
@@ -1526,6 +1530,9 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
1526 iwl_mvm_power_update_mac(mvm); 1530 iwl_mvm_power_update_mac(mvm);
1527 iwl_mvm_mac_ctxt_remove(mvm, vif); 1531 iwl_mvm_mac_ctxt_remove(mvm, vif);
1528 1532
1533 if (vif->type == NL80211_IFTYPE_MONITOR)
1534 mvm->monitor_on = false;
1535
1529out_release: 1536out_release:
1530 mutex_unlock(&mvm->mutex); 1537 mutex_unlock(&mvm->mutex);
1531} 1538}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 83303bac0e4b..949e63418299 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1015,6 +1015,9 @@ struct iwl_mvm {
1015 bool drop_bcn_ap_mode; 1015 bool drop_bcn_ap_mode;
1016 1016
1017 struct delayed_work cs_tx_unblock_dwork; 1017 struct delayed_work cs_tx_unblock_dwork;
1018
1019 /* does a monitor vif exist (only one can exist hence bool) */
1020 bool monitor_on;
1018#ifdef CONFIG_ACPI 1021#ifdef CONFIG_ACPI
1019 struct iwl_mvm_sar_profile sar_profiles[IWL_MVM_SAR_PROFILE_NUM]; 1022 struct iwl_mvm_sar_profile sar_profiles[IWL_MVM_SAR_PROFILE_NUM];
1020 struct iwl_mvm_geo_profile geo_profiles[IWL_NUM_GEO_PROFILES]; 1023 struct iwl_mvm_geo_profile geo_profiles[IWL_NUM_GEO_PROFILES];
@@ -1159,7 +1162,7 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
1159 * Enable LAR only if it is supported by the FW (TLV) && 1162 * Enable LAR only if it is supported by the FW (TLV) &&
1160 * enabled in the NVM 1163 * enabled in the NVM
1161 */ 1164 */
1162 if (mvm->cfg->ext_nvm) 1165 if (mvm->cfg->nvm_type == IWL_NVM_EXT)
1163 return nvm_lar && tlv_lar; 1166 return nvm_lar && tlv_lar;
1164 else 1167 else
1165 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;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 184c749766f2..2d14a58cbdd7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -244,7 +244,9 @@ static u32 iwl_mvm_set_mac80211_rx_flag(struct iwl_mvm *mvm,
244 return 0; 244 return 0;
245 245
246 default: 246 default:
247 IWL_ERR(mvm, "Unhandled alg: 0x%x\n", rx_pkt_status); 247 /* Expected in monitor (not having the keys) */
248 if (!mvm->monitor_on)
249 IWL_ERR(mvm, "Unhandled alg: 0x%x\n", rx_pkt_status);
248 } 250 }
249 251
250 return 0; 252 return 0;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 77f77bc5d083..248699c2c4bf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -277,7 +277,9 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
277 stats->flag |= RX_FLAG_DECRYPTED; 277 stats->flag |= RX_FLAG_DECRYPTED;
278 return 0; 278 return 0;
279 default: 279 default:
280 IWL_ERR(mvm, "Unhandled alg: 0x%x\n", status); 280 /* Expected in monitor (not having the keys) */
281 if (!mvm->monitor_on)
282 IWL_ERR(mvm, "Unhandled alg: 0x%x\n", status);
281 } 283 }
282 284
283 return 0; 285 return 0;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 4d907f60bce9..1232f63278eb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -631,7 +631,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
631 631
632 if (!iwl_mvm_firmware_running(mvm) || 632 if (!iwl_mvm_firmware_running(mvm) ||
633 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) { 633 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
634 ret = -EIO; 634 ret = -ENODATA;
635 goto out; 635 goto out;
636 } 636 }
637 637
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 4f73012978e9..1d431d4bf6d2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1122,7 +1122,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
1122 } 1122 }
1123 if (0 == tmp) { 1123 if (0 == tmp) {
1124 read_addr = REG_DBI_RDATA + addr % 4; 1124 read_addr = REG_DBI_RDATA + addr % 4;
1125 ret = rtl_read_byte(rtlpriv, read_addr); 1125 ret = rtl_read_word(rtlpriv, read_addr);
1126 } 1126 }
1127 return ret; 1127 return ret;
1128} 1128}