Lines Matching +full:0 +full:x801

106 #define SAVE_RF_REG(mac, regs, n)	(regs)->rf_##n = RF_READ((mac), 0x##n)
107 #define RESTORE_RF_REG(mac, regs, n) RF_WRITE((mac), 0x##n, (regs)->rf_##n)
109 #define SAVE_PHY_REG(mac, regs, n) (regs)->phy_##n = PHY_READ((mac), 0x##n)
110 #define RESTORE_PHY_REG(mac, regs, n) PHY_WRITE((mac), 0x##n, (regs)->phy_##n)
165 val = (int16_t)__SHIFTOUT(PHY_READ(mac, 0x47f), NRSSI_11G_MASK); in bwi_nrssi_11g()
191 KASSERT(idx >= 0 && idx < BWI_RFLO_MAX, ("idx %d", idx)); in bwi_rf_lo_isused()
214 if (ctrl < 0x70) in bwi_rf_read()
215 ctrl += 0x80; in bwi_rf_read()
216 else if (ctrl < 0x80) in bwi_rf_read()
217 ctrl += 0x70; in bwi_rf_read()
242 if (sc->sc_bbp_rev == 0) in bwi_rf_attach()
262 device_printf(sc->sc_dev, "RF: manu 0x%03x, type 0x%04x, rev %u\n", in bwi_rf_attach()
268 rf->rf_ctrl_rd = 0; in bwi_rf_attach()
269 rf->rf_ctrl_adj = 0; in bwi_rf_attach()
336 return 0; in bwi_rf_attach()
363 CSR_CLRBITS_2(sc, BWI_RF_CHAN_EX, 0x840); /* XXX */ in bwi_rf_set_chan()
377 { 0x52, 0x43, 0x7a }; in bwi_rf_get_gains()
379 0x0429, 0x0001, 0x0811, 0x0812, in bwi_rf_get_gains()
380 0x0814, 0x0815, 0x005a, 0x0059, in bwi_rf_get_gains()
381 0x0058, 0x000a, 0x0003, 0x080f, in bwi_rf_get_gains()
382 0x0810, 0x002b, 0x0015 in bwi_rf_get_gains()
396 for (i = 0; i < SAVE_PHY_MAX; ++i) in bwi_rf_get_gains()
398 PHY_READ(mac, 0x2d); /* dummy read */ in bwi_rf_get_gains()
400 for (i = 0; i < SAVE_RF_MAX; ++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()
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()
464 j = 0; in bwi_rf_get_gains()
465 for (i = 0; i < loop1_max; ++i) { in bwi_rf_get_gains()
466 for (j = 0; j < 16; ++j) { in bwi_rf_get_gains()
467 RF_WRITE(mac, 0x43, i); in bwi_rf_get_gains()
482 PHY_SETBITS(mac, 0x812, 0x30); in bwi_rf_get_gains()
483 trsw = 0x1b; in bwi_rf_get_gains()
490 trsw = 0x18; in bwi_rf_get_gains()
502 for (i = 0; i < SAVE_RF_MAX; ++i) in bwi_rf_get_gains()
505 PHY_WRITE(mac, save_phy_regs[2], save_phy[2] | 0x3); in bwi_rf_get_gains()
509 PHY_WRITE(mac, save_phy_regs[0], save_phy[0]); in bwi_rf_get_gains()
534 RF_WRITE(mac, 0x78, rf->rf_calib); in bwi_rf_init()
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()
555 PHY_WRITE(mac, 0x15, 0xaa00); in bwi_rf_off_11bg()
561 PHY_SETBITS(mac, 0x811, 0x8c); in bwi_rf_off_11g_rev5()
562 PHY_CLRBITS(mac, 0x812, 0x8c); in bwi_rf_off_11g_rev5()
599 remap_rf_atten = 0; in bwi_rf_lo_find()
613 #if 0 in bwi_rf_lo_find()
618 rf_atten = 0; /* XXX */ in bwi_rf_lo_find()
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()
667 ret = (val & 0x8) >> 3; in bitswap4()
668 ret |= (val & 0x4) >> 1; in bitswap4()
669 ret |= (val & 0x2) << 1; in bitswap4()
670 ret |= (val & 0x1) << 3; in bitswap4()
682 if ((phy->phy_flags & BWI_PHY_F_LINKED) == 0) in bwi_phy812_value()
683 return 0; in bwi_phy812_value()
687 lo_gain += 0x3e; in bwi_phy812_value()
689 lo_gain += 0x26; in bwi_phy812_value()
691 if (lo_gain >= 0x46) { in bwi_phy812_value()
692 lo_gain -= 0x46; in bwi_phy812_value()
693 ext_lna = 0x3000; in bwi_phy812_value()
694 } else if (lo_gain >= 0x3a) { in bwi_phy812_value()
695 lo_gain -= 0x3a; in bwi_phy812_value()
696 ext_lna = 0x1000; in bwi_phy812_value()
697 } else if (lo_gain >= 0x2e) { in bwi_phy812_value()
698 lo_gain -= 0x2e; in bwi_phy812_value()
699 ext_lna = 0x2000; in bwi_phy812_value()
701 lo_gain -= 0x10; in bwi_phy812_value()
702 ext_lna = 0; in bwi_phy812_value()
705 for (loop = 0; loop < 16; ++loop) { in bwi_phy812_value()
713 ext_lna |= 0x8000; in bwi_phy812_value()
716 case 0x011: in bwi_phy812_value()
717 return 0x8f92; in bwi_phy812_value()
718 case 0x001: in bwi_phy812_value()
719 return (0x8092 | ext_lna); in bwi_phy812_value()
720 case 0x101: in bwi_phy812_value()
721 return (0x2092 | ext_lna); in bwi_phy812_value()
722 case 0x100: in bwi_phy812_value()
723 return (0x2093 | ext_lna); in bwi_phy812_value()
730 case 0x011: in bwi_phy812_value()
731 return 0xf92; in bwi_phy812_value()
732 case 0x001: in bwi_phy812_value()
733 case 0x101: in bwi_phy812_value()
734 return (0x92 | ext_lna); in bwi_phy812_value()
735 case 0x100: in bwi_phy812_value()
736 return (0x93 | ext_lna); in bwi_phy812_value()
743 return 0; in bwi_phy812_value()
754 { 0x0043, 0x0051, 0x0052 }; in bwi_rf_init_bcm2050()
756 { 0x0015, 0x005a, 0x0059, 0x0058 }; in bwi_rf_init_bcm2050()
758 { 0x0811, 0x0812, 0x0814, 0x0815, 0x0429, 0x0802 }; in bwi_rf_init_bcm2050()
763 uint16_t phyr_35, phyr_30 = 0, rfr_78, phyr_80f = 0, phyr_810 = 0; in bwi_rf_init_bcm2050()
764 uint16_t bphy_ctrl = 0, bbp_atten, rf_chan_ex; in bwi_rf_init_bcm2050()
776 for (i = 0; i < SAVE_RF_MAX; ++i) in bwi_rf_init_bcm2050()
778 for (i = 0; i < SAVE_PHY_COMM_MAX; ++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()
786 CSR_WRITE_2(sc, BWI_BPHY_CTRL, 0x3f3f); in bwi_rf_init_bcm2050()
788 for (i = 0; i < SAVE_PHY_11G_MAX; ++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()
810 (sc->sc_card_flags & BWI_CARD_F_EXT_LNA) == 0) 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()
815 CSR_SETBITS_2(sc, BWI_RF_ANTDIV, 0x8000); 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()
823 if (phy->phy_version == 0) { in bwi_rf_init_bcm2050()
824 CSR_WRITE_2(sc, BWI_BBP_ATTEN, 0x122); in bwi_rf_init_bcm2050()
827 PHY_FILT_SETBITS(mac, 0x3, 0xffbf, 0x40); in bwi_rf_init_bcm2050()
828 CSR_SETBITS_2(sc, BWI_RF_CHAN_EX, 0x2000); 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()
859 test_lim = 0; in bwi_rf_init_bcm2050()
860 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
861 for (i = 0; i < 16; ++i) { 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()
901 test = 0; in bwi_rf_init_bcm2050()
902 PHY_WRITE(mac, 0x58, 0); in bwi_rf_init_bcm2050()
903 for (i = 0; i < 16; ++i) { in bwi_rf_init_bcm2050()
906 rfr_78 = (bitswap4(i) << 1) | 0x20; in bwi_rf_init_bcm2050()
907 RF_WRITE(mac, 0x78, rfr_78); in bwi_rf_init_bcm2050()
911 for (j = 0; j < 16; ++j) { 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()
961 if (rf->rf_calib != 0xffff) { in bwi_rf_init_bcm2050()
963 "RF calibration value: 0x%04x\n", rf->rf_calib); in bwi_rf_init_bcm2050()
970 PHY_WRITE(mac, save_phy_regs_comm[0], save_phy_comm[0]); in bwi_rf_init_bcm2050()
972 for (i = 0; i < SAVE_RF_MAX; ++i) { in bwi_rf_init_bcm2050()
981 if (phy->phy_version != 0) in bwi_rf_init_bcm2050()
984 PHY_WRITE(mac, 0x35, phyr_35); in bwi_rf_init_bcm2050()
988 PHY_WRITE(mac, 0x30, phyr_30); in bwi_rf_init_bcm2050()
992 CSR_CLRBITS_2(sc, BWI_RF_ANTDIV, 0x8000); in bwi_rf_init_bcm2050()
994 for (i = 0; i < SAVE_PHY_11G_MAX; ++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()
1013 0x2, 0x3, 0x1, 0xf, 0x6, 0x7, 0x5, 0xf, in bwi_rf_calibval()
1014 0xa, 0xb, 0x9, 0xf, 0xe, 0xf, 0xd, 0xf in bwi_rf_calibval()
1025 calib |= 0x1; in bwi_rf_calibval()
1026 calib |= 0x20; in bwi_rf_calibval()
1034 if (num < 0) in _bwi_adjust_devide()
1050 m1 = _bwi_adjust_devide(16 * pa_params[0] + idx * pa_params[1], 32); in bwi_rf_calc_txpower()
1056 for (i = 0; i < ITER_MAX; ++i) { in bwi_rf_calc_txpower()
1079 return 0; in bwi_rf_calc_txpower()
1090 int error = 0, i, ant_gain, reg_txpower_max; in bwi_rf_map_txpower()
1107 if (rf->rf_txpower_max <= 0) { in bwi_rf_map_txpower()
1124 if (ant_gain == 0xff) { in bwi_rf_map_txpower()
1156 #define IS_VALID_PA_PARAM(p) ((p) != 0 && (p) != -1) in bwi_rf_map_txpower()
1165 for (i = 0; i < nitems(pa_params); ++i) in bwi_rf_map_txpower()
1168 for (i = 0; i < nitems(pa_params); ++i) { in bwi_rf_map_txpower()
1210 "sprom idle tssi: 0x%04x\n", val); in bwi_rf_map_txpower()
1228 for (i = 0; i < BWI_TSSI_MAX; ++i) { in bwi_rf_map_txpower()
1238 if (i != 0 && i % 8 == 0) { in bwi_rf_map_txpower()
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()
1282 CSR_WRITE_2(sc, BWI_RF_ANTDIV, ant_div | 0x8000); 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()
1307 RF_WRITE(mac, 0x43, 0x6); in bwi_rf_lo_update_11g()
1311 CSR_WRITE_2(sc, BWI_RF_CHAN_EX, 0); 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()
1327 if ((sc->sc_flags & BWI_F_RUNNING) == 0) in bwi_rf_lo_update_11g()
1329 PHY_WRITE(mac, 0x80f, 0x8078); 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()
1350 if ((sc->sc_flags & BWI_F_RUNNING) == 0) 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()
1370 regs.rf_52 &= 0xf0; 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()
1392 uint32_t devi = 0; in bwi_rf_lo_devi_measure()
1398 for (i = 0; i < 8; ++i) { 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()
1425 uint16_t tp_ctrl2 = 0; in bwi_rf_get_tp_ctrl2()
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()
1432 for (i = 0; i < 16; ++i) { 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()
1454 { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8, 1, 2, 3, 4 }; in _bwi_rf_lo_update_11g()
1456 { 0, 3, 1, 5, 7, 3, 2, 0, 4, 6, -1, -1, -1, -1 }; in _bwi_rf_lo_update_11g()
1458 { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8, 10, 11, 12, 13 }; in _bwi_rf_lo_update_11g()
1462 uint8_t devi_ctrl = 0; in _bwi_rf_lo_update_11g()
1463 int idx, adj_rf7a = 0; in _bwi_rf_lo_update_11g()
1466 for (idx = 0; idx < RF_ATTEN_LISTSZ; ++idx) { in _bwi_rf_lo_update_11g()
1471 for (bbp_atten = 0; bbp_atten < BBP_ATTEN_MAX; ++bbp_atten) { in _bwi_rf_lo_update_11g()
1474 if ((sc->sc_flags & BWI_F_RUNNING) == 0) { in _bwi_rf_lo_update_11g()
1475 if (idx == 0) { in _bwi_rf_lo_update_11g()
1477 } else if (init_rf_atten < 0) { in _bwi_rf_lo_update_11g()
1483 init_rf_atten, 0); in _bwi_rf_lo_update_11g()
1487 devi_ctrl = 0; in _bwi_rf_lo_update_11g()
1488 adj_rf7a = 0; in _bwi_rf_lo_update_11g()
1494 if (init_rf_atten >= 0) { in _bwi_rf_lo_update_11g()
1514 adj_rf7a = 0; in _bwi_rf_lo_update_11g()
1520 if (init_rf_atten < 0) in _bwi_rf_lo_update_11g()
1528 rf7a = orig_rf7a & 0xfff0; in _bwi_rf_lo_update_11g()
1530 rf7a |= 0x8; in _bwi_rf_lo_update_11g()
1531 RF_WRITE(mac, 0x7a, rf7a); in _bwi_rf_lo_update_11g()
1553 LO_ADJUST(1, 0), in bwi_rf_lo_measure_11g()
1555 LO_ADJUST(0, -1), in bwi_rf_lo_measure_11g()
1557 LO_ADJUST(-1, 0), in bwi_rf_lo_measure_11g()
1559 LO_ADJUST(0, 1) in bwi_rf_lo_measure_11g()
1572 adjust_state = 0; in bwi_rf_lo_measure_11g()
1577 found = 0; in bwi_rf_lo_measure_11g()
1578 if (adjust_state == 0) { in bwi_rf_lo_measure_11g()
1581 } else if (adjust_state % 2 == 0) { in bwi_rf_lo_measure_11g()
1641 { 0x7a, 0x52, 0x43 }; in bwi_rf_calc_nrssi_slope_11b()
1643 { 0x30, 0x26, 0x15, 0x2a, 0x20, 0x5a, 0x59, 0x58 }; in bwi_rf_calc_nrssi_slope_11b()
1657 for (i = 0; i < SAVE_RF_MAX; ++i) in bwi_rf_calc_nrssi_slope_11b()
1659 for (i = 0; i < SAVE_PHY_MAX; ++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()
1675 CSR_WRITE_2(sc, BWI_BPHY_CTRL, 0x7f7f); 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()
1689 CSR_WRITE_2(sc, BWI_BBP_ATTEN, 0x40); in bwi_rf_calc_nrssi_slope_11b()
1690 else if (phy->phy_version == 0) in bwi_rf_calc_nrssi_slope_11b()
1691 CSR_WRITE_2(sc, BWI_BBP_ATTEN, 0x122); in bwi_rf_calc_nrssi_slope_11b()
1693 CSR_CLRBITS_2(sc, BWI_RF_CHAN_EX, 0xdfff); 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()
1722 if (phy->phy_version != 0) in bwi_rf_calc_nrssi_slope_11b()
1734 if (nrssi[0] == nrssi[1]) in bwi_rf_calc_nrssi_slope_11b()
1735 rf->rf_nrssi_slope = 0x10000; in bwi_rf_calc_nrssi_slope_11b()
1737 rf->rf_nrssi_slope = 0x400000 / (nrssi[0] - nrssi[1]); in bwi_rf_calc_nrssi_slope_11b()
1738 if (nrssi[0] <= -4) { in bwi_rf_calc_nrssi_slope_11b()
1739 rf->rf_nrssi[0] = nrssi[0]; in bwi_rf_calc_nrssi_slope_11b()
1755 { 0x7a, 0x43 }; in bwi_rf_set_nrssi_ofs_11g()
1757 0x0001, 0x0811, 0x0812, 0x0814, in bwi_rf_set_nrssi_ofs_11g()
1758 0x0815, 0x005a, 0x0059, 0x0058, in bwi_rf_set_nrssi_ofs_11g()
1759 0x000a, 0x0003 in bwi_rf_set_nrssi_ofs_11g()
1762 0x002e, 0x002f, 0x080f, 0x0810, in bwi_rf_set_nrssi_ofs_11g()
1763 0x0801, 0x0060, 0x0014, 0x0478 in bwi_rf_set_nrssi_ofs_11g()
1770 uint16_t rf7b = 0xffff; in bwi_rf_set_nrssi_ofs_11g()
1772 int i, phy6_idx = 0; in bwi_rf_set_nrssi_ofs_11g()
1774 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwi_rf_set_nrssi_ofs_11g()
1776 for (i = 0; i < SAVE_RF_MAX; ++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()
1786 for (i = 0; i < SAVE_PHY6_MAX; ++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()
1807 RF_WRITE(mac, 0x7b, i); in bwi_rf_set_nrssi_ofs_11g()
1810 if (nrssi < 31 && rf7b == 0xffff) in bwi_rf_set_nrssi_ofs_11g()
1813 if (rf7b == 0xffff) 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()
1829 if (phy->phy_version == 0) 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()
1840 gains.tbl_gain2 = 0; in bwi_rf_set_nrssi_ofs_11g()
1844 RF_FILT_SETBITS(mac, 0x43, 0xf0, 0xf); in bwi_rf_set_nrssi_ofs_11g()
1849 for (i = 0; i < 4; ++i) { in bwi_rf_set_nrssi_ofs_11g()
1850 RF_WRITE(mac, 0x7b, i); in bwi_rf_set_nrssi_ofs_11g()
1853 if (nrssi > -31 && rf7b == 0xffff) in bwi_rf_set_nrssi_ofs_11g()
1856 if (rf7b == 0xffff) in bwi_rf_set_nrssi_ofs_11g()
1859 rf7b = 0; in bwi_rf_set_nrssi_ofs_11g()
1862 RF_WRITE(mac, 0x7b, rf7b); in bwi_rf_set_nrssi_ofs_11g()
1868 for (phy6_idx = 0; phy6_idx < 4; ++phy6_idx) { in bwi_rf_set_nrssi_ofs_11g()
1874 /* Saved PHY registers 0, 1, 2 are handled later */ in bwi_rf_set_nrssi_ofs_11g()
1878 for (i = SAVE_RF_MAX - 1; i >= 0; --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()
1893 PHY_WRITE(mac, save_phy_comm_regs[0], save_phy_comm[0]); in bwi_rf_set_nrssi_ofs_11g()
1910 { 0x7a, 0x52, 0x43 }; in bwi_rf_calc_nrssi_slope_11g()
1912 { 0x15, 0x5a, 0x59, 0x58 }; in bwi_rf_calc_nrssi_slope_11g()
1914 0x002e, 0x002f, 0x080f, 0x0810, in bwi_rf_calc_nrssi_slope_11g()
1915 0x0801, 0x0060, 0x0014, 0x0478 in bwi_rf_calc_nrssi_slope_11g()
1927 int i, phy3_idx = 0; 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()
1941 CSR_SETBITS_2(sc, BWI_RF_ANTDIV, 0x8000); in bwi_rf_calc_nrssi_slope_11g()
1943 for (i = 0; i < SAVE_RF_MAX; ++i) in bwi_rf_calc_nrssi_slope_11g()
1945 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwi_rf_calc_nrssi_slope_11g()
1952 for (i = 0; i < SAVE_PHY3_MAX; ++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()
1976 gains.tbl_gain1 = 0; in bwi_rf_calc_nrssi_slope_11g()
1978 gains.phy_gain = 0; 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()
1997 CSR_SETBITS_2(sc, BWI_RF_CHAN_EX, 0x2000); 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()
2008 gains.tbl_gain2 = 0; 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()
2028 if (nrssi[1] == nrssi[0]) in bwi_rf_calc_nrssi_slope_11g()
2029 rf->rf_nrssi_slope = 0x10000; in bwi_rf_calc_nrssi_slope_11g()
2031 rf->rf_nrssi_slope = 0x400000 / (nrssi[0] - nrssi[1]); in bwi_rf_calc_nrssi_slope_11g()
2032 if (nrssi[0] >= -4) { in bwi_rf_calc_nrssi_slope_11g()
2033 rf->rf_nrssi[0] = nrssi[1]; in bwi_rf_calc_nrssi_slope_11g()
2034 rf->rf_nrssi[1] = nrssi[0]; in bwi_rf_calc_nrssi_slope_11g()
2041 for (phy3_idx = 0; phy3_idx < 4; ++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()
2051 for (i = 0; i < SAVE_RF_MAX; ++i) in bwi_rf_calc_nrssi_slope_11g()
2058 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwi_rf_calc_nrssi_slope_11g()
2062 PHY_SETBITS(mac, 0x802, 0x3); in bwi_rf_calc_nrssi_slope_11g()
2064 PHY_SETBITS(mac, 0x429, 0x8000); in bwi_rf_calc_nrssi_slope_11g()
2087 d = 0x1f - rf->rf_nrssi[0]; in bwi_rf_init_sw_nrssi_table()
2088 for (i = 0; i < BWI_NRSSI_TBLSZ; ++i) { in bwi_rf_init_sw_nrssi_table()
2091 val = (((i - d) * rf->rf_nrssi_slope) / 0x10000) + 0x3a; in bwi_rf_init_sw_nrssi_table()
2092 if (val < 0) in bwi_rf_init_sw_nrssi_table()
2093 val = 0; in bwi_rf_init_sw_nrssi_table()
2094 else if (val > 0x3f) in bwi_rf_init_sw_nrssi_table()
2095 val = 0x3f; in bwi_rf_init_sw_nrssi_table()
2106 for (i = 0; i < BWI_NRSSI_TBLSZ; ++i) { in bwi_rf_init_hw_nrssi_table()
2128 (mac->mac_sc->sc_card_flags & BWI_CARD_F_SW_NRSSI) == 0) in bwi_rf_set_nrssi_thr_11b()
2135 thr = (rf->rf_nrssi[1] - rf->rf_nrssi[0]) * 32; in bwi_rf_set_nrssi_thr_11b()
2136 thr += 20 * (rf->rf_nrssi[0] + 1); in bwi_rf_set_nrssi_thr_11b()
2141 if (thr < 0) in bwi_rf_set_nrssi_thr_11b()
2142 thr = 0; in bwi_rf_set_nrssi_thr_11b()
2143 else if (thr > 0x3e) in bwi_rf_set_nrssi_thr_11b()
2144 thr = 0x3e; 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()
2164 val *= (rf->rf_nrssi[1] - rf->rf_nrssi[0]); in _nrssi_threshold()
2165 val += (rf->rf_nrssi[0] << 6); in _nrssi_threshold()
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()
2196 thr1 = 0x2b; in bwi_rf_set_nrssi_thr_11g()
2197 thr2 = 0x27; in bwi_rf_set_nrssi_thr_11g()
2199 thr1 = 0x2d; in bwi_rf_set_nrssi_thr_11g()
2200 thr2 = 0x2b; 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()
2208 #define NRSSI_THR1_MASK __BITS(5, 0) 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()
2232 for (i = 0; i < 2; ++i) { in bwi_rf_clear_tssi()
2237 for (i = 0; i < 2; ++i) { in bwi_rf_clear_tssi()
2253 rf->rf_nrssi_slope = 0; in bwi_rf_clear_state()
2254 rf->rf_nrssi[0] = BWI_INVALID_NRSSI; in bwi_rf_clear_state()
2257 for (i = 0; i < BWI_NRSSI_TBLSZ; ++i) in bwi_rf_clear_state()
2260 rf->rf_lo_gain = 0; in bwi_rf_clear_state()
2261 rf->rf_rx_gain = 0; in bwi_rf_clear_state()
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()
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()
2333 0xff00, 0x8); in bwi_rf_set_ant_mode()
2337 PHY_WRITE(mac, 0x49b, 0xdc); in bwi_rf_set_ant_mode()
2348 0xfc3f, val); in bwi_rf_set_ant_mode()
2350 0xfc3f, val); in bwi_rf_set_ant_mode()
2352 0xfc3f, val); in bwi_rf_set_ant_mode()
2356 CSR_SETBITS_2(sc, 0x5e, 0x4); in bwi_rf_set_ant_mode()
2358 CSR_WRITE_4(sc, 0x100, 0x1000000); in bwi_rf_set_ant_mode()
2360 CSR_WRITE_4(sc, 0x10c, 0x1000000); in bwi_rf_set_ant_mode()
2370 for (i = 0; i < 4; ) { in bwi_rf_get_latest_tssi()
2378 for (i = 0; i < 4; ++i) { in bwi_rf_get_latest_tssi()
2382 return 0; in bwi_rf_get_latest_tssi()
2392 #if 0 in bwi_rf_tssi2dbm()
2393 if (pwr_idx < 0 || pwr_idx >= BWI_TSSI_MAX) in bwi_rf_tssi2dbm()
2396 if (pwr_idx < 0) in bwi_rf_tssi2dbm()
2397 pwr_idx = 0; in bwi_rf_tssi2dbm()
2403 return 0; in bwi_rf_tssi2dbm()
2448 "lna_gain %d, phyinfo 0x%04x\n", in bwi_rf_calc_rssi_bcm2050()
2451 case 0: in bwi_rf_calc_rssi_bcm2050()
2554 val = 0; in bwi_rf_lo_measure_11b()
2555 for (i = 0; i < 10; ++i) { in bwi_rf_lo_measure_11b()
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()
2581 bphy_ctrl = 0; 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()
2602 regs.rf_52 &= 0xf0; in bwi_rf_lo_update_11b()
2604 PHY_WRITE(mac, 0x30, 0xff); in bwi_rf_lo_update_11b()
2605 CSR_WRITE_2(sc, BWI_PHY_CTRL, 0x3f3f); 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()
2622 rf_val = 0; in bwi_rf_lo_update_11b()
2625 for (i = 0; i < 4; ++i) { in bwi_rf_lo_update_11b()
2626 RF_WRITE(mac, 0x52, rf52 | i); in bwi_rf_lo_update_11b()
2629 for (i = 0; i < 10; ++i) { in bwi_rf_lo_update_11b()
2630 RF_WRITE(mac, 0x52, rf52 | i); in bwi_rf_lo_update_11b()
2638 RF_WRITE(mac, 0x52, rf52 | rf_val); in bwi_rf_lo_update_11b()
2643 phy_val = 0; in bwi_rf_lo_update_11b()
2652 phy2f = (0x100 * i) + j; in bwi_rf_lo_update_11b()
2653 if (j < 0) in bwi_rf_lo_update_11b()
2654 phy2f += 0x100; in bwi_rf_lo_update_11b()
2655 PHY_WRITE(mac, 0x2f, phy2f); 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()
2680 RF_FILT_SETBITS(mac, 0x52, 0xf, regs.rf_52); in bwi_rf_lo_update_11b()