Lines Matching +full:32 +full:- +full:rail

1 // SPDX-License-Identifier: GPL-2.0-or-later
8 Copyright (c) 2010-2011 Rafał Miłecki <zajec5@gmail.com>
96 enum nl80211_band band = b43_current_band(dev->wl); in b43_nphy_ipa()
97 return ((dev->phy.n->ipa2g_on && band == NL80211_BAND_2GHZ) || in b43_nphy_ipa()
98 (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ)); in b43_nphy_ipa()
101 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */
112 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */
137 b43err(dev->wl, "RF sequence status timeout\n"); in b43_nphy_force_rf_sequence()
149 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverrideRev7 */
154 struct b43_phy *phy = &dev->phy; in b43_nphy_rf_ctl_override_rev7()
164 if (phy->rev >= 19 || phy->rev < 3) { in b43_nphy_rf_ctl_override_rev7()
174 b43err(dev->wl, "Invalid override value %d\n", override); in b43_nphy_rf_ctl_override_rev7()
180 val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1; in b43_nphy_rf_ctl_override_rev7()
185 b43_phy_mask(dev, val_addr, ~e->val_mask); in b43_nphy_rf_ctl_override_rev7()
190 b43_phy_maskset(dev, val_addr, ~e->val_mask, (value << e->val_shift)); in b43_nphy_rf_ctl_override_rev7()
196 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverideOneToMany */
201 struct b43_phy *phy = &dev->phy; in b43_nphy_rf_ctl_override_one_to_many()
204 B43_WARN_ON(phy->rev < 7); in b43_nphy_rf_ctl_override_one_to_many()
240 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */
248 B43_WARN_ON(field & (~(1 << (index - 1)))); in b43_nphy_rf_ctl_override()
250 if (dev->phy.rev >= 3) { in b43_nphy_rf_ctl_override()
254 b43err(dev->wl, in b43_nphy_rf_ctl_override()
259 rf_ctrl = &tbl_rf_control_override_rev3[index - 1]; in b43_nphy_rf_ctl_override()
261 rf_ctrl->en_addr0 : rf_ctrl->en_addr1); in b43_nphy_rf_ctl_override()
263 rf_ctrl->val_addr0 : rf_ctrl->val_addr1); in b43_nphy_rf_ctl_override()
268 ~(rf_ctrl->val_mask)); in b43_nphy_rf_ctl_override()
273 ~(rf_ctrl->val_mask), in b43_nphy_rf_ctl_override()
274 (value << rf_ctrl->val_shift)); in b43_nphy_rf_ctl_override()
289 b43err(dev->wl, in b43_nphy_rf_ctl_override()
299 rf_ctrl = &tbl_rf_control_override_rev2[index - 2]; in b43_nphy_rf_ctl_override()
301 rf_ctrl->addr0 : rf_ctrl->addr1); in b43_nphy_rf_ctl_override()
304 b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask), in b43_nphy_rf_ctl_override()
305 (value << rf_ctrl->shift)); in b43_nphy_rf_ctl_override()
348 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) in b43_nphy_rf_ctl_intc_override_rev7()
356 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rf_ctl_intc_override_rev7()
369 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rf_ctl_intc_override_rev7()
385 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */
393 if (dev->phy.rev >= 7) { in b43_nphy_rf_ctl_intc_override()
399 B43_WARN_ON(dev->phy.rev < 3); in b43_nphy_rf_ctl_intc_override()
430 b43err(dev->wl, in b43_nphy_rf_ctl_intc_override()
449 b43err(dev->wl, in b43_nphy_rf_ctl_intc_override()
456 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rf_ctl_intc_override()
466 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rf_ctl_intc_override()
476 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rf_ctl_intc_override()
493 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
501 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
508 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
513 if (dev->dev->core_rev == 16) in b43_nphy_classifier()
523 if (dev->dev->core_rev == 16) in b43_nphy_classifier()
529 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
543 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */
546 struct b43_phy *phy = &dev->phy; in b43_nphy_stay_in_carrier_search()
547 struct b43_phy_n *nphy = phy->n; in b43_nphy_stay_in_carrier_search()
551 if (nphy->deaf_count++ == 0) { in b43_nphy_stay_in_carrier_search()
552 nphy->classifier_state = b43_nphy_classifier(dev, 0, 0); in b43_nphy_stay_in_carrier_search()
555 b43_nphy_read_clip_detection(dev, nphy->clip_state); in b43_nphy_stay_in_carrier_search()
560 if (--nphy->deaf_count == 0) { in b43_nphy_stay_in_carrier_search()
561 b43_nphy_classifier(dev, 0x7, nphy->classifier_state); in b43_nphy_stay_in_carrier_search()
562 b43_nphy_write_clip_detection(dev, nphy->clip_state); in b43_nphy_stay_in_carrier_search()
567 /* https://bcm-v4.sipsolutions.net/PHY/N/Read_Lpf_Bw_Ctl */
575 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
578 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_adjust_lna_gain_table()
585 static const s16 lna_gain[4] = { -2, 10, 19, 25 }; in b43_nphy_adjust_lna_gain_table()
587 if (nphy->hang_avoid) in b43_nphy_adjust_lna_gain_table()
590 if (nphy->gain_boost) { in b43_nphy_adjust_lna_gain_table()
591 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_adjust_lna_gain_table()
595 tmp = 40370 - 315 * dev->phy.channel; in b43_nphy_adjust_lna_gain_table()
597 tmp = 23242 - 224 * dev->phy.channel; in b43_nphy_adjust_lna_gain_table()
606 if (nphy->elna_gain_config) { in b43_nphy_adjust_lna_gain_table()
627 if (nphy->hang_avoid) in b43_nphy_adjust_lna_gain_table()
631 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */
635 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_set_rf_sequence()
637 u8 end = (dev->phy.rev >= 3) ? 0x1F : 0x0F; in b43_nphy_set_rf_sequence()
641 if (nphy->hang_avoid) in b43_nphy_set_rf_sequence()
652 if (nphy->hang_avoid) in b43_nphy_set_rf_sequence()
665 b43_radio_write(dev, R2057_VCOCAL_COUNTVAL0, e_r7_2g->radio_vcocal_countval0); in b43_radio_2057_chantab_upload()
666 b43_radio_write(dev, R2057_VCOCAL_COUNTVAL1, e_r7_2g->radio_vcocal_countval1); in b43_radio_2057_chantab_upload()
667 …b43_radio_write(dev, R2057_RFPLL_REFMASTER_SPAREXTALSIZE, e_r7_2g->radio_rfpll_refmaster_sparextal… in b43_radio_2057_chantab_upload()
668 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_R1, e_r7_2g->radio_rfpll_loopfilter_r1); in b43_radio_2057_chantab_upload()
669 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C2, e_r7_2g->radio_rfpll_loopfilter_c2); in b43_radio_2057_chantab_upload()
670 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C1, e_r7_2g->radio_rfpll_loopfilter_c1); in b43_radio_2057_chantab_upload()
671 b43_radio_write(dev, R2057_CP_KPD_IDAC, e_r7_2g->radio_cp_kpd_idac); in b43_radio_2057_chantab_upload()
672 b43_radio_write(dev, R2057_RFPLL_MMD0, e_r7_2g->radio_rfpll_mmd0); in b43_radio_2057_chantab_upload()
673 b43_radio_write(dev, R2057_RFPLL_MMD1, e_r7_2g->radio_rfpll_mmd1); in b43_radio_2057_chantab_upload()
674 b43_radio_write(dev, R2057_VCOBUF_TUNE, e_r7_2g->radio_vcobuf_tune); in b43_radio_2057_chantab_upload()
675 b43_radio_write(dev, R2057_LOGEN_MX2G_TUNE, e_r7_2g->radio_logen_mx2g_tune); in b43_radio_2057_chantab_upload()
676 b43_radio_write(dev, R2057_LOGEN_INDBUF2G_TUNE, e_r7_2g->radio_logen_indbuf2g_tune); in b43_radio_2057_chantab_upload()
677 …b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE0, e_r7_2g->radio_txmix2g_tune_boost_pu_core0… in b43_radio_2057_chantab_upload()
678 b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE0, e_r7_2g->radio_pad2g_tune_pus_core0); in b43_radio_2057_chantab_upload()
679 b43_radio_write(dev, R2057_LNA2G_TUNE_CORE0, e_r7_2g->radio_lna2g_tune_core0); in b43_radio_2057_chantab_upload()
680 …b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE1, e_r7_2g->radio_txmix2g_tune_boost_pu_core1… in b43_radio_2057_chantab_upload()
681 b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE1, e_r7_2g->radio_pad2g_tune_pus_core1); in b43_radio_2057_chantab_upload()
682 b43_radio_write(dev, R2057_LNA2G_TUNE_CORE1, e_r7_2g->radio_lna2g_tune_core1); in b43_radio_2057_chantab_upload()
685 b43_radio_write(dev, R2057_VCOCAL_COUNTVAL0, e_r7->radio_vcocal_countval0); in b43_radio_2057_chantab_upload()
686 b43_radio_write(dev, R2057_VCOCAL_COUNTVAL1, e_r7->radio_vcocal_countval1); in b43_radio_2057_chantab_upload()
687 …b43_radio_write(dev, R2057_RFPLL_REFMASTER_SPAREXTALSIZE, e_r7->radio_rfpll_refmaster_sparextalsiz… in b43_radio_2057_chantab_upload()
688 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_R1, e_r7->radio_rfpll_loopfilter_r1); in b43_radio_2057_chantab_upload()
689 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C2, e_r7->radio_rfpll_loopfilter_c2); in b43_radio_2057_chantab_upload()
690 b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C1, e_r7->radio_rfpll_loopfilter_c1); in b43_radio_2057_chantab_upload()
691 b43_radio_write(dev, R2057_CP_KPD_IDAC, e_r7->radio_cp_kpd_idac); in b43_radio_2057_chantab_upload()
692 b43_radio_write(dev, R2057_RFPLL_MMD0, e_r7->radio_rfpll_mmd0); in b43_radio_2057_chantab_upload()
693 b43_radio_write(dev, R2057_RFPLL_MMD1, e_r7->radio_rfpll_mmd1); in b43_radio_2057_chantab_upload()
694 b43_radio_write(dev, R2057_VCOBUF_TUNE, e_r7->radio_vcobuf_tune); in b43_radio_2057_chantab_upload()
695 b43_radio_write(dev, R2057_LOGEN_MX2G_TUNE, e_r7->radio_logen_mx2g_tune); in b43_radio_2057_chantab_upload()
696 b43_radio_write(dev, R2057_LOGEN_MX5G_TUNE, e_r7->radio_logen_mx5g_tune); in b43_radio_2057_chantab_upload()
697 b43_radio_write(dev, R2057_LOGEN_INDBUF2G_TUNE, e_r7->radio_logen_indbuf2g_tune); in b43_radio_2057_chantab_upload()
698 b43_radio_write(dev, R2057_LOGEN_INDBUF5G_TUNE, e_r7->radio_logen_indbuf5g_tune); in b43_radio_2057_chantab_upload()
699 b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE0, e_r7->radio_txmix2g_tune_boost_pu_core0); in b43_radio_2057_chantab_upload()
700 b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE0, e_r7->radio_pad2g_tune_pus_core0); in b43_radio_2057_chantab_upload()
701 b43_radio_write(dev, R2057_PGA_BOOST_TUNE_CORE0, e_r7->radio_pga_boost_tune_core0); in b43_radio_2057_chantab_upload()
702 b43_radio_write(dev, R2057_TXMIX5G_BOOST_TUNE_CORE0, e_r7->radio_txmix5g_boost_tune_core0); in b43_radio_2057_chantab_upload()
703 b43_radio_write(dev, R2057_PAD5G_TUNE_MISC_PUS_CORE0, e_r7->radio_pad5g_tune_misc_pus_core0); in b43_radio_2057_chantab_upload()
704 b43_radio_write(dev, R2057_LNA2G_TUNE_CORE0, e_r7->radio_lna2g_tune_core0); in b43_radio_2057_chantab_upload()
705 b43_radio_write(dev, R2057_LNA5G_TUNE_CORE0, e_r7->radio_lna5g_tune_core0); in b43_radio_2057_chantab_upload()
706 b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE1, e_r7->radio_txmix2g_tune_boost_pu_core1); in b43_radio_2057_chantab_upload()
707 b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE1, e_r7->radio_pad2g_tune_pus_core1); in b43_radio_2057_chantab_upload()
708 b43_radio_write(dev, R2057_PGA_BOOST_TUNE_CORE1, e_r7->radio_pga_boost_tune_core1); in b43_radio_2057_chantab_upload()
709 b43_radio_write(dev, R2057_TXMIX5G_BOOST_TUNE_CORE1, e_r7->radio_txmix5g_boost_tune_core1); in b43_radio_2057_chantab_upload()
710 b43_radio_write(dev, R2057_PAD5G_TUNE_MISC_PUS_CORE1, e_r7->radio_pad5g_tune_misc_pus_core1); in b43_radio_2057_chantab_upload()
711 b43_radio_write(dev, R2057_LNA2G_TUNE_CORE1, e_r7->radio_lna2g_tune_core1); in b43_radio_2057_chantab_upload()
712 b43_radio_write(dev, R2057_LNA5G_TUNE_CORE1, e_r7->radio_lna5g_tune_core1); in b43_radio_2057_chantab_upload()
720 struct b43_phy *phy = &dev->phy; in b43_radio_2057_setup()
724 switch (phy->radio_rev) { in b43_radio_2057_setup()
727 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_radio_2057_setup()
742 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_radio_2057_setup()
766 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_radio_2057_setup()
771 switch (phy->radio_rev) { in b43_radio_2057_setup()
808 * https://bcm-v4.sipsolutions.net/PHY/radio205x_rcal
812 struct b43_phy *phy = &dev->phy; in b43_radio_2057_rcal()
848 switch (phy->radio_rev) { in b43_radio_2057_rcal()
884 b43err(dev->wl, "Radio 0x2057 rcal timeout\n"); in b43_radio_2057_rcal()
898 switch (phy->radio_rev) { in b43_radio_2057_rcal()
922 * https://bcm-v4.sipsolutions.net/PHY/radio2057_rccal
926 struct b43_phy *phy = &dev->phy; in b43_radio_2057_rccal()
927 bool special = (phy->radio_rev == 3 || phy->radio_rev == 4 || in b43_radio_2057_rccal()
928 phy->radio_rev == 6); in b43_radio_2057_rccal()
945 b43dbg(dev->wl, "Radio 0x2057 rccal timeout\n"); in b43_radio_2057_rccal()
966 b43dbg(dev->wl, "Radio 0x2057 rccal timeout\n"); in b43_radio_2057_rccal()
988 b43err(dev->wl, "Radio 0x2057 rcal timeout\n"); in b43_radio_2057_rccal()
1026 if (dev->phy.do_full_init) { in b43_radio_2057_init_post()
1033 /* https://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */
1048 b43_radio_write(dev, B2056_SYN_PLL_VCOCAL1, e->radio_syn_pll_vcocal1); in b43_chantab_radio_2056_upload()
1049 b43_radio_write(dev, B2056_SYN_PLL_VCOCAL2, e->radio_syn_pll_vcocal2); in b43_chantab_radio_2056_upload()
1050 b43_radio_write(dev, B2056_SYN_PLL_REFDIV, e->radio_syn_pll_refdiv); in b43_chantab_radio_2056_upload()
1051 b43_radio_write(dev, B2056_SYN_PLL_MMD2, e->radio_syn_pll_mmd2); in b43_chantab_radio_2056_upload()
1052 b43_radio_write(dev, B2056_SYN_PLL_MMD1, e->radio_syn_pll_mmd1); in b43_chantab_radio_2056_upload()
1054 e->radio_syn_pll_loopfilter1); in b43_chantab_radio_2056_upload()
1056 e->radio_syn_pll_loopfilter2); in b43_chantab_radio_2056_upload()
1058 e->radio_syn_pll_loopfilter3); in b43_chantab_radio_2056_upload()
1060 e->radio_syn_pll_loopfilter4); in b43_chantab_radio_2056_upload()
1062 e->radio_syn_pll_loopfilter5); in b43_chantab_radio_2056_upload()
1064 e->radio_syn_reserved_addr27); in b43_chantab_radio_2056_upload()
1066 e->radio_syn_reserved_addr28); in b43_chantab_radio_2056_upload()
1068 e->radio_syn_reserved_addr29); in b43_chantab_radio_2056_upload()
1070 e->radio_syn_logen_vcobuf1); in b43_chantab_radio_2056_upload()
1071 b43_radio_write(dev, B2056_SYN_LOGEN_MIXER2, e->radio_syn_logen_mixer2); in b43_chantab_radio_2056_upload()
1072 b43_radio_write(dev, B2056_SYN_LOGEN_BUF3, e->radio_syn_logen_buf3); in b43_chantab_radio_2056_upload()
1073 b43_radio_write(dev, B2056_SYN_LOGEN_BUF4, e->radio_syn_logen_buf4); in b43_chantab_radio_2056_upload()
1076 e->radio_rx0_lnaa_tune); in b43_chantab_radio_2056_upload()
1078 e->radio_rx0_lnag_tune); in b43_chantab_radio_2056_upload()
1081 e->radio_tx0_intpaa_boost_tune); in b43_chantab_radio_2056_upload()
1083 e->radio_tx0_intpag_boost_tune); in b43_chantab_radio_2056_upload()
1085 e->radio_tx0_pada_boost_tune); in b43_chantab_radio_2056_upload()
1087 e->radio_tx0_padg_boost_tune); in b43_chantab_radio_2056_upload()
1089 e->radio_tx0_pgaa_boost_tune); in b43_chantab_radio_2056_upload()
1091 e->radio_tx0_pgag_boost_tune); in b43_chantab_radio_2056_upload()
1093 e->radio_tx0_mixa_boost_tune); in b43_chantab_radio_2056_upload()
1095 e->radio_tx0_mixg_boost_tune); in b43_chantab_radio_2056_upload()
1098 e->radio_rx1_lnaa_tune); in b43_chantab_radio_2056_upload()
1100 e->radio_rx1_lnag_tune); in b43_chantab_radio_2056_upload()
1103 e->radio_tx1_intpaa_boost_tune); in b43_chantab_radio_2056_upload()
1105 e->radio_tx1_intpag_boost_tune); in b43_chantab_radio_2056_upload()
1107 e->radio_tx1_pada_boost_tune); in b43_chantab_radio_2056_upload()
1109 e->radio_tx1_padg_boost_tune); in b43_chantab_radio_2056_upload()
1111 e->radio_tx1_pgaa_boost_tune); in b43_chantab_radio_2056_upload()
1113 e->radio_tx1_pgag_boost_tune); in b43_chantab_radio_2056_upload()
1115 e->radio_tx1_mixa_boost_tune); in b43_chantab_radio_2056_upload()
1117 e->radio_tx1_mixg_boost_tune); in b43_chantab_radio_2056_upload()
1120 /* https://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */
1124 struct b43_phy *phy = &dev->phy; in b43_radio_2056_setup()
1125 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_radio_2056_setup()
1126 enum nl80211_band band = b43_current_band(dev->wl); in b43_radio_2056_setup()
1134 B43_WARN_ON(dev->phy.rev < 3); in b43_radio_2056_setup()
1137 ((dev->dev->chip_id == BCMA_CHIP_ID_BCM43224 || in b43_radio_2056_setup()
1138 dev->dev->chip_id == BCMA_CHIP_ID_BCM43225 || in b43_radio_2056_setup()
1139 dev->dev->chip_id == BCMA_CHIP_ID_BCM43421) && in b43_radio_2056_setup()
1140 dev->dev->chip_pkg == BCMA_PKG_ID_BCM43224_FAB_SMIC); in b43_radio_2056_setup()
1145 if (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && in b43_radio_2056_setup()
1146 b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_radio_2056_setup()
1149 if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || in b43_radio_2056_setup()
1150 dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { in b43_radio_2056_setup()
1158 if (sprom->boardflags2_hi & B43_BFH2_GPLL_WAR2 && in b43_radio_2056_setup()
1159 b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_radio_2056_setup()
1165 if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && in b43_radio_2056_setup()
1166 b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_radio_2056_setup()
1173 if (dev->phy.n->ipa2g_on && band == NL80211_BAND_2GHZ) { in b43_radio_2056_setup()
1176 if (dev->phy.rev >= 5) { in b43_radio_2056_setup()
1180 if (dev->dev->chip_id == BCMA_CHIP_ID_BCM4716 || in b43_radio_2056_setup()
1181 dev->dev->chip_id == BCMA_CHIP_ID_BCM47162) { in b43_radio_2056_setup()
1235 } else if (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ) { in b43_radio_2056_setup()
1236 u16 freq = phy->chandef->chan->center_freq; in b43_radio_2056_setup()
1256 pgaa_boost = -(freq - 18) / 36 + 168; in b43_radio_2056_setup()
1302 struct b43_phy *phy = &dev->phy; in b43_radio_2056_rcal()
1305 if (phy->rev != 3) in b43_radio_2056_rcal()
1318 b43err(dev->wl, "Radio recalibration timeout\n"); in b43_radio_2056_rcal()
1353 if (dev->phy.do_full_init) in b43_radio_init2056_post()
1358 * Initialize a Broadcom 2056 N-radio
1359 * https://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init
1375 b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref); in b43_chantab_radio_upload()
1376 b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0); in b43_chantab_radio_upload()
1377 b43_radio_write(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1); in b43_chantab_radio_upload()
1378 b43_radio_write(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail); in b43_chantab_radio_upload()
1381 b43_radio_write(dev, B2055_VCO_CAL1, e->radio_vco_cal1); in b43_chantab_radio_upload()
1382 b43_radio_write(dev, B2055_VCO_CAL2, e->radio_vco_cal2); in b43_chantab_radio_upload()
1383 b43_radio_write(dev, B2055_PLL_LFC1, e->radio_pll_lfc1); in b43_chantab_radio_upload()
1384 b43_radio_write(dev, B2055_PLL_LFR1, e->radio_pll_lfr1); in b43_chantab_radio_upload()
1387 b43_radio_write(dev, B2055_PLL_LFC2, e->radio_pll_lfc2); in b43_chantab_radio_upload()
1388 b43_radio_write(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf); in b43_chantab_radio_upload()
1389 b43_radio_write(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1); in b43_chantab_radio_upload()
1390 b43_radio_write(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2); in b43_chantab_radio_upload()
1393 b43_radio_write(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune); in b43_chantab_radio_upload()
1394 b43_radio_write(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune); in b43_chantab_radio_upload()
1395 b43_radio_write(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1); in b43_chantab_radio_upload()
1396 b43_radio_write(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn); in b43_chantab_radio_upload()
1399 b43_radio_write(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim); in b43_chantab_radio_upload()
1400 b43_radio_write(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune); in b43_chantab_radio_upload()
1401 b43_radio_write(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune); in b43_chantab_radio_upload()
1402 b43_radio_write(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1); in b43_chantab_radio_upload()
1405 b43_radio_write(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn); in b43_chantab_radio_upload()
1406 b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim); in b43_chantab_radio_upload()
1409 /* https://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
1413 B43_WARN_ON(dev->phy.rev >= 3); in b43_radio_2055_setup()
1437 struct b43_phy_n *nphy = dev->phy.n; in b43_radio_init2055_post()
1438 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_radio_init2055_post()
1441 if (sprom->revision < 4) in b43_radio_init2055_post()
1442 workaround = (dev->dev->board_vendor != PCI_VENDOR_ID_BROADCOM in b43_radio_init2055_post()
1443 && dev->dev->board_type == SSB_BOARD_CB2_4321 in b43_radio_init2055_post()
1444 && dev->dev->board_rev >= 0x41); in b43_radio_init2055_post()
1447 !(sprom->boardflags2_lo & B43_BFL2_RXBB_INT_REG_DIS); in b43_radio_init2055_post()
1462 b43err(dev->wl, "radio post init timeout\n"); in b43_radio_init2055_post()
1464 b43_switch_channel(dev, dev->phy.channel); in b43_radio_init2055_post()
1471 if (!nphy->gain_boost) { in b43_radio_init2055_post()
1482 * Initialize a Broadcom 2055 N-radio
1483 * https://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
1492 bool ghz5 = b43_current_band(dev->wl) == NL80211_BAND_5GHZ; in b43_radio_init2055()
1502 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */
1505 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_load_samples()
1511 b43err(dev->wl, "allocation for samples loading failed\n"); in b43_nphy_load_samples()
1512 return -ENOMEM; in b43_nphy_load_samples()
1514 if (nphy->hang_avoid) in b43_nphy_load_samples()
1524 if (nphy->hang_avoid) in b43_nphy_load_samples()
1529 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
1554 b43err(dev->wl, "allocation for samples generation failed\n"); in b43_nphy_gen_load_samples()
1572 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
1577 struct b43_phy *phy = &dev->phy; in b43_nphy_run_samples()
1578 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_run_samples()
1585 if (phy->rev >= 7) { in b43_nphy_run_samples()
1595 if (phy->rev >= 19) in b43_nphy_run_samples()
1601 nphy->lpf_bw_overrode_for_sample_play = true; in b43_nphy_run_samples()
1605 if ((nphy->bb_mult_save & 0x80000000) == 0) { in b43_nphy_run_samples()
1607 nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; in b43_nphy_run_samples()
1615 b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); in b43_nphy_run_samples()
1618 b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, (loops - 1)); in b43_nphy_run_samples()
1642 b43err(dev->wl, "run samples timeout\n"); in b43_nphy_run_samples()
1653 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */
1656 enum n_rail_type rail, in b43_nphy_scale_offset_rssi() argument
1663 offset = clamp_val(offset, -32, 31); in b43_nphy_scale_offset_rssi()
1668 if (core1or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1670 if (core1or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1672 if (core2or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1674 if (core2or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1678 if (core1or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1680 if (core1or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1682 if (core2or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1684 if (core2or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1688 if (core1or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1690 if (core1or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1692 if (core2or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1694 if (core2or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1698 if (core1or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1700 if (core1or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1702 if (core2or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1704 if (core2or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1708 if (core1or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1710 if (core1or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1712 if (core2or5 && rail == N_RAIL_I) in b43_nphy_scale_offset_rssi()
1714 if (core2or5 && rail == N_RAIL_Q) in b43_nphy_scale_offset_rssi()
1776 val = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ? 4 : 8; in b43_nphy_rev3_rssi_select()
1780 val = 32; in b43_nphy_rev3_rssi_select()
1805 b43_current_band(dev->wl); in b43_nphy_rev3_rssi_select()
1807 if (dev->phy.rev < 7) { in b43_nphy_rev3_rssi_select()
1898 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSISel */
1902 if (dev->phy.rev >= 19) in b43_nphy_rssi_select()
1904 else if (dev->phy.rev >= 3) in b43_nphy_rssi_select()
1910 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRssi2055Vcm */
1939 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/PollRssi */
1950 if (dev->phy.rev >= 3) { in b43_nphy_poll_rssi()
1976 if (dev->phy.rev < 2) { in b43_nphy_poll_rssi()
1985 if (dev->phy.rev < 2) { in b43_nphy_poll_rssi()
2001 if (dev->phy.rev < 2) in b43_nphy_poll_rssi()
2004 if (dev->phy.rev >= 3) { in b43_nphy_poll_rssi()
2028 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
2031 struct b43_phy *phy = &dev->phy; in b43_nphy_rev3_rssi_cal()
2032 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_rev3_rssi_cal()
2080 if (dev->phy.rev >= 7) { in b43_nphy_rev3_rssi_cal()
2102 if (dev->phy.rev >= 7) { in b43_nphy_rev3_rssi_cal()
2111 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rev3_rssi_cal()
2127 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_rev3_rssi_cal()
2148 if (dev->phy.rev >= 7) in b43_nphy_rev3_rssi_cal()
2182 if (dev->phy.rev >= 7) in b43_nphy_rev3_rssi_cal()
2194 offset[i] = -results[vcm_final][i]; in b43_nphy_rev3_rssi_cal()
2196 offset[i] = -((abs(offset[i]) + 4) / 8); in b43_nphy_rev3_rssi_cal()
2200 offset[i] = -32; in b43_nphy_rev3_rssi_cal()
2219 offset[j] = 232 - poll_results[j]; in b43_nphy_rev3_rssi_cal()
2221 offset[j] = -(abs(offset[j] + 4) / 8); in b43_nphy_rev3_rssi_cal()
2248 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_rev3_rssi_cal()
2249 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; in b43_nphy_rev3_rssi_cal()
2250 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; in b43_nphy_rev3_rssi_cal()
2252 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; in b43_nphy_rev3_rssi_cal()
2253 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; in b43_nphy_rev3_rssi_cal()
2255 if (dev->phy.rev >= 7) { in b43_nphy_rev3_rssi_cal()
2280 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_rev3_rssi_cal()
2281 nphy->rssical_chanspec_2G.center_freq = phy->chandef->chan->center_freq; in b43_nphy_rev3_rssi_cal()
2283 nphy->rssical_chanspec_5G.center_freq = phy->chandef->chan->center_freq; in b43_nphy_rev3_rssi_cal()
2290 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */
2302 u8 rail; in b43_nphy_rev2_rssi_cal() local
2327 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) in b43_nphy_rev2_rssi_cal()
2373 currd = abs(results[vcm][i] - code * 8); in b43_nphy_rev2_rssi_cal()
2375 currd = abs(miniq[vcm][i / 2] - code * 8); in b43_nphy_rev2_rssi_cal()
2393 offset[i] = (code * 8) - results[vcm_final[i]][i]; in b43_nphy_rev2_rssi_cal()
2396 offset[i] = -((abs(offset[i]) + 4) / 8); in b43_nphy_rev2_rssi_cal()
2401 offset[i] = code - 32; in b43_nphy_rev2_rssi_cal()
2404 rail = (i % 2) ? N_RAIL_Q : N_RAIL_I; in b43_nphy_rev2_rssi_cal()
2406 b43_nphy_scale_offset_rssi(dev, 0, offset[i], core, rail, in b43_nphy_rev2_rssi_cal()
2456 * https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal
2460 if (dev->phy.rev >= 19) { in b43_nphy_rssi_cal()
2462 } else if (dev->phy.rev >= 3) { in b43_nphy_rssi_cal()
2482 /* TODO - should depend on phy->rev */ in b43_nphy_gain_ctl_workarounds_rev7()
2487 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_gain_ctl_workarounds_rev3()
2499 ext_lna = ghz5 ? sprom->boardflags_hi & B43_BFH_EXTLNA_5GHZ : in b43_nphy_gain_ctl_workarounds_rev3()
2500 sprom->boardflags_lo & B43_BFL_EXTLNA; in b43_nphy_gain_ctl_workarounds_rev3()
2502 if (ghz5 && dev->phy.rev >= 5) in b43_nphy_gain_ctl_workarounds_rev3()
2532 b43_ntab_write_bulk(dev, B43_NTAB8(0, 8), 4, e->lna1_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2533 b43_ntab_write_bulk(dev, B43_NTAB8(1, 8), 4, e->lna1_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2534 b43_ntab_write_bulk(dev, B43_NTAB8(0, 16), 4, e->lna2_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2535 b43_ntab_write_bulk(dev, B43_NTAB8(1, 16), 4, e->lna2_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2536 b43_ntab_write_bulk(dev, B43_NTAB8(0, 32), 10, e->gain_db); in b43_nphy_gain_ctl_workarounds_rev3()
2537 b43_ntab_write_bulk(dev, B43_NTAB8(1, 32), 10, e->gain_db); in b43_nphy_gain_ctl_workarounds_rev3()
2538 b43_ntab_write_bulk(dev, B43_NTAB8(2, 32), 10, e->gain_bits); in b43_nphy_gain_ctl_workarounds_rev3()
2539 b43_ntab_write_bulk(dev, B43_NTAB8(3, 32), 10, e->gain_bits); in b43_nphy_gain_ctl_workarounds_rev3()
2545 b43_phy_write(dev, B43_NPHY_REV3_C1_INITGAIN_A, e->init_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2546 b43_phy_write(dev, B43_NPHY_REV3_C2_INITGAIN_A, e->init_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2549 e->rfseq_init); in b43_nphy_gain_ctl_workarounds_rev3()
2551 b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_HIGAIN_A, e->cliphi_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2552 b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_HIGAIN_A, e->cliphi_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2553 b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_MEDGAIN_A, e->clipmd_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2554 b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_MEDGAIN_A, e->clipmd_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2555 b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_LOGAIN_A, e->cliplo_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2556 b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_LOGAIN_A, e->cliplo_gain); in b43_nphy_gain_ctl_workarounds_rev3()
2558 b43_phy_maskset(dev, B43_NPHY_CRSMINPOWER0, 0xFF00, e->crsmin); in b43_nphy_gain_ctl_workarounds_rev3()
2559 b43_phy_maskset(dev, B43_NPHY_CRSMINPOWERL0, 0xFF00, e->crsminl); in b43_nphy_gain_ctl_workarounds_rev3()
2560 b43_phy_maskset(dev, B43_NPHY_CRSMINPOWERU0, 0xFF00, e->crsminu); in b43_nphy_gain_ctl_workarounds_rev3()
2561 b43_phy_write(dev, B43_NPHY_C1_NBCLIPTHRES, e->nbclip); in b43_nphy_gain_ctl_workarounds_rev3()
2562 b43_phy_write(dev, B43_NPHY_C2_NBCLIPTHRES, e->nbclip); in b43_nphy_gain_ctl_workarounds_rev3()
2564 ~B43_NPHY_C1_CLIPWBTHRES_CLIP2, e->wlclip); in b43_nphy_gain_ctl_workarounds_rev3()
2566 ~B43_NPHY_C2_CLIPWBTHRES_CLIP2, e->wlclip); in b43_nphy_gain_ctl_workarounds_rev3()
2572 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_gain_ctl_workarounds_rev1_2()
2615 if (nphy->gain_boost) { in b43_nphy_gain_ctl_workarounds_rev1_2()
2616 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ && in b43_nphy_gain_ctl_workarounds_rev1_2()
2638 if (nphy->elna_gain_config) { in b43_nphy_gain_ctl_workarounds_rev1_2()
2658 if (dev->phy.rev == 2) { in b43_nphy_gain_ctl_workarounds_rev1_2()
2675 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_gain_ctl_workarounds_rev1_2()
2679 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
2682 if (dev->phy.rev >= 19) in b43_nphy_gain_ctl_workarounds()
2684 else if (dev->phy.rev >= 7) in b43_nphy_gain_ctl_workarounds()
2686 else if (dev->phy.rev >= 3) in b43_nphy_gain_ctl_workarounds()
2694 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_workarounds_rev7plus()
2695 struct b43_phy *phy = &dev->phy; in b43_nphy_workarounds_rev7plus()
2730 if (phy->rev == 7) { in b43_nphy_workarounds_rev7plus()
2750 if (phy->rev >= 16) { in b43_nphy_workarounds_rev7plus()
2753 } else if (phy->rev <= 8) { in b43_nphy_workarounds_rev7plus()
2758 if (phy->rev >= 16) in b43_nphy_workarounds_rev7plus()
2760 else if (phy->rev >= 8) in b43_nphy_workarounds_rev7plus()
2790 bool ghz2 = b43_current_band(dev->wl) == NL80211_BAND_2GHZ; in b43_nphy_workarounds_rev7plus()
2792 switch (phy->radio_rev) { in b43_nphy_workarounds_rev7plus()
2795 if (phy->rev == 8 && b43_is_40mhz(dev)) { in b43_nphy_workarounds_rev7plus()
2807 if (phy->rev == 9) { in b43_nphy_workarounds_rev7plus()
2818 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_workarounds_rev7plus()
2849 bcap_val_11n_40[core] = bcap_val - 7; in b43_nphy_workarounds_rev7plus()
2850 scap_val_11n_40[core] = scap_val - 5; in b43_nphy_workarounds_rev7plus()
2887 if (phy->radio_rev == 5) { in b43_nphy_workarounds_rev7plus()
2950 if (phy->radio_rev == 4 || phy->radio_rev == 6) in b43_nphy_workarounds_rev7plus()
2953 if (phy->radio_rev == 3 || phy->radio_rev == 4 || phy->radio_rev == 6) { in b43_nphy_workarounds_rev7plus()
2954 if (sprom->revision && in b43_nphy_workarounds_rev7plus()
2955 sprom->boardflags2_hi & B43_BFH2_IPALVLSHIFT_3P3) { in b43_nphy_workarounds_rev7plus()
2969 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_workarounds_rev7plus()
2985 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_workarounds_rev7plus()
2986 if (phy->radio_rev == 3 || phy->radio_rev == 4 || in b43_nphy_workarounds_rev7plus()
2987 phy->radio_rev == 6) { in b43_nphy_workarounds_rev7plus()
2997 switch (phy->radio_rev) { in b43_nphy_workarounds_rev7plus()
3051 u16 freq = phy->chandef->chan->center_freq; in b43_nphy_workarounds_rev7plus()
3059 if (phy->radio_rev != 5) { in b43_nphy_workarounds_rev7plus()
3072 if (phy->radio_rev == 4) { in b43_nphy_workarounds_rev7plus()
3139 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_workarounds_rev3plus()
3140 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_workarounds_rev3plus()
3197 if (nphy->hw_phyrxchain != 3 && in b43_nphy_workarounds_rev3plus()
3198 nphy->hw_phyrxchain != nphy->hw_phytxchain) { in b43_nphy_workarounds_rev3plus()
3208 tmp16 = (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) ? in b43_nphy_workarounds_rev3plus()
3227 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_workarounds_rev3plus()
3228 pdet_range = sprom->fem.ghz2.pdet_range; in b43_nphy_workarounds_rev3plus()
3230 pdet_range = sprom->fem.ghz5.pdet_range; in b43_nphy_workarounds_rev3plus()
3235 if (!(dev->phy.rev >= 4 && in b43_nphy_workarounds_rev3plus()
3236 b43_current_band(dev->wl) == NL80211_BAND_2GHZ)) in b43_nphy_workarounds_rev3plus()
3247 if (dev->phy.rev >= 6) { in b43_nphy_workarounds_rev3plus()
3248 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_workarounds_rev3plus()
3253 } else if (dev->phy.rev == 5) { in b43_nphy_workarounds_rev3plus()
3264 if (b43_current_band(dev->wl) != NL80211_BAND_2GHZ) { in b43_nphy_workarounds_rev3plus()
3308 if ((sprom->boardflags2_lo & B43_BFL2_APLL_WAR && in b43_nphy_workarounds_rev3plus()
3309 b43_current_band(dev->wl) == NL80211_BAND_5GHZ) || in b43_nphy_workarounds_rev3plus()
3310 (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && in b43_nphy_workarounds_rev3plus()
3311 b43_current_band(dev->wl) == NL80211_BAND_2GHZ)) in b43_nphy_workarounds_rev3plus()
3319 if (dev->phy.rev == 4 && in b43_nphy_workarounds_rev3plus()
3320 b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_workarounds_rev3plus()
3327 /* Dropped probably-always-true condition */ in b43_nphy_workarounds_rev3plus()
3341 if (dev->phy.rev >= 6 && sprom->boardflags2_lo & B43_BFL2_SINGLEANT_CCK) { in b43_nphy_workarounds_rev3plus()
3348 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_workarounds_rev1_2()
3349 struct b43_phy *phy = &dev->phy; in b43_nphy_workarounds_rev1_2()
3350 struct b43_phy_n *nphy = phy->n; in b43_nphy_workarounds_rev1_2()
3358 if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD || in b43_nphy_workarounds_rev1_2()
3359 dev->dev->board_type == BCMA_BOARD_TYPE_BCM943224M93) { in b43_nphy_workarounds_rev1_2()
3364 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ && in b43_nphy_workarounds_rev1_2()
3365 nphy->band5g_pwrgain) { in b43_nphy_workarounds_rev1_2()
3375 if (dev->phy.rev < 3) { in b43_nphy_workarounds_rev1_2()
3380 if (dev->phy.rev < 2) { in b43_nphy_workarounds_rev1_2()
3399 if (dev->phy.rev < 2) { in b43_nphy_workarounds_rev1_2()
3403 } else if (dev->phy.rev == 2) { in b43_nphy_workarounds_rev1_2()
3408 if (dev->phy.rev < 2) in b43_nphy_workarounds_rev1_2()
3420 if (dev->phy.rev < 3) { in b43_nphy_workarounds_rev1_2()
3428 if (dev->phy.rev == 2) in b43_nphy_workarounds_rev1_2()
3433 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
3436 struct b43_phy *phy = &dev->phy; in b43_nphy_workarounds()
3437 struct b43_phy_n *nphy = phy->n; in b43_nphy_workarounds()
3439 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) in b43_nphy_workarounds()
3444 if (nphy->hang_avoid) in b43_nphy_workarounds()
3451 if (dev->phy.rev >= 7) in b43_nphy_workarounds()
3453 else if (dev->phy.rev >= 3) in b43_nphy_workarounds()
3458 if (nphy->hang_avoid) in b43_nphy_workarounds()
3468 * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
3475 return -1; in b43_nphy_tx_tone()
3481 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */
3484 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_update_txrx_chain()
3489 if (nphy->txrx_chain == 0) { in b43_nphy_update_txrx_chain()
3492 } else if (nphy->txrx_chain == 1) { in b43_nphy_update_txrx_chain()
3509 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */
3512 struct b43_phy *phy = &dev->phy; in b43_nphy_stop_playback()
3513 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_stop_playback()
3516 if (nphy->hang_avoid) in b43_nphy_stop_playback()
3527 if (nphy->bb_mult_save & 0x80000000) { in b43_nphy_stop_playback()
3528 tmp = nphy->bb_mult_save & 0xFFFF; in b43_nphy_stop_playback()
3530 nphy->bb_mult_save = 0; in b43_nphy_stop_playback()
3533 if (phy->rev >= 7 && nphy->lpf_bw_overrode_for_sample_play) { in b43_nphy_stop_playback()
3534 if (phy->rev >= 19) in b43_nphy_stop_playback()
3539 nphy->lpf_bw_overrode_for_sample_play = false; in b43_nphy_stop_playback()
3542 if (nphy->hang_avoid) in b43_nphy_stop_playback()
3546 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */
3551 struct b43_phy *phy = &dev->phy; in b43_nphy_iq_cal_gain_params()
3555 if (dev->phy.rev >= 3) { in b43_nphy_iq_cal_gain_params()
3556 params->tx_lpf = target.tx_lpf[core]; /* Rev 7+ */ in b43_nphy_iq_cal_gain_params()
3557 params->txgm = target.txgm[core]; in b43_nphy_iq_cal_gain_params()
3558 params->pga = target.pga[core]; in b43_nphy_iq_cal_gain_params()
3559 params->pad = target.pad[core]; in b43_nphy_iq_cal_gain_params()
3560 params->ipa = target.ipa[core]; in b43_nphy_iq_cal_gain_params()
3561 if (phy->rev >= 19) { in b43_nphy_iq_cal_gain_params()
3563 } else if (phy->rev >= 7) { in b43_nphy_iq_cal_gain_params()
3564 …params->cal_gain = (params->txgm << 12) | (params->pga << 8) | (params->pad << 3) | (params->ipa) … in b43_nphy_iq_cal_gain_params()
3566 … params->cal_gain = (params->txgm << 12) | (params->pga << 8) | (params->pad << 4) | (params->ipa); in b43_nphy_iq_cal_gain_params()
3569 params->ncorr[j] = 0x79; in b43_nphy_iq_cal_gain_params()
3574 indx = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ? in b43_nphy_iq_cal_gain_params()
3581 params->txgm = tbl_iqcal_gainparams[indx][i][1]; in b43_nphy_iq_cal_gain_params()
3582 params->pga = tbl_iqcal_gainparams[indx][i][2]; in b43_nphy_iq_cal_gain_params()
3583 params->pad = tbl_iqcal_gainparams[indx][i][3]; in b43_nphy_iq_cal_gain_params()
3584 params->cal_gain = (params->txgm << 7) | (params->pga << 4) | in b43_nphy_iq_cal_gain_params()
3585 (params->pad << 2); in b43_nphy_iq_cal_gain_params()
3587 params->ncorr[j] = tbl_iqcal_gainparams[indx][i][4 + j]; in b43_nphy_iq_cal_gain_params()
3595 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */
3598 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_power_ctrl()
3599 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_ctrl()
3602 enum nl80211_band band = b43_current_band(dev->wl); in b43_nphy_tx_power_ctrl()
3604 if (nphy->hang_avoid) in b43_nphy_tx_power_ctrl()
3607 nphy->txpwrctrl = enable; in b43_nphy_tx_power_ctrl()
3609 if (dev->phy.rev >= 3 && in b43_nphy_tx_power_ctrl()
3615 nphy->tx_pwr_idx[0] = b43_phy_read(dev, in b43_nphy_tx_power_ctrl()
3617 nphy->tx_pwr_idx[1] = b43_phy_read(dev, in b43_nphy_tx_power_ctrl()
3630 if (dev->phy.rev >= 3) in b43_nphy_tx_power_ctrl()
3634 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
3641 if (dev->phy.rev == 2) in b43_nphy_tx_power_ctrl()
3644 else if (dev->phy.rev < 2) in b43_nphy_tx_power_ctrl()
3648 if (dev->phy.rev < 2 && b43_is_40mhz(dev)) in b43_nphy_tx_power_ctrl()
3652 nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctrl()
3654 nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctrl()
3660 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
3668 if (phy->rev >= 19) { in b43_nphy_tx_power_ctrl()
3670 } else if (phy->rev >= 7) { in b43_nphy_tx_power_ctrl()
3681 if (phy->rev > 1) in b43_nphy_tx_power_ctrl()
3689 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
3690 if (nphy->tx_pwr_idx[0] != 128 && in b43_nphy_tx_power_ctrl()
3691 nphy->tx_pwr_idx[1] != 128) { in b43_nphy_tx_power_ctrl()
3695 nphy->tx_pwr_idx[0]); in b43_nphy_tx_power_ctrl()
3696 if (dev->phy.rev > 1) in b43_nphy_tx_power_ctrl()
3699 ~0xff, nphy->tx_pwr_idx[1]); in b43_nphy_tx_power_ctrl()
3703 if (phy->rev >= 7) { in b43_nphy_tx_power_ctrl()
3707 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
3714 if (dev->phy.rev == 2) in b43_nphy_tx_power_ctrl()
3716 else if (dev->phy.rev < 2) in b43_nphy_tx_power_ctrl()
3719 if (dev->phy.rev < 2 && b43_is_40mhz(dev)) in b43_nphy_tx_power_ctrl()
3728 if (nphy->hang_avoid) in b43_nphy_tx_power_ctrl()
3732 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
3735 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_power_fix()
3736 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_fix()
3737 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_tx_power_fix()
3741 u16 freq = phy->chandef->chan->center_freq; in b43_nphy_tx_power_fix()
3745 if (nphy->hang_avoid) in b43_nphy_tx_power_fix()
3749 if (dev->phy.rev >= 7) { in b43_nphy_tx_power_fix()
3751 } else if (dev->phy.rev >= 3) { in b43_nphy_tx_power_fix()
3754 } else if (sprom->revision < 4) { in b43_nphy_tx_power_fix()
3758 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_tx_power_fix()
3759 txpi[0] = sprom->txpid2g[0]; in b43_nphy_tx_power_fix()
3760 txpi[1] = sprom->txpid2g[1]; in b43_nphy_tx_power_fix()
3762 txpi[0] = sprom->txpid5gl[0]; in b43_nphy_tx_power_fix()
3763 txpi[1] = sprom->txpid5gl[1]; in b43_nphy_tx_power_fix()
3765 txpi[0] = sprom->txpid5g[0]; in b43_nphy_tx_power_fix()
3766 txpi[1] = sprom->txpid5g[1]; in b43_nphy_tx_power_fix()
3768 txpi[0] = sprom->txpid5gh[0]; in b43_nphy_tx_power_fix()
3769 txpi[1] = sprom->txpid5gh[1]; in b43_nphy_tx_power_fix()
3775 if (dev->phy.rev < 7 && in b43_nphy_tx_power_fix()
3781 nphy->txpwrindex[i].index_internal = txpi[i]; in b43_nphy_tx_power_fix()
3782 nphy->txpwrindex[i].index_internal_save = txpi[i]; in b43_nphy_tx_power_fix()
3793 if (dev->phy.rev >= 3) in b43_nphy_tx_power_fix()
3798 if (dev->phy.rev >= 7) in b43_nphy_tx_power_fix()
3804 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_fix()
3840 if (nphy->hang_avoid) in b43_nphy_tx_power_fix()
3846 struct b43_phy *phy = &dev->phy; in b43_nphy_ipa_internal_tssi_setup()
3851 if (phy->rev >= 19) { in b43_nphy_ipa_internal_tssi_setup()
3853 } else if (phy->rev >= 7) { in b43_nphy_ipa_internal_tssi_setup()
3856 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_ipa_internal_tssi_setup()
3859 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
3861 if (phy->rev != 7) in b43_nphy_ipa_internal_tssi_setup()
3869 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
3880 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_ipa_internal_tssi_setup()
3897 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_ipa_internal_tssi_setup()
3900 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
3903 if (phy->rev >= 5) in b43_nphy_ipa_internal_tssi_setup()
3926 * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi
3930 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_power_ctl_idle_tssi()
3931 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_ctl_idle_tssi()
3936 if (phy->chandef->chan->flags & IEEE80211_CHAN_NO_IR) in b43_nphy_tx_power_ctl_idle_tssi()
3942 if (phy->rev >= 19) in b43_nphy_tx_power_ctl_idle_tssi()
3944 else if (phy->rev >= 7) in b43_nphy_tx_power_ctl_idle_tssi()
3946 else if (phy->rev >= 3) in b43_nphy_tx_power_ctl_idle_tssi()
3957 if (phy->rev >= 19) in b43_nphy_tx_power_ctl_idle_tssi()
3959 else if (phy->rev >= 7) in b43_nphy_tx_power_ctl_idle_tssi()
3961 else if (phy->rev >= 3) in b43_nphy_tx_power_ctl_idle_tssi()
3964 if (phy->rev >= 19) { in b43_nphy_tx_power_ctl_idle_tssi()
3967 } else if (phy->rev >= 3) { in b43_nphy_tx_power_ctl_idle_tssi()
3968 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 24) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3969 nphy->pwr_ctl_info[1].idle_tssi_5g = (tmp >> 8) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3971 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 16) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3972 nphy->pwr_ctl_info[1].idle_tssi_5g = tmp & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3974 nphy->pwr_ctl_info[0].idle_tssi_2g = (tmp >> 24) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3975 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
3978 /* https://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */
3981 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_prepare_adjusted_power_table()
3995 * Groups 9..12 use 16-QAM (group per coding rate) in b43_nphy_tx_prepare_adjusted_power_table()
3996 * Groups 13..16 use 64-QAM (group per coding rate) in b43_nphy_tx_prepare_adjusted_power_table()
4001 nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i]; in b43_nphy_tx_prepare_adjusted_power_table()
4007 if (b43_is_40mhz(dev) && dev->phy.rev >= 5) { in b43_nphy_tx_prepare_adjusted_power_table()
4026 nphy->adj_pwr_tbl[4 + 4 * i + stf_mode] = in b43_nphy_tx_prepare_adjusted_power_table()
4027 nphy->tx_power_offset[idx]; in b43_nphy_tx_prepare_adjusted_power_table()
4031 idx += 1 - delta; in b43_nphy_tx_prepare_adjusted_power_table()
4039 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */
4042 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_power_ctl_setup()
4043 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_ctl_setup()
4044 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_tx_power_ctl_setup()
4053 u16 freq = phy->chandef->chan->center_freq; in b43_nphy_tx_power_ctl_setup()
4058 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { in b43_nphy_tx_power_ctl_setup()
4064 if (nphy->hang_avoid) in b43_nphy_tx_power_ctl_setup()
4068 if (dev->phy.rev >= 3) in b43_nphy_tx_power_ctl_setup()
4075 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) in b43_nphy_tx_power_ctl_setup()
4078 if (sprom->revision < 4) { in b43_nphy_tx_power_ctl_setup()
4079 idle[0] = nphy->pwr_ctl_info[0].idle_tssi_2g; in b43_nphy_tx_power_ctl_setup()
4080 idle[1] = nphy->pwr_ctl_info[1].idle_tssi_2g; in b43_nphy_tx_power_ctl_setup()
4082 a1[0] = a1[1] = -424; in b43_nphy_tx_power_ctl_setup()
4084 b1[0] = b1[1] = -1393; in b43_nphy_tx_power_ctl_setup()
4086 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_tx_power_ctl_setup()
4088 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_2g; in b43_nphy_tx_power_ctl_setup()
4089 target[c] = sprom->core_pwr_info[c].maxpwr_2g; in b43_nphy_tx_power_ctl_setup()
4090 a1[c] = sprom->core_pwr_info[c].pa_2g[0]; in b43_nphy_tx_power_ctl_setup()
4091 b0[c] = sprom->core_pwr_info[c].pa_2g[1]; in b43_nphy_tx_power_ctl_setup()
4092 b1[c] = sprom->core_pwr_info[c].pa_2g[2]; in b43_nphy_tx_power_ctl_setup()
4096 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; in b43_nphy_tx_power_ctl_setup()
4097 target[c] = sprom->core_pwr_info[c].maxpwr_5gl; in b43_nphy_tx_power_ctl_setup()
4098 a1[c] = sprom->core_pwr_info[c].pa_5gl[0]; in b43_nphy_tx_power_ctl_setup()
4099 b0[c] = sprom->core_pwr_info[c].pa_5gl[1]; in b43_nphy_tx_power_ctl_setup()
4100 b1[c] = sprom->core_pwr_info[c].pa_5gl[2]; in b43_nphy_tx_power_ctl_setup()
4104 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; in b43_nphy_tx_power_ctl_setup()
4105 target[c] = sprom->core_pwr_info[c].maxpwr_5g; in b43_nphy_tx_power_ctl_setup()
4106 a1[c] = sprom->core_pwr_info[c].pa_5g[0]; in b43_nphy_tx_power_ctl_setup()
4107 b0[c] = sprom->core_pwr_info[c].pa_5g[1]; in b43_nphy_tx_power_ctl_setup()
4108 b1[c] = sprom->core_pwr_info[c].pa_5g[2]; in b43_nphy_tx_power_ctl_setup()
4112 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; in b43_nphy_tx_power_ctl_setup()
4113 target[c] = sprom->core_pwr_info[c].maxpwr_5gh; in b43_nphy_tx_power_ctl_setup()
4114 a1[c] = sprom->core_pwr_info[c].pa_5gh[0]; in b43_nphy_tx_power_ctl_setup()
4115 b0[c] = sprom->core_pwr_info[c].pa_5gh[1]; in b43_nphy_tx_power_ctl_setup()
4116 b1[c] = sprom->core_pwr_info[c].pa_5gh[2]; in b43_nphy_tx_power_ctl_setup()
4119 idle[0] = nphy->pwr_ctl_info[0].idle_tssi_5g; in b43_nphy_tx_power_ctl_setup()
4120 idle[1] = nphy->pwr_ctl_info[1].idle_tssi_5g; in b43_nphy_tx_power_ctl_setup()
4122 a1[0] = a1[1] = -424; in b43_nphy_tx_power_ctl_setup()
4124 b1[0] = b1[1] = -1393; in b43_nphy_tx_power_ctl_setup()
4128 ppr_max = b43_ppr_get_max(dev, &nphy->tx_pwr_max_ppr); in b43_nphy_tx_power_ctl_setup()
4134 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctl_setup()
4135 if (sprom->fem.ghz2.tssipos) in b43_nphy_tx_power_ctl_setup()
4137 if (dev->phy.rev >= 7) { in b43_nphy_tx_power_ctl_setup()
4141 b43_radio_write(dev, r + 0x9, (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) ? 0xE : 0xC); in b43_nphy_tx_power_ctl_setup()
4145 tmp = (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) ? 0xC : 0xE; in b43_nphy_tx_power_ctl_setup()
4159 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { in b43_nphy_tx_power_ctl_setup()
4165 if (phy->rev >= 19) { in b43_nphy_tx_power_ctl_setup()
4167 } else if (phy->rev >= 7) { in b43_nphy_tx_power_ctl_setup()
4175 if (dev->phy.rev > 1) in b43_nphy_tx_power_ctl_setup()
4180 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) in b43_nphy_tx_power_ctl_setup()
4198 pwr = max((4 * num + den / 2) / den, -8); in b43_nphy_tx_power_ctl_setup()
4199 if (dev->phy.rev < 3 && (i <= (31 - idle[c] + 1))) in b43_nphy_tx_power_ctl_setup()
4207 b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctl_setup()
4208 b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctl_setup()
4210 if (nphy->hang_avoid) in b43_nphy_tx_power_ctl_setup()
4216 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_gain_table_upload()
4231 if (phy->rev < 3) in b43_nphy_tx_gain_table_upload()
4235 nphy->gmval = (table[0] >> 16) & 0x7000; in b43_nphy_tx_gain_table_upload()
4238 if (phy->rev >= 19) { in b43_nphy_tx_gain_table_upload()
4240 } else if (phy->rev >= 7) { in b43_nphy_tx_gain_table_upload()
4249 if (phy->rev >= 19) { in b43_nphy_tx_gain_table_upload()
4252 } else if (phy->rev >= 7) { in b43_nphy_tx_gain_table_upload()
4255 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_tx_gain_table_upload()
4261 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_tx_gain_table_upload()
4272 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/PA%20override */
4275 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_pa_override()
4280 nphy->rfctrl_intc1_save = b43_phy_read(dev, in b43_nphy_pa_override()
4282 nphy->rfctrl_intc2_save = b43_phy_read(dev, in b43_nphy_pa_override()
4284 band = b43_current_band(dev->wl); in b43_nphy_pa_override()
4285 if (dev->phy.rev >= 7) { in b43_nphy_pa_override()
4287 } else if (dev->phy.rev >= 3) { in b43_nphy_pa_override()
4302 nphy->rfctrl_intc1_save); in b43_nphy_pa_override()
4304 nphy->rfctrl_intc2_save); in b43_nphy_pa_override()
4309 * TX low-pass filter bandwidth setup
4310 * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw
4316 if (dev->phy.rev < 3 || dev->phy.rev >= 7) in b43_nphy_tx_lpf_bw()
4333 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */
4349 for (i = 1000; i; i--) { in b43_nphy_rx_iq_est()
4352 est->i0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI0) << 16) | in b43_nphy_rx_iq_est()
4354 est->q0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI0) << 16) | in b43_nphy_rx_iq_est()
4356 est->iq0_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI0) << 16) | in b43_nphy_rx_iq_est()
4359 est->i1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI1) << 16) | in b43_nphy_rx_iq_est()
4361 est->q1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI1) << 16) | in b43_nphy_rx_iq_est()
4363 est->iq1_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI1) << 16) | in b43_nphy_rx_iq_est()
4372 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqCoeffs */
4377 b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPA0, pcomp->a0); in b43_nphy_rx_iq_coeffs()
4378 b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPB0, pcomp->b0); in b43_nphy_rx_iq_coeffs()
4379 b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPA1, pcomp->a1); in b43_nphy_rx_iq_coeffs()
4380 b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPB1, pcomp->b1); in b43_nphy_rx_iq_coeffs()
4382 pcomp->a0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPA0); in b43_nphy_rx_iq_coeffs()
4383 pcomp->b0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPB0); in b43_nphy_rx_iq_coeffs()
4384 pcomp->a1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPA1); in b43_nphy_rx_iq_coeffs()
4385 pcomp->b1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPB1); in b43_nphy_rx_iq_coeffs()
4391 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */
4394 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
4414 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhySetup */
4418 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
4442 ((1 - core) << B43_NPHY_RFSEQCA_RXDIS_SHIFT));
4444 ((1 - core) << B43_NPHY_RFSEQCA_TXEN_SHIFT));
4472 2 - core);
4476 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */
4497 b43_nphy_rx_iq_est(dev, &est, 0x4000, 32, false); in b43_nphy_calc_rx_iq_comp()
4521 arsh = iq_nbits - 20; in b43_nphy_calc_rx_iq_comp()
4523 a = -((iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); in b43_nphy_calc_rx_iq_comp()
4526 a = -((iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); in b43_nphy_calc_rx_iq_comp()
4527 tmp = ii << -arsh; in b43_nphy_calc_rx_iq_comp()
4535 brsh = qq_nbits - 11; in b43_nphy_calc_rx_iq_comp()
4537 b = (qq << (31 - qq_nbits)); in b43_nphy_calc_rx_iq_comp()
4540 b = (qq << (31 - qq_nbits)); in b43_nphy_calc_rx_iq_comp()
4541 tmp = ii << -brsh; in b43_nphy_calc_rx_iq_comp()
4547 b = int_sqrt(b / tmp - a * a) - (1 << 10); in b43_nphy_calc_rx_iq_comp()
4550 if (dev->phy.rev >= 3) { in b43_nphy_calc_rx_iq_comp()
4558 if (dev->phy.rev >= 3) { in b43_nphy_calc_rx_iq_comp()
4574 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxIqWar */
4586 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */
4589 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_spur_workaround()
4591 B43_WARN_ON(dev->phy.rev < 3); in b43_nphy_spur_workaround()
4593 if (nphy->hang_avoid) in b43_nphy_spur_workaround()
4596 if (nphy->hang_avoid) in b43_nphy_spur_workaround()
4600 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
4603 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_pwr_ctrl_coef_setup()
4610 if (nphy->hang_avoid) in b43_nphy_tx_pwr_ctrl_coef_setup()
4635 if (dev->phy.rev >= 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
4642 if (dev->phy.rev < 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
4655 if (dev->phy.rev >= 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
4662 if (nphy->hang_avoid) in b43_nphy_tx_pwr_ctrl_coef_setup()
4668 * https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreRssiCal
4672 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_restore_rssi_cal()
4677 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_restore_rssi_cal()
4678 if (!nphy->rssical_chanspec_2G.center_freq) in b43_nphy_restore_rssi_cal()
4680 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; in b43_nphy_restore_rssi_cal()
4681 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; in b43_nphy_restore_rssi_cal()
4683 if (!nphy->rssical_chanspec_5G.center_freq) in b43_nphy_restore_rssi_cal()
4685 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; in b43_nphy_restore_rssi_cal()
4686 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; in b43_nphy_restore_rssi_cal()
4689 if (dev->phy.rev >= 19) { in b43_nphy_restore_rssi_cal()
4691 } else if (dev->phy.rev >= 7) { in b43_nphy_restore_rssi_cal()
4726 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_cal_radio_setup_rev7()
4727 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_cal_radio_setup_rev7()
4728 u16 *save = nphy->tx_rx_cal_radio_saveregs; in b43_nphy_tx_cal_radio_setup_rev7()
4742 if (phy->radio_rev != 5) in b43_nphy_tx_cal_radio_setup_rev7()
4747 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_tx_cal_radio_setup_rev7()
4753 if (nphy->use_int_tx_iq_lo_cal) { in b43_nphy_tx_cal_radio_setup_rev7()
4765 if (phy->radio_rev != 5) in b43_nphy_tx_cal_radio_setup_rev7()
4767 if (nphy->use_int_tx_iq_lo_cal) { in b43_nphy_tx_cal_radio_setup_rev7()
4777 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalRadioSetup */
4780 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_cal_radio_setup()
4781 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_cal_radio_setup()
4782 u16 *save = nphy->tx_rx_cal_radio_saveregs; in b43_nphy_tx_cal_radio_setup()
4786 if (phy->rev >= 19) { in b43_nphy_tx_cal_radio_setup()
4788 } else if (phy->rev >= 7) { in b43_nphy_tx_cal_radio_setup()
4790 } else if (phy->rev >= 3) { in b43_nphy_tx_cal_radio_setup()
4807 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) { in b43_nphy_tx_cal_radio_setup()
4813 if (nphy->ipa5g_on) { in b43_nphy_tx_cal_radio_setup()
4828 if (nphy->ipa2g_on) { in b43_nphy_tx_cal_radio_setup()
4831 (dev->phy.rev < 5) ? 0x11 : 0x01); in b43_nphy_tx_cal_radio_setup()
4866 if (dev->phy.rev < 2) { in b43_nphy_tx_cal_radio_setup()
4876 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/UpdateTxCalLadder */
4879 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_update_tx_cal_ladder()
4883 u16 tmp = nphy->txcal_bbmult; in b43_nphy_update_tx_cal_ladder()
4895 b43_ntab_write(dev, B43_NTAB16(15, i + 32), entry); in b43_nphy_update_tx_cal_ladder()
4910 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */
4917 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */
4923 -375, 136, -407, 208, -1527, in b43_nphy_int_pa_set_tx_dig_filters()
4925 -44, 230, 201, -191, 201, in b43_nphy_int_pa_set_tx_dig_filters()
4934 if (dev->phy.rev == 16) in b43_nphy_int_pa_set_tx_dig_filters()
4938 if (dev->phy.rev == 17) { in b43_nphy_int_pa_set_tx_dig_filters()
4948 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) in b43_nphy_int_pa_set_tx_dig_filters()
4951 if (dev->phy.channel == 14) in b43_nphy_int_pa_set_tx_dig_filters()
4957 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
4960 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_get_tx_gains()
4966 if (!nphy->txpwrctrl) { in b43_nphy_get_tx_gains()
4969 if (nphy->hang_avoid) in b43_nphy_get_tx_gains()
4972 if (nphy->hang_avoid) in b43_nphy_get_tx_gains()
4976 if (dev->phy.rev >= 7) { in b43_nphy_get_tx_gains()
4982 } else if (dev->phy.rev >= 3) { in b43_nphy_get_tx_gains()
5009 if (dev->phy.rev >= 7) { in b43_nphy_get_tx_gains()
5015 } else if (dev->phy.rev >= 3) { in b43_nphy_get_tx_gains()
5032 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
5035 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; in b43_nphy_tx_cal_phy_cleanup()
5037 if (dev->phy.rev >= 3) { in b43_nphy_tx_cal_phy_cleanup()
5061 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
5064 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_cal_phy_setup()
5065 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_cal_phy_setup()
5066 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; in b43_nphy_tx_cal_phy_setup()
5071 if (dev->phy.rev >= 3) { in b43_nphy_tx_cal_phy_setup()
5097 if (!nphy->use_int_tx_iq_lo_cal) in b43_nphy_tx_cal_phy_setup()
5112 if (phy->rev >= 19) in b43_nphy_tx_cal_phy_setup()
5115 else if (phy->rev >= 7) in b43_nphy_tx_cal_phy_setup()
5119 if (nphy->use_int_tx_iq_lo_cal && true /* FIXME */) { in b43_nphy_tx_cal_phy_setup()
5120 if (phy->rev >= 19) { in b43_nphy_tx_cal_phy_setup()
5123 } else if (phy->rev >= 8) { in b43_nphy_tx_cal_phy_setup()
5126 } else if (phy->rev == 7) { in b43_nphy_tx_cal_phy_setup()
5128 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_tx_cal_phy_setup()
5153 if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ) in b43_nphy_tx_cal_phy_setup()
5162 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
5165 struct b43_phy *phy = &dev->phy; in b43_nphy_save_cal()
5166 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_save_cal()
5173 if (nphy->hang_avoid) in b43_nphy_save_cal()
5176 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_save_cal()
5177 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; in b43_nphy_save_cal()
5178 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; in b43_nphy_save_cal()
5179 iqcal_chanspec = &nphy->iqcal_chanspec_2G; in b43_nphy_save_cal()
5180 table = nphy->cal_cache.txcal_coeffs_2G; in b43_nphy_save_cal()
5182 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; in b43_nphy_save_cal()
5183 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; in b43_nphy_save_cal()
5184 iqcal_chanspec = &nphy->iqcal_chanspec_5G; in b43_nphy_save_cal()
5185 table = nphy->cal_cache.txcal_coeffs_5G; in b43_nphy_save_cal()
5190 if (phy->rev >= 19) { in b43_nphy_save_cal()
5192 } else if (phy->rev >= 7) { in b43_nphy_save_cal()
5209 } else if (phy->rev >= 3) { in b43_nphy_save_cal()
5224 iqcal_chanspec->center_freq = dev->phy.chandef->chan->center_freq; in b43_nphy_save_cal()
5225 iqcal_chanspec->channel_type = in b43_nphy_save_cal()
5226 cfg80211_get_chandef_type(dev->phy.chandef); in b43_nphy_save_cal()
5229 if (nphy->hang_avoid) in b43_nphy_save_cal()
5233 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
5236 struct b43_phy *phy = &dev->phy; in b43_nphy_restore_cal()
5237 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_restore_cal()
5247 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_restore_cal()
5248 if (!nphy->iqcal_chanspec_2G.center_freq) in b43_nphy_restore_cal()
5250 table = nphy->cal_cache.txcal_coeffs_2G; in b43_nphy_restore_cal()
5251 loft = &nphy->cal_cache.txcal_coeffs_2G[5]; in b43_nphy_restore_cal()
5253 if (!nphy->iqcal_chanspec_5G.center_freq) in b43_nphy_restore_cal()
5255 table = nphy->cal_cache.txcal_coeffs_5G; in b43_nphy_restore_cal()
5256 loft = &nphy->cal_cache.txcal_coeffs_5G[5]; in b43_nphy_restore_cal()
5262 if (dev->phy.rev >= 3) in b43_nphy_restore_cal()
5272 if (dev->phy.rev < 2) in b43_nphy_restore_cal()
5275 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_restore_cal()
5276 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; in b43_nphy_restore_cal()
5277 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; in b43_nphy_restore_cal()
5279 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; in b43_nphy_restore_cal()
5280 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; in b43_nphy_restore_cal()
5284 if (phy->rev >= 19) { in b43_nphy_restore_cal()
5286 } else if (phy->rev >= 7) { in b43_nphy_restore_cal()
5303 } else if (phy->rev >= 3) { in b43_nphy_restore_cal()
5321 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalTxIqlo */
5326 struct b43_phy *phy = &dev->phy; in b43_nphy_cal_tx_iq_lo()
5327 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_cal_tx_iq_lo()
5346 if (dev->phy.rev >= 4) { in b43_nphy_cal_tx_iq_lo()
5347 avoid = nphy->hang_avoid; in b43_nphy_cal_tx_iq_lo()
5348 nphy->hang_avoid = false; in b43_nphy_cal_tx_iq_lo()
5363 phy6or5x = dev->phy.rev >= 6 || in b43_nphy_cal_tx_iq_lo()
5364 (dev->phy.rev == 5 && nphy->ipa2g_on && in b43_nphy_cal_tx_iq_lo()
5365 b43_current_band(dev->wl) == NL80211_BAND_2GHZ); in b43_nphy_cal_tx_iq_lo()
5370 b43_ntab_write_bulk(dev, B43_NTAB16(15, 32), 18, in b43_nphy_cal_tx_iq_lo()
5375 b43_ntab_write_bulk(dev, B43_NTAB16(15, 32), 18, in b43_nphy_cal_tx_iq_lo()
5380 if (phy->rev >= 19) { in b43_nphy_cal_tx_iq_lo()
5382 } else if (phy->rev >= 7) { in b43_nphy_cal_tx_iq_lo()
5393 if (nphy->mphase_cal_phase_id > 2) in b43_nphy_cal_tx_iq_lo()
5400 if (nphy->mphase_cal_phase_id > 2) { in b43_nphy_cal_tx_iq_lo()
5401 table = nphy->mphase_txcal_bestcoeffs; in b43_nphy_cal_tx_iq_lo()
5403 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
5404 length -= 2; in b43_nphy_cal_tx_iq_lo()
5406 if (!full && nphy->txiqlocal_coeffsvalid) { in b43_nphy_cal_tx_iq_lo()
5407 table = nphy->txiqlocal_bestc; in b43_nphy_cal_tx_iq_lo()
5409 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
5410 length -= 2; in b43_nphy_cal_tx_iq_lo()
5413 if (dev->phy.rev >= 3) { in b43_nphy_cal_tx_iq_lo()
5426 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
5431 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
5438 count = nphy->mphase_txcal_cmdidx; in b43_nphy_cal_tx_iq_lo()
5440 (u16)(count + nphy->mphase_txcal_numcmds)); in b43_nphy_cal_tx_iq_lo()
5448 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
5453 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
5497 nphy->mphase_txcal_cmdidx = (numb >= max) ? 0 : numb; in b43_nphy_cal_tx_iq_lo()
5499 last = (dev->phy.rev < 3) ? 6 : 7; in b43_nphy_cal_tx_iq_lo()
5501 if (!mphase || nphy->mphase_cal_phase_id == last) { in b43_nphy_cal_tx_iq_lo()
5504 if (dev->phy.rev < 3) { in b43_nphy_cal_tx_iq_lo()
5519 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
5520 length -= 2; in b43_nphy_cal_tx_iq_lo()
5522 nphy->txiqlocal_bestc); in b43_nphy_cal_tx_iq_lo()
5523 nphy->txiqlocal_coeffsvalid = true; in b43_nphy_cal_tx_iq_lo()
5524 nphy->txiqlocal_chanspec.center_freq = in b43_nphy_cal_tx_iq_lo()
5525 phy->chandef->chan->center_freq; in b43_nphy_cal_tx_iq_lo()
5526 nphy->txiqlocal_chanspec.channel_type = in b43_nphy_cal_tx_iq_lo()
5527 cfg80211_get_chandef_type(phy->chandef); in b43_nphy_cal_tx_iq_lo()
5530 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
5531 length -= 2; in b43_nphy_cal_tx_iq_lo()
5533 nphy->mphase_txcal_bestcoeffs); in b43_nphy_cal_tx_iq_lo()
5543 if (dev->phy.rev < 2 && (!mphase || nphy->mphase_cal_phase_id == last)) in b43_nphy_cal_tx_iq_lo()
5546 if (dev->phy.rev >= 4) in b43_nphy_cal_tx_iq_lo()
5547 nphy->hang_avoid = avoid; in b43_nphy_cal_tx_iq_lo()
5554 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */
5557 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_reapply_tx_cal_coeffs()
5562 if (!nphy->txiqlocal_coeffsvalid || in b43_nphy_reapply_tx_cal_coeffs()
5563 nphy->txiqlocal_chanspec.center_freq != dev->phy.chandef->chan->center_freq || in b43_nphy_reapply_tx_cal_coeffs()
5564 nphy->txiqlocal_chanspec.channel_type != cfg80211_get_chandef_type(dev->phy.chandef)) in b43_nphy_reapply_tx_cal_coeffs()
5569 if (buffer[i] != nphy->txiqlocal_bestc[i]) { in b43_nphy_reapply_tx_cal_coeffs()
5577 nphy->txiqlocal_bestc); in b43_nphy_reapply_tx_cal_coeffs()
5583 &nphy->txiqlocal_bestc[5]); in b43_nphy_reapply_tx_cal_coeffs()
5585 &nphy->txiqlocal_bestc[5]); in b43_nphy_reapply_tx_cal_coeffs()
5589 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */
5593 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_rev2_cal_rx_iq()
5618 if (dev->phy.rev < 2) in b43_nphy_rev2_cal_rx_iq()
5646 ((1 - i) << B43_NPHY_RFSEQCA_RXDIS_SHIFT)); in b43_nphy_rev2_cal_rx_iq()
5648 (1 - i)); in b43_nphy_rev2_cal_rx_iq()
5652 band = b43_current_band(dev->wl); in b43_nphy_rev2_cal_rx_iq()
5654 if (nphy->rxcalparams & 0xFF000000) { in b43_nphy_rev2_cal_rx_iq()
5671 if (nphy->rxcalparams & 0x10000) { in b43_nphy_rev2_cal_rx_iq()
5675 (2 - i)); in b43_nphy_rev2_cal_rx_iq()
5702 cur_hpf += desired - hweight32(power[index]); in b43_nphy_rev2_cal_rx_iq()
5719 (nphy->rxcalparams & 0xFFFF), in b43_nphy_rev2_cal_rx_iq()
5729 b43_nphy_rx_iq_est(dev, &est, 1024, 32, in b43_nphy_rev2_cal_rx_iq()
5773 return -1; in b43_nphy_rev3_cal_rx_iq()
5776 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIq */
5780 if (dev->phy.rev >= 7) in b43_nphy_cal_rx_iq()
5783 if (dev->phy.rev >= 3) in b43_nphy_cal_rx_iq()
5789 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
5792 struct b43_phy *phy = &dev->phy; in b43_nphy_set_rx_core_state()
5793 struct b43_phy_n *nphy = phy->n; in b43_nphy_set_rx_core_state()
5796 nphy->phyrxchain = mask; in b43_nphy_set_rx_core_state()
5803 if (nphy->hang_avoid) in b43_nphy_set_rx_core_state()
5811 if (dev->phy.rev >= 3) { in b43_nphy_set_rx_core_state()
5816 if (dev->phy.rev >= 3) { in b43_nphy_set_rx_core_state()
5823 if (nphy->hang_avoid) in b43_nphy_set_rx_core_state()
5832 struct b43_phy *phy = &dev->phy; in b43_nphy_op_recalc_txpower()
5833 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_op_recalc_txpower()
5834 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; in b43_nphy_op_recalc_txpower()
5835 struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr; in b43_nphy_op_recalc_txpower()
5838 if (nphy->tx_pwr_last_recalc_freq == channel->center_freq && in b43_nphy_op_recalc_txpower()
5839 nphy->tx_pwr_last_recalc_limit == phy->desired_txpower) in b43_nphy_op_recalc_txpower()
5849 max = INT_TO_Q52(phy->chandef->chan->max_power); in b43_nphy_op_recalc_txpower()
5850 if (phy->desired_txpower) in b43_nphy_op_recalc_txpower()
5851 max = min_t(u8, max, INT_TO_Q52(phy->desired_txpower)); in b43_nphy_op_recalc_txpower()
5854 b43dbg(dev->wl, "Calculated TX power: " Q52_FMT "\n", in b43_nphy_op_recalc_txpower()
5860 hw_gain = 6; /* N-PHY specific */ in b43_nphy_op_recalc_txpower()
5861 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_op_recalc_txpower()
5862 hw_gain += sprom->antenna_gain.a0; in b43_nphy_op_recalc_txpower()
5864 hw_gain += sprom->antenna_gain.a1; in b43_nphy_op_recalc_txpower()
5865 b43_ppr_add(dev, ppr, -hw_gain); in b43_nphy_op_recalc_txpower()
5874 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { in b43_nphy_op_recalc_txpower()
5879 b43_nphy_tx_power_ctrl(dev, nphy->txpwrctrl); in b43_nphy_op_recalc_txpower()
5880 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) in b43_nphy_op_recalc_txpower()
5884 nphy->tx_pwr_last_recalc_freq = channel->center_freq; in b43_nphy_op_recalc_txpower()
5885 nphy->tx_pwr_last_recalc_limit = phy->desired_txpower; in b43_nphy_op_recalc_txpower()
5891 * N-PHY init
5894 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/MIMOConfig */
5908 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/BPHYInit */
5917 val -= 0x202; in b43_nphy_bphy_init()
5922 val -= 0x202; in b43_nphy_bphy_init()
5927 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
5930 if (dev->phy.rev >= 7) in b43_nphy_superswitch_init()
5933 if (dev->phy.rev >= 3) { in b43_nphy_superswitch_init()
5946 switch (dev->dev->bus_type) { in b43_nphy_superswitch_init()
5949 bcma_chipco_gpio_control(&dev->dev->bdev->bus->drv_cc, in b43_nphy_superswitch_init()
5955 ssb_chipco_gpio_control(&dev->dev->sdev->bus->chipco, in b43_nphy_superswitch_init()
5975 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N */
5978 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_phy_initn()
5979 struct b43_phy *phy = &dev->phy; in b43_phy_initn()
5980 struct b43_phy_n *nphy = phy->n; in b43_phy_initn()
5989 if ((dev->phy.rev >= 3) && in b43_phy_initn()
5990 (sprom->boardflags_lo & B43_BFL_EXTLNA) && in b43_phy_initn()
5991 (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)) { in b43_phy_initn()
5992 switch (dev->dev->bus_type) { in b43_phy_initn()
5995 bcma_cc_set32(&dev->dev->bdev->bus->drv_cc, in b43_phy_initn()
6001 chipco_set32(&dev->dev->sdev->bus->chipco, in b43_phy_initn()
6007 nphy->use_int_tx_iq_lo_cal = b43_nphy_ipa(dev) || in b43_phy_initn()
6008 phy->rev >= 7 || in b43_phy_initn()
6009 (phy->rev >= 5 && in b43_phy_initn()
6010 sprom->boardflags2_hi & B43_BFH2_INTERNDET_TXIQCAL); in b43_phy_initn()
6011 nphy->deaf_count = 0; in b43_phy_initn()
6013 nphy->crsminpwr_adjusted = false; in b43_phy_initn()
6014 nphy->noisevars_adjusted = false; in b43_phy_initn()
6017 if (dev->phy.rev >= 3) { in b43_phy_initn()
6020 if (phy->rev >= 7) { in b43_phy_initn()
6026 if (phy->rev >= 19) { in b43_phy_initn()
6037 if (dev->phy.rev < 6) { in b43_phy_initn()
6044 if (dev->phy.rev >= 3) in b43_phy_initn()
6048 if (dev->phy.rev <= 2) { in b43_phy_initn()
6049 tmp = (dev->phy.rev == 2) ? 0x3B : 0x40; in b43_phy_initn()
6057 if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD || in b43_phy_initn()
6058 (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && in b43_phy_initn()
6059 dev->dev->board_type == BCMA_BOARD_TYPE_BCM943224M93)) in b43_phy_initn()
6067 if (phy->rev < 8) in b43_phy_initn()
6068 b43_nphy_update_mimo_config(dev, nphy->preamble_override); in b43_phy_initn()
6072 if (phy->rev < 2) { in b43_phy_initn()
6080 nphy->papd_epsilon_offset[0] << 7); in b43_phy_initn()
6083 nphy->papd_epsilon_offset[1] << 7); in b43_phy_initn()
6085 } else if (phy->rev >= 5) { in b43_phy_initn()
6100 if (phy->rev < 7) { in b43_phy_initn()
6109 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_phy_initn()
6112 tx_pwr_state = nphy->txpwrctrl; in b43_phy_initn()
6119 if (nphy->phyrxchain != 3) in b43_phy_initn()
6120 b43_nphy_set_rx_core_state(dev, nphy->phyrxchain); in b43_phy_initn()
6121 if (nphy->mphase_cal_phase_id > 0) { in b43_phy_initn()
6122 ;/* TODO PHY Periodic Calibration Multi-Phase Restart */ in b43_phy_initn()
6126 if (phy->rev >= 3) { in b43_phy_initn()
6127 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_phy_initn()
6128 do_rssi_cal = !nphy->rssical_chanspec_2G.center_freq; in b43_phy_initn()
6130 do_rssi_cal = !nphy->rssical_chanspec_5G.center_freq; in b43_phy_initn()
6140 if (!((nphy->measure_hold & 0x6) != 0)) { in b43_phy_initn()
6141 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_phy_initn()
6142 do_cal = !nphy->iqcal_chanspec_2G.center_freq; in b43_phy_initn()
6144 do_cal = !nphy->iqcal_chanspec_5G.center_freq; in b43_phy_initn()
6146 if (nphy->mute) in b43_phy_initn()
6152 if (nphy->antsel_type == 2) in b43_phy_initn()
6154 if (nphy->perical != 2) { in b43_phy_initn()
6156 if (phy->rev >= 3) { in b43_phy_initn()
6157 nphy->cal_orig_pwr_idx[0] = in b43_phy_initn()
6158 nphy->txpwrindex[0].index_internal; in b43_phy_initn()
6159 nphy->cal_orig_pwr_idx[1] = in b43_phy_initn()
6160 nphy->txpwrindex[1].index_internal; in b43_phy_initn()
6167 } else if (nphy->mphase_cal_phase_id == 0) { in b43_phy_initn()
6179 if (phy->rev >= 3 && phy->rev <= 6) in b43_phy_initn()
6182 if (phy->rev >= 3) in b43_phy_initn()
6195 b43_phy_write(dev, B43_NPHY_BW1A, e->phy_bw1a); in b43_chantab_phy_upload()
6196 b43_phy_write(dev, B43_NPHY_BW2, e->phy_bw2); in b43_chantab_phy_upload()
6197 b43_phy_write(dev, B43_NPHY_BW3, e->phy_bw3); in b43_chantab_phy_upload()
6198 b43_phy_write(dev, B43_NPHY_BW4, e->phy_bw4); in b43_chantab_phy_upload()
6199 b43_phy_write(dev, B43_NPHY_BW5, e->phy_bw5); in b43_chantab_phy_upload()
6200 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); in b43_chantab_phy_upload()
6203 /* https://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
6206 switch (dev->dev->bus_type) { in b43_nphy_pmu_spur_avoid()
6209 bcma_pmu_spuravoid_pllupdate(&dev->dev->bdev->bus->drv_cc, in b43_nphy_pmu_spur_avoid()
6215 ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco, in b43_nphy_pmu_spur_avoid()
6222 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
6227 struct b43_phy *phy = &dev->phy; in b43_nphy_channel_setup()
6228 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_channel_setup()
6229 int ch = new_channel->hw_value; in b43_nphy_channel_setup()
6232 if (new_channel->band == NL80211_BAND_5GHZ) { in b43_nphy_channel_setup()
6243 } else if (new_channel->band == NL80211_BAND_2GHZ) { in b43_nphy_channel_setup()
6255 if (new_channel->hw_value == 14) { in b43_nphy_channel_setup()
6260 if (new_channel->band == NL80211_BAND_2GHZ) in b43_nphy_channel_setup()
6264 if (!nphy->txpwrctrl) in b43_nphy_channel_setup()
6267 if (dev->phy.rev < 3) in b43_nphy_channel_setup()
6272 if (dev->phy.rev >= 3 && in b43_nphy_channel_setup()
6273 dev->phy.n->spur_avoid != B43_SPUR_AVOID_DISABLE) { in b43_nphy_channel_setup()
6276 if (dev->phy.n->spur_avoid == B43_SPUR_AVOID_FORCE) { in b43_nphy_channel_setup()
6278 } else if (phy->rev >= 19) { in b43_nphy_channel_setup()
6280 } else if (phy->rev >= 18) { in b43_nphy_channel_setup()
6282 } else if (phy->rev >= 17) { in b43_nphy_channel_setup()
6283 /* TODO: Off for channels 1-11, but check 12-14! */ in b43_nphy_channel_setup()
6284 } else if (phy->rev >= 16) { in b43_nphy_channel_setup()
6286 } else if (phy->rev >= 7) { in b43_nphy_channel_setup()
6299 if (nphy->aband_spurwar_en && in b43_nphy_channel_setup()
6301 spuravoid = dev->dev->chip_id == 0x4716; in b43_nphy_channel_setup()
6309 if (dev->phy.rev == 3 || dev->phy.rev == 4) in b43_nphy_channel_setup()
6325 if (phy->rev >= 3) in b43_nphy_channel_setup()
6329 /* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
6334 struct b43_phy *phy = &dev->phy; in b43_nphy_set_channel()
6343 if (phy->rev >= 19) { in b43_nphy_set_channel()
6344 return -ESRCH; in b43_nphy_set_channel()
6346 } else if (phy->rev >= 7) { in b43_nphy_set_channel()
6347 r2057_get_chantabent_rev7(dev, channel->center_freq, in b43_nphy_set_channel()
6350 return -ESRCH; in b43_nphy_set_channel()
6351 } else if (phy->rev >= 3) { in b43_nphy_set_channel()
6353 channel->center_freq); in b43_nphy_set_channel()
6355 return -ESRCH; in b43_nphy_set_channel()
6358 channel->hw_value); in b43_nphy_set_channel()
6360 return -ESRCH; in b43_nphy_set_channel()
6365 phy->channel = channel->hw_value; in b43_nphy_set_channel()
6368 if (b43_channel_type_is_40mhz(phy->channel_type) != in b43_nphy_set_channel()
6375 if (phy->rev >= 7) in b43_nphy_set_channel()
6379 if (phy->rev >= 7) in b43_nphy_set_channel()
6383 if (phy->rev >= 19) { in b43_nphy_set_channel()
6385 } else if (phy->rev >= 7) { in b43_nphy_set_channel()
6387 &(tabent_r7->phy_regs) : &(tabent_r7_2g->phy_regs); in b43_nphy_set_channel()
6389 if (phy->radio_rev <= 4 || phy->radio_rev == 6) { in b43_nphy_set_channel()
6390 tmp = (channel->band == NL80211_BAND_5GHZ) ? 2 : 0; in b43_nphy_set_channel()
6397 } else if (phy->rev >= 3) { in b43_nphy_set_channel()
6398 tmp = (channel->band == NL80211_BAND_5GHZ) ? 4 : 0; in b43_nphy_set_channel()
6401 b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel); in b43_nphy_set_channel()
6403 tmp = (channel->band == NL80211_BAND_5GHZ) ? 0x0020 : 0x0050; in b43_nphy_set_channel()
6406 b43_nphy_channel_setup(dev, &(tabent_r2->phy_regs), channel); in b43_nphy_set_channel()
6422 return -ENOMEM; in b43_nphy_op_allocate()
6424 dev->phy.n = nphy; in b43_nphy_op_allocate()
6431 struct b43_phy *phy = &dev->phy; in b43_nphy_op_prepare_structs()
6432 struct b43_phy_n *nphy = phy->n; in b43_nphy_op_prepare_structs()
6433 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_op_prepare_structs()
6437 nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); in b43_nphy_op_prepare_structs()
6438 nphy->spur_avoid = (phy->rev >= 3) ? in b43_nphy_op_prepare_structs()
6440 nphy->gain_boost = true; /* this way we follow wl, assume it is true */ in b43_nphy_op_prepare_structs()
6441 nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ in b43_nphy_op_prepare_structs()
6442 nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ in b43_nphy_op_prepare_structs()
6443 nphy->perical = 2; /* avoid additional rssi cal on init (like wl) */ in b43_nphy_op_prepare_structs()
6444 /* 128 can mean disabled-by-default state of TX pwr ctl. Max value is in b43_nphy_op_prepare_structs()
6446 nphy->tx_pwr_idx[0] = 128; in b43_nphy_op_prepare_structs()
6447 nphy->tx_pwr_idx[1] = 128; in b43_nphy_op_prepare_structs()
6450 nphy->txpwrctrl = false; in b43_nphy_op_prepare_structs()
6451 nphy->pwg_gain_5ghz = false; in b43_nphy_op_prepare_structs()
6452 if (dev->phy.rev >= 3 || in b43_nphy_op_prepare_structs()
6453 (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && in b43_nphy_op_prepare_structs()
6454 (dev->dev->core_rev == 11 || dev->dev->core_rev == 12))) { in b43_nphy_op_prepare_structs()
6455 nphy->txpwrctrl = true; in b43_nphy_op_prepare_structs()
6456 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
6457 } else if (sprom->revision >= 4) { in b43_nphy_op_prepare_structs()
6458 if (dev->phy.rev >= 2 && in b43_nphy_op_prepare_structs()
6459 (sprom->boardflags2_lo & B43_BFL2_TXPWRCTRL_EN)) { in b43_nphy_op_prepare_structs()
6460 nphy->txpwrctrl = true; in b43_nphy_op_prepare_structs()
6462 if (dev->dev->bus_type == B43_BUS_SSB && in b43_nphy_op_prepare_structs()
6463 dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) { in b43_nphy_op_prepare_structs()
6465 dev->dev->sdev->bus->host_pci; in b43_nphy_op_prepare_structs()
6466 if (pdev->device == 0x4328 || in b43_nphy_op_prepare_structs()
6467 pdev->device == 0x432a) in b43_nphy_op_prepare_structs()
6468 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
6471 } else if (sprom->boardflags2_lo & B43_BFL2_5G_PWRGAIN) { in b43_nphy_op_prepare_structs()
6472 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
6476 if (dev->phy.rev >= 3) { in b43_nphy_op_prepare_structs()
6477 nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2; in b43_nphy_op_prepare_structs()
6478 nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2; in b43_nphy_op_prepare_structs()
6484 struct b43_phy *phy = &dev->phy; in b43_nphy_op_free()
6485 struct b43_phy_n *nphy = phy->n; in b43_nphy_op_free()
6488 phy->n = NULL; in b43_nphy_op_free()
6500 /* OFDM registers are onnly available on A/G-PHYs */ in check_phyreg()
6501 b43err(dev->wl, "Invalid OFDM PHY access at " in check_phyreg()
6502 "0x%04X on N-PHY\n", offset); in check_phyreg()
6506 /* Ext-G registers are only available on G-PHYs */ in check_phyreg()
6507 b43err(dev->wl, "Invalid EXT-G PHY access at " in check_phyreg()
6508 "0x%04X on N-PHY\n", offset); in check_phyreg()
6520 dev->phy.writes_counter = 1; in b43_nphy_op_maskset()
6525 /* Register 1 is a 32-bit register. */ in b43_nphy_op_radio_read()
6526 B43_WARN_ON(dev->phy.rev < 7 && reg == 1); in b43_nphy_op_radio_read()
6528 if (dev->phy.rev >= 7) in b43_nphy_op_radio_read()
6539 /* Register 1 is a 32-bit register. */ in b43_nphy_op_radio_write()
6540 B43_WARN_ON(dev->phy.rev < 7 && reg == 1); in b43_nphy_op_radio_write()
6546 /* https://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
6550 struct b43_phy *phy = &dev->phy; in b43_nphy_op_software_rfkill()
6553 b43err(dev->wl, "MAC not suspended\n"); in b43_nphy_op_software_rfkill()
6556 if (phy->rev >= 19) { in b43_nphy_op_software_rfkill()
6558 } else if (phy->rev >= 8) { in b43_nphy_op_software_rfkill()
6561 } else if (phy->rev >= 7) { in b43_nphy_op_software_rfkill()
6563 } else if (phy->rev >= 3) { in b43_nphy_op_software_rfkill()
6584 if (phy->rev >= 19) { in b43_nphy_op_software_rfkill()
6586 } else if (phy->rev >= 7) { in b43_nphy_op_software_rfkill()
6587 if (!dev->phy.radio_on) in b43_nphy_op_software_rfkill()
6589 b43_switch_channel(dev, dev->phy.channel); in b43_nphy_op_software_rfkill()
6590 } else if (phy->rev >= 3) { in b43_nphy_op_software_rfkill()
6591 if (!dev->phy.radio_on) in b43_nphy_op_software_rfkill()
6593 b43_switch_channel(dev, dev->phy.channel); in b43_nphy_op_software_rfkill()
6600 /* https://bcm-v4.sipsolutions.net/802.11/PHY/Anacore */
6603 struct b43_phy *phy = &dev->phy; in b43_nphy_op_switch_analog()
6607 if (phy->rev >= 19) { in b43_nphy_op_switch_analog()
6609 } else if (phy->rev >= 3) { in b43_nphy_op_switch_analog()
6629 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; in b43_nphy_op_switch_channel()
6631 cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef); in b43_nphy_op_switch_channel()
6633 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in b43_nphy_op_switch_channel()
6635 return -EINVAL; in b43_nphy_op_switch_channel()
6638 return -EINVAL; in b43_nphy_op_switch_channel()
6646 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_nphy_op_get_default_chan()