Lines Matching +full:reg +full:- +full:names
7 Copyright (c) 2010-2011 Rafał Miłecki <zajec5@gmail.com>
22 Boston, MA 02110-1301, USA.
83 enum ieee80211_band band = b43_current_band(dev->wl); in b43_nphy_ipa()
84 return ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) || in b43_nphy_ipa()
85 (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)); in b43_nphy_ipa()
88 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */
91 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_get_ipa_gain_table()
92 if (dev->phy.rev >= 6) { in b43_nphy_get_ipa_gain_table()
93 if (dev->dev->chip_id == 47162) in b43_nphy_get_ipa_gain_table()
96 } else if (dev->phy.rev >= 5) { in b43_nphy_get_ipa_gain_table()
110 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */
135 b43err(dev->wl, "RF sequence status timeout\n"); in b43_nphy_force_rf_sequence()
140 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */
148 B43_WARN_ON(field & (~(1 << (index - 1)))); in b43_nphy_rf_control_override()
150 if (dev->phy.rev >= 3) { in b43_nphy_rf_control_override()
154 b43err(dev->wl, in b43_nphy_rf_control_override()
159 rf_ctrl = &tbl_rf_control_override_rev3[index - 1]; in b43_nphy_rf_control_override()
161 rf_ctrl->en_addr0 : rf_ctrl->en_addr1); in b43_nphy_rf_control_override()
163 rf_ctrl->val_addr0 : rf_ctrl->val_addr1); in b43_nphy_rf_control_override()
168 ~(rf_ctrl->val_mask)); in b43_nphy_rf_control_override()
173 ~(rf_ctrl->val_mask), in b43_nphy_rf_control_override()
174 (value << rf_ctrl->val_shift)); in b43_nphy_rf_control_override()
189 b43err(dev->wl, in b43_nphy_rf_control_override()
199 rf_ctrl = &tbl_rf_control_override_rev2[index - 2]; in b43_nphy_rf_control_override()
201 rf_ctrl->addr0 : rf_ctrl->addr1); in b43_nphy_rf_control_override()
204 b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask), in b43_nphy_rf_control_override()
205 (value << rf_ctrl->shift)); in b43_nphy_rf_control_override()
216 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */
221 u16 reg, tmp, val; in b43_nphy_rf_control_intc_override() local
223 B43_WARN_ON(dev->phy.rev < 3); in b43_nphy_rf_control_intc_override()
230 reg = (i == 0) ? in b43_nphy_rf_control_intc_override()
232 b43_phy_mask(dev, reg, 0xFBFF); in b43_nphy_rf_control_intc_override()
236 b43_phy_write(dev, reg, 0); in b43_nphy_rf_control_intc_override()
255 b43err(dev->wl, in b43_nphy_rf_control_intc_override()
274 b43err(dev->wl, in b43_nphy_rf_control_intc_override()
281 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_rf_control_intc_override()
288 b43_phy_maskset(dev, reg, ~tmp, val); in b43_nphy_rf_control_intc_override()
291 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_rf_control_intc_override()
298 b43_phy_maskset(dev, reg, ~tmp, val); in b43_nphy_rf_control_intc_override()
301 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_rf_control_intc_override()
308 b43_phy_maskset(dev, reg, ~tmp, val); in b43_nphy_rf_control_intc_override()
318 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
326 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
333 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
338 if (dev->dev->core_rev == 16) in b43_nphy_classifier()
348 if (dev->dev->core_rev == 16) in b43_nphy_classifier()
354 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
368 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */
371 struct b43_phy *phy = &dev->phy; in b43_nphy_stay_in_carrier_search()
372 struct b43_phy_n *nphy = phy->n; in b43_nphy_stay_in_carrier_search()
376 if (nphy->deaf_count++ == 0) { in b43_nphy_stay_in_carrier_search()
377 nphy->classifier_state = b43_nphy_classifier(dev, 0, 0); in b43_nphy_stay_in_carrier_search()
379 b43_nphy_read_clip_detection(dev, nphy->clip_state); in b43_nphy_stay_in_carrier_search()
384 if (--nphy->deaf_count == 0) { in b43_nphy_stay_in_carrier_search()
385 b43_nphy_classifier(dev, 0x7, nphy->classifier_state); in b43_nphy_stay_in_carrier_search()
386 b43_nphy_write_clip_detection(dev, nphy->clip_state); in b43_nphy_stay_in_carrier_search()
391 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
394 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_adjust_lna_gain_table()
401 static const u16 lna_gain[4] = { -2, 10, 19, 25 }; in b43_nphy_adjust_lna_gain_table()
403 if (nphy->hang_avoid) in b43_nphy_adjust_lna_gain_table()
406 if (nphy->gain_boost) { in b43_nphy_adjust_lna_gain_table()
407 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_adjust_lna_gain_table()
411 tmp = 40370 - 315 * dev->phy.channel; in b43_nphy_adjust_lna_gain_table()
413 tmp = 23242 - 224 * dev->phy.channel; in b43_nphy_adjust_lna_gain_table()
422 if (nphy->elna_gain_config) { in b43_nphy_adjust_lna_gain_table()
443 if (nphy->hang_avoid) in b43_nphy_adjust_lna_gain_table()
447 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */
451 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_set_rf_sequence()
453 u8 end = (dev->phy.rev >= 3) ? 0x1F : 0x0F; in b43_nphy_set_rf_sequence()
457 if (nphy->hang_avoid) in b43_nphy_set_rf_sequence()
468 if (nphy->hang_avoid) in b43_nphy_set_rf_sequence()
479 b43_radio_write(dev, B2056_SYN_PLL_VCOCAL1, e->radio_syn_pll_vcocal1); in b43_chantab_radio_2056_upload()
480 b43_radio_write(dev, B2056_SYN_PLL_VCOCAL2, e->radio_syn_pll_vcocal2); in b43_chantab_radio_2056_upload()
481 b43_radio_write(dev, B2056_SYN_PLL_REFDIV, e->radio_syn_pll_refdiv); in b43_chantab_radio_2056_upload()
482 b43_radio_write(dev, B2056_SYN_PLL_MMD2, e->radio_syn_pll_mmd2); in b43_chantab_radio_2056_upload()
483 b43_radio_write(dev, B2056_SYN_PLL_MMD1, e->radio_syn_pll_mmd1); in b43_chantab_radio_2056_upload()
485 e->radio_syn_pll_loopfilter1); in b43_chantab_radio_2056_upload()
487 e->radio_syn_pll_loopfilter2); in b43_chantab_radio_2056_upload()
489 e->radio_syn_pll_loopfilter3); in b43_chantab_radio_2056_upload()
491 e->radio_syn_pll_loopfilter4); in b43_chantab_radio_2056_upload()
493 e->radio_syn_pll_loopfilter5); in b43_chantab_radio_2056_upload()
495 e->radio_syn_reserved_addr27); in b43_chantab_radio_2056_upload()
497 e->radio_syn_reserved_addr28); in b43_chantab_radio_2056_upload()
499 e->radio_syn_reserved_addr29); in b43_chantab_radio_2056_upload()
501 e->radio_syn_logen_vcobuf1); in b43_chantab_radio_2056_upload()
502 b43_radio_write(dev, B2056_SYN_LOGEN_MIXER2, e->radio_syn_logen_mixer2); in b43_chantab_radio_2056_upload()
503 b43_radio_write(dev, B2056_SYN_LOGEN_BUF3, e->radio_syn_logen_buf3); in b43_chantab_radio_2056_upload()
504 b43_radio_write(dev, B2056_SYN_LOGEN_BUF4, e->radio_syn_logen_buf4); in b43_chantab_radio_2056_upload()
507 e->radio_rx0_lnaa_tune); in b43_chantab_radio_2056_upload()
509 e->radio_rx0_lnag_tune); in b43_chantab_radio_2056_upload()
512 e->radio_tx0_intpaa_boost_tune); in b43_chantab_radio_2056_upload()
514 e->radio_tx0_intpag_boost_tune); in b43_chantab_radio_2056_upload()
516 e->radio_tx0_pada_boost_tune); in b43_chantab_radio_2056_upload()
518 e->radio_tx0_padg_boost_tune); in b43_chantab_radio_2056_upload()
520 e->radio_tx0_pgaa_boost_tune); in b43_chantab_radio_2056_upload()
522 e->radio_tx0_pgag_boost_tune); in b43_chantab_radio_2056_upload()
524 e->radio_tx0_mixa_boost_tune); in b43_chantab_radio_2056_upload()
526 e->radio_tx0_mixg_boost_tune); in b43_chantab_radio_2056_upload()
529 e->radio_rx1_lnaa_tune); in b43_chantab_radio_2056_upload()
531 e->radio_rx1_lnag_tune); in b43_chantab_radio_2056_upload()
534 e->radio_tx1_intpaa_boost_tune); in b43_chantab_radio_2056_upload()
536 e->radio_tx1_intpag_boost_tune); in b43_chantab_radio_2056_upload()
538 e->radio_tx1_pada_boost_tune); in b43_chantab_radio_2056_upload()
540 e->radio_tx1_padg_boost_tune); in b43_chantab_radio_2056_upload()
542 e->radio_tx1_pgaa_boost_tune); in b43_chantab_radio_2056_upload()
544 e->radio_tx1_pgag_boost_tune); in b43_chantab_radio_2056_upload()
546 e->radio_tx1_mixa_boost_tune); in b43_chantab_radio_2056_upload()
548 e->radio_tx1_mixg_boost_tune); in b43_chantab_radio_2056_upload()
551 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */
555 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_radio_2056_setup()
556 enum ieee80211_band band = b43_current_band(dev->wl); in b43_radio_2056_setup()
561 B43_WARN_ON(dev->phy.rev < 3); in b43_radio_2056_setup()
566 if (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && in b43_radio_2056_setup()
567 b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_radio_2056_setup()
570 if (dev->dev->chip_id == 0x4716) { in b43_radio_2056_setup()
578 if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && in b43_radio_2056_setup()
579 b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_radio_2056_setup()
586 if (dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) { in b43_radio_2056_setup()
589 if (dev->phy.rev >= 5) { in b43_radio_2056_setup()
593 if (dev->dev->chip_id == 0x4716) { in b43_radio_2056_setup()
630 bias = dev->phy.is_40mhz ? 0x40 : 0x20; in b43_radio_2056_setup()
643 } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) { in b43_radio_2056_setup()
680 if (nphy->init_por) in b43_radio_init2056_post()
686 * Initialize a Broadcom 2056 N-radio
687 * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init
703 b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref); in b43_chantab_radio_upload()
704 b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0); in b43_chantab_radio_upload()
705 b43_radio_write(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1); in b43_chantab_radio_upload()
706 b43_radio_write(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail); in b43_chantab_radio_upload()
709 b43_radio_write(dev, B2055_VCO_CAL1, e->radio_vco_cal1); in b43_chantab_radio_upload()
710 b43_radio_write(dev, B2055_VCO_CAL2, e->radio_vco_cal2); in b43_chantab_radio_upload()
711 b43_radio_write(dev, B2055_PLL_LFC1, e->radio_pll_lfc1); in b43_chantab_radio_upload()
712 b43_radio_write(dev, B2055_PLL_LFR1, e->radio_pll_lfr1); in b43_chantab_radio_upload()
715 b43_radio_write(dev, B2055_PLL_LFC2, e->radio_pll_lfc2); in b43_chantab_radio_upload()
716 b43_radio_write(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf); in b43_chantab_radio_upload()
717 b43_radio_write(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1); in b43_chantab_radio_upload()
718 b43_radio_write(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2); in b43_chantab_radio_upload()
721 b43_radio_write(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune); in b43_chantab_radio_upload()
722 b43_radio_write(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune); in b43_chantab_radio_upload()
723 b43_radio_write(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1); in b43_chantab_radio_upload()
724 b43_radio_write(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn); in b43_chantab_radio_upload()
727 b43_radio_write(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim); in b43_chantab_radio_upload()
728 b43_radio_write(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune); in b43_chantab_radio_upload()
729 b43_radio_write(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune); in b43_chantab_radio_upload()
730 b43_radio_write(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1); in b43_chantab_radio_upload()
733 b43_radio_write(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn); in b43_chantab_radio_upload()
734 b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim); in b43_chantab_radio_upload()
737 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
741 B43_WARN_ON(dev->phy.rev >= 3); in b43_radio_2055_setup()
765 struct b43_phy_n *nphy = dev->phy.n; in b43_radio_init2055_post()
766 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_radio_init2055_post()
771 if (sprom->revision < 4) in b43_radio_init2055_post()
772 workaround = (dev->dev->board_vendor != PCI_VENDOR_ID_BROADCOM in b43_radio_init2055_post()
773 && dev->dev->board_type == 0x46D in b43_radio_init2055_post()
774 && dev->dev->board_rev >= 0x41); in b43_radio_init2055_post()
777 !(sprom->boardflags2_lo & B43_BFL2_RXBB_INT_REG_DIS); in b43_radio_init2055_post()
800 b43err(dev->wl, "radio post init timeout\n"); in b43_radio_init2055_post()
802 b43_switch_channel(dev, dev->phy.channel); in b43_radio_init2055_post()
809 if (!nphy->gain_boost) { in b43_radio_init2055_post()
820 * Initialize a Broadcom 2055 N-radio
821 * http://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
830 bool ghz5 = b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ; in b43_radio_init2055()
840 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */
843 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_load_samples()
849 b43err(dev->wl, "allocation for samples loading failed\n"); in b43_nphy_load_samples()
850 return -ENOMEM; in b43_nphy_load_samples()
852 if (nphy->hang_avoid) in b43_nphy_load_samples()
862 if (nphy->hang_avoid) in b43_nphy_load_samples()
867 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
876 bw = (dev->phy.is_40mhz) ? 40 : 20; in b43_nphy_gen_load_samples()
885 if (dev->phy.is_40mhz) in b43_nphy_gen_load_samples()
893 b43err(dev->wl, "allocation for samples generation failed\n"); in b43_nphy_gen_load_samples()
911 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
915 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_run_samples()
920 if (nphy->hang_avoid) in b43_nphy_run_samples()
923 if ((nphy->bb_mult_save & 0x80000000) == 0) { in b43_nphy_run_samples()
925 nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; in b43_nphy_run_samples()
928 if (!dev->phy.is_40mhz) in b43_nphy_run_samples()
934 if (nphy->hang_avoid) in b43_nphy_run_samples()
937 b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); in b43_nphy_run_samples()
940 b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, (loops - 1)); in b43_nphy_run_samples()
966 b43err(dev->wl, "run samples timeout\n"); in b43_nphy_run_samples()
975 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */
984 offset = clamp_val(offset, -32, 31); in b43_nphy_scale_offset_rssi()
1046 u16 reg, val; in b43_nphy_rev3_rssi_select() local
1062 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1064 b43_phy_maskset(dev, reg, 0xFDFF, 0x0200); in b43_nphy_rev3_rssi_select()
1067 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1070 b43_phy_maskset(dev, reg, 0xFCFF, 0); in b43_nphy_rev3_rssi_select()
1072 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1075 b43_phy_maskset(dev, reg, 0xFFC3, 0); in b43_nphy_rev3_rssi_select()
1078 val = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 4 : 8; in b43_nphy_rev3_rssi_select()
1083 b43_phy_set(dev, reg, val); in b43_nphy_rev3_rssi_select()
1085 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1088 b43_phy_set(dev, reg, 0x0020); in b43_nphy_rev3_rssi_select()
1097 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1101 b43_phy_maskset(dev, reg, 0xFCFF, val); in b43_nphy_rev3_rssi_select()
1102 b43_phy_maskset(dev, reg, 0xF3FF, val << 2); in b43_nphy_rev3_rssi_select()
1106 b43_current_band(dev->wl); in b43_nphy_rev3_rssi_select()
1112 reg = (i == 0) ? 0x2000 : 0x3000; in b43_nphy_rev3_rssi_select()
1113 reg |= B2055_PADDRV; in b43_nphy_rev3_rssi_select()
1114 b43_radio_write16(dev, reg, val); in b43_nphy_rev3_rssi_select()
1116 reg = (i == 0) ? in b43_nphy_rev3_rssi_select()
1119 b43_phy_set(dev, reg, 0x0200); in b43_nphy_rev3_rssi_select()
1187 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSISel */
1190 if (dev->phy.rev >= 3) in b43_nphy_rssi_select()
1196 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRssi2055Vcm */
1224 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PollRssi */
1233 if (dev->phy.rev >= 3) { in b43_nphy_poll_rssi()
1259 if (dev->phy.rev < 2) { in b43_nphy_poll_rssi()
1268 if (dev->phy.rev < 2) { in b43_nphy_poll_rssi()
1284 if (dev->phy.rev < 2) in b43_nphy_poll_rssi()
1287 if (dev->phy.rev >= 3) { in b43_nphy_poll_rssi()
1311 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */
1348 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) in b43_nphy_rev2_rssi_cal()
1396 curr = abs(miniq[j][i / 2] - code * 8); in b43_nphy_rev2_rssi_cal()
1414 offset[i] = (code * 8) - results[vcm_final[i]][i]; in b43_nphy_rev2_rssi_cal()
1417 offset[i] = -((abs(offset[i]) + 4) / 8); in b43_nphy_rev2_rssi_cal()
1422 offset[i] = code - 32; in b43_nphy_rev2_rssi_cal()
1475 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
1483 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal
1487 if (dev->phy.rev >= 3) { in b43_nphy_rssi_cal()
1502 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_gain_ctl_workarounds_rev3plus()
1514 ext_lna = ghz5 ? sprom->boardflags_hi & B43_BFH_EXTLNA_5GHZ : in b43_nphy_gain_ctl_workarounds_rev3plus()
1515 sprom->boardflags_lo & B43_BFL_EXTLNA; in b43_nphy_gain_ctl_workarounds_rev3plus()
1517 if (ghz5 && dev->phy.rev >= 5) in b43_nphy_gain_ctl_workarounds_rev3plus()
1549 b43_ntab_write_bulk(dev, B43_NTAB8(0, 8), 4, e->lna1_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1550 b43_ntab_write_bulk(dev, B43_NTAB8(1, 8), 4, e->lna1_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1551 b43_ntab_write_bulk(dev, B43_NTAB8(0, 16), 4, e->lna2_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1552 b43_ntab_write_bulk(dev, B43_NTAB8(1, 16), 4, e->lna2_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1553 b43_ntab_write_bulk(dev, B43_NTAB8(0, 32), 10, e->gain_db); in b43_nphy_gain_ctl_workarounds_rev3plus()
1554 b43_ntab_write_bulk(dev, B43_NTAB8(1, 32), 10, e->gain_db); in b43_nphy_gain_ctl_workarounds_rev3plus()
1555 b43_ntab_write_bulk(dev, B43_NTAB8(2, 32), 10, e->gain_bits); in b43_nphy_gain_ctl_workarounds_rev3plus()
1556 b43_ntab_write_bulk(dev, B43_NTAB8(3, 32), 10, e->gain_bits); in b43_nphy_gain_ctl_workarounds_rev3plus()
1562 b43_phy_write(dev, B43_NPHY_C1_INITGAIN, e->init_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1563 b43_phy_write(dev, 0x2A7, e->init_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1565 e->rfseq_init); in b43_nphy_gain_ctl_workarounds_rev3plus()
1567 /* TODO: check defines. Do not match variables names */ in b43_nphy_gain_ctl_workarounds_rev3plus()
1568 b43_phy_write(dev, B43_NPHY_C1_CLIP1_MEDGAIN, e->cliphi_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1569 b43_phy_write(dev, 0x2A9, e->cliphi_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1570 b43_phy_write(dev, B43_NPHY_C1_CLIP2_GAIN, e->clipmd_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1571 b43_phy_write(dev, 0x2AB, e->clipmd_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1572 b43_phy_write(dev, B43_NPHY_C2_CLIP1_HIGAIN, e->cliplo_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1573 b43_phy_write(dev, 0x2AD, e->cliplo_gain); in b43_nphy_gain_ctl_workarounds_rev3plus()
1575 b43_phy_maskset(dev, 0x27D, 0xFF00, e->crsmin); in b43_nphy_gain_ctl_workarounds_rev3plus()
1576 b43_phy_maskset(dev, 0x280, 0xFF00, e->crsminl); in b43_nphy_gain_ctl_workarounds_rev3plus()
1577 b43_phy_maskset(dev, 0x283, 0xFF00, e->crsminu); in b43_nphy_gain_ctl_workarounds_rev3plus()
1578 b43_phy_write(dev, B43_NPHY_C1_NBCLIPTHRES, e->nbclip); in b43_nphy_gain_ctl_workarounds_rev3plus()
1579 b43_phy_write(dev, B43_NPHY_C2_NBCLIPTHRES, e->nbclip); in b43_nphy_gain_ctl_workarounds_rev3plus()
1581 ~B43_NPHY_C1_CLIPWBTHRES_CLIP2, e->wlclip); in b43_nphy_gain_ctl_workarounds_rev3plus()
1583 ~B43_NPHY_C2_CLIPWBTHRES_CLIP2, e->wlclip); in b43_nphy_gain_ctl_workarounds_rev3plus()
1589 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_gain_ctl_workarounds_rev1_2()
1605 if (!dev->phy.is_40mhz) { in b43_nphy_gain_ctl_workarounds_rev1_2()
1619 if (!dev->phy.is_40mhz) { in b43_nphy_gain_ctl_workarounds_rev1_2()
1632 if (nphy->gain_boost) { in b43_nphy_gain_ctl_workarounds_rev1_2()
1633 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ && in b43_nphy_gain_ctl_workarounds_rev1_2()
1634 dev->phy.is_40mhz) in b43_nphy_gain_ctl_workarounds_rev1_2()
1639 code = dev->phy.is_40mhz ? 6 : 7; in b43_nphy_gain_ctl_workarounds_rev1_2()
1655 if (nphy->elna_gain_config) { in b43_nphy_gain_ctl_workarounds_rev1_2()
1675 if (dev->phy.rev == 2) { in b43_nphy_gain_ctl_workarounds_rev1_2()
1692 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_nphy_gain_ctl_workarounds_rev1_2()
1696 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
1699 if (dev->phy.rev >= 3) in b43_nphy_gain_ctl_workarounds()
1707 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_workarounds_rev3plus()
1708 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_workarounds_rev3plus()
1748 if (nphy->hw_phyrxchain != 3 && in b43_nphy_workarounds_rev3plus()
1749 nphy->hw_phyrxchain != nphy->hw_phytxchain) { in b43_nphy_workarounds_rev3plus()
1759 tmp16 = (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ? in b43_nphy_workarounds_rev3plus()
1790 if ((sprom->boardflags2_lo & B43_BFL2_APLL_WAR && in b43_nphy_workarounds_rev3plus()
1791 b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) || in b43_nphy_workarounds_rev3plus()
1792 (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && in b43_nphy_workarounds_rev3plus()
1793 b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) in b43_nphy_workarounds_rev3plus()
1801 if (dev->phy.rev == 4 && in b43_nphy_workarounds_rev3plus()
1802 b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_workarounds_rev3plus()
1825 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_workarounds_rev1_2()
1826 struct b43_phy *phy = &dev->phy; in b43_nphy_workarounds_rev1_2()
1827 struct b43_phy_n *nphy = phy->n; in b43_nphy_workarounds_rev1_2()
1835 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ && in b43_nphy_workarounds_rev1_2()
1836 nphy->band5g_pwrgain) { in b43_nphy_workarounds_rev1_2()
1849 if (dev->phy.rev < 2) { in b43_nphy_workarounds_rev1_2()
1863 if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD && in b43_nphy_workarounds_rev1_2()
1864 dev->dev->board_type == 0x8B) { in b43_nphy_workarounds_rev1_2()
1873 if (dev->phy.rev < 2) { in b43_nphy_workarounds_rev1_2()
1877 } else if (dev->phy.rev == 2) { in b43_nphy_workarounds_rev1_2()
1882 if (dev->phy.rev < 2) in b43_nphy_workarounds_rev1_2()
1900 if (dev->phy.rev == 2) in b43_nphy_workarounds_rev1_2()
1905 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
1908 struct b43_phy *phy = &dev->phy; in b43_nphy_workarounds()
1909 struct b43_phy_n *nphy = phy->n; in b43_nphy_workarounds()
1911 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) in b43_nphy_workarounds()
1916 if (nphy->hang_avoid) in b43_nphy_workarounds()
1922 if (dev->phy.rev >= 3) in b43_nphy_workarounds()
1927 if (nphy->hang_avoid) in b43_nphy_workarounds()
1937 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
1944 return -1; in b43_nphy_tx_tone()
1949 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */
1952 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_update_txrx_chain()
1957 if (nphy->txrx_chain == 0) { in b43_nphy_update_txrx_chain()
1960 } else if (nphy->txrx_chain == 1) { in b43_nphy_update_txrx_chain()
1977 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */
1980 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_stop_playback()
1983 if (nphy->hang_avoid) in b43_nphy_stop_playback()
1994 if (nphy->bb_mult_save & 0x80000000) { in b43_nphy_stop_playback()
1995 tmp = nphy->bb_mult_save & 0xFFFF; in b43_nphy_stop_playback()
1997 nphy->bb_mult_save = 0; in b43_nphy_stop_playback()
2000 if (nphy->hang_avoid) in b43_nphy_stop_playback()
2004 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */
2012 if (dev->phy.rev >= 3) { in b43_nphy_iq_cal_gain_params()
2013 params->txgm = target.txgm[core]; in b43_nphy_iq_cal_gain_params()
2014 params->pga = target.pga[core]; in b43_nphy_iq_cal_gain_params()
2015 params->pad = target.pad[core]; in b43_nphy_iq_cal_gain_params()
2016 params->ipa = target.ipa[core]; in b43_nphy_iq_cal_gain_params()
2017 params->cal_gain = (params->txgm << 12) | (params->pga << 8) | in b43_nphy_iq_cal_gain_params()
2018 (params->pad << 4) | (params->ipa); in b43_nphy_iq_cal_gain_params()
2020 params->ncorr[j] = 0x79; in b43_nphy_iq_cal_gain_params()
2025 indx = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? in b43_nphy_iq_cal_gain_params()
2032 params->txgm = tbl_iqcal_gainparams[indx][i][1]; in b43_nphy_iq_cal_gain_params()
2033 params->pga = tbl_iqcal_gainparams[indx][i][2]; in b43_nphy_iq_cal_gain_params()
2034 params->pad = tbl_iqcal_gainparams[indx][i][3]; in b43_nphy_iq_cal_gain_params()
2035 params->cal_gain = (params->txgm << 7) | (params->pga << 4) | in b43_nphy_iq_cal_gain_params()
2036 (params->pad << 2); in b43_nphy_iq_cal_gain_params()
2038 params->ncorr[j] = tbl_iqcal_gainparams[indx][i][4 + j]; in b43_nphy_iq_cal_gain_params()
2060 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */
2063 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_ctrl()
2066 enum ieee80211_band band = b43_current_band(dev->wl); in b43_nphy_tx_power_ctrl()
2068 if (nphy->hang_avoid) in b43_nphy_tx_power_ctrl()
2071 nphy->txpwrctrl = enable; in b43_nphy_tx_power_ctrl()
2073 if (dev->phy.rev >= 3 && in b43_nphy_tx_power_ctrl()
2079 nphy->tx_pwr_idx[0] = b43_phy_read(dev, in b43_nphy_tx_power_ctrl()
2081 nphy->tx_pwr_idx[1] = b43_phy_read(dev, in b43_nphy_tx_power_ctrl()
2094 if (dev->phy.rev >= 3) in b43_nphy_tx_power_ctrl()
2098 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
2105 if (dev->phy.rev == 2) in b43_nphy_tx_power_ctrl()
2108 else if (dev->phy.rev < 2) in b43_nphy_tx_power_ctrl()
2112 if (dev->phy.rev < 2 && dev->phy.is_40mhz) in b43_nphy_tx_power_ctrl()
2116 nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctrl()
2118 nphy->adj_pwr_tbl); in b43_nphy_tx_power_ctrl()
2124 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
2134 if (dev->phy.rev > 1) in b43_nphy_tx_power_ctrl()
2140 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
2141 if (nphy->tx_pwr_idx[0] != 128 && in b43_nphy_tx_power_ctrl()
2142 nphy->tx_pwr_idx[1] != 128) { in b43_nphy_tx_power_ctrl()
2146 nphy->tx_pwr_idx[0]); in b43_nphy_tx_power_ctrl()
2147 if (dev->phy.rev > 1) in b43_nphy_tx_power_ctrl()
2150 ~0xff, nphy->tx_pwr_idx[1]); in b43_nphy_tx_power_ctrl()
2154 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_ctrl()
2161 if (dev->phy.rev == 2) in b43_nphy_tx_power_ctrl()
2163 else if (dev->phy.rev < 2) in b43_nphy_tx_power_ctrl()
2166 if (dev->phy.rev < 2 && dev->phy.is_40mhz) in b43_nphy_tx_power_ctrl()
2175 if (nphy->hang_avoid) in b43_nphy_tx_power_ctrl()
2179 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
2182 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_fix()
2183 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_tx_power_fix()
2187 u16 freq = dev->phy.channel_freq; in b43_nphy_tx_power_fix()
2191 if (nphy->hang_avoid) in b43_nphy_tx_power_fix()
2194 if (dev->phy.rev >= 7) { in b43_nphy_tx_power_fix()
2196 } else if (dev->phy.rev >= 3) { in b43_nphy_tx_power_fix()
2199 } else if (sprom->revision < 4) { in b43_nphy_tx_power_fix()
2203 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_tx_power_fix()
2204 txpi[0] = sprom->txpid2g[0]; in b43_nphy_tx_power_fix()
2205 txpi[1] = sprom->txpid2g[1]; in b43_nphy_tx_power_fix()
2207 txpi[0] = sprom->txpid5gl[0]; in b43_nphy_tx_power_fix()
2208 txpi[1] = sprom->txpid5gl[1]; in b43_nphy_tx_power_fix()
2210 txpi[0] = sprom->txpid5g[0]; in b43_nphy_tx_power_fix()
2211 txpi[1] = sprom->txpid5g[1]; in b43_nphy_tx_power_fix()
2213 txpi[0] = sprom->txpid5gh[0]; in b43_nphy_tx_power_fix()
2214 txpi[1] = sprom->txpid5gh[1]; in b43_nphy_tx_power_fix()
2220 if (dev->phy.rev < 7 && in b43_nphy_tx_power_fix()
2226 nphy->txpwrindex[i].index_internal = txpi[i]; in b43_nphy_tx_power_fix()
2227 nphy->txpwrindex[i].index_internal_save = txpi[i]; in b43_nphy_tx_power_fix()
2232 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_fix()
2236 } else if (b43_current_band(dev->wl) == in b43_nphy_tx_power_fix()
2242 if (dev->phy.rev >= 5 && in b43_nphy_tx_power_fix()
2243 sprom->fem.ghz5.extpa_gain == 3) in b43_nphy_tx_power_fix()
2254 if (dev->phy.rev >= 7) in b43_nphy_tx_power_fix()
2260 if (dev->phy.rev >= 3) { in b43_nphy_tx_power_fix()
2285 u16 reg = (i == 0) ? in b43_nphy_tx_power_fix() local
2289 b43_phy_maskset(dev, reg, 0xE00F, (u32) tmp32 << 4); in b43_nphy_tx_power_fix()
2290 b43_phy_set(dev, reg, 0x4); in b43_nphy_tx_power_fix()
2296 if (nphy->hang_avoid) in b43_nphy_tx_power_fix()
2302 struct b43_phy *phy = &dev->phy; in b43_nphy_ipa_internal_tssi_setup()
2307 if (phy->rev >= 7) { in b43_nphy_ipa_internal_tssi_setup()
2310 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_ipa_internal_tssi_setup()
2313 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
2315 if (phy->rev != 7) in b43_nphy_ipa_internal_tssi_setup()
2323 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
2334 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_nphy_ipa_internal_tssi_setup()
2351 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_ipa_internal_tssi_setup()
2354 if (phy->rev != 5) in b43_nphy_ipa_internal_tssi_setup()
2357 if (phy->rev >= 5) in b43_nphy_ipa_internal_tssi_setup()
2380 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi
2384 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_power_ctl_idle_tssi()
2385 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_power_ctl_idle_tssi()
2395 if (phy->rev >= 7) in b43_nphy_tx_power_ctl_idle_tssi()
2397 else if (phy->rev >= 3) in b43_nphy_tx_power_ctl_idle_tssi()
2407 if (phy->rev >= 7) in b43_nphy_tx_power_ctl_idle_tssi()
2409 else if (phy->rev >= 3) in b43_nphy_tx_power_ctl_idle_tssi()
2412 if (phy->rev >= 3) { in b43_nphy_tx_power_ctl_idle_tssi()
2413 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 24) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2414 nphy->pwr_ctl_info[1].idle_tssi_5g = (tmp >> 8) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2416 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 16) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2417 nphy->pwr_ctl_info[1].idle_tssi_5g = tmp & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2419 nphy->pwr_ctl_info[0].idle_tssi_2g = (tmp >> 24) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2420 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF; in b43_nphy_tx_power_ctl_idle_tssi()
2425 struct b43_phy *phy = &dev->phy; in b43_nphy_tx_gain_table_upload()
2435 if (phy->rev >= 3) { in b43_nphy_tx_gain_table_upload()
2439 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_tx_gain_table_upload()
2440 if (phy->rev == 3) in b43_nphy_tx_gain_table_upload()
2442 if (phy->rev == 4) in b43_nphy_tx_gain_table_upload()
2456 if (phy->rev >= 3) { in b43_nphy_tx_gain_table_upload()
2458 nphy->gmval = (table[0] >> 16) & 0x7000; in b43_nphy_tx_gain_table_upload()
2462 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_nphy_tx_gain_table_upload()
2475 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PA%20override */
2478 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_pa_override()
2483 nphy->rfctrl_intc1_save = b43_phy_read(dev, in b43_nphy_pa_override()
2485 nphy->rfctrl_intc2_save = b43_phy_read(dev, in b43_nphy_pa_override()
2487 band = b43_current_band(dev->wl); in b43_nphy_pa_override()
2488 if (dev->phy.rev >= 3) { in b43_nphy_pa_override()
2503 nphy->rfctrl_intc1_save); in b43_nphy_pa_override()
2505 nphy->rfctrl_intc2_save); in b43_nphy_pa_override()
2509 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw */
2514 if (dev->phy.rev >= 3) { in b43_nphy_tx_lp_fbw()
2527 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */
2543 for (i = 1000; i; i--) { in b43_nphy_rx_iq_est()
2546 est->i0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI0) << 16) | in b43_nphy_rx_iq_est()
2548 est->q0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI0) << 16) | in b43_nphy_rx_iq_est()
2550 est->iq0_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI0) << 16) | in b43_nphy_rx_iq_est()
2553 est->i1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI1) << 16) | in b43_nphy_rx_iq_est()
2555 est->q1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI1) << 16) | in b43_nphy_rx_iq_est()
2557 est->iq1_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI1) << 16) | in b43_nphy_rx_iq_est()
2566 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqCoeffs */
2571 b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPA0, pcomp->a0); in b43_nphy_rx_iq_coeffs()
2572 b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPB0, pcomp->b0); in b43_nphy_rx_iq_coeffs()
2573 b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPA1, pcomp->a1); in b43_nphy_rx_iq_coeffs()
2574 b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPB1, pcomp->b1); in b43_nphy_rx_iq_coeffs()
2576 pcomp->a0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPA0); in b43_nphy_rx_iq_coeffs()
2577 pcomp->b0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPB0); in b43_nphy_rx_iq_coeffs()
2578 pcomp->a1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPA1); in b43_nphy_rx_iq_coeffs()
2579 pcomp->b1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPB1); in b43_nphy_rx_iq_coeffs()
2585 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */
2588 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
2608 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhySetup */
2612 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
2636 ((1 - core) << B43_NPHY_RFSEQCA_RXDIS_SHIFT));
2638 ((1 - core) << B43_NPHY_RFSEQCA_TXEN_SHIFT));
2664 b43_nphy_rf_control_intc_override(dev, 1, txval, (2 - core));
2668 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */
2713 arsh = iq_nbits - 20; in b43_nphy_calc_rx_iq_comp()
2715 a = -((iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); in b43_nphy_calc_rx_iq_comp()
2718 a = -((iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); in b43_nphy_calc_rx_iq_comp()
2719 tmp = ii << -arsh; in b43_nphy_calc_rx_iq_comp()
2727 brsh = qq_nbits - 11; in b43_nphy_calc_rx_iq_comp()
2729 b = (qq << (31 - qq_nbits)); in b43_nphy_calc_rx_iq_comp()
2732 b = (qq << (31 - qq_nbits)); in b43_nphy_calc_rx_iq_comp()
2733 tmp = ii << -brsh; in b43_nphy_calc_rx_iq_comp()
2739 b = int_sqrt(b / tmp - a * a) - (1 << 10); in b43_nphy_calc_rx_iq_comp()
2742 if (dev->phy.rev >= 3) { in b43_nphy_calc_rx_iq_comp()
2750 if (dev->phy.rev >= 3) { in b43_nphy_calc_rx_iq_comp()
2766 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxIqWar */
2778 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */
2781 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_spur_workaround()
2783 u8 channel = dev->phy.channel; in b43_nphy_spur_workaround()
2787 B43_WARN_ON(dev->phy.rev < 3); in b43_nphy_spur_workaround()
2789 if (nphy->hang_avoid) in b43_nphy_spur_workaround()
2792 if (nphy->gband_spurwar_en) { in b43_nphy_spur_workaround()
2794 if (channel == 11 && dev->phy.is_40mhz) in b43_nphy_spur_workaround()
2801 if (nphy->aband_spurwar_en) { in b43_nphy_spur_workaround()
2833 if (nphy->hang_avoid) in b43_nphy_spur_workaround()
2837 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
2840 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_pwr_ctrl_coef_setup()
2847 if (nphy->hang_avoid) in b43_nphy_tx_pwr_ctrl_coef_setup()
2872 if (dev->phy.rev >= 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
2879 if (dev->phy.rev < 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
2892 if (dev->phy.rev >= 3) { in b43_nphy_tx_pwr_ctrl_coef_setup()
2899 if (nphy->hang_avoid) in b43_nphy_tx_pwr_ctrl_coef_setup()
2905 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreRssiCal
2909 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_restore_rssi_cal()
2914 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_restore_rssi_cal()
2915 if (!nphy->rssical_chanspec_2G.center_freq) in b43_nphy_restore_rssi_cal()
2917 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; in b43_nphy_restore_rssi_cal()
2918 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; in b43_nphy_restore_rssi_cal()
2920 if (!nphy->rssical_chanspec_5G.center_freq) in b43_nphy_restore_rssi_cal()
2922 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; in b43_nphy_restore_rssi_cal()
2923 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; in b43_nphy_restore_rssi_cal()
2946 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalRadioSetup */
2949 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_tx_cal_radio_setup()
2950 u16 *save = nphy->tx_rx_cal_radio_saveregs; in b43_nphy_tx_cal_radio_setup()
2954 if (dev->phy.rev >= 3) { in b43_nphy_tx_cal_radio_setup()
2971 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_tx_cal_radio_setup()
2977 if (nphy->ipa5g_on) { in b43_nphy_tx_cal_radio_setup()
2992 if (nphy->ipa2g_on) { in b43_nphy_tx_cal_radio_setup()
2995 (dev->phy.rev < 5) ? 0x11 : 0x01); in b43_nphy_tx_cal_radio_setup()
3030 if (dev->phy.rev < 2) { in b43_nphy_tx_cal_radio_setup()
3040 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/UpdateTxCalLadder */
3043 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_update_tx_cal_ladder()
3047 u16 tmp = nphy->txcal_bbmult; in b43_nphy_update_tx_cal_ladder()
3063 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */
3072 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */
3084 if (dev->phy.is_40mhz) { in b43_nphy_int_pa_set_tx_dig_filters()
3088 } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { in b43_nphy_int_pa_set_tx_dig_filters()
3094 if (dev->phy.channel == 14) in b43_nphy_int_pa_set_tx_dig_filters()
3100 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
3103 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_get_tx_gains()
3109 if (!nphy->txpwrctrl) { in b43_nphy_get_tx_gains()
3112 if (nphy->hang_avoid) in b43_nphy_get_tx_gains()
3115 if (nphy->hang_avoid) in b43_nphy_get_tx_gains()
3119 if (dev->phy.rev >= 3) { in b43_nphy_get_tx_gains()
3142 if (dev->phy.rev >= 3) { in b43_nphy_get_tx_gains()
3144 b43_current_band(dev->wl); in b43_nphy_get_tx_gains()
3150 if (dev->phy.rev == 3) in b43_nphy_get_tx_gains()
3152 else if (dev->phy.rev == 4) in b43_nphy_get_tx_gains()
3179 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
3182 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; in b43_nphy_tx_cal_phy_cleanup()
3184 if (dev->phy.rev >= 3) { in b43_nphy_tx_cal_phy_cleanup()
3208 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
3211 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; in b43_nphy_tx_cal_phy_setup()
3216 if (dev->phy.rev >= 3) { in b43_nphy_tx_cal_phy_setup()
3266 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) in b43_nphy_tx_cal_phy_setup()
3275 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
3278 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_save_cal()
3285 if (nphy->hang_avoid) in b43_nphy_save_cal()
3288 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_save_cal()
3289 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; in b43_nphy_save_cal()
3290 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; in b43_nphy_save_cal()
3291 iqcal_chanspec = &nphy->iqcal_chanspec_2G; in b43_nphy_save_cal()
3292 table = nphy->cal_cache.txcal_coeffs_2G; in b43_nphy_save_cal()
3294 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; in b43_nphy_save_cal()
3295 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; in b43_nphy_save_cal()
3296 iqcal_chanspec = &nphy->iqcal_chanspec_5G; in b43_nphy_save_cal()
3297 table = nphy->cal_cache.txcal_coeffs_5G; in b43_nphy_save_cal()
3302 if (dev->phy.rev >= 3) { in b43_nphy_save_cal()
3317 iqcal_chanspec->center_freq = dev->phy.channel_freq; in b43_nphy_save_cal()
3318 iqcal_chanspec->channel_type = dev->phy.channel_type; in b43_nphy_save_cal()
3321 if (nphy->hang_avoid) in b43_nphy_save_cal()
3325 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
3328 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_restore_cal()
3338 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_restore_cal()
3339 if (!nphy->iqcal_chanspec_2G.center_freq) in b43_nphy_restore_cal()
3341 table = nphy->cal_cache.txcal_coeffs_2G; in b43_nphy_restore_cal()
3342 loft = &nphy->cal_cache.txcal_coeffs_2G[5]; in b43_nphy_restore_cal()
3344 if (!nphy->iqcal_chanspec_5G.center_freq) in b43_nphy_restore_cal()
3346 table = nphy->cal_cache.txcal_coeffs_5G; in b43_nphy_restore_cal()
3347 loft = &nphy->cal_cache.txcal_coeffs_5G[5]; in b43_nphy_restore_cal()
3353 if (dev->phy.rev >= 3) in b43_nphy_restore_cal()
3363 if (dev->phy.rev < 2) in b43_nphy_restore_cal()
3366 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_restore_cal()
3367 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; in b43_nphy_restore_cal()
3368 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; in b43_nphy_restore_cal()
3370 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; in b43_nphy_restore_cal()
3371 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; in b43_nphy_restore_cal()
3375 if (dev->phy.rev >= 3) { in b43_nphy_restore_cal()
3393 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalTxIqlo */
3398 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_cal_tx_iq_lo()
3417 if (dev->phy.rev >= 4) { in b43_nphy_cal_tx_iq_lo()
3418 avoid = nphy->hang_avoid; in b43_nphy_cal_tx_iq_lo()
3419 nphy->hang_avoid = false; in b43_nphy_cal_tx_iq_lo()
3434 phy6or5x = dev->phy.rev >= 6 || in b43_nphy_cal_tx_iq_lo()
3435 (dev->phy.rev == 5 && nphy->ipa2g_on && in b43_nphy_cal_tx_iq_lo()
3436 b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ); in b43_nphy_cal_tx_iq_lo()
3438 if (dev->phy.is_40mhz) { in b43_nphy_cal_tx_iq_lo()
3453 if (!dev->phy.is_40mhz) in b43_nphy_cal_tx_iq_lo()
3458 if (nphy->mphase_cal_phase_id > 2) in b43_nphy_cal_tx_iq_lo()
3459 b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8, in b43_nphy_cal_tx_iq_lo()
3465 if (nphy->mphase_cal_phase_id > 2) { in b43_nphy_cal_tx_iq_lo()
3466 table = nphy->mphase_txcal_bestcoeffs; in b43_nphy_cal_tx_iq_lo()
3468 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
3469 length -= 2; in b43_nphy_cal_tx_iq_lo()
3471 if (!full && nphy->txiqlocal_coeffsvalid) { in b43_nphy_cal_tx_iq_lo()
3472 table = nphy->txiqlocal_bestc; in b43_nphy_cal_tx_iq_lo()
3474 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
3475 length -= 2; in b43_nphy_cal_tx_iq_lo()
3478 if (dev->phy.rev >= 3) { in b43_nphy_cal_tx_iq_lo()
3491 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
3496 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
3503 count = nphy->mphase_txcal_cmdidx; in b43_nphy_cal_tx_iq_lo()
3505 (u16)(count + nphy->mphase_txcal_numcmds)); in b43_nphy_cal_tx_iq_lo()
3513 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
3518 if (dev->phy.rev >= 3) in b43_nphy_cal_tx_iq_lo()
3562 nphy->mphase_txcal_cmdidx = (numb >= max) ? 0 : numb; in b43_nphy_cal_tx_iq_lo()
3564 last = (dev->phy.rev < 3) ? 6 : 7; in b43_nphy_cal_tx_iq_lo()
3566 if (!mphase || nphy->mphase_cal_phase_id == last) { in b43_nphy_cal_tx_iq_lo()
3569 if (dev->phy.rev < 3) { in b43_nphy_cal_tx_iq_lo()
3584 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
3585 length -= 2; in b43_nphy_cal_tx_iq_lo()
3587 nphy->txiqlocal_bestc); in b43_nphy_cal_tx_iq_lo()
3588 nphy->txiqlocal_coeffsvalid = true; in b43_nphy_cal_tx_iq_lo()
3589 nphy->txiqlocal_chanspec.center_freq = in b43_nphy_cal_tx_iq_lo()
3590 dev->phy.channel_freq; in b43_nphy_cal_tx_iq_lo()
3591 nphy->txiqlocal_chanspec.channel_type = in b43_nphy_cal_tx_iq_lo()
3592 dev->phy.channel_type; in b43_nphy_cal_tx_iq_lo()
3595 if (dev->phy.rev < 3) in b43_nphy_cal_tx_iq_lo()
3596 length -= 2; in b43_nphy_cal_tx_iq_lo()
3598 nphy->mphase_txcal_bestcoeffs); in b43_nphy_cal_tx_iq_lo()
3608 if (dev->phy.rev < 2 && (!mphase || nphy->mphase_cal_phase_id == last)) in b43_nphy_cal_tx_iq_lo()
3611 if (dev->phy.rev >= 4) in b43_nphy_cal_tx_iq_lo()
3612 nphy->hang_avoid = avoid; in b43_nphy_cal_tx_iq_lo()
3619 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */
3622 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_reapply_tx_cal_coeffs()
3627 if (!nphy->txiqlocal_coeffsvalid || in b43_nphy_reapply_tx_cal_coeffs()
3628 nphy->txiqlocal_chanspec.center_freq != dev->phy.channel_freq || in b43_nphy_reapply_tx_cal_coeffs()
3629 nphy->txiqlocal_chanspec.channel_type != dev->phy.channel_type) in b43_nphy_reapply_tx_cal_coeffs()
3634 if (buffer[i] != nphy->txiqlocal_bestc[i]) { in b43_nphy_reapply_tx_cal_coeffs()
3642 nphy->txiqlocal_bestc); in b43_nphy_reapply_tx_cal_coeffs()
3648 &nphy->txiqlocal_bestc[5]); in b43_nphy_reapply_tx_cal_coeffs()
3650 &nphy->txiqlocal_bestc[5]); in b43_nphy_reapply_tx_cal_coeffs()
3654 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */
3658 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_rev2_cal_rx_iq()
3683 if (dev->phy.rev < 2) in b43_nphy_rev2_cal_rx_iq()
3711 ((1 - i) << B43_NPHY_RFSEQCA_RXDIS_SHIFT)); in b43_nphy_rev2_cal_rx_iq()
3713 (1 - i)); in b43_nphy_rev2_cal_rx_iq()
3717 band = b43_current_band(dev->wl); in b43_nphy_rev2_cal_rx_iq()
3719 if (nphy->rxcalparams & 0xFF000000) { in b43_nphy_rev2_cal_rx_iq()
3736 if (nphy->rxcalparams & 0x10000) { in b43_nphy_rev2_cal_rx_iq()
3740 (2 - i)); in b43_nphy_rev2_cal_rx_iq()
3767 cur_hpf += desired - hweight32(power[index]); in b43_nphy_rev2_cal_rx_iq()
3784 (nphy->rxcalparams & 0xFFFF), in b43_nphy_rev2_cal_rx_iq()
3838 return -1; in b43_nphy_rev3_cal_rx_iq()
3841 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIq */
3845 if (dev->phy.rev >= 3) in b43_nphy_cal_rx_iq()
3851 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
3854 struct b43_phy *phy = &dev->phy; in b43_nphy_set_rx_core_state()
3855 struct b43_phy_n *nphy = phy->n; in b43_nphy_set_rx_core_state()
3858 nphy->phyrxchain = mask; in b43_nphy_set_rx_core_state()
3865 if (nphy->hang_avoid) in b43_nphy_set_rx_core_state()
3873 if (dev->phy.rev >= 3) { in b43_nphy_set_rx_core_state()
3878 if (dev->phy.rev >= 3) { in b43_nphy_set_rx_core_state()
3885 if (nphy->hang_avoid) in b43_nphy_set_rx_core_state()
3892 * N-PHY init
3896 * Upload the N-PHY tables.
3897 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables
3901 if (dev->phy.rev < 3) in b43_nphy_tables_init()
3907 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MIMOConfig */
3921 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BPHYInit */
3930 val -= 0x202; in b43_nphy_bphy_init()
3935 val -= 0x202; in b43_nphy_bphy_init()
3940 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
3943 if (dev->phy.rev >= 3) { in b43_nphy_superswitch_init()
3956 switch (dev->dev->bus_type) { in b43_nphy_superswitch_init()
3959 bcma_chipco_gpio_control(&dev->dev->bdev->bus->drv_cc, in b43_nphy_superswitch_init()
3965 ssb_chipco_gpio_control(&dev->dev->sdev->bus->chipco, in b43_nphy_superswitch_init()
3988 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N */
3991 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_phy_initn()
3992 struct b43_phy *phy = &dev->phy; in b43_phy_initn()
3993 struct b43_phy_n *nphy = phy->n; in b43_phy_initn()
4003 if ((dev->phy.rev >= 3) && in b43_phy_initn()
4004 (sprom->boardflags_lo & B43_BFL_EXTLNA) && in b43_phy_initn()
4005 (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) { in b43_phy_initn()
4006 switch (dev->dev->bus_type) { in b43_phy_initn()
4009 bcma_cc_set32(&dev->dev->bdev->bus->drv_cc, in b43_phy_initn()
4015 chipco_set32(&dev->dev->sdev->bus->chipco, in b43_phy_initn()
4021 nphy->deaf_count = 0; in b43_phy_initn()
4023 nphy->crsminpwr_adjusted = false; in b43_phy_initn()
4024 nphy->noisevars_adjusted = false; in b43_phy_initn()
4027 if (dev->phy.rev >= 3) { in b43_phy_initn()
4037 if (dev->phy.rev < 6) { in b43_phy_initn()
4044 if (dev->phy.rev >= 3) in b43_phy_initn()
4048 if (dev->phy.rev <= 2) { in b43_phy_initn()
4049 tmp = (dev->phy.rev == 2) ? 0x3B : 0x40; in b43_phy_initn()
4057 if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD || in b43_phy_initn()
4058 (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && in b43_phy_initn()
4059 dev->dev->board_type == 0x8B)) in b43_phy_initn()
4067 b43_nphy_update_mimo_config(dev, nphy->preamble_override); in b43_phy_initn()
4070 if (phy->rev < 2) { in b43_phy_initn()
4075 tmp2 = b43_current_band(dev->wl); in b43_phy_initn()
4079 nphy->papd_epsilon_offset[0] << 7); in b43_phy_initn()
4082 nphy->papd_epsilon_offset[1] << 7); in b43_phy_initn()
4084 } else if (phy->rev >= 5) { in b43_phy_initn()
4106 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_phy_initn()
4109 tx_pwr_state = nphy->txpwrctrl; in b43_phy_initn()
4116 if (nphy->phyrxchain != 3) in b43_phy_initn()
4117 b43_nphy_set_rx_core_state(dev, nphy->phyrxchain); in b43_phy_initn()
4118 if (nphy->mphase_cal_phase_id > 0) in b43_phy_initn()
4119 ;/* TODO PHY Periodic Calibration Multi-Phase Restart */ in b43_phy_initn()
4122 if (phy->rev >= 3) { in b43_phy_initn()
4123 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_phy_initn()
4124 do_rssi_cal = !nphy->rssical_chanspec_2G.center_freq; in b43_phy_initn()
4126 do_rssi_cal = !nphy->rssical_chanspec_5G.center_freq; in b43_phy_initn()
4136 if (!((nphy->measure_hold & 0x6) != 0)) { in b43_phy_initn()
4137 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_phy_initn()
4138 do_cal = !nphy->iqcal_chanspec_2G.center_freq; in b43_phy_initn()
4140 do_cal = !nphy->iqcal_chanspec_5G.center_freq; in b43_phy_initn()
4142 if (nphy->mute) in b43_phy_initn()
4148 if (nphy->antsel_type == 2) in b43_phy_initn()
4150 if (nphy->perical != 2) { in b43_phy_initn()
4152 if (phy->rev >= 3) { in b43_phy_initn()
4153 nphy->cal_orig_pwr_idx[0] = in b43_phy_initn()
4154 nphy->txpwrindex[0].index_internal; in b43_phy_initn()
4155 nphy->cal_orig_pwr_idx[1] = in b43_phy_initn()
4156 nphy->txpwrindex[1].index_internal; in b43_phy_initn()
4163 } else if (nphy->mphase_cal_phase_id == 0) in b43_phy_initn()
4174 if (phy->rev >= 3 && phy->rev <= 6) in b43_phy_initn()
4177 if (phy->rev >= 3) in b43_phy_initn()
4190 b43_phy_write(dev, B43_NPHY_BW1A, e->phy_bw1a); in b43_chantab_phy_upload()
4191 b43_phy_write(dev, B43_NPHY_BW2, e->phy_bw2); in b43_chantab_phy_upload()
4192 b43_phy_write(dev, B43_NPHY_BW3, e->phy_bw3); in b43_chantab_phy_upload()
4193 b43_phy_write(dev, B43_NPHY_BW4, e->phy_bw4); in b43_chantab_phy_upload()
4194 b43_phy_write(dev, B43_NPHY_BW5, e->phy_bw5); in b43_chantab_phy_upload()
4195 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); in b43_chantab_phy_upload()
4198 /* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
4204 switch (dev->dev->bus_type) { in b43_nphy_pmu_spur_avoid()
4207 cc = &dev->dev->bdev->bus->drv_cc; in b43_nphy_pmu_spur_avoid()
4208 if (dev->dev->chip_id == 43224 || dev->dev->chip_id == 43225) { in b43_nphy_pmu_spur_avoid()
4225 } else if (dev->dev->chip_id == 0x4716) { in b43_nphy_pmu_spur_avoid()
4243 } else if (dev->dev->chip_id == 0x4322 || in b43_nphy_pmu_spur_avoid()
4244 dev->dev->chip_id == 0x4340 || in b43_nphy_pmu_spur_avoid()
4245 dev->dev->chip_id == 0x4341) { in b43_nphy_pmu_spur_avoid()
4268 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
4273 struct b43_phy *phy = &dev->phy; in b43_nphy_channel_setup()
4274 struct b43_phy_n *nphy = dev->phy.n; in b43_nphy_channel_setup()
4275 int ch = new_channel->hw_value; in b43_nphy_channel_setup()
4282 if (new_channel->band == IEEE80211_BAND_5GHZ && !old_band_5ghz) { in b43_nphy_channel_setup()
4288 } else if (new_channel->band == IEEE80211_BAND_2GHZ && old_band_5ghz) { in b43_nphy_channel_setup()
4298 if (new_channel->hw_value == 14) { in b43_nphy_channel_setup()
4303 if (new_channel->band == IEEE80211_BAND_2GHZ) in b43_nphy_channel_setup()
4307 if (!nphy->txpwrctrl) in b43_nphy_channel_setup()
4310 if (dev->phy.rev < 3) in b43_nphy_channel_setup()
4315 if (dev->phy.rev >= 3 && in b43_nphy_channel_setup()
4316 dev->phy.n->spur_avoid != B43_SPUR_AVOID_DISABLE) { in b43_nphy_channel_setup()
4318 if (dev->phy.n->spur_avoid == B43_SPUR_AVOID_FORCE) { in b43_nphy_channel_setup()
4320 } else if (!b43_channel_type_is_40mhz(phy->channel_type)) { in b43_nphy_channel_setup()
4324 if (nphy->aband_spurwar_en && in b43_nphy_channel_setup()
4326 avoid = dev->dev->chip_id == 0x4716; in b43_nphy_channel_setup()
4331 if (dev->dev->chip_id == 43222 || dev->dev->chip_id == 43224 || in b43_nphy_channel_setup()
4332 dev->dev->chip_id == 43225) { in b43_nphy_channel_setup()
4338 if (dev->phy.rev == 3 || dev->phy.rev == 4) in b43_nphy_channel_setup()
4354 if (phy->rev >= 3) in b43_nphy_channel_setup()
4358 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
4363 struct b43_phy *phy = &dev->phy; in b43_nphy_set_channel()
4370 if (dev->phy.rev >= 3) { in b43_nphy_set_channel()
4372 channel->center_freq); in b43_nphy_set_channel()
4374 return -ESRCH; in b43_nphy_set_channel()
4377 channel->hw_value); in b43_nphy_set_channel()
4379 return -ESRCH; in b43_nphy_set_channel()
4384 phy->channel = channel->hw_value; in b43_nphy_set_channel()
4385 phy->channel_freq = channel->center_freq; in b43_nphy_set_channel()
4387 if (b43_channel_type_is_40mhz(phy->channel_type) != in b43_nphy_set_channel()
4398 if (dev->phy.rev >= 3) { in b43_nphy_set_channel()
4399 tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 4 : 0; in b43_nphy_set_channel()
4402 b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel); in b43_nphy_set_channel()
4404 tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 0x0020 : 0x0050; in b43_nphy_set_channel()
4407 b43_nphy_channel_setup(dev, &(tabent_r2->phy_regs), channel); in b43_nphy_set_channel()
4423 return -ENOMEM; in b43_nphy_op_allocate()
4424 dev->phy.n = nphy; in b43_nphy_op_allocate()
4431 struct b43_phy *phy = &dev->phy; in b43_nphy_op_prepare_structs()
4432 struct b43_phy_n *nphy = phy->n; in b43_nphy_op_prepare_structs()
4433 struct ssb_sprom *sprom = dev->dev->bus_sprom; in b43_nphy_op_prepare_structs()
4437 nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); in b43_nphy_op_prepare_structs()
4438 nphy->spur_avoid = (phy->rev >= 3) ? in b43_nphy_op_prepare_structs()
4440 nphy->gain_boost = true; /* this way we follow wl, assume it is true */ in b43_nphy_op_prepare_structs()
4441 nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ in b43_nphy_op_prepare_structs()
4442 nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ in b43_nphy_op_prepare_structs()
4443 nphy->perical = 2; /* avoid additional rssi cal on init (like wl) */ in b43_nphy_op_prepare_structs()
4444 /* 128 can mean disabled-by-default state of TX pwr ctl. Max value is in b43_nphy_op_prepare_structs()
4446 nphy->tx_pwr_idx[0] = 128; in b43_nphy_op_prepare_structs()
4447 nphy->tx_pwr_idx[1] = 128; in b43_nphy_op_prepare_structs()
4450 nphy->txpwrctrl = false; in b43_nphy_op_prepare_structs()
4451 nphy->pwg_gain_5ghz = false; in b43_nphy_op_prepare_structs()
4452 if (dev->phy.rev >= 3 || in b43_nphy_op_prepare_structs()
4453 (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && in b43_nphy_op_prepare_structs()
4454 (dev->dev->core_rev == 11 || dev->dev->core_rev == 12))) { in b43_nphy_op_prepare_structs()
4455 nphy->txpwrctrl = true; in b43_nphy_op_prepare_structs()
4456 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
4457 } else if (sprom->revision >= 4) { in b43_nphy_op_prepare_structs()
4458 if (dev->phy.rev >= 2 && in b43_nphy_op_prepare_structs()
4459 (sprom->boardflags2_lo & B43_BFL2_TXPWRCTRL_EN)) { in b43_nphy_op_prepare_structs()
4460 nphy->txpwrctrl = true; in b43_nphy_op_prepare_structs()
4462 if (dev->dev->bus_type == B43_BUS_SSB && in b43_nphy_op_prepare_structs()
4463 dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) { in b43_nphy_op_prepare_structs()
4465 dev->dev->sdev->bus->host_pci; in b43_nphy_op_prepare_structs()
4466 if (pdev->device == 0x4328 || in b43_nphy_op_prepare_structs()
4467 pdev->device == 0x432a) in b43_nphy_op_prepare_structs()
4468 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
4471 } else if (sprom->boardflags2_lo & B43_BFL2_5G_PWRGAIN) { in b43_nphy_op_prepare_structs()
4472 nphy->pwg_gain_5ghz = true; in b43_nphy_op_prepare_structs()
4476 if (dev->phy.rev >= 3) { in b43_nphy_op_prepare_structs()
4477 nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2; in b43_nphy_op_prepare_structs()
4478 nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2; in b43_nphy_op_prepare_structs()
4484 struct b43_phy *phy = &dev->phy; in b43_nphy_op_free()
4485 struct b43_phy_n *nphy = phy->n; in b43_nphy_op_free()
4488 phy->n = NULL; in b43_nphy_op_free()
4500 /* OFDM registers are onnly available on A/G-PHYs */ in check_phyreg()
4501 b43err(dev->wl, "Invalid OFDM PHY access at " in check_phyreg()
4502 "0x%04X on N-PHY\n", offset); in check_phyreg()
4506 /* Ext-G registers are only available on G-PHYs */ in check_phyreg()
4507 b43err(dev->wl, "Invalid EXT-G PHY access at " in check_phyreg()
4508 "0x%04X on N-PHY\n", offset); in check_phyreg()
4514 static u16 b43_nphy_op_read(struct b43_wldev *dev, u16 reg) in b43_nphy_op_read() argument
4516 check_phyreg(dev, reg); in b43_nphy_op_read()
4517 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); in b43_nphy_op_read()
4521 static void b43_nphy_op_write(struct b43_wldev *dev, u16 reg, u16 value) in b43_nphy_op_write() argument
4523 check_phyreg(dev, reg); in b43_nphy_op_write()
4524 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); in b43_nphy_op_write()
4528 static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, in b43_nphy_op_maskset() argument
4531 check_phyreg(dev, reg); in b43_nphy_op_maskset()
4532 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); in b43_nphy_op_maskset()
4537 static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) in b43_nphy_op_radio_read() argument
4539 /* Register 1 is a 32-bit register. */ in b43_nphy_op_radio_read()
4540 B43_WARN_ON(reg == 1); in b43_nphy_op_radio_read()
4541 /* N-PHY needs 0x100 for read access */ in b43_nphy_op_radio_read()
4542 reg |= 0x100; in b43_nphy_op_radio_read()
4544 b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); in b43_nphy_op_radio_read()
4548 static void b43_nphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value) in b43_nphy_op_radio_write() argument
4550 /* Register 1 is a 32-bit register. */ in b43_nphy_op_radio_write()
4551 B43_WARN_ON(reg == 1); in b43_nphy_op_radio_write()
4553 b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); in b43_nphy_op_radio_write()
4557 /* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
4562 b43err(dev->wl, "MAC not suspended\n"); in b43_nphy_op_software_rfkill()
4567 if (dev->phy.rev >= 3) { in b43_nphy_op_software_rfkill()
4585 if (dev->phy.rev >= 3) { in b43_nphy_op_software_rfkill()
4587 b43_switch_channel(dev, dev->phy.channel); in b43_nphy_op_software_rfkill()
4594 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Anacore */
4600 if (dev->phy.rev >= 3) { in b43_nphy_op_switch_analog()
4620 struct ieee80211_channel *channel = dev->wl->hw->conf.channel; in b43_nphy_op_switch_channel()
4621 enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; in b43_nphy_op_switch_channel()
4623 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { in b43_nphy_op_switch_channel()
4625 return -EINVAL; in b43_nphy_op_switch_channel()
4628 return -EINVAL; in b43_nphy_op_switch_channel()
4636 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) in b43_nphy_op_get_default_chan()