Lines Matching full:mac

78 #define RF_LO_WRITE(mac, lo)	bwi_rf_lo_write((mac), (lo))  argument
106 #define SAVE_RF_REG(mac, regs, n) (regs)->rf_##n = RF_READ((mac), 0x##n) argument
107 #define RESTORE_RF_REG(mac, regs, n) RF_WRITE((mac), 0x##n, (regs)->rf_##n) argument
109 #define SAVE_PHY_REG(mac, regs, n) (regs)->phy_##n = PHY_READ((mac), 0x##n) argument
110 #define RESTORE_PHY_REG(mac, regs, n) PHY_WRITE((mac), 0x##n, (regs)->phy_##n) argument
159 bwi_nrssi_11g(struct bwi_mac *mac) in bwi_nrssi_11g() argument
165 val = (int16_t)__SHIFTOUT(PHY_READ(mac, 0x47f), NRSSI_11G_MASK); in bwi_nrssi_11g()
174 bwi_get_rf_lo(struct bwi_mac *mac, uint16_t rf_atten, uint16_t bbp_atten) in bwi_get_rf_lo() argument
181 return &mac->mac_rf.rf_lo[n]; in bwi_get_rf_lo()
185 bwi_rf_lo_isused(struct bwi_mac *mac, const struct bwi_rf_lo *lo) in bwi_rf_lo_isused() argument
187 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_lo_isused()
197 bwi_rf_write(struct bwi_mac *mac, uint16_t ctrl, uint16_t data) in bwi_rf_write() argument
199 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_write()
206 bwi_rf_read(struct bwi_mac *mac, uint16_t ctrl) in bwi_rf_read() argument
208 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_read()
209 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_read()
225 bwi_rf_attach(struct bwi_mac *mac) in bwi_rf_attach() argument
227 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_attach()
228 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_attach()
229 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_attach()
316 if (mac->mac_rev >= 5) in bwi_rf_attach()
340 bwi_rf_set_chan(struct bwi_mac *mac, u_int chan, int work_around) in bwi_rf_set_chan() argument
342 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_set_chan()
347 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_CHAN, chan); in bwi_rf_set_chan()
352 bwi_rf_work_around(mac, chan); in bwi_rf_set_chan()
358 HFLAGS_CLRBITS(mac, BWI_HFLAG_NOT_JAPAN); in bwi_rf_set_chan()
360 HFLAGS_SETBITS(mac, BWI_HFLAG_NOT_JAPAN); in bwi_rf_set_chan()
367 mac->mac_rf.rf_curchan = chan; in bwi_rf_set_chan()
371 bwi_rf_get_gains(struct bwi_mac *mac) in bwi_rf_get_gains() argument
385 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_get_gains()
386 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_get_gains()
387 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_get_gains()
397 save_phy[i] = PHY_READ(mac, save_phy_regs[i]); in bwi_rf_get_gains()
398 PHY_READ(mac, 0x2d); /* dummy read */ in bwi_rf_get_gains()
401 save_rf[i] = RF_READ(mac, save_rf_regs[i]); in bwi_rf_get_gains()
403 PHY_CLRBITS(mac, 0x429, 0xc000); in bwi_rf_get_gains()
404 PHY_SETBITS(mac, 0x1, 0x8000); in bwi_rf_get_gains()
406 PHY_SETBITS(mac, 0x811, 0x2); in bwi_rf_get_gains()
407 PHY_CLRBITS(mac, 0x812, 0x2); in bwi_rf_get_gains()
408 PHY_SETBITS(mac, 0x811, 0x1); in bwi_rf_get_gains()
409 PHY_CLRBITS(mac, 0x812, 0x1); in bwi_rf_get_gains()
411 PHY_SETBITS(mac, 0x814, 0x1); in bwi_rf_get_gains()
412 PHY_CLRBITS(mac, 0x815, 0x1); in bwi_rf_get_gains()
413 PHY_SETBITS(mac, 0x814, 0x2); in bwi_rf_get_gains()
414 PHY_CLRBITS(mac, 0x815, 0x2); in bwi_rf_get_gains()
416 PHY_SETBITS(mac, 0x811, 0xc); in bwi_rf_get_gains()
417 PHY_SETBITS(mac, 0x812, 0xc); in bwi_rf_get_gains()
418 PHY_SETBITS(mac, 0x811, 0x30); in bwi_rf_get_gains()
419 PHY_FILT_SETBITS(mac, 0x812, 0xffcf, 0x10); in bwi_rf_get_gains()
421 PHY_WRITE(mac, 0x5a, 0x780); in bwi_rf_get_gains()
422 PHY_WRITE(mac, 0x59, 0xc810); in bwi_rf_get_gains()
423 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_get_gains()
424 PHY_SETBITS(mac, 0xa, 0x2000); in bwi_rf_get_gains()
426 PHY_SETBITS(mac, 0x814, 0x4); in bwi_rf_get_gains()
427 PHY_CLRBITS(mac, 0x815, 0x4); in bwi_rf_get_gains()
429 PHY_FILT_SETBITS(mac, 0x3, 0xff9f, 0x40); in bwi_rf_get_gains()
433 RF_WRITE(mac, 0x43, loop1_max); in bwi_rf_get_gains()
436 RF_WRITE(mac, 0x52, 0x0); in bwi_rf_get_gains()
437 RF_FILT_SETBITS(mac, 0x43, 0xfff0, loop1_max); in bwi_rf_get_gains()
440 bwi_phy_set_bbp_atten(mac, 11); in bwi_rf_get_gains()
443 PHY_WRITE(mac, 0x80f, 0xc020); in bwi_rf_get_gains()
445 PHY_WRITE(mac, 0x80f, 0x8020); in bwi_rf_get_gains()
446 PHY_WRITE(mac, 0x810, 0); in bwi_rf_get_gains()
448 PHY_FILT_SETBITS(mac, 0x2b, 0xffc0, 0x1); in bwi_rf_get_gains()
449 PHY_FILT_SETBITS(mac, 0x2b, 0xc0ff, 0x800); in bwi_rf_get_gains()
450 PHY_SETBITS(mac, 0x811, 0x100); in bwi_rf_get_gains()
451 PHY_CLRBITS(mac, 0x812, 0x3000); in bwi_rf_get_gains()
455 PHY_SETBITS(mac, 0x811, 0x800); in bwi_rf_get_gains()
456 PHY_SETBITS(mac, 0x812, 0x8000); in bwi_rf_get_gains()
458 RF_CLRBITS(mac, 0x7a, 0xff08); in bwi_rf_get_gains()
467 RF_WRITE(mac, 0x43, i); in bwi_rf_get_gains()
469 if (bwi_rf_gain_max_reached(mac, j)) in bwi_rf_get_gains()
482 PHY_SETBITS(mac, 0x812, 0x30); in bwi_rf_get_gains()
486 if (bwi_rf_gain_max_reached(mac, i)) in bwi_rf_get_gains()
498 PHY_WRITE(mac, save_phy_regs[i], save_phy[i]); in bwi_rf_get_gains()
500 bwi_phy_set_bbp_atten(mac, mac->mac_tpctl.bbp_atten); in bwi_rf_get_gains()
503 RF_WRITE(mac, save_rf_regs[i], save_rf[i]); in bwi_rf_get_gains()
505 PHY_WRITE(mac, save_phy_regs[2], save_phy[2] | 0x3); in bwi_rf_get_gains()
507 PHY_WRITE(mac, save_phy_regs[2], save_phy[2]); in bwi_rf_get_gains()
508 PHY_WRITE(mac, save_phy_regs[3], save_phy[3]); in bwi_rf_get_gains()
509 PHY_WRITE(mac, save_phy_regs[0], save_phy[0]); in bwi_rf_get_gains()
510 PHY_WRITE(mac, save_phy_regs[1], save_phy[1]); in bwi_rf_get_gains()
517 DPRINTF(mac->mac_sc, BWI_DBG_RF | BWI_DBG_INIT, in bwi_rf_get_gains()
526 bwi_rf_init(struct bwi_mac *mac) in bwi_rf_init() argument
528 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_init()
534 RF_WRITE(mac, 0x78, rf->rf_calib); in bwi_rf_init()
536 bwi_rf_init_bcm2050(mac); in bwi_rf_init()
541 bwi_rf_off_11a(struct bwi_mac *mac) in bwi_rf_off_11a() argument
543 RF_WRITE(mac, 0x4, 0xff); in bwi_rf_off_11a()
544 RF_WRITE(mac, 0x5, 0xfb); in bwi_rf_off_11a()
546 PHY_SETBITS(mac, 0x10, 0x8); in bwi_rf_off_11a()
547 PHY_SETBITS(mac, 0x11, 0x8); in bwi_rf_off_11a()
549 PHY_WRITE(mac, 0x15, 0xaa00); in bwi_rf_off_11a()
553 bwi_rf_off_11bg(struct bwi_mac *mac) in bwi_rf_off_11bg() argument
555 PHY_WRITE(mac, 0x15, 0xaa00); in bwi_rf_off_11bg()
559 bwi_rf_off_11g_rev5(struct bwi_mac *mac) in bwi_rf_off_11g_rev5() argument
561 PHY_SETBITS(mac, 0x811, 0x8c); in bwi_rf_off_11g_rev5()
562 PHY_CLRBITS(mac, 0x812, 0x8c); in bwi_rf_off_11g_rev5()
566 bwi_rf_work_around(struct bwi_mac *mac, u_int chan) in bwi_rf_work_around() argument
568 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_work_around()
569 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_work_around()
588 bwi_rf_lo_find(struct bwi_mac *mac, const struct bwi_tpctl *tpctl) in bwi_rf_lo_find() argument
626 return bwi_get_rf_lo(mac, rf_atten, bbp_atten); in bwi_rf_lo_find()
630 bwi_rf_lo_adjust(struct bwi_mac *mac, const struct bwi_tpctl *tpctl) in bwi_rf_lo_adjust() argument
634 lo = bwi_rf_lo_find(mac, tpctl); in bwi_rf_lo_adjust()
635 RF_LO_WRITE(mac, lo); in bwi_rf_lo_adjust()
639 bwi_rf_lo_write(struct bwi_mac *mac, const struct bwi_rf_lo *lo) in bwi_rf_lo_write() argument
646 PHY_WRITE(mac, BWI_PHYR_RF_LO, val); in bwi_rf_lo_write()
650 bwi_rf_gain_max_reached(struct bwi_mac *mac, int idx) in bwi_rf_gain_max_reached() argument
652 PHY_FILT_SETBITS(mac, 0x812, 0xf0ff, idx << 8); in bwi_rf_gain_max_reached()
653 PHY_FILT_SETBITS(mac, 0x15, 0xfff, 0xa000); in bwi_rf_gain_max_reached()
654 PHY_SETBITS(mac, 0x15, 0xf000); in bwi_rf_gain_max_reached()
658 return (PHY_READ(mac, 0x2d) >= 0xdfc); in bwi_rf_gain_max_reached()
675 bwi_phy812_value(struct bwi_mac *mac, uint16_t lpd) in bwi_phy812_value() argument
677 struct bwi_softc *sc = mac->mac_sc; in bwi_phy812_value()
678 struct bwi_phy *phy = &mac->mac_phy; in bwi_phy812_value()
679 struct bwi_rf *rf = &mac->mac_rf; in bwi_phy812_value()
747 bwi_rf_init_bcm2050(struct bwi_mac *mac) in bwi_rf_init_bcm2050() argument
768 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_init_bcm2050()
769 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_init_bcm2050()
770 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_init_bcm2050()
777 save_rf[i] = RF_READ(mac, save_rf_regs[i]); in bwi_rf_init_bcm2050()
779 save_phy_comm[i] = PHY_READ(mac, save_phy_regs_comm[i]); in bwi_rf_init_bcm2050()
782 phyr_30 = PHY_READ(mac, 0x30); in bwi_rf_init_bcm2050()
785 PHY_WRITE(mac, 0x30, 0xff); in bwi_rf_init_bcm2050()
790 PHY_READ(mac, save_phy_regs_11g[i]); in bwi_rf_init_bcm2050()
793 PHY_SETBITS(mac, 0x814, 0x3); in bwi_rf_init_bcm2050()
794 PHY_CLRBITS(mac, 0x815, 0x3); in bwi_rf_init_bcm2050()
795 PHY_CLRBITS(mac, 0x429, 0x8000); in bwi_rf_init_bcm2050()
796 PHY_CLRBITS(mac, 0x802, 0x3); in bwi_rf_init_bcm2050()
798 phyr_80f = PHY_READ(mac, 0x80f); in bwi_rf_init_bcm2050()
799 phyr_810 = PHY_READ(mac, 0x810); in bwi_rf_init_bcm2050()
802 PHY_WRITE(mac, 0x80f, 0xc020); in bwi_rf_init_bcm2050()
804 PHY_WRITE(mac, 0x80f, 0x8020); in bwi_rf_init_bcm2050()
805 PHY_WRITE(mac, 0x810, 0); in bwi_rf_init_bcm2050()
807 phy812_val = bwi_phy812_value(mac, 0x011); in bwi_rf_init_bcm2050()
808 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
811 PHY_WRITE(mac, 0x811, 0x1b3); in bwi_rf_init_bcm2050()
813 PHY_WRITE(mac, 0x811, 0x9b3); in bwi_rf_init_bcm2050()
817 phyr_35 = PHY_READ(mac, 0x35); in bwi_rf_init_bcm2050()
818 PHY_CLRBITS(mac, 0x35, 0x80); in bwi_rf_init_bcm2050()
827 PHY_FILT_SETBITS(mac, 0x3, 0xffbf, 0x40); in bwi_rf_init_bcm2050()
831 calib = bwi_rf_calibval(mac); in bwi_rf_init_bcm2050()
834 RF_WRITE(mac, 0x78, 0x26); in bwi_rf_init_bcm2050()
837 phy812_val = bwi_phy812_value(mac, 0x011); in bwi_rf_init_bcm2050()
838 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
841 PHY_WRITE(mac, 0x15, 0xbfaf); in bwi_rf_init_bcm2050()
842 PHY_WRITE(mac, 0x2b, 0x1403); in bwi_rf_init_bcm2050()
845 phy812_val = bwi_phy812_value(mac, 0x001); in bwi_rf_init_bcm2050()
846 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
849 PHY_WRITE(mac, 0x15, 0xbfa0); in bwi_rf_init_bcm2050()
851 RF_SETBITS(mac, 0x51, 0x4); in bwi_rf_init_bcm2050()
853 RF_WRITE(mac, 0x43, 0x1f); in bwi_rf_init_bcm2050()
855 RF_WRITE(mac, 0x52, 0); in bwi_rf_init_bcm2050()
856 RF_FILT_SETBITS(mac, 0x43, 0xfff0, 0x9); in bwi_rf_init_bcm2050()
860 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
862 PHY_WRITE(mac, 0x5a, 0x480); in bwi_rf_init_bcm2050()
863 PHY_WRITE(mac, 0x59, 0xc810); in bwi_rf_init_bcm2050()
865 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_init_bcm2050()
867 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
868 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
870 PHY_WRITE(mac, 0x15, 0xafb0); in bwi_rf_init_bcm2050()
874 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
875 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
877 PHY_WRITE(mac, 0x15, 0xefb0); in bwi_rf_init_bcm2050()
881 phy812_val = bwi_phy812_value(mac, 0x100); in bwi_rf_init_bcm2050()
882 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
884 PHY_WRITE(mac, 0x15, 0xfff0); in bwi_rf_init_bcm2050()
887 test_lim += PHY_READ(mac, 0x2d); in bwi_rf_init_bcm2050()
889 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
891 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
892 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
894 PHY_WRITE(mac, 0x15, 0xafb0); in bwi_rf_init_bcm2050()
902 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
907 RF_WRITE(mac, 0x78, rfr_78); in bwi_rf_init_bcm2050()
912 PHY_WRITE(mac, 0x5a, 0xd80); in bwi_rf_init_bcm2050()
913 PHY_WRITE(mac, 0x59, 0xc810); in bwi_rf_init_bcm2050()
915 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_init_bcm2050()
918 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
919 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
921 PHY_WRITE(mac, 0x15, 0xafb0); in bwi_rf_init_bcm2050()
926 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
927 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
929 PHY_WRITE(mac, 0x15, 0xefb0); in bwi_rf_init_bcm2050()
934 phy812_val = bwi_phy812_value(mac, 0x100); in bwi_rf_init_bcm2050()
935 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
937 PHY_WRITE(mac, 0x15, 0xfff0); in bwi_rf_init_bcm2050()
940 test += PHY_READ(mac, 0x2d); in bwi_rf_init_bcm2050()
942 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
945 phy812_val = bwi_phy812_value(mac, 0x101); in bwi_rf_init_bcm2050()
946 PHY_WRITE(mac, 0x812, phy812_val); in bwi_rf_init_bcm2050()
948 PHY_WRITE(mac, 0x15, 0xafb0); in bwi_rf_init_bcm2050()
970 PHY_WRITE(mac, save_phy_regs_comm[0], save_phy_comm[0]); in bwi_rf_init_bcm2050()
975 RF_WRITE(mac, save_rf_regs[pos], save_rf[pos]); in bwi_rf_init_bcm2050()
978 PHY_WRITE(mac, save_phy_regs_comm[i], save_phy_comm[i]); in bwi_rf_init_bcm2050()
984 PHY_WRITE(mac, 0x35, phyr_35); in bwi_rf_init_bcm2050()
985 bwi_rf_work_around(mac, rf->rf_curchan); in bwi_rf_init_bcm2050()
988 PHY_WRITE(mac, 0x30, phyr_30); in bwi_rf_init_bcm2050()
995 PHY_WRITE(mac, save_phy_regs_11g[i], in bwi_rf_init_bcm2050()
999 PHY_WRITE(mac, 0x80f, phyr_80f); in bwi_rf_init_bcm2050()
1000 PHY_WRITE(mac, 0x810, phyr_810); in bwi_rf_init_bcm2050()
1009 bwi_rf_calibval(struct bwi_mac *mac) in bwi_rf_calibval() argument
1019 val = RF_READ(mac, BWI_RFR_BBP_ATTEN); in bwi_rf_calibval()
1083 bwi_rf_map_txpower(struct bwi_mac *mac) in bwi_rf_map_txpower() argument
1085 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_map_txpower()
1086 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_map_txpower()
1087 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_map_txpower()
1256 bwi_rf_lo_update_11g(struct bwi_mac *mac) in bwi_rf_lo_update_11g() argument
1258 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_lo_update_11g()
1259 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_lo_update_11g()
1260 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_lo_update_11g()
1261 struct bwi_tpctl *tpctl = &mac->mac_tpctl; in bwi_rf_lo_update_11g()
1274 SAVE_PHY_REG(mac, &regs, 429); in bwi_rf_lo_update_11g()
1275 SAVE_PHY_REG(mac, &regs, 802); in bwi_rf_lo_update_11g()
1277 PHY_WRITE(mac, 0x429, regs.phy_429 & 0x7fff); in bwi_rf_lo_update_11g()
1278 PHY_WRITE(mac, 0x802, regs.phy_802 & 0xfffc); in bwi_rf_lo_update_11g()
1285 SAVE_PHY_REG(mac, &regs, 15); in bwi_rf_lo_update_11g()
1286 SAVE_PHY_REG(mac, &regs, 2a); in bwi_rf_lo_update_11g()
1287 SAVE_PHY_REG(mac, &regs, 35); in bwi_rf_lo_update_11g()
1288 SAVE_PHY_REG(mac, &regs, 60); in bwi_rf_lo_update_11g()
1289 SAVE_RF_REG(mac, &regs, 43); in bwi_rf_lo_update_11g()
1290 SAVE_RF_REG(mac, &regs, 7a); in bwi_rf_lo_update_11g()
1291 SAVE_RF_REG(mac, &regs, 52); in bwi_rf_lo_update_11g()
1293 SAVE_PHY_REG(mac, &regs, 811); in bwi_rf_lo_update_11g()
1294 SAVE_PHY_REG(mac, &regs, 812); in bwi_rf_lo_update_11g()
1295 SAVE_PHY_REG(mac, &regs, 814); in bwi_rf_lo_update_11g()
1296 SAVE_PHY_REG(mac, &regs, 815); in bwi_rf_lo_update_11g()
1300 bwi_rf_set_chan(mac, 6, 0); in bwi_rf_lo_update_11g()
1303 PHY_WRITE(mac, 0x429, regs.phy_429 & 0x7fff); in bwi_rf_lo_update_11g()
1304 PHY_WRITE(mac, 0x802, regs.phy_802 & 0xfffc); in bwi_rf_lo_update_11g()
1305 bwi_mac_dummy_xmit(mac); in bwi_rf_lo_update_11g()
1307 RF_WRITE(mac, 0x43, 0x6); in bwi_rf_lo_update_11g()
1309 bwi_phy_set_bbp_atten(mac, 2); in bwi_rf_lo_update_11g()
1313 PHY_WRITE(mac, 0x2e, 0x7f); in bwi_rf_lo_update_11g()
1314 PHY_WRITE(mac, 0x80f, 0x78); in bwi_rf_lo_update_11g()
1315 PHY_WRITE(mac, 0x35, regs.phy_35 & 0xff7f); in bwi_rf_lo_update_11g()
1316 RF_WRITE(mac, 0x7a, regs.rf_7a & 0xfff0); in bwi_rf_lo_update_11g()
1317 PHY_WRITE(mac, 0x2b, 0x203); in bwi_rf_lo_update_11g()
1318 PHY_WRITE(mac, 0x2a, 0x8a3); in bwi_rf_lo_update_11g()
1321 PHY_WRITE(mac, 0x814, regs.phy_814 | 0x3); in bwi_rf_lo_update_11g()
1322 PHY_WRITE(mac, 0x815, regs.phy_815 & 0xfffc); in bwi_rf_lo_update_11g()
1323 PHY_WRITE(mac, 0x811, 0x1b3); in bwi_rf_lo_update_11g()
1324 PHY_WRITE(mac, 0x812, 0xb2); in bwi_rf_lo_update_11g()
1328 tpctl->tp_ctrl2 = bwi_rf_get_tp_ctrl2(mac); in bwi_rf_lo_update_11g()
1329 PHY_WRITE(mac, 0x80f, 0x8078); in bwi_rf_lo_update_11g()
1334 devi_ctrl = _bwi_rf_lo_update_11g(mac, regs.rf_7a); in bwi_rf_lo_update_11g()
1340 PHY_WRITE(mac, 0x15, 0xe300); in bwi_rf_lo_update_11g()
1341 PHY_WRITE(mac, 0x812, (devi_ctrl << 8) | 0xa0); in bwi_rf_lo_update_11g()
1343 PHY_WRITE(mac, 0x812, (devi_ctrl << 8) | 0xa2); in bwi_rf_lo_update_11g()
1345 PHY_WRITE(mac, 0x812, (devi_ctrl << 8) | 0xa3); in bwi_rf_lo_update_11g()
1347 PHY_WRITE(mac, 0x15, devi_ctrl | 0xefa0); in bwi_rf_lo_update_11g()
1352 bwi_rf_lo_adjust(mac, tpctl); in bwi_rf_lo_update_11g()
1354 PHY_WRITE(mac, 0x2e, 0x807f); in bwi_rf_lo_update_11g()
1356 PHY_WRITE(mac, 0x2f, 0x202); in bwi_rf_lo_update_11g()
1358 PHY_WRITE(mac, 0x2f, 0x101); in bwi_rf_lo_update_11g()
1362 RESTORE_PHY_REG(mac, &regs, 15); in bwi_rf_lo_update_11g()
1363 RESTORE_PHY_REG(mac, &regs, 2a); in bwi_rf_lo_update_11g()
1364 RESTORE_PHY_REG(mac, &regs, 35); in bwi_rf_lo_update_11g()
1365 RESTORE_PHY_REG(mac, &regs, 60); in bwi_rf_lo_update_11g()
1367 RESTORE_RF_REG(mac, &regs, 43); in bwi_rf_lo_update_11g()
1368 RESTORE_RF_REG(mac, &regs, 7a); in bwi_rf_lo_update_11g()
1371 regs.rf_52 |= (RF_READ(mac, 0x52) & 0xf); in bwi_rf_lo_update_11g()
1372 RF_WRITE(mac, 0x52, regs.rf_52); in bwi_rf_lo_update_11g()
1377 RESTORE_PHY_REG(mac, &regs, 811); in bwi_rf_lo_update_11g()
1378 RESTORE_PHY_REG(mac, &regs, 812); in bwi_rf_lo_update_11g()
1379 RESTORE_PHY_REG(mac, &regs, 814); in bwi_rf_lo_update_11g()
1380 RESTORE_PHY_REG(mac, &regs, 815); in bwi_rf_lo_update_11g()
1381 RESTORE_PHY_REG(mac, &regs, 429); in bwi_rf_lo_update_11g()
1382 RESTORE_PHY_REG(mac, &regs, 802); in bwi_rf_lo_update_11g()
1385 bwi_rf_set_chan(mac, orig_chan, 1); in bwi_rf_lo_update_11g()
1389 bwi_rf_lo_devi_measure(struct bwi_mac *mac, uint16_t ctrl) in bwi_rf_lo_devi_measure() argument
1391 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_lo_devi_measure()
1400 PHY_WRITE(mac, 0x15, 0xe300); in bwi_rf_lo_devi_measure()
1401 PHY_WRITE(mac, 0x812, ctrl | 0xb0); in bwi_rf_lo_devi_measure()
1403 PHY_WRITE(mac, 0x812, ctrl | 0xb2); in bwi_rf_lo_devi_measure()
1405 PHY_WRITE(mac, 0x812, ctrl | 0xb3); in bwi_rf_lo_devi_measure()
1407 PHY_WRITE(mac, 0x15, 0xf300); in bwi_rf_lo_devi_measure()
1409 PHY_WRITE(mac, 0x15, ctrl | 0xefa0); in bwi_rf_lo_devi_measure()
1411 PHY_WRITE(mac, 0x15, ctrl | 0xefe0); in bwi_rf_lo_devi_measure()
1413 PHY_WRITE(mac, 0x15, ctrl | 0xffe0); in bwi_rf_lo_devi_measure()
1416 devi += PHY_READ(mac, 0x2d); in bwi_rf_lo_devi_measure()
1422 bwi_rf_get_tp_ctrl2(struct bwi_mac *mac) in bwi_rf_get_tp_ctrl2() argument
1428 RF_WRITE(mac, 0x52, 0); in bwi_rf_get_tp_ctrl2()
1430 devi_min = bwi_rf_lo_devi_measure(mac, 0); in bwi_rf_get_tp_ctrl2()
1435 RF_WRITE(mac, 0x52, i); in bwi_rf_get_tp_ctrl2()
1437 devi = bwi_rf_lo_devi_measure(mac, 0); in bwi_rf_get_tp_ctrl2()
1448 _bwi_rf_lo_update_11g(struct bwi_mac *mac, uint16_t orig_rf7a) in _bwi_rf_lo_update_11g() argument
1460 struct bwi_softc *sc = mac->mac_sc; in _bwi_rf_lo_update_11g()
1478 lo = bwi_get_rf_lo(mac, in _bwi_rf_lo_update_11g()
1482 lo = bwi_get_rf_lo(mac, in _bwi_rf_lo_update_11g()
1507 lo = bwi_get_rf_lo(mac, in _bwi_rf_lo_update_11g()
1509 if (!bwi_rf_lo_isused(mac, lo)) in _bwi_rf_lo_update_11g()
1517 RF_WRITE(mac, BWI_RFR_ATTEN, rf_atten); in _bwi_rf_lo_update_11g()
1519 tp_ctrl2 = mac->mac_tpctl.tp_ctrl2; in _bwi_rf_lo_update_11g()
1522 RF_WRITE(mac, BWI_RFR_TXPWR, tp_ctrl2); in _bwi_rf_lo_update_11g()
1526 bwi_phy_set_bbp_atten(mac, bbp_atten * 2); in _bwi_rf_lo_update_11g()
1531 RF_WRITE(mac, 0x7a, rf7a); in _bwi_rf_lo_update_11g()
1533 lo = bwi_get_rf_lo(mac, in _bwi_rf_lo_update_11g()
1535 bwi_rf_lo_measure_11g(mac, &lo_save, lo, devi_ctrl); in _bwi_rf_lo_update_11g()
1545 bwi_rf_lo_measure_11g(struct bwi_mac *mac, const struct bwi_rf_lo *src_lo, in bwi_rf_lo_measure_11g() argument
1568 RF_LO_WRITE(mac, &lo_min); in bwi_rf_lo_measure_11g()
1569 devi_min = bwi_rf_lo_devi_measure(mac, devi_ctrl); in bwi_rf_lo_measure_11g()
1610 RF_LO_WRITE(mac, &lo); in bwi_rf_lo_measure_11g()
1611 devi = bwi_rf_lo_devi_measure(mac, devi_ctrl); in bwi_rf_lo_measure_11g()
1635 bwi_rf_calc_nrssi_slope_11b(struct bwi_mac *mac) in bwi_rf_calc_nrssi_slope_11b() argument
1645 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_calc_nrssi_slope_11b()
1646 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_calc_nrssi_slope_11b()
1647 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_calc_nrssi_slope_11b()
1658 save_rf[i] = RF_READ(mac, save_rf_regs[i]); in bwi_rf_calc_nrssi_slope_11b()
1660 save_phy[i] = PHY_READ(mac, save_phy_regs[i]); in bwi_rf_calc_nrssi_slope_11b()
1670 RF_CLRBITS(mac, 0x7a, 0xff80); in bwi_rf_calc_nrssi_slope_11b()
1672 RF_CLRBITS(mac, 0x7a, 0xfff0); in bwi_rf_calc_nrssi_slope_11b()
1673 PHY_WRITE(mac, 0x30, 0xff); in bwi_rf_calc_nrssi_slope_11b()
1677 PHY_WRITE(mac, 0x26, 0); in bwi_rf_calc_nrssi_slope_11b()
1678 PHY_SETBITS(mac, 0x15, 0x20); in bwi_rf_calc_nrssi_slope_11b()
1679 PHY_WRITE(mac, 0x2a, 0x8a3); in bwi_rf_calc_nrssi_slope_11b()
1680 RF_SETBITS(mac, 0x7a, 0x80); in bwi_rf_calc_nrssi_slope_11b()
1682 nrssi[0] = (int16_t)PHY_READ(mac, 0x27); in bwi_rf_calc_nrssi_slope_11b()
1687 RF_CLRBITS(mac, 0x7a, 0xff80); in bwi_rf_calc_nrssi_slope_11b()
1695 PHY_WRITE(mac, 0x20, 0x3f3f); in bwi_rf_calc_nrssi_slope_11b()
1696 PHY_WRITE(mac, 0x15, 0xf330); in bwi_rf_calc_nrssi_slope_11b()
1698 RF_WRITE(mac, 0x5a, 0x60); in bwi_rf_calc_nrssi_slope_11b()
1699 RF_CLRBITS(mac, 0x43, 0xff0f); in bwi_rf_calc_nrssi_slope_11b()
1701 PHY_WRITE(mac, 0x5a, 0x480); in bwi_rf_calc_nrssi_slope_11b()
1702 PHY_WRITE(mac, 0x59, 0x810); in bwi_rf_calc_nrssi_slope_11b()
1703 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_calc_nrssi_slope_11b()
1707 nrssi[1] = (int16_t)PHY_READ(mac, 0x27); in bwi_rf_calc_nrssi_slope_11b()
1712 PHY_WRITE(mac, save_phy_regs[0], save_phy[0]); in bwi_rf_calc_nrssi_slope_11b()
1713 RF_WRITE(mac, save_rf_regs[0], save_rf[0]); in bwi_rf_calc_nrssi_slope_11b()
1718 PHY_WRITE(mac, save_phy_regs[i], save_phy[i]); in bwi_rf_calc_nrssi_slope_11b()
1720 bwi_rf_work_around(mac, rf->rf_curchan); in bwi_rf_calc_nrssi_slope_11b()
1726 PHY_WRITE(mac, save_phy_regs[i], save_phy[i]); in bwi_rf_calc_nrssi_slope_11b()
1729 RF_WRITE(mac, save_rf_regs[i], save_rf[i]); in bwi_rf_calc_nrssi_slope_11b()
1748 bwi_rf_set_nrssi_ofs_11g(struct bwi_mac *mac) in bwi_rf_set_nrssi_ofs_11g() argument
1766 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_set_nrssi_ofs_11g()
1775 save_phy_comm[i] = PHY_READ(mac, save_phy_comm_regs[i]); in bwi_rf_set_nrssi_ofs_11g()
1777 save_rf[i] = RF_READ(mac, save_rf_regs[i]); in bwi_rf_set_nrssi_ofs_11g()
1779 PHY_CLRBITS(mac, 0x429, 0x8000); in bwi_rf_set_nrssi_ofs_11g()
1780 PHY_FILT_SETBITS(mac, 0x1, 0x3fff, 0x4000); in bwi_rf_set_nrssi_ofs_11g()
1781 PHY_SETBITS(mac, 0x811, 0xc); in bwi_rf_set_nrssi_ofs_11g()
1782 PHY_FILT_SETBITS(mac, 0x812, 0xfff3, 0x4); in bwi_rf_set_nrssi_ofs_11g()
1783 PHY_CLRBITS(mac, 0x802, 0x3); in bwi_rf_set_nrssi_ofs_11g()
1787 save_phy6[i] = PHY_READ(mac, save_phy6_regs[i]); in bwi_rf_set_nrssi_ofs_11g()
1789 PHY_WRITE(mac, 0x2e, 0); in bwi_rf_set_nrssi_ofs_11g()
1790 PHY_WRITE(mac, 0x2f, 0); in bwi_rf_set_nrssi_ofs_11g()
1791 PHY_WRITE(mac, 0x80f, 0); in bwi_rf_set_nrssi_ofs_11g()
1792 PHY_WRITE(mac, 0x810, 0); in bwi_rf_set_nrssi_ofs_11g()
1793 PHY_SETBITS(mac, 0x478, 0x100); in bwi_rf_set_nrssi_ofs_11g()
1794 PHY_SETBITS(mac, 0x801, 0x40); in bwi_rf_set_nrssi_ofs_11g()
1795 PHY_SETBITS(mac, 0x60, 0x40); in bwi_rf_set_nrssi_ofs_11g()
1796 PHY_SETBITS(mac, 0x14, 0x200); in bwi_rf_set_nrssi_ofs_11g()
1799 RF_SETBITS(mac, 0x7a, 0x70); in bwi_rf_set_nrssi_ofs_11g()
1800 RF_SETBITS(mac, 0x7a, 0x80); in bwi_rf_set_nrssi_ofs_11g()
1804 nrssi = bwi_nrssi_11g(mac); in bwi_rf_set_nrssi_ofs_11g()
1807 RF_WRITE(mac, 0x7b, i); in bwi_rf_set_nrssi_ofs_11g()
1809 nrssi = bwi_nrssi_11g(mac); in bwi_rf_set_nrssi_ofs_11g()
1818 RF_CLRBITS(mac, 0x7a, 0xff80); in bwi_rf_set_nrssi_ofs_11g()
1820 PHY_SETBITS(mac, 0x814, 0x1); in bwi_rf_set_nrssi_ofs_11g()
1821 PHY_CLRBITS(mac, 0x815, 0x1); in bwi_rf_set_nrssi_ofs_11g()
1822 PHY_SETBITS(mac, 0x811, 0xc); in bwi_rf_set_nrssi_ofs_11g()
1823 PHY_SETBITS(mac, 0x812, 0xc); in bwi_rf_set_nrssi_ofs_11g()
1824 PHY_SETBITS(mac, 0x811, 0x30); in bwi_rf_set_nrssi_ofs_11g()
1825 PHY_SETBITS(mac, 0x812, 0x30); in bwi_rf_set_nrssi_ofs_11g()
1826 PHY_WRITE(mac, 0x5a, 0x480); in bwi_rf_set_nrssi_ofs_11g()
1827 PHY_WRITE(mac, 0x59, 0x810); in bwi_rf_set_nrssi_ofs_11g()
1828 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_set_nrssi_ofs_11g()
1830 PHY_WRITE(mac, 0x3, 0x122); in bwi_rf_set_nrssi_ofs_11g()
1832 PHY_SETBITS(mac, 0xa, 0x2000); in bwi_rf_set_nrssi_ofs_11g()
1833 PHY_SETBITS(mac, 0x814, 0x4); in bwi_rf_set_nrssi_ofs_11g()
1834 PHY_CLRBITS(mac, 0x815, 0x4); in bwi_rf_set_nrssi_ofs_11g()
1835 PHY_FILT_SETBITS(mac, 0x3, 0xff9f, 0x40); in bwi_rf_set_nrssi_ofs_11g()
1836 RF_SETBITS(mac, 0x7a, 0xf); in bwi_rf_set_nrssi_ofs_11g()
1842 bwi_set_gains(mac, &gains); in bwi_rf_set_nrssi_ofs_11g()
1844 RF_FILT_SETBITS(mac, 0x43, 0xf0, 0xf); in bwi_rf_set_nrssi_ofs_11g()
1847 nrssi = bwi_nrssi_11g(mac); in bwi_rf_set_nrssi_ofs_11g()
1850 RF_WRITE(mac, 0x7b, i); in bwi_rf_set_nrssi_ofs_11g()
1852 nrssi = bwi_nrssi_11g(mac); in bwi_rf_set_nrssi_ofs_11g()
1862 RF_WRITE(mac, 0x7b, rf7b); in bwi_rf_set_nrssi_ofs_11g()
1869 PHY_WRITE(mac, save_phy6_regs[phy6_idx], in bwi_rf_set_nrssi_ofs_11g()
1876 PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]); in bwi_rf_set_nrssi_ofs_11g()
1879 RF_WRITE(mac, save_rf_regs[i], save_rf[i]); in bwi_rf_set_nrssi_ofs_11g()
1881 PHY_SETBITS(mac, 0x802, 0x3); in bwi_rf_set_nrssi_ofs_11g()
1882 PHY_SETBITS(mac, 0x429, 0x8000); in bwi_rf_set_nrssi_ofs_11g()
1884 bwi_set_gains(mac, NULL); in bwi_rf_set_nrssi_ofs_11g()
1888 PHY_WRITE(mac, save_phy6_regs[phy6_idx], in bwi_rf_set_nrssi_ofs_11g()
1893 PHY_WRITE(mac, save_phy_comm_regs[0], save_phy_comm[0]); in bwi_rf_set_nrssi_ofs_11g()
1894 PHY_WRITE(mac, save_phy_comm_regs[2], save_phy_comm[2]); in bwi_rf_set_nrssi_ofs_11g()
1895 PHY_WRITE(mac, save_phy_comm_regs[1], save_phy_comm[1]); in bwi_rf_set_nrssi_ofs_11g()
1903 bwi_rf_calc_nrssi_slope_11g(struct bwi_mac *mac) in bwi_rf_calc_nrssi_slope_11g() argument
1918 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_calc_nrssi_slope_11g()
1919 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_calc_nrssi_slope_11g()
1920 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_calc_nrssi_slope_11g()
1932 bwi_rf_set_nrssi_ofs_11g(mac); in bwi_rf_calc_nrssi_slope_11g()
1934 PHY_CLRBITS(mac, 0x429, 0x8000); in bwi_rf_calc_nrssi_slope_11g()
1935 PHY_CLRBITS(mac, 0x802, 0x3); in bwi_rf_calc_nrssi_slope_11g()
1944 save_rf[i] = RF_READ(mac, save_rf_regs[i]); in bwi_rf_calc_nrssi_slope_11g()
1946 save_phy_comm[i] = PHY_READ(mac, save_phy_comm_regs[i]); in bwi_rf_calc_nrssi_slope_11g()
1953 save_phy3[i] = PHY_READ(mac, save_phy3_regs[i]); in bwi_rf_calc_nrssi_slope_11g()
1955 PHY_WRITE(mac, 0x2e, 0); in bwi_rf_calc_nrssi_slope_11g()
1956 PHY_WRITE(mac, 0x810, 0); in bwi_rf_calc_nrssi_slope_11g()
1960 PHY_SETBITS(mac, 0x478, 0x100); in bwi_rf_calc_nrssi_slope_11g()
1961 PHY_SETBITS(mac, 0x810, 0x40); in bwi_rf_calc_nrssi_slope_11g()
1963 PHY_CLRBITS(mac, 0x810, 0x40); in bwi_rf_calc_nrssi_slope_11g()
1966 PHY_SETBITS(mac, 0x60, 0x40); in bwi_rf_calc_nrssi_slope_11g()
1967 PHY_SETBITS(mac, 0x14, 0x200); in bwi_rf_calc_nrssi_slope_11g()
1973 RF_SETBITS(mac, 0x7a, 0x70); in bwi_rf_calc_nrssi_slope_11g()
1979 bwi_set_gains(mac, &gains); in bwi_rf_calc_nrssi_slope_11g()
1981 RF_CLRBITS(mac, 0x7a, 0xff08); in bwi_rf_calc_nrssi_slope_11g()
1983 PHY_FILT_SETBITS(mac, 0x811, 0xffcf, 0x30); in bwi_rf_calc_nrssi_slope_11g()
1984 PHY_FILT_SETBITS(mac, 0x812, 0xffcf, 0x10); in bwi_rf_calc_nrssi_slope_11g()
1987 RF_SETBITS(mac, 0x7a, 0x80); in bwi_rf_calc_nrssi_slope_11g()
1989 nrssi[0] = bwi_nrssi_11g(mac); in bwi_rf_calc_nrssi_slope_11g()
1994 RF_CLRBITS(mac, 0x7a, 0xff80); in bwi_rf_calc_nrssi_slope_11g()
1996 PHY_FILT_SETBITS(mac, 0x3, 0xff9f, 0x40); in bwi_rf_calc_nrssi_slope_11g()
1999 RF_SETBITS(mac, 0x7a, 0xf); in bwi_rf_calc_nrssi_slope_11g()
2000 PHY_WRITE(mac, 0x15, 0xf330); in bwi_rf_calc_nrssi_slope_11g()
2002 PHY_FILT_SETBITS(mac, 0x812, 0xffcf, 0x20); in bwi_rf_calc_nrssi_slope_11g()
2003 PHY_FILT_SETBITS(mac, 0x811, 0xffcf, 0x20); in bwi_rf_calc_nrssi_slope_11g()
2010 bwi_set_gains(mac, &gains); in bwi_rf_calc_nrssi_slope_11g()
2013 RF_WRITE(mac, 0x43, 0x1f); in bwi_rf_calc_nrssi_slope_11g()
2015 RF_FILT_SETBITS(mac, 0x52, 0xff0f, 0x60); in bwi_rf_calc_nrssi_slope_11g()
2016 RF_FILT_SETBITS(mac, 0x43, 0xfff0, 0x9); in bwi_rf_calc_nrssi_slope_11g()
2018 PHY_WRITE(mac, 0x5a, 0x480); in bwi_rf_calc_nrssi_slope_11g()
2019 PHY_WRITE(mac, 0x59, 0x810); in bwi_rf_calc_nrssi_slope_11g()
2020 PHY_WRITE(mac, 0x58, 0xd); in bwi_rf_calc_nrssi_slope_11g()
2023 nrssi[1] = bwi_nrssi_11g(mac); in bwi_rf_calc_nrssi_slope_11g()
2042 PHY_WRITE(mac, save_phy3_regs[phy3_idx], in bwi_rf_calc_nrssi_slope_11g()
2047 PHY_CLRBITS(mac, 0x812, 0x30); in bwi_rf_calc_nrssi_slope_11g()
2048 PHY_CLRBITS(mac, 0x811, 0x30); in bwi_rf_calc_nrssi_slope_11g()
2052 RF_WRITE(mac, save_rf_regs[i], save_rf[i]); in bwi_rf_calc_nrssi_slope_11g()
2059 PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]); in bwi_rf_calc_nrssi_slope_11g()
2061 bwi_rf_work_around(mac, rf->rf_curchan); in bwi_rf_calc_nrssi_slope_11g()
2062 PHY_SETBITS(mac, 0x802, 0x3); in bwi_rf_calc_nrssi_slope_11g()
2063 bwi_set_gains(mac, NULL); in bwi_rf_calc_nrssi_slope_11g()
2064 PHY_SETBITS(mac, 0x429, 0x8000); in bwi_rf_calc_nrssi_slope_11g()
2068 PHY_WRITE(mac, save_phy3_regs[phy3_idx], in bwi_rf_calc_nrssi_slope_11g()
2073 bwi_rf_init_sw_nrssi_table(mac); in bwi_rf_calc_nrssi_slope_11g()
2074 bwi_rf_set_nrssi_thr_11g(mac); in bwi_rf_calc_nrssi_slope_11g()
2082 bwi_rf_init_sw_nrssi_table(struct bwi_mac *mac) in bwi_rf_init_sw_nrssi_table() argument
2084 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_init_sw_nrssi_table()
2102 bwi_rf_init_hw_nrssi_table(struct bwi_mac *mac, uint16_t adjust) in bwi_rf_init_hw_nrssi_table() argument
2109 val = bwi_nrssi_read(mac, i); in bwi_rf_init_hw_nrssi_table()
2117 bwi_nrssi_write(mac, i, val); in bwi_rf_init_hw_nrssi_table()
2122 bwi_rf_set_nrssi_thr_11b(struct bwi_mac *mac) in bwi_rf_set_nrssi_thr_11b() argument
2124 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_set_nrssi_thr_11b()
2128 (mac->mac_sc->sc_card_flags & BWI_CARD_F_SW_NRSSI) == 0) in bwi_rf_set_nrssi_thr_11b()
2146 PHY_READ(mac, BWI_PHYR_NRSSI_THR_11B); /* dummy read */ in bwi_rf_set_nrssi_thr_11b()
2147 PHY_WRITE(mac, BWI_PHYR_NRSSI_THR_11B, (((uint16_t)thr) << 8) | 0x1c); in bwi_rf_set_nrssi_thr_11b()
2150 PHY_WRITE(mac, 0x87, 0xe0d); in bwi_rf_set_nrssi_thr_11b()
2151 PHY_WRITE(mac, 0x86, 0xc0b); in bwi_rf_set_nrssi_thr_11b()
2152 PHY_WRITE(mac, 0x85, 0xa09); in bwi_rf_set_nrssi_thr_11b()
2153 PHY_WRITE(mac, 0x84, 0x808); in bwi_rf_set_nrssi_thr_11b()
2154 PHY_WRITE(mac, 0x83, 0x808); in bwi_rf_set_nrssi_thr_11b()
2155 PHY_WRITE(mac, 0x82, 0x604); in bwi_rf_set_nrssi_thr_11b()
2156 PHY_WRITE(mac, 0x81, 0x302); in bwi_rf_set_nrssi_thr_11b()
2157 PHY_WRITE(mac, 0x80, 0x100); in bwi_rf_set_nrssi_thr_11b()
2179 bwi_rf_set_nrssi_thr_11g(struct bwi_mac *mac) in bwi_rf_set_nrssi_thr_11g() argument
2187 if ((mac->mac_phy.phy_flags & BWI_PHY_F_LINKED) == 0 || in bwi_rf_set_nrssi_thr_11g()
2188 (mac->mac_sc->sc_card_flags & BWI_CARD_F_SW_NRSSI) == 0) { in bwi_rf_set_nrssi_thr_11g()
2191 nrssi = bwi_nrssi_read(mac, 0x20); in bwi_rf_set_nrssi_thr_11g()
2204 thr1 = _nrssi_threshold(&mac->mac_rf, 0x11); in bwi_rf_set_nrssi_thr_11g()
2205 thr2 = _nrssi_threshold(&mac->mac_rf, 0xe); in bwi_rf_set_nrssi_thr_11g()
2213 PHY_FILT_SETBITS(mac, BWI_PHYR_NRSSI_THR_11G, 0xf000, thr); in bwi_rf_set_nrssi_thr_11g()
2220 bwi_rf_clear_tssi(struct bwi_mac *mac) in bwi_rf_clear_tssi() argument
2223 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11A) { in bwi_rf_clear_tssi()
2233 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, in bwi_rf_clear_tssi()
2238 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, in bwi_rf_clear_tssi()
2269 bwi_rf_on_11a(struct bwi_mac *mac) in bwi_rf_on_11a() argument
2275 bwi_rf_on_11bg(struct bwi_mac *mac) in bwi_rf_on_11bg() argument
2277 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_on_11bg()
2279 PHY_WRITE(mac, 0x15, 0x8000); in bwi_rf_on_11bg()
2280 PHY_WRITE(mac, 0x15, 0xcc00); in bwi_rf_on_11bg()
2282 PHY_WRITE(mac, 0x15, 0xc0); in bwi_rf_on_11bg()
2284 PHY_WRITE(mac, 0x15, 0); in bwi_rf_on_11bg()
2286 bwi_rf_set_chan(mac, 6 /* XXX */, 1); in bwi_rf_on_11bg()
2290 bwi_rf_set_ant_mode(struct bwi_mac *mac, int ant_mode) in bwi_rf_set_ant_mode() argument
2292 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_set_ant_mode()
2293 struct bwi_phy *phy = &mac->mac_phy; in bwi_rf_set_ant_mode()
2300 HFLAGS_CLRBITS(mac, BWI_HFLAG_AUTO_ANTDIV); in bwi_rf_set_ant_mode()
2304 if (mac->mac_rev == 2) in bwi_rf_set_ant_mode()
2309 PHY_FILT_SETBITS(mac, 0x3e2, 0xfe7f, val); in bwi_rf_set_ant_mode()
2313 PHY_FILT_SETBITS(mac, 0x401, 0x7e7f, val); in bwi_rf_set_ant_mode()
2316 PHY_CLRBITS(mac, 0x42b, 0x100); in bwi_rf_set_ant_mode()
2322 PHY_SETBITS(mac, 0x48c, 0x2000); in bwi_rf_set_ant_mode()
2324 PHY_CLRBITS(mac, 0x48c, 0x2000); in bwi_rf_set_ant_mode()
2327 PHY_SETBITS(mac, 0x461, 0x10); in bwi_rf_set_ant_mode()
2328 PHY_FILT_SETBITS(mac, 0x4ad, 0xff00, 0x15); in bwi_rf_set_ant_mode()
2330 PHY_WRITE(mac, 0x427, 0x8); in bwi_rf_set_ant_mode()
2332 PHY_FILT_SETBITS(mac, 0x427, in bwi_rf_set_ant_mode()
2337 PHY_WRITE(mac, 0x49b, 0xdc); in bwi_rf_set_ant_mode()
2344 HFLAGS_SETBITS(mac, BWI_HFLAG_AUTO_ANTDIV); in bwi_rf_set_ant_mode()
2347 MOBJ_FILT_SETBITS_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_TX_BEACON, in bwi_rf_set_ant_mode()
2349 MOBJ_FILT_SETBITS_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_TX_ACK, in bwi_rf_set_ant_mode()
2351 MOBJ_FILT_SETBITS_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_TX_PROBE_RESP, in bwi_rf_set_ant_mode()
2359 if (mac->mac_rev < 5) in bwi_rf_set_ant_mode()
2362 mac->mac_rf.rf_ant_mode = ant_mode; in bwi_rf_set_ant_mode()
2366 bwi_rf_get_latest_tssi(struct bwi_mac *mac, int8_t tssi[], uint16_t ofs) in bwi_rf_get_latest_tssi() argument
2373 val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, ofs + i); in bwi_rf_get_latest_tssi()
2386 bwi_rf_tssi2dbm(struct bwi_mac *mac, int8_t tssi, int8_t *txpwr) in bwi_rf_tssi2dbm() argument
2388 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_tssi2dbm()
2407 bwi_rf_calc_rssi_bcm2050(struct bwi_mac *mac, const struct bwi_rxbuf_hdr *hdr) in bwi_rf_calc_rssi_bcm2050() argument
2426 if (mac->mac_sc->sc_card_flags & BWI_CARD_F_SW_NRSSI) { in bwi_rf_calc_rssi_bcm2050()
2427 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_calc_rssi_bcm2050()
2439 if (mac->mac_phy.phy_mode != IEEE80211_MODE_11G) in bwi_rf_calc_rssi_bcm2050()
2447 DPRINTF(mac->mac_sc, BWI_DBG_RF | BWI_DBG_RX, in bwi_rf_calc_rssi_bcm2050()
2477 bwi_rf_calc_rssi_bcm2053(struct bwi_mac *mac, const struct bwi_rxbuf_hdr *hdr) in bwi_rf_calc_rssi_bcm2053() argument
2493 bwi_rf_calc_rssi_bcm2060(struct bwi_mac *mac, const struct bwi_rxbuf_hdr *hdr) in bwi_rf_calc_rssi_bcm2060() argument
2504 bwi_rf_calc_noise_bcm2050(struct bwi_mac *mac) in bwi_rf_calc_noise_bcm2050() argument
2509 val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_RF_NOISE); in bwi_rf_calc_noise_bcm2050()
2512 if (mac->mac_sc->sc_card_flags & BWI_CARD_F_SW_NRSSI) { in bwi_rf_calc_noise_bcm2050()
2513 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_calc_noise_bcm2050()
2528 bwi_rf_calc_noise_bcm2053(struct bwi_mac *mac) in bwi_rf_calc_noise_bcm2053() argument
2533 val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_RF_NOISE); in bwi_rf_calc_noise_bcm2053()
2542 bwi_rf_calc_noise_bcm2060(struct bwi_mac *mac) in bwi_rf_calc_noise_bcm2060() argument
2549 bwi_rf_lo_measure_11b(struct bwi_mac *mac) in bwi_rf_lo_measure_11b() argument
2556 PHY_WRITE(mac, 0x15, 0xafa0); in bwi_rf_lo_measure_11b()
2558 PHY_WRITE(mac, 0x15, 0xefa0); in bwi_rf_lo_measure_11b()
2560 PHY_WRITE(mac, 0x15, 0xffa0); in bwi_rf_lo_measure_11b()
2563 val += PHY_READ(mac, 0x2c); in bwi_rf_lo_measure_11b()
2569 bwi_rf_lo_update_11b(struct bwi_mac *mac) in bwi_rf_lo_update_11b() argument
2571 struct bwi_softc *sc = mac->mac_sc; in bwi_rf_lo_update_11b()
2572 struct bwi_rf *rf = &mac->mac_rf; in bwi_rf_lo_update_11b()
2586 SAVE_PHY_REG(mac, &regs, 15); in bwi_rf_lo_update_11b()
2587 rf52 = RF_READ(mac, 0x52) & 0xfff0; in bwi_rf_lo_update_11b()
2589 SAVE_PHY_REG(mac, &regs, 0a); in bwi_rf_lo_update_11b()
2590 SAVE_PHY_REG(mac, &regs, 2a); in bwi_rf_lo_update_11b()
2591 SAVE_PHY_REG(mac, &regs, 35); in bwi_rf_lo_update_11b()
2592 SAVE_PHY_REG(mac, &regs, 03); in bwi_rf_lo_update_11b()
2593 SAVE_PHY_REG(mac, &regs, 01); in bwi_rf_lo_update_11b()
2594 SAVE_PHY_REG(mac, &regs, 30); in bwi_rf_lo_update_11b()
2596 SAVE_RF_REG(mac, &regs, 43); in bwi_rf_lo_update_11b()
2597 SAVE_RF_REG(mac, &regs, 7a); in bwi_rf_lo_update_11b()
2601 SAVE_RF_REG(mac, &regs, 52); in bwi_rf_lo_update_11b()
2604 PHY_WRITE(mac, 0x30, 0xff); in bwi_rf_lo_update_11b()
2606 PHY_WRITE(mac, 0x35, regs.phy_35 & 0xff7f); in bwi_rf_lo_update_11b()
2607 RF_WRITE(mac, 0x7a, regs.rf_7a & 0xfff0); in bwi_rf_lo_update_11b()
2610 PHY_WRITE(mac, 0x15, 0xb000); in bwi_rf_lo_update_11b()
2613 PHY_WRITE(mac, 0x2b, 0x203); in bwi_rf_lo_update_11b()
2614 PHY_WRITE(mac, 0x2a, 0x8a3); in bwi_rf_lo_update_11b()
2616 PHY_WRITE(mac, 0x2b, 0x1402); in bwi_rf_lo_update_11b()
2626 RF_WRITE(mac, 0x52, rf52 | i); in bwi_rf_lo_update_11b()
2627 bwi_rf_lo_measure_11b(mac); /* Ignore return value */ in bwi_rf_lo_update_11b()
2630 RF_WRITE(mac, 0x52, rf52 | i); in bwi_rf_lo_update_11b()
2632 val = bwi_rf_lo_measure_11b(mac) / 10; in bwi_rf_lo_update_11b()
2638 RF_WRITE(mac, 0x52, rf52 | rf_val); in bwi_rf_lo_update_11b()
2655 PHY_WRITE(mac, 0x2f, phy2f); in bwi_rf_lo_update_11b()
2657 val = bwi_rf_lo_measure_11b(mac) / 10; in bwi_rf_lo_update_11b()
2664 PHY_WRITE(mac, 0x2f, phy_val + 0x101); in bwi_rf_lo_update_11b()
2670 RESTORE_PHY_REG(mac, &regs, 0a); in bwi_rf_lo_update_11b()
2671 RESTORE_PHY_REG(mac, &regs, 2a); in bwi_rf_lo_update_11b()
2672 RESTORE_PHY_REG(mac, &regs, 35); in bwi_rf_lo_update_11b()
2673 RESTORE_PHY_REG(mac, &regs, 03); in bwi_rf_lo_update_11b()
2674 RESTORE_PHY_REG(mac, &regs, 01); in bwi_rf_lo_update_11b()
2675 RESTORE_PHY_REG(mac, &regs, 30); in bwi_rf_lo_update_11b()
2677 RESTORE_RF_REG(mac, &regs, 43); in bwi_rf_lo_update_11b()
2678 RESTORE_RF_REG(mac, &regs, 7a); in bwi_rf_lo_update_11b()
2680 RF_FILT_SETBITS(mac, 0x52, 0xf, regs.rf_52); in bwi_rf_lo_update_11b()
2684 RESTORE_PHY_REG(mac, &regs, 15); in bwi_rf_lo_update_11b()
2686 bwi_rf_work_around(mac, rf->rf_curchan); in bwi_rf_lo_update_11b()