Lines Matching +full:0 +full:x8006

143 	if (mac->mac_phy.hwpctl == 0 || mac->mac_phy.use_hwpctl == NULL)  in bwn_has_hwpctl()
144 return (0); in bwn_has_hwpctl()
169 } while(0) in bwn_phy_g_attach()
180 pg->pg_flags = 0; in bwn_phy_g_attach()
181 if (pab0 == 0 || pab1 == 0 || pab2 == 0 || pab0 == -1 || pab1 == -1 || in bwn_phy_g_attach()
185 return (0); in bwn_phy_g_attach()
188 pg->pg_idletssi = (bg == 0 || bg == -1) ? 62 : bg; in bwn_phy_g_attach()
194 for (i = 0; i < 64; i++) { in bwn_phy_g_attach()
196 int8_t j = 0; in bwn_phy_g_attach()
221 return (0); in bwn_phy_g_attach()
233 pg->pg_flags = 0; in bwn_phy_g_detach()
248 memset(pg, 0, sizeof(*pg)); in bwn_phy_g_init_pre()
253 memset(pg->pg_minlowsig, 0xff, sizeof(pg->pg_minlowsig)); in bwn_phy_g_init_pre()
255 for (i = 0; i < N(pg->pg_nrssi); i++) in bwn_phy_g_init_pre()
257 for (i = 0; i < N(pg->pg_nrssi_lt); i++) in bwn_phy_g_init_pre()
259 pg->pg_lofcal = 0xffff; in bwn_phy_g_init_pre()
260 pg->pg_initval = 0xffff; in bwn_phy_g_init_pre()
263 pg->pg_avgtssi = 0xff; in bwn_phy_g_init_pre()
265 pg->pg_loctl.tx_bias = 0xff; in bwn_phy_g_init_pre()
277 { 3, 0 }, { 1, 0 }, { 5, 0 }, { 7, 0 }, { 9, 0 }, { 2, 0 }, in bwn_phy_g_prepare_hw()
278 { 0, 0 }, { 4, 0 }, { 6, 0 }, { 8, 0 }, { 1, 1 }, { 2, 1 }, in bwn_phy_g_prepare_hw()
286 { 0, 1 }, { 2, 1 }, { 4, 1 }, { 6, 1 }, { 8, 1 }, { 9, 1 }, in bwn_phy_g_prepare_hw()
290 { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 } in bwn_phy_g_prepare_hw()
295 if (phy->rf_ver == 0x2050 && phy->rf_rev < 6) in bwn_phy_g_prepare_hw()
296 pg->pg_bbatt.att = 0; in bwn_phy_g_prepare_hw()
301 pg->pg_rfatt.padmix = 0; in bwn_phy_g_prepare_hw()
305 if (sc->sc_board_info.board_rev < 0x43) { in bwn_phy_g_prepare_hw()
308 } else if (sc->sc_board_info.board_rev < 0x51) { in bwn_phy_g_prepare_hw()
315 pg->pg_rfatt.att = 0x60; in bwn_phy_g_prepare_hw()
320 case 0x2050: in bwn_phy_g_prepare_hw()
322 case 0: in bwn_phy_g_prepare_hw()
384 pg->pg_rfatt.att = 0xa; in bwn_phy_g_prepare_hw()
393 case 0x2053: in bwn_phy_g_prepare_hw()
408 lo->rfatt.min = 0; in bwn_phy_g_prepare_hw()
412 if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) { in bwn_phy_g_prepare_hw()
415 lo->rfatt.min = 0; in bwn_phy_g_prepare_hw()
421 lo->rfatt.min = 0; in bwn_phy_g_prepare_hw()
426 lo->bbatt.min = 0; in bwn_phy_g_prepare_hw()
431 phy->gmode = 0; in bwn_phy_g_prepare_hw()
432 bwn_reset_core(mac, 0); in bwn_phy_g_prepare_hw()
437 return (0); in bwn_phy_g_prepare_hw()
445 if (phy->rf_ver != 0x2050) in bwn_phy_g_txctl()
446 return (0); in bwn_phy_g_txctl()
453 return (0); in bwn_phy_g_txctl()
461 return (0); in bwn_phy_g_init()
499 BWN_WRITE_2(mac, BWN_RFCTL, reg | 0x80); in bwn_phy_g_rf_read()
531 BWN_PHY_WRITE(mac, 0x15, 0x8000); in bwn_phy_g_rf_onoff()
532 BWN_PHY_WRITE(mac, 0x15, 0xcc00); in bwn_phy_g_rf_onoff()
533 BWN_PHY_WRITE(mac, 0x15, (phy->gmode ? 0xc0 : 0x0)); in bwn_phy_g_rf_onoff()
543 bwn_phy_g_switch_chan(mac, channel, 0); in bwn_phy_g_rf_onoff()
552 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, rfover | 0x008c); in bwn_phy_g_rf_onoff()
553 BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfoverval & 0xff73); in bwn_phy_g_rf_onoff()
562 bwn_phy_g_switch_chan(mac, newchan, 0); in bwn_phy_g_switch_channel()
564 return (0); in bwn_phy_g_switch_channel()
579 int autodiv = 0; in bwn_phy_g_set_antenna()
611 (BWN_PHY_READ(mac, BWN_PHY_DIVSRCHGAINBACK) & 0xff00) | in bwn_phy_g_set_antenna()
612 0x15); in bwn_phy_g_set_antenna()
617 (BWN_PHY_READ(mac, BWN_PHY_ADIVRELATED) & 0xff00) | in bwn_phy_g_set_antenna()
621 BWN_PHY_WRITE(mac, BWN_PHY_OFDM9B, 0xdc); in bwn_phy_g_set_antenna()
636 if (phy->rev == 0 || !phy->gmode) in bwn_phy_g_im()
639 pg->pg_aci_wlan_automatic = 0; in bwn_phy_g_im()
640 return (0); in bwn_phy_g_im()
659 if (cck < 0 && ofdm < 0) { in bwn_phy_g_recalc_txpwr()
660 if (ignore_tssi == 0) in bwn_phy_g_recalc_txpwr()
662 cck = 0; in bwn_phy_g_recalc_txpwr()
663 ofdm = 0; in bwn_phy_g_recalc_txpwr()
665 tssi = (cck < 0) ? ofdm : ((ofdm < 0) ? cck : (cck + ofdm) / 2); in bwn_phy_g_recalc_txpwr()
666 if (pg->pg_avgtssi != 0xff) in bwn_phy_g_recalc_txpwr()
680 power = MIN(MAX((phy->txpower < 0) ? 0 : (phy->txpower << 2), 0), max) - in bwn_phy_g_recalc_txpwr()
682 tssi, 0x00), 0x3f)]); in bwn_phy_g_recalc_txpwr()
683 if (power == 0) in bwn_phy_g_recalc_txpwr()
688 if ((rfatt == 0) && (bbatt == 0)) in bwn_phy_g_recalc_txpwr()
715 if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 2)) { in bwn_phy_g_set_txpwr()
717 if (txctl == 0) { in bwn_phy_g_set_txpwr()
727 txctl = 0; in bwn_phy_g_set_txpwr()
763 uint8_t expired = 0; in bwn_phy_g_task_15s()
775 bwn_phy_g_dc_lookup_init(mac, 0); in bwn_phy_g_task_15s()
825 if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 8)) { in bwn_phy_g_task_60s()
836 BWN_WRITE_2(mac, BWN_PHY0, on ? 0 : 0xf4); in bwn_phy_switch_analog()
856 BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, 0); in bwn_phy_g_init_sub()
857 BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL, 0); in bwn_phy_g_init_sub()
860 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0); in bwn_phy_g_init_sub()
861 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0); in bwn_phy_g_init_sub()
864 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x400); in bwn_phy_g_init_sub()
865 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0); in bwn_phy_g_init_sub()
871 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc2), 0x1816); in bwn_phy_g_init_sub()
872 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc3), 0x8006); in bwn_phy_g_init_sub()
875 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xcc), 0x00ff, in bwn_phy_g_init_sub()
876 0x1f00); in bwn_phy_g_init_sub()
880 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x7e), 0x78); in bwn_phy_g_init_sub()
882 BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x80); in bwn_phy_g_init_sub()
883 BWN_PHY_SET(mac, BWN_PHY_OFDM(0x3e), 0x4); in bwn_phy_g_init_sub()
889 if (pg->pg_initval == 0xffff) in bwn_phy_g_init_sub()
892 BWN_RF_WRITE(mac, 0x0078, pg->pg_initval); in bwn_phy_g_init_sub()
896 BWN_RF_WRITE(mac, 0x52, in bwn_phy_g_init_sub()
897 (BWN_RF_READ(mac, 0x52) & 0xff00) in bwn_phy_g_init_sub()
901 BWN_RF_SETMASK(mac, 0x52, 0xfff0, pg->pg_loctl.tx_bias); in bwn_phy_g_init_sub()
904 BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x36), 0x0fff, in bwn_phy_g_init_sub()
908 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8075); in bwn_phy_g_init_sub()
910 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x807f); in bwn_phy_g_init_sub()
912 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x101); in bwn_phy_g_init_sub()
914 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x202); in bwn_phy_g_init_sub()
917 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078); in bwn_phy_g_init_sub()
921 for (i = 0; i < 64; i++) { in bwn_phy_g_init_sub()
924 (uint16_t)MIN(MAX(bwn_nrssi_read(mac, i) - 0xffff, in bwn_phy_g_init_sub()
929 if (pg->pg_nrssi[0] == -1000) { in bwn_phy_g_init_sub()
937 BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x05), 0x3230); in bwn_phy_g_init_sub()
940 && sc->sc_cid.chip_pkg == 2) || 0) { in bwn_phy_g_init_sub()
941 BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0xbfff); in bwn_phy_g_init_sub()
942 BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xc3), 0x7fff); in bwn_phy_g_init_sub()
956 BWN_RF_SET(mac, 0x007a, 0x0050); in bwn_phy_init_b5()
959 value = 0x2120; in bwn_phy_init_b5()
960 for (offset = 0x00a8; offset < 0x00c7; offset++) { in bwn_phy_init_b5()
962 value += 0x202; in bwn_phy_init_b5()
965 BWN_PHY_SETMASK(mac, 0x0035, 0xf0ff, 0x0700); in bwn_phy_init_b5()
966 if (phy->rf_ver == 0x2050) in bwn_phy_init_b5()
967 BWN_PHY_WRITE(mac, 0x0038, 0x0667); in bwn_phy_init_b5()
970 if (phy->rf_ver == 0x2050) { in bwn_phy_init_b5()
971 BWN_RF_SET(mac, 0x007a, 0x0020); in bwn_phy_init_b5()
972 BWN_RF_SET(mac, 0x0051, 0x0004); in bwn_phy_init_b5()
974 BWN_WRITE_2(mac, BWN_PHY_RADIO, 0x0000); in bwn_phy_init_b5()
976 BWN_PHY_SET(mac, 0x0802, 0x0100); in bwn_phy_init_b5()
977 BWN_PHY_SET(mac, 0x042b, 0x2000); in bwn_phy_init_b5()
979 BWN_PHY_WRITE(mac, 0x001c, 0x186a); in bwn_phy_init_b5()
981 BWN_PHY_SETMASK(mac, 0x0013, 0x00ff, 0x1900); in bwn_phy_init_b5()
982 BWN_PHY_SETMASK(mac, 0x0035, 0xffc0, 0x0064); in bwn_phy_init_b5()
983 BWN_PHY_SETMASK(mac, 0x005d, 0xff80, 0x000a); in bwn_phy_init_b5()
990 BWN_PHY_WRITE(mac, 0x0026, 0xce00); in bwn_phy_init_b5()
991 BWN_PHY_WRITE(mac, 0x0021, 0x3763); in bwn_phy_init_b5()
992 BWN_PHY_WRITE(mac, 0x0022, 0x1bc3); in bwn_phy_init_b5()
993 BWN_PHY_WRITE(mac, 0x0023, 0x06f9); in bwn_phy_init_b5()
994 BWN_PHY_WRITE(mac, 0x0024, 0x037e); in bwn_phy_init_b5()
996 BWN_PHY_WRITE(mac, 0x0026, 0xcc00); in bwn_phy_init_b5()
997 BWN_PHY_WRITE(mac, 0x0030, 0x00c6); in bwn_phy_init_b5()
998 BWN_WRITE_2(mac, 0x03ec, 0x3f22); in bwn_phy_init_b5()
1001 BWN_PHY_WRITE(mac, 0x0020, 0x3e1c); in bwn_phy_init_b5()
1003 BWN_PHY_WRITE(mac, 0x0020, 0x301c); in bwn_phy_init_b5()
1005 if (phy->analog == 0) in bwn_phy_init_b5()
1006 BWN_WRITE_2(mac, 0x03e4, 0x3000); in bwn_phy_init_b5()
1009 bwn_phy_g_switch_chan(mac, 7, 0); in bwn_phy_init_b5()
1011 if (phy->rf_ver != 0x2050) { in bwn_phy_init_b5()
1012 BWN_RF_WRITE(mac, 0x0075, 0x0080); in bwn_phy_init_b5()
1013 BWN_RF_WRITE(mac, 0x0079, 0x0081); in bwn_phy_init_b5()
1016 BWN_RF_WRITE(mac, 0x0050, 0x0020); in bwn_phy_init_b5()
1017 BWN_RF_WRITE(mac, 0x0050, 0x0023); in bwn_phy_init_b5()
1019 if (phy->rf_ver == 0x2050) { in bwn_phy_init_b5()
1020 BWN_RF_WRITE(mac, 0x0050, 0x0020); in bwn_phy_init_b5()
1021 BWN_RF_WRITE(mac, 0x005a, 0x0070); in bwn_phy_init_b5()
1024 BWN_RF_WRITE(mac, 0x005b, 0x007b); in bwn_phy_init_b5()
1025 BWN_RF_WRITE(mac, 0x005c, 0x00b0); in bwn_phy_init_b5()
1026 BWN_RF_SET(mac, 0x007a, 0x0007); in bwn_phy_init_b5()
1028 bwn_phy_g_switch_chan(mac, old_channel, 0); in bwn_phy_init_b5()
1029 BWN_PHY_WRITE(mac, 0x0014, 0x0080); in bwn_phy_init_b5()
1030 BWN_PHY_WRITE(mac, 0x0032, 0x00ca); in bwn_phy_init_b5()
1031 BWN_PHY_WRITE(mac, 0x002a, 0x88a3); in bwn_phy_init_b5()
1036 if (phy->rf_ver == 0x2050) in bwn_phy_init_b5()
1037 BWN_RF_WRITE(mac, 0x005d, 0x000d); in bwn_phy_init_b5()
1039 BWN_WRITE_2(mac, 0x03e4, (BWN_READ_2(mac, 0x03e4) & 0xffc0) | 0x0004); in bwn_phy_init_b5()
1048 uint16_t backup_phy[16] = { 0 }; in bwn_loopback_calcgain()
1055 backup_phy[0] = BWN_PHY_READ(mac, BWN_PHY_CRS0); in bwn_loopback_calcgain()
1063 backup_phy[6] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a)); in bwn_loopback_calcgain()
1064 backup_phy[7] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59)); in bwn_loopback_calcgain()
1065 backup_phy[8] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58)); in bwn_loopback_calcgain()
1066 backup_phy[9] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x0a)); in bwn_loopback_calcgain()
1067 backup_phy[10] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x03)); in bwn_loopback_calcgain()
1070 backup_phy[13] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2b)); in bwn_loopback_calcgain()
1074 backup_radio[0] = BWN_RF_READ(mac, 0x52); in bwn_loopback_calcgain()
1075 backup_radio[1] = BWN_RF_READ(mac, 0x43); in bwn_loopback_calcgain()
1076 backup_radio[2] = BWN_RF_READ(mac, 0x7a); in bwn_loopback_calcgain()
1078 BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x3fff); in bwn_loopback_calcgain()
1079 BWN_PHY_SET(mac, BWN_PHY_CCKBBANDCFG, 0x8000); in bwn_loopback_calcgain()
1080 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0002); in bwn_loopback_calcgain()
1081 BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffd); in bwn_loopback_calcgain()
1082 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0001); in bwn_loopback_calcgain()
1083 BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffe); in bwn_loopback_calcgain()
1085 BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0001); in bwn_loopback_calcgain()
1086 BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffe); in bwn_loopback_calcgain()
1087 BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0002); in bwn_loopback_calcgain()
1088 BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffd); in bwn_loopback_calcgain()
1090 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x000c); in bwn_loopback_calcgain()
1091 BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x000c); in bwn_loopback_calcgain()
1092 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0030); in bwn_loopback_calcgain()
1093 BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xffcf, 0x10); in bwn_loopback_calcgain()
1095 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0780); in bwn_loopback_calcgain()
1096 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810); in bwn_loopback_calcgain()
1097 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d); in bwn_loopback_calcgain()
1099 BWN_PHY_SET(mac, BWN_PHY_CCK(0x0a), 0x2000); in bwn_loopback_calcgain()
1101 BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0004); in bwn_loopback_calcgain()
1102 BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffb); in bwn_loopback_calcgain()
1104 BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xff9f, 0x40); in bwn_loopback_calcgain()
1107 BWN_RF_WRITE(mac, 0x43, 0x000f); in bwn_loopback_calcgain()
1109 BWN_RF_WRITE(mac, 0x52, 0); in bwn_loopback_calcgain()
1110 BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x9); in bwn_loopback_calcgain()
1115 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020); in bwn_loopback_calcgain()
1117 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020); in bwn_loopback_calcgain()
1118 BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0); in bwn_loopback_calcgain()
1120 BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xffc0, 0x01); in bwn_loopback_calcgain()
1121 BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xc0ff, 0x800); in bwn_loopback_calcgain()
1123 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0100); in bwn_loopback_calcgain()
1124 BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xcfff); in bwn_loopback_calcgain()
1128 BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0800); in bwn_loopback_calcgain()
1129 BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x8000); in bwn_loopback_calcgain()
1132 BWN_RF_MASK(mac, 0x7a, 0x00f7); in bwn_loopback_calcgain()
1134 j = 0; in bwn_loopback_calcgain()
1136 for (i = 0; i < loop_i_max; i++) { in bwn_loopback_calcgain()
1137 for (j = 0; j < 16; j++) { in bwn_loopback_calcgain()
1138 BWN_RF_WRITE(mac, 0x43, i); in bwn_loopback_calcgain()
1139 BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff, in bwn_loopback_calcgain()
1141 BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000); in bwn_loopback_calcgain()
1142 BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000); in bwn_loopback_calcgain()
1144 if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc) in bwn_loopback_calcgain()
1152 BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x30); in bwn_loopback_calcgain()
1153 trsw_rx = 0x1b; in bwn_loopback_calcgain()
1155 BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff, j << 8); in bwn_loopback_calcgain()
1156 BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000); in bwn_loopback_calcgain()
1157 BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000); in bwn_loopback_calcgain()
1160 if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc) in bwn_loopback_calcgain()
1164 trsw_rx = 0x18; in bwn_loopback_calcgain()
1171 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), backup_phy[6]); in bwn_loopback_calcgain()
1172 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), backup_phy[7]); in bwn_loopback_calcgain()
1173 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), backup_phy[8]); in bwn_loopback_calcgain()
1174 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x0a), backup_phy[9]); in bwn_loopback_calcgain()
1175 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x03), backup_phy[10]); in bwn_loopback_calcgain()
1178 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), backup_phy[13]); in bwn_loopback_calcgain()
1183 BWN_RF_WRITE(mac, 0x52, backup_radio[0]); in bwn_loopback_calcgain()
1184 BWN_RF_WRITE(mac, 0x43, backup_radio[1]); in bwn_loopback_calcgain()
1185 BWN_RF_WRITE(mac, 0x7a, backup_radio[2]); in bwn_loopback_calcgain()
1187 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, backup_phy[2] | 0x0003); in bwn_loopback_calcgain()
1191 BWN_PHY_WRITE(mac, BWN_PHY_CRS0, backup_phy[0]); in bwn_loopback_calcgain()
1203 uint32_t tmp1 = 0, tmp2 = 0; in bwn_rf_init_bcm2050()
1208 0x02, 0x03, 0x01, 0x0f, in bwn_rf_init_bcm2050()
1209 0x06, 0x07, 0x05, 0x0f, in bwn_rf_init_bcm2050()
1210 0x0a, 0x0b, 0x09, 0x0f, in bwn_rf_init_bcm2050()
1211 0x0e, 0x0f, 0x0d, 0x0f, in bwn_rf_init_bcm2050()
1215 rfoverval = rfover = cck3 = 0; in bwn_rf_init_bcm2050()
1216 radio0 = BWN_RF_READ(mac, 0x43); in bwn_rf_init_bcm2050()
1217 radio1 = BWN_RF_READ(mac, 0x51); in bwn_rf_init_bcm2050()
1218 radio2 = BWN_RF_READ(mac, 0x52); in bwn_rf_init_bcm2050()
1220 cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a)); in bwn_rf_init_bcm2050()
1221 cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59)); in bwn_rf_init_bcm2050()
1222 cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58)); in bwn_rf_init_bcm2050()
1225 cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30)); in bwn_rf_init_bcm2050()
1226 reg0 = BWN_READ_2(mac, 0x3ec); in bwn_rf_init_bcm2050()
1228 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0xff); in bwn_rf_init_bcm2050()
1229 BWN_WRITE_2(mac, 0x3ec, 0x3f3f); in bwn_rf_init_bcm2050()
1238 BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003); in bwn_rf_init_bcm2050()
1239 BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc); in bwn_rf_init_bcm2050()
1240 BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff); in bwn_rf_init_bcm2050()
1241 BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc); in bwn_rf_init_bcm2050()
1246 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020); in bwn_rf_init_bcm2050()
1248 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020); in bwn_rf_init_bcm2050()
1249 BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0); in bwn_rf_init_bcm2050()
1254 BWN_LPD(0, 1, 1))); in bwn_rf_init_bcm2050()
1256 bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVER, 0)); in bwn_rf_init_bcm2050()
1258 BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2) | 0x8000); in bwn_rf_init_bcm2050()
1261 BWN_PHY_MASK(mac, BWN_PHY_SYNCCTL, 0xff7f); in bwn_rf_init_bcm2050()
1262 reg1 = BWN_READ_2(mac, 0x3e6); in bwn_rf_init_bcm2050()
1263 reg2 = BWN_READ_2(mac, 0x3f4); in bwn_rf_init_bcm2050()
1265 if (phy->analog == 0) in bwn_rf_init_bcm2050()
1266 BWN_WRITE_2(mac, 0x03e6, 0x0122); in bwn_rf_init_bcm2050()
1269 BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xffbf, 0x40); in bwn_rf_init_bcm2050()
1271 (BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000)); in bwn_rf_init_bcm2050()
1274 reg = BWN_RF_READ(mac, 0x60); in bwn_rf_init_bcm2050()
1275 index = (reg & 0x001e) >> 1; in bwn_rf_init_bcm2050()
1276 rcc = (((rcc_table[index] << 1) | (reg & 0x0001)) | 0x0020); in bwn_rf_init_bcm2050()
1279 BWN_RF_WRITE(mac, 0x78, 0x26); in bwn_rf_init_bcm2050()
1283 BWN_LPD(0, 1, 1))); in bwn_rf_init_bcm2050()
1285 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfaf); in bwn_rf_init_bcm2050()
1286 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1403); in bwn_rf_init_bcm2050()
1290 BWN_LPD(0, 0, 1))); in bwn_rf_init_bcm2050()
1292 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfa0); in bwn_rf_init_bcm2050()
1293 BWN_RF_SET(mac, 0x51, 0x0004); in bwn_rf_init_bcm2050()
1295 BWN_RF_WRITE(mac, 0x43, 0x1f); in bwn_rf_init_bcm2050()
1297 BWN_RF_WRITE(mac, 0x52, 0); in bwn_rf_init_bcm2050()
1298 BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x0009); in bwn_rf_init_bcm2050()
1300 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0); in bwn_rf_init_bcm2050()
1302 for (i = 0; i < 16; i++) { in bwn_rf_init_bcm2050()
1303 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0480); in bwn_rf_init_bcm2050()
1304 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810); in bwn_rf_init_bcm2050()
1305 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d); in bwn_rf_init_bcm2050()
1309 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1311 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0); in bwn_rf_init_bcm2050()
1316 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1318 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0); in bwn_rf_init_bcm2050()
1323 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0))); in bwn_rf_init_bcm2050()
1325 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0); in bwn_rf_init_bcm2050()
1328 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0); in bwn_rf_init_bcm2050()
1332 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1334 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0); in bwn_rf_init_bcm2050()
1338 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0); in bwn_rf_init_bcm2050()
1342 for (i = 0; i < 16; i++) { in bwn_rf_init_bcm2050()
1343 radio78 = (BWN_BITREV4(i) << 1) | 0x0020; in bwn_rf_init_bcm2050()
1344 BWN_RF_WRITE(mac, 0x78, radio78); in bwn_rf_init_bcm2050()
1346 for (j = 0; j < 16; j++) { in bwn_rf_init_bcm2050()
1347 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0d80); in bwn_rf_init_bcm2050()
1348 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810); in bwn_rf_init_bcm2050()
1349 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d); in bwn_rf_init_bcm2050()
1353 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1355 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0); in bwn_rf_init_bcm2050()
1360 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1362 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0); in bwn_rf_init_bcm2050()
1367 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0))); in bwn_rf_init_bcm2050()
1369 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0); in bwn_rf_init_bcm2050()
1372 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0); in bwn_rf_init_bcm2050()
1376 BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1))); in bwn_rf_init_bcm2050()
1378 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0); in bwn_rf_init_bcm2050()
1387 BWN_RF_WRITE(mac, 0x51, radio1); in bwn_rf_init_bcm2050()
1388 BWN_RF_WRITE(mac, 0x52, radio2); in bwn_rf_init_bcm2050()
1389 BWN_RF_WRITE(mac, 0x43, radio0); in bwn_rf_init_bcm2050()
1390 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), cck0); in bwn_rf_init_bcm2050()
1391 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), cck1); in bwn_rf_init_bcm2050()
1392 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), cck2); in bwn_rf_init_bcm2050()
1393 BWN_WRITE_2(mac, 0x3e6, reg1); in bwn_rf_init_bcm2050()
1394 if (phy->analog != 0) in bwn_rf_init_bcm2050()
1395 BWN_WRITE_2(mac, 0x3f4, reg2); in bwn_rf_init_bcm2050()
1399 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), cck3); in bwn_rf_init_bcm2050()
1400 BWN_WRITE_2(mac, 0x3ec, reg0); in bwn_rf_init_bcm2050()
1404 & 0x7fff); in bwn_rf_init_bcm2050()
1433 BWN_PHY_WRITE(mac, 0x003e, 0x817a); in bwn_phy_init_b6()
1434 BWN_RF_WRITE(mac, 0x007a, BWN_RF_READ(mac, 0x007a) | 0x0058); in bwn_phy_init_b6()
1436 BWN_RF_WRITE(mac, 0x51, 0x37); in bwn_phy_init_b6()
1437 BWN_RF_WRITE(mac, 0x52, 0x70); in bwn_phy_init_b6()
1438 BWN_RF_WRITE(mac, 0x53, 0xb3); in bwn_phy_init_b6()
1439 BWN_RF_WRITE(mac, 0x54, 0x9b); in bwn_phy_init_b6()
1440 BWN_RF_WRITE(mac, 0x5a, 0x88); in bwn_phy_init_b6()
1441 BWN_RF_WRITE(mac, 0x5b, 0x88); in bwn_phy_init_b6()
1442 BWN_RF_WRITE(mac, 0x5d, 0x88); in bwn_phy_init_b6()
1443 BWN_RF_WRITE(mac, 0x5e, 0x88); in bwn_phy_init_b6()
1444 BWN_RF_WRITE(mac, 0x7d, 0x88); in bwn_phy_init_b6()
1449 BWN_RF_WRITE(mac, 0x51, 0); in bwn_phy_init_b6()
1450 BWN_RF_WRITE(mac, 0x52, 0x40); in bwn_phy_init_b6()
1451 BWN_RF_WRITE(mac, 0x53, 0xb7); in bwn_phy_init_b6()
1452 BWN_RF_WRITE(mac, 0x54, 0x98); in bwn_phy_init_b6()
1453 BWN_RF_WRITE(mac, 0x5a, 0x88); in bwn_phy_init_b6()
1454 BWN_RF_WRITE(mac, 0x5b, 0x6b); in bwn_phy_init_b6()
1455 BWN_RF_WRITE(mac, 0x5c, 0x0f); in bwn_phy_init_b6()
1457 BWN_RF_WRITE(mac, 0x5d, 0xfa); in bwn_phy_init_b6()
1458 BWN_RF_WRITE(mac, 0x5e, 0xd8); in bwn_phy_init_b6()
1460 BWN_RF_WRITE(mac, 0x5d, 0xf5); in bwn_phy_init_b6()
1461 BWN_RF_WRITE(mac, 0x5e, 0xb8); in bwn_phy_init_b6()
1463 BWN_RF_WRITE(mac, 0x0073, 0x0003); in bwn_phy_init_b6()
1464 BWN_RF_WRITE(mac, 0x007d, 0x00a8); in bwn_phy_init_b6()
1465 BWN_RF_WRITE(mac, 0x007c, 0x0001); in bwn_phy_init_b6()
1466 BWN_RF_WRITE(mac, 0x007e, 0x0008); in bwn_phy_init_b6()
1468 for (val = 0x1e1f, offset = 0x0088; offset < 0x0098; offset++) { in bwn_phy_init_b6()
1470 val -= 0x0202; in bwn_phy_init_b6()
1472 for (val = 0x3e3f, offset = 0x0098; offset < 0x00a8; offset++) { in bwn_phy_init_b6()
1474 val -= 0x0202; in bwn_phy_init_b6()
1476 for (val = 0x2120, offset = 0x00a8; offset < 0x00c8; offset++) { in bwn_phy_init_b6()
1477 BWN_PHY_WRITE(mac, offset, (val & 0x3f3f)); in bwn_phy_init_b6()
1478 val += 0x0202; in bwn_phy_init_b6()
1481 BWN_RF_SET(mac, 0x007a, 0x0020); in bwn_phy_init_b6()
1482 BWN_RF_SET(mac, 0x0051, 0x0004); in bwn_phy_init_b6()
1483 BWN_PHY_SET(mac, 0x0802, 0x0100); in bwn_phy_init_b6()
1484 BWN_PHY_SET(mac, 0x042b, 0x2000); in bwn_phy_init_b6()
1485 BWN_PHY_WRITE(mac, 0x5b, 0); in bwn_phy_init_b6()
1486 BWN_PHY_WRITE(mac, 0x5c, 0); in bwn_phy_init_b6()
1490 bwn_phy_g_switch_chan(mac, (old_channel >= 8) ? 1 : 13, 0); in bwn_phy_init_b6()
1492 BWN_RF_WRITE(mac, 0x0050, 0x0020); in bwn_phy_init_b6()
1493 BWN_RF_WRITE(mac, 0x0050, 0x0023); in bwn_phy_init_b6()
1496 BWN_RF_WRITE(mac, 0x7c, BWN_RF_READ(mac, 0x7c) | 0x0002); in bwn_phy_init_b6()
1497 BWN_RF_WRITE(mac, 0x50, 0x20); in bwn_phy_init_b6()
1500 BWN_RF_WRITE(mac, 0x7c, 0x20); in bwn_phy_init_b6()
1501 BWN_RF_WRITE(mac, 0x5a, 0x70); in bwn_phy_init_b6()
1502 BWN_RF_WRITE(mac, 0x5b, 0x7b); in bwn_phy_init_b6()
1503 BWN_RF_WRITE(mac, 0x5c, 0xb0); in bwn_phy_init_b6()
1505 BWN_RF_SETMASK(mac, 0x007a, 0x00f8, 0x0007); in bwn_phy_init_b6()
1507 bwn_phy_g_switch_chan(mac, old_channel, 0); in bwn_phy_init_b6()
1509 BWN_PHY_WRITE(mac, 0x0014, 0x0200); in bwn_phy_init_b6()
1511 BWN_PHY_WRITE(mac, 0x2a, 0x88c2); in bwn_phy_init_b6()
1513 BWN_PHY_WRITE(mac, 0x2a, 0x8ac0); in bwn_phy_init_b6()
1514 BWN_PHY_WRITE(mac, 0x0038, 0x0668); in bwn_phy_init_b6()
1518 BWN_PHY_SETMASK(mac, 0x5d, 0xff80, 0x0003); in bwn_phy_init_b6()
1520 BWN_RF_WRITE(mac, 0x005d, 0x000d); in bwn_phy_init_b6()
1523 BWN_WRITE_2(mac, 0x3e4, 9); in bwn_phy_init_b6()
1524 BWN_PHY_MASK(mac, 0x61, 0x0fff); in bwn_phy_init_b6()
1526 BWN_PHY_SETMASK(mac, 0x0002, 0xffc0, 0x0004); in bwn_phy_init_b6()
1528 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_phy_init_b6()
1530 BWN_WRITE_2(mac, 0x03e6, 0x0); in bwn_phy_init_b6()
1544 BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x1000); in bwn_phy_init_a()
1546 BWN_PHY_SET(mac, BWN_PHY_ENCORE, 0x0010); in bwn_phy_init_a()
1548 BWN_PHY_MASK(mac, BWN_PHY_ENCORE, ~0x1010); in bwn_phy_init_a()
1555 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x6e), 0xe000, 0x3cf); in bwn_phy_init_a()
1563 for (i = 0; i < BWN_TAB_NOISESCALE_SIZE; i++) in bwn_wa_write_noisescale()
1573 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 0, 254); in bwn_wa_agc()
1577 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 0, 0x2710); in bwn_wa_agc()
1578 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 1, 0x9b83); in bwn_wa_agc()
1579 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 2, 0x9b83); in bwn_wa_agc()
1580 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 3, 0x0f8d); in bwn_wa_agc()
1583 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 0, 254); in bwn_wa_agc()
1589 BWN_PHY_SETMASK(mac, BWN_PHY_CCKSHIFTBITS_WA, (uint16_t)~0xff00, in bwn_wa_agc()
1590 0x5700); in bwn_wa_agc()
1591 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x007f, 0x000f); in bwn_wa_agc()
1592 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x3f80, 0x2b80); in bwn_wa_agc()
1593 BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, 0xf0ff, 0x0300); in bwn_wa_agc()
1594 BWN_RF_SET(mac, 0x7a, 0x0008); in bwn_wa_agc()
1595 BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x000f, 0x0008); in bwn_wa_agc()
1596 BWN_PHY_SETMASK(mac, BWN_PHY_P1P2GAIN, ~0x0f00, 0x0600); in bwn_wa_agc()
1597 BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x0f00, 0x0700); in bwn_wa_agc()
1598 BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x0f00, 0x0100); in bwn_wa_agc()
1600 BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x000f, 0x0007); in bwn_wa_agc()
1601 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x00ff, 0x001c); in bwn_wa_agc()
1602 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x3f00, 0x0200); in bwn_wa_agc()
1603 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), ~0x00ff, 0x001c); in bwn_wa_agc()
1604 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x00ff, 0x0020); in bwn_wa_agc()
1605 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x3f00, 0x0200); in bwn_wa_agc()
1606 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x82), ~0x00ff, 0x002e); in bwn_wa_agc()
1607 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), (uint16_t)~0xff00, 0x1a00); in bwn_wa_agc()
1608 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), ~0x00ff, 0x0028); in bwn_wa_agc()
1609 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), (uint16_t)~0xff00, 0x2c00); in bwn_wa_agc()
1611 BWN_PHY_WRITE(mac, BWN_PHY_PEAK_COUNT, 0x092b); in bwn_wa_agc()
1612 BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e, 0x0002); in bwn_wa_agc()
1614 BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e); in bwn_wa_agc()
1615 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x1f), 0x287a); in bwn_wa_agc()
1616 BWN_PHY_SETMASK(mac, BWN_PHY_LPFGAINCTL, ~0x000f, 0x0004); in bwn_wa_agc()
1618 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x22), 0x287a); in bwn_wa_agc()
1620 (uint16_t)~0xf000, 0x3000); in bwn_wa_agc()
1623 BWN_PHY_SETMASK(mac, BWN_PHY_DIVSRCHIDX, 0x8080, 0x7874); in bwn_wa_agc()
1624 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8e), 0x1c00); in bwn_wa_agc()
1626 BWN_PHY_SETMASK(mac, BWN_PHY_DIVP1P2GAIN, ~0x0f00, 0x0600); in bwn_wa_agc()
1627 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8b), 0x005e); in bwn_wa_agc()
1628 BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, ~0x00ff, 0x001e); in bwn_wa_agc()
1629 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8d), 0x0002); in bwn_wa_agc()
1630 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 0, 0); in bwn_wa_agc()
1635 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 0, 0); in bwn_wa_agc()
1641 BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x0003); in bwn_wa_agc()
1642 BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x1000); in bwn_wa_agc()
1660 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19); in bwn_wa_grev1()
1662 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861); in bwn_wa_grev1()
1663 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271); in bwn_wa_grev1()
1664 BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800); in bwn_wa_grev1()
1666 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098); in bwn_wa_grev1()
1667 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070); in bwn_wa_grev1()
1668 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080); in bwn_wa_grev1()
1669 BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800); in bwn_wa_grev1()
1671 BWN_PHY_SETMASK(mac, BWN_PHY_CRS0, ~0x03c0, 0xd000); in bwn_wa_grev1()
1672 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x2c), 0x005a); in bwn_wa_grev1()
1673 BWN_PHY_WRITE(mac, BWN_PHY_CCKSHIFTBITS, 0x0026); in bwn_wa_grev1()
1676 for (i = 0; i < N(bwn_tab_finefreqg); i++) in bwn_wa_grev1()
1682 for (i = 0; i < N(bwn_tab_noise_g1); i++) in bwn_wa_grev1()
1686 for (i = 0; i < N(bwn_tab_noise_g2); i++) in bwn_wa_grev1()
1690 for (i = 0; i < N(bwn_tab_rotor); i++) in bwn_wa_grev1()
1704 for (i = 0; i < N(bwn_tab_retard); i++) in bwn_wa_grev1()
1709 for (i = 0; i < 16; i++) in bwn_wa_grev1()
1711 i, 0x0020); in bwn_wa_grev1()
1713 for (i = 0; i < 32; i++) in bwn_wa_grev1()
1714 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820); in bwn_wa_grev1()
1730 bwn_gtab_write(mac, BWN_GTAB_ORIGTR, 0, 0xc480); in bwn_wa_grev26789()
1734 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19); in bwn_wa_grev26789()
1736 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861); in bwn_wa_grev26789()
1737 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271); in bwn_wa_grev26789()
1738 BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800); in bwn_wa_grev26789()
1740 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098); in bwn_wa_grev26789()
1741 BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070); in bwn_wa_grev26789()
1742 BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080); in bwn_wa_grev26789()
1743 BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800); in bwn_wa_grev26789()
1746 for (i = 0; i < 64; i++) in bwn_wa_grev26789()
1751 for (i = 0; i < N(bwn_tab_noise_g1); i++) in bwn_wa_grev26789()
1755 for (i = 0; i < N(bwn_tab_noise_g2); i++) in bwn_wa_grev26789()
1769 for (i = 0; i < N(bwn_tab_sigmasqr2); i++) in bwn_wa_grev26789()
1774 for (i = 0; i < 16; i++) in bwn_wa_grev26789()
1776 0x0020); in bwn_wa_grev26789()
1778 for (i = 0; i < 32; i++) in bwn_wa_grev26789()
1779 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820); in bwn_wa_grev26789()
1787 BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1808); in bwn_wa_grev26789()
1789 BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1000); in bwn_wa_grev26789()
1791 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 3, 0x1044); in bwn_wa_grev26789()
1792 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 4, 0x7201); in bwn_wa_grev26789()
1793 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 6, 0x0040); in bwn_wa_grev26789()
1820 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_wa_init()
1825 sc->sc_board_info.board_rev != 0x17) { in bwn_wa_init()
1828 0x0002); in bwn_wa_init()
1830 0x0001); in bwn_wa_init()
1832 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 1, 0x0002); in bwn_wa_init()
1833 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 2, 0x0001); in bwn_wa_init()
1837 BWN_PHY_MASK(mac, BWN_PHY_EXTG(0x11), 0xf7ff); in bwn_wa_init()
1839 0x0020, 0x0001); in bwn_wa_init()
1841 0x0021, 0x0001); in bwn_wa_init()
1843 0x0022, 0x0001); in bwn_wa_init()
1845 0x0023, 0x0000); in bwn_wa_init()
1847 0x0000, 0x0000); in bwn_wa_init()
1849 0x0003, 0x0002); in bwn_wa_init()
1854 BWN_PHY_WRITE(mac, BWN_PHY_GTABCTL, 0x3120); in bwn_wa_init()
1855 BWN_PHY_WRITE(mac, BWN_PHY_GTABDATA, 0xc480); in bwn_wa_init()
1858 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 0, 0); in bwn_wa_init()
1859 bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 1, 0); in bwn_wa_init()
1933 KASSERT((lna & ~BWN_PHY_RFOVERVAL_LNA) == 0, in bwn_lo_calcfeed()
1935 KASSERT((pga & ~BWN_PHY_RFOVERVAL_PGA) == 0, in bwn_lo_calcfeed()
1945 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300); in bwn_lo_calcfeed()
1954 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xf300); in bwn_lo_calcfeed()
1979 v = 0x30; in bwn_lo_txctl_regtable()
1981 reg = 0x43; in bwn_lo_txctl_regtable()
1982 padmix = 0; in bwn_lo_txctl_regtable()
1984 reg = 0x52; in bwn_lo_txctl_regtable()
1989 reg = 0x43; in bwn_lo_txctl_regtable()
1990 v = 0x10; in bwn_lo_txctl_regtable()
1993 reg = 0x52; in bwn_lo_txctl_regtable()
1994 v = 0x30; in bwn_lo_txctl_regtable()
2017 0x09, 0x08, 0x0a, 0x01, 0x00, in bwn_lo_measure_txctl_values()
2018 0x02, 0x05, 0x04, 0x06, in bwn_lo_measure_txctl_values()
2021 0x70, 0x40, in bwn_lo_measure_txctl_values()
2027 pga = 0; in bwn_lo_measure_txctl_values()
2031 trsw_rx = 0; in bwn_lo_measure_txctl_values()
2034 rf_pctl_reg = 0; in bwn_lo_measure_txctl_values()
2036 pga = MIN(MAX(pga, 0), 15); in bwn_lo_measure_txctl_values()
2041 pga = 0; in bwn_lo_measure_txctl_values()
2042 cmp_val = 0x24; in bwn_lo_measure_txctl_values()
2044 (phy->rf_ver == 0x2050) && (phy->rf_rev == 8)) in bwn_lo_measure_txctl_values()
2045 cmp_val = 0x3c; in bwn_lo_measure_txctl_values()
2049 if (tmp < 0) in bwn_lo_measure_txctl_values()
2061 BWN_RF_SETMASK(mac, 0x43, 0xfff0, rf_pctl_reg); in bwn_lo_measure_txctl_values()
2071 int min_feedth = 0xffff; in bwn_lo_measure_txctl_values()
2074 for (i = 0; i < N(tx_magn_values); i++) { in bwn_lo_measure_txctl_values()
2076 BWN_RF_SETMASK(mac, 0x52, 0xff0f, tx_magn); in bwn_lo_measure_txctl_values()
2077 for (j = 0; j < N(tx_bias_values); j++) { in bwn_lo_measure_txctl_values()
2079 BWN_RF_SETMASK(mac, 0x52, 0xfff0, tx_bias); in bwn_lo_measure_txctl_values()
2080 feedthrough = bwn_lo_calcfeed(mac, 0, pga, in bwn_lo_measure_txctl_values()
2087 if (lo->tx_bias == 0) in bwn_lo_measure_txctl_values()
2090 BWN_RF_WRITE(mac, 0x52, in bwn_lo_measure_txctl_values()
2091 (BWN_RF_READ(mac, 0x52) in bwn_lo_measure_txctl_values()
2092 & 0xff00) | lo->tx_bias | lo-> in bwn_lo_measure_txctl_values()
2096 lo->tx_magn = 0; in bwn_lo_measure_txctl_values()
2097 lo->tx_bias = 0; in bwn_lo_measure_txctl_values()
2098 BWN_RF_MASK(mac, 0x52, 0xfff0); in bwn_lo_measure_txctl_values()
2112 uint64_t power_vector = 0; in bwn_lo_get_powervector()
2114 for (i = 0; i < 8; i += 2) { in bwn_lo_get_powervector()
2115 tmp = bwn_shm_read_2(mac, BWN_SHARED, 0x310 + i); in bwn_lo_get_powervector()
2117 bwn_shm_write_2(mac, BWN_SHARED, 0x310 + i, 0); in bwn_lo_get_powervector()
2133 if (max_rx_gain < 0) in bwn_lo_measure_gain_values()
2134 max_rx_gain = 0; in bwn_lo_measure_gain_values()
2147 pg->pg_lna_lod_gain = 0; in bwn_lo_measure_gain_values()
2152 trsw_rx_gain = MIN(MAX(trsw_rx_gain, 0), 0x2d); in bwn_lo_measure_gain_values()
2158 pg->pg_lna_gain = 0; in bwn_lo_measure_gain_values()
2160 pg->pg_lna_gain = 0; in bwn_lo_measure_gain_values()
2161 pg->pg_trsw_rx_gain = 0x20; in bwn_lo_measure_gain_values()
2162 if (max_rx_gain >= 0x14) { in bwn_lo_measure_gain_values()
2165 } else if (max_rx_gain >= 0x12) { in bwn_lo_measure_gain_values()
2168 } else if (max_rx_gain >= 0xf) { in bwn_lo_measure_gain_values()
2170 pg->pg_pga_gain = 0; in bwn_lo_measure_gain_values()
2172 pg->pg_lna_lod_gain = 0; in bwn_lo_measure_gain_values()
2173 pg->pg_pga_gain = 0; in bwn_lo_measure_gain_values()
2177 tmp = BWN_RF_READ(mac, 0x7a); in bwn_lo_measure_gain_values()
2178 if (pg->pg_lna_lod_gain == 0) in bwn_lo_measure_gain_values()
2179 tmp &= ~0x0008; in bwn_lo_measure_gain_values()
2181 tmp |= 0x0008; in bwn_lo_measure_gain_values()
2182 BWN_RF_WRITE(mac, 0x7a, tmp); in bwn_lo_measure_gain_values()
2197 sav->phy_extg = BWN_PHY_READ(mac, BWN_PHY_EXTG(0x01)); in bwn_lo_save()
2199 sav->phy_cck4 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x14)); in bwn_lo_save()
2202 BWN_PHY_SET(mac, BWN_PHY_HPWR_TSSICTL, 0x100); in bwn_lo_save()
2203 BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x40); in bwn_lo_save()
2204 BWN_PHY_SET(mac, BWN_PHY_DACCTL, 0x40); in bwn_lo_save()
2205 BWN_PHY_SET(mac, BWN_PHY_CCK(0x14), 0x200); in bwn_lo_save()
2208 phy->rf_ver == 0x2050 && phy->rf_rev < 6) { in bwn_lo_save()
2209 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x16), 0x410); in bwn_lo_save()
2210 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x17), 0x820); in bwn_lo_save()
2219 sav->phy_cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x3e)); in bwn_lo_save()
2222 BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc); in bwn_lo_save()
2223 BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff); in bwn_lo_save()
2224 BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003); in bwn_lo_save()
2225 BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc); in bwn_lo_save()
2230 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x933); in bwn_lo_save()
2232 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x133); in bwn_lo_save()
2235 BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0); in bwn_lo_save()
2237 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), 0); in bwn_lo_save()
2239 sav->reg0 = BWN_READ_2(mac, 0x3f4); in bwn_lo_save()
2240 sav->reg1 = BWN_READ_2(mac, 0x3e2); in bwn_lo_save()
2241 sav->rf0 = BWN_RF_READ(mac, 0x43); in bwn_lo_save()
2242 sav->rf1 = BWN_RF_READ(mac, 0x7a); in bwn_lo_save()
2244 sav->phy_cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2a)); in bwn_lo_save()
2249 sav->rf2 = BWN_RF_READ(mac, 0x52); in bwn_lo_save()
2250 sav->rf2 &= 0x00f0; in bwn_lo_save()
2253 sav->phy_cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30)); in bwn_lo_save()
2254 sav->phy_cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x06)); in bwn_lo_save()
2255 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0x00ff); in bwn_lo_save()
2256 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), 0x3f3f); in bwn_lo_save()
2258 BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2) in bwn_lo_save()
2259 | 0x8000); in bwn_lo_save()
2261 BWN_WRITE_2(mac, 0x3f4, BWN_READ_2(mac, 0x3f4) in bwn_lo_save()
2262 & 0xf000); in bwn_lo_save()
2265 (phy->type == BWN_PHYTYPE_G) ? BWN_PHY_LO_MASK : BWN_PHY_CCK(0x2e); in bwn_lo_save()
2266 BWN_PHY_WRITE(mac, tmp, 0x007f); in bwn_lo_save()
2269 BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, tmp & 0xff7f); in bwn_lo_save()
2271 BWN_RF_WRITE(mac, 0x007a, tmp & 0xfff0); in bwn_lo_save()
2273 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), 0x8a3); in bwn_lo_save()
2276 phy->rf_ver == 0x2050 && phy->rf_rev >= 6)) { in bwn_lo_save()
2277 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1003); in bwn_lo_save()
2279 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x0802); in bwn_lo_save()
2281 bwn_dummy_transmission(mac, 0, 1); in bwn_lo_save()
2282 bwn_phy_g_switch_chan(mac, 6, 0); in bwn_lo_save()
2283 BWN_RF_READ(mac, 0x51); in bwn_lo_save()
2285 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0); in bwn_lo_save()
2293 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc078); in bwn_lo_save()
2296 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078); in bwn_lo_save()
2298 BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078); in bwn_lo_save()
2310 BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300); in bwn_lo_restore()
2312 BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa0); in bwn_lo_restore()
2314 BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa2); in bwn_lo_restore()
2316 BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa3); in bwn_lo_restore()
2318 tmp = (pg->pg_pga_gain | 0xefa0); in bwn_lo_restore()
2323 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0xc078); in bwn_lo_restore()
2325 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078); in bwn_lo_restore()
2327 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0202); in bwn_lo_restore()
2329 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0101); in bwn_lo_restore()
2331 BWN_WRITE_2(mac, 0x3f4, sav->reg0); in bwn_lo_restore()
2333 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), sav->phy_cck2); in bwn_lo_restore()
2336 BWN_RF_WRITE(mac, 0x43, sav->rf0); in bwn_lo_restore()
2337 BWN_RF_WRITE(mac, 0x7a, sav->rf1); in bwn_lo_restore()
2340 BWN_RF_SETMASK(mac, 0x52, 0xff0f, tmp); in bwn_lo_restore()
2342 BWN_WRITE_2(mac, 0x3e2, sav->reg1); in bwn_lo_restore()
2344 phy->rf_ver == 0x2050 && phy->rf_rev <= 5) { in bwn_lo_restore()
2345 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), sav->phy_cck0); in bwn_lo_restore()
2346 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), sav->phy_cck1); in bwn_lo_restore()
2355 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), sav->phy_cck3); in bwn_lo_restore()
2359 tmp = (sav->phy_lomask & 0xbfff); in bwn_lo_restore()
2361 BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x01), sav->phy_extg); in bwn_lo_restore()
2363 BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x14), sav->phy_cck4); in bwn_lo_restore()
2378 { 1, 1,}, { 1, 0,}, { 1, -1,}, { 0, -1,}, in bwn_lo_probe_loctl()
2379 { -1, -1,}, { -1, 0,}, { -1, 1,}, { 0, 1,} in bwn_lo_probe_loctl()
2381 int begin, end, lower = 0, i; in bwn_lo_probe_loctl()
2384 if (d->curstate == 0) { in bwn_lo_probe_loctl()
2387 } else if (d->curstate % 2 == 0) { in bwn_lo_probe_loctl()
2441 int lower, repeat, cnt = 0; in bwn_lo_probe_sm()
2444 d.nmeasure = 0; in bwn_lo_probe_sm()
2456 if (feedth < 0x258) { in bwn_lo_probe_sm()
2457 if (feedth >= 0x12c) in bwn_lo_probe_sm()
2465 d.curstate = 0; in bwn_lo_probe_sm()
2467 KASSERT(d.curstate >= 0 && d.curstate <= 8, in bwn_lo_probe_sm()
2482 if (d.feedth > 0x1194) in bwn_lo_probe_sm()
2484 else if (d.feedth < 0x5dc) in bwn_lo_probe_sm()
2486 if (cnt == 0) { in bwn_lo_probe_sm()
2487 if (d.feedth <= 0x5dc) { in bwn_lo_probe_sm()
2505 struct bwn_loctl loctl = { 0, 0 }; in bwn_lo_calibset()
2507 struct bwn_lo_g_value sval = { 0 }; in bwn_lo_calibset()
2516 BWN_RF_SETMASK(mac, 0x43, 0xfff0, rfatt->att); in bwn_lo_calibset()
2517 BWN_RF_SETMASK(mac, reg, ~value, (rfatt->padmix ? value :0)); in bwn_lo_calibset()
2580 uint8_t changed = 0; in bwn_phy_g_dc_lookup_init()
2592 for (i = 0; i < BWN_DC_LT_SIZE * 2; i++) { in bwn_phy_g_dc_lookup_init()
2616 lo->dc_lt[idx] = (lo->dc_lt[idx] & 0x00ff) in bwn_phy_g_dc_lookup_init()
2617 | ((val & 0x00ff) << 8); in bwn_phy_g_dc_lookup_init()
2619 lo->dc_lt[idx] = (lo->dc_lt[idx] & 0xff00) in bwn_phy_g_dc_lookup_init()
2620 | (val & 0x00ff); in bwn_phy_g_dc_lookup_init()
2624 for (i = 0; i < BWN_DC_LT_SIZE; i++) in bwn_phy_g_dc_lookup_init()
2625 BWN_PHY_WRITE(mac, 0x3a0 + i, lo->dc_lt[i]); in bwn_phy_g_dc_lookup_init()
2689 a = 0x13; in bwn_nrssi_threshold()
2690 b = 0x12; in bwn_nrssi_threshold()
2692 a = 0xe; in bwn_nrssi_threshold()
2693 b = 0x11; in bwn_nrssi_threshold()
2696 a = a * (pg->pg_nrssi[1] - pg->pg_nrssi[0]); in bwn_nrssi_threshold()
2697 a += (pg->pg_nrssi[0] << 6); in bwn_nrssi_threshold()
2702 b = b * (pg->pg_nrssi[1] - pg->pg_nrssi[0]); in bwn_nrssi_threshold()
2703 b += (pg->pg_nrssi[0] << 6); in bwn_nrssi_threshold()
2711 tmpu16 = BWN_PHY_READ(mac, 0x048a) & 0xf000; in bwn_nrssi_threshold()
2712 tmpu16 |= ((uint32_t)b & 0x0000003f); in bwn_nrssi_threshold()
2713 tmpu16 |= (((uint32_t)a & 0x0000003f) << 6); in bwn_nrssi_threshold()
2714 BWN_PHY_WRITE(mac, 0x048a, tmpu16); in bwn_nrssi_threshold()
2718 tmp16 = bwn_nrssi_read(mac, 0x20); in bwn_nrssi_threshold()
2719 if (tmp16 >= 0x20) in bwn_nrssi_threshold()
2720 tmp16 -= 0x40; in bwn_nrssi_threshold()
2721 BWN_PHY_SETMASK(mac, 0x048a, 0xf000, (tmp16 < 3) ? 0x09eb : 0x0aed); in bwn_nrssi_threshold()
2731 { 0x7a, 0x52, 0x43 }; in bwn_nrssi_slope_11g()
2733 { 0x15, 0x5a, 0x59, 0x58 }; in bwn_nrssi_slope_11g()
2735 0x002e, 0x002f, 0x080f, BWN_PHY_G_LOCTL, in bwn_nrssi_slope_11g()
2736 0x0801, 0x0060, 0x0014, 0x0478 in bwn_nrssi_slope_11g()
2740 int32_t i, tmp32, phy3_idx = 0; in bwn_nrssi_slope_11g()
2756 BWN_PHY_MASK(mac, BWN_PHY_G_CRS, 0x7fff); in bwn_nrssi_slope_11g()
2757 BWN_PHY_MASK(mac, 0x0802, 0xfffc); in bwn_nrssi_slope_11g()
2762 ant_div = BWN_READ_2(mac, 0x03e2); in bwn_nrssi_slope_11g()
2763 BWN_WRITE_2(mac, 0x03e2, BWN_READ_2(mac, 0x03e2) | 0x8000); in bwn_nrssi_slope_11g()
2764 for (i = 0; i < SAVE_RF_MAX; ++i) in bwn_nrssi_slope_11g()
2766 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwn_nrssi_slope_11g()
2772 for (i = 0; i < SAVE_PHY3_MAX; ++i) in bwn_nrssi_slope_11g()
2774 BWN_PHY_WRITE(mac, 0x002e, 0); in bwn_nrssi_slope_11g()
2775 BWN_PHY_WRITE(mac, BWN_PHY_G_LOCTL, 0); in bwn_nrssi_slope_11g()
2780 BWN_PHY_SET(mac, 0x0478, 0x0100); in bwn_nrssi_slope_11g()
2781 BWN_PHY_SET(mac, 0x0801, 0x0040); in bwn_nrssi_slope_11g()
2785 BWN_PHY_MASK(mac, 0x0801, 0xffbf); in bwn_nrssi_slope_11g()
2788 BWN_PHY_SET(mac, 0x0060, 0x0040); in bwn_nrssi_slope_11g()
2789 BWN_PHY_SET(mac, 0x0014, 0x0200); in bwn_nrssi_slope_11g()
2794 BWN_RF_SET(mac, 0x007a, 0x0070); in bwn_nrssi_slope_11g()
2795 bwn_set_all_gains(mac, 0, 8, 0); in bwn_nrssi_slope_11g()
2796 BWN_RF_MASK(mac, 0x007a, 0x00f7); in bwn_nrssi_slope_11g()
2798 BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0030); in bwn_nrssi_slope_11g()
2799 BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0010); in bwn_nrssi_slope_11g()
2801 BWN_RF_SET(mac, 0x007a, 0x0080); in bwn_nrssi_slope_11g()
2804 nrssi0 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f); in bwn_nrssi_slope_11g()
2805 if (nrssi0 >= 0x0020) in bwn_nrssi_slope_11g()
2806 nrssi0 -= 0x0040; in bwn_nrssi_slope_11g()
2811 BWN_RF_MASK(mac, 0x007a, 0x007f); in bwn_nrssi_slope_11g()
2813 BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040); in bwn_nrssi_slope_11g()
2816 BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000); in bwn_nrssi_slope_11g()
2817 BWN_RF_SET(mac, 0x007a, 0x000f); in bwn_nrssi_slope_11g()
2818 BWN_PHY_WRITE(mac, 0x0015, 0xf330); in bwn_nrssi_slope_11g()
2820 BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0020); in bwn_nrssi_slope_11g()
2821 BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0020); in bwn_nrssi_slope_11g()
2824 bwn_set_all_gains(mac, 3, 0, 1); in bwn_nrssi_slope_11g()
2826 BWN_RF_WRITE(mac, 0x0043, 0x001f); in bwn_nrssi_slope_11g()
2828 tmp = BWN_RF_READ(mac, 0x0052) & 0xff0f; in bwn_nrssi_slope_11g()
2829 BWN_RF_WRITE(mac, 0x0052, tmp | 0x0060); in bwn_nrssi_slope_11g()
2830 tmp = BWN_RF_READ(mac, 0x0043) & 0xfff0; in bwn_nrssi_slope_11g()
2831 BWN_RF_WRITE(mac, 0x0043, tmp | 0x0009); in bwn_nrssi_slope_11g()
2833 BWN_PHY_WRITE(mac, 0x005a, 0x0480); in bwn_nrssi_slope_11g()
2834 BWN_PHY_WRITE(mac, 0x0059, 0x0810); in bwn_nrssi_slope_11g()
2835 BWN_PHY_WRITE(mac, 0x0058, 0x000d); in bwn_nrssi_slope_11g()
2837 nrssi1 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f); in bwn_nrssi_slope_11g()
2842 if (nrssi1 >= 0x0020) in bwn_nrssi_slope_11g()
2843 nrssi1 -= 0x0040; in bwn_nrssi_slope_11g()
2845 pg->pg_nrssi_slope = 0x00010000; in bwn_nrssi_slope_11g()
2847 pg->pg_nrssi_slope = 0x00400000 / (nrssi0 - nrssi1); in bwn_nrssi_slope_11g()
2849 pg->pg_nrssi[0] = nrssi1; in bwn_nrssi_slope_11g()
2857 for (phy3_idx = 0; phy3_idx < 4; ++phy3_idx) { in bwn_nrssi_slope_11g()
2863 BWN_PHY_MASK(mac, 0x0812, 0xffcf); in bwn_nrssi_slope_11g()
2864 BWN_PHY_MASK(mac, 0x0811, 0xffcf); in bwn_nrssi_slope_11g()
2867 for (i = 0; i < SAVE_RF_MAX; ++i) in bwn_nrssi_slope_11g()
2870 BWN_WRITE_2(mac, 0x03e2, ant_div); in bwn_nrssi_slope_11g()
2871 BWN_WRITE_2(mac, 0x03e6, phy0); in bwn_nrssi_slope_11g()
2874 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwn_nrssi_slope_11g()
2878 BWN_PHY_SET(mac, 0x0802, (0x0001 | 0x0002)); in bwn_nrssi_slope_11g()
2880 BWN_PHY_SET(mac, BWN_PHY_G_CRS, 0x8000); in bwn_nrssi_slope_11g()
2888 delta = 0x1f - pg->pg_nrssi[0]; in bwn_nrssi_slope_11g()
2889 for (i = 0; i < 64; i++) { in bwn_nrssi_slope_11g()
2890 tmp32 = (((i - delta) * pg->pg_nrssi_slope) / 0x10000) + 0x3a; in bwn_nrssi_slope_11g()
2891 tmp32 = MIN(MAX(tmp32, 0), 0x3f); in bwn_nrssi_slope_11g()
2908 { 0x7a, 0x43 }; in bwn_nrssi_offset()
2910 0x0001, 0x0811, 0x0812, 0x0814, in bwn_nrssi_offset()
2911 0x0815, 0x005a, 0x0059, 0x0058, in bwn_nrssi_offset()
2912 0x000a, 0x0003 in bwn_nrssi_offset()
2915 0x002e, 0x002f, 0x080f, 0x0810, in bwn_nrssi_offset()
2916 0x0801, 0x0060, 0x0014, 0x0478 in bwn_nrssi_offset()
2919 int i, phy6_idx = 0; in bwn_nrssi_offset()
2924 uint16_t saved = 0xffff; in bwn_nrssi_offset()
2926 for (i = 0; i < SAVE_PHY_COMM_MAX; ++i) in bwn_nrssi_offset()
2928 for (i = 0; i < SAVE_RF_MAX; ++i) in bwn_nrssi_offset()
2931 BWN_PHY_MASK(mac, 0x0429, 0x7fff); in bwn_nrssi_offset()
2932 BWN_PHY_SETMASK(mac, 0x0001, 0x3fff, 0x4000); in bwn_nrssi_offset()
2933 BWN_PHY_SET(mac, 0x0811, 0x000c); in bwn_nrssi_offset()
2934 BWN_PHY_SETMASK(mac, 0x0812, 0xfff3, 0x0004); in bwn_nrssi_offset()
2935 BWN_PHY_MASK(mac, 0x0802, ~(0x1 | 0x2)); in bwn_nrssi_offset()
2937 for (i = 0; i < SAVE_PHY6_MAX; ++i) in bwn_nrssi_offset()
2940 BWN_PHY_WRITE(mac, 0x002e, 0); in bwn_nrssi_offset()
2941 BWN_PHY_WRITE(mac, 0x002f, 0); in bwn_nrssi_offset()
2942 BWN_PHY_WRITE(mac, 0x080f, 0); in bwn_nrssi_offset()
2943 BWN_PHY_WRITE(mac, 0x0810, 0); in bwn_nrssi_offset()
2944 BWN_PHY_SET(mac, 0x0478, 0x0100); in bwn_nrssi_offset()
2945 BWN_PHY_SET(mac, 0x0801, 0x0040); in bwn_nrssi_offset()
2946 BWN_PHY_SET(mac, 0x0060, 0x0040); in bwn_nrssi_offset()
2947 BWN_PHY_SET(mac, 0x0014, 0x0200); in bwn_nrssi_offset()
2949 BWN_RF_SET(mac, 0x007a, 0x0070); in bwn_nrssi_offset()
2950 BWN_RF_SET(mac, 0x007a, 0x0080); in bwn_nrssi_offset()
2953 nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f); in bwn_nrssi_offset()
2954 if (nrssi >= 0x20) in bwn_nrssi_offset()
2955 nrssi -= 0x40; in bwn_nrssi_offset()
2958 BWN_RF_WRITE(mac, 0x007b, i); in bwn_nrssi_offset()
2960 nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & in bwn_nrssi_offset()
2961 0x003f); in bwn_nrssi_offset()
2962 if (nrssi >= 0x20) in bwn_nrssi_offset()
2963 nrssi -= 0x40; in bwn_nrssi_offset()
2964 if (nrssi < 31 && saved == 0xffff) in bwn_nrssi_offset()
2967 if (saved == 0xffff) in bwn_nrssi_offset()
2970 BWN_RF_MASK(mac, 0x007a, 0x007f); in bwn_nrssi_offset()
2972 BWN_PHY_SET(mac, 0x0814, 0x0001); in bwn_nrssi_offset()
2973 BWN_PHY_MASK(mac, 0x0815, 0xfffe); in bwn_nrssi_offset()
2975 BWN_PHY_SET(mac, 0x0811, 0x000c); in bwn_nrssi_offset()
2976 BWN_PHY_SET(mac, 0x0812, 0x000c); in bwn_nrssi_offset()
2977 BWN_PHY_SET(mac, 0x0811, 0x0030); in bwn_nrssi_offset()
2978 BWN_PHY_SET(mac, 0x0812, 0x0030); in bwn_nrssi_offset()
2979 BWN_PHY_WRITE(mac, 0x005a, 0x0480); in bwn_nrssi_offset()
2980 BWN_PHY_WRITE(mac, 0x0059, 0x0810); in bwn_nrssi_offset()
2981 BWN_PHY_WRITE(mac, 0x0058, 0x000d); in bwn_nrssi_offset()
2982 if (phy->rev == 0) in bwn_nrssi_offset()
2983 BWN_PHY_WRITE(mac, 0x0003, 0x0122); in bwn_nrssi_offset()
2985 BWN_PHY_SET(mac, 0x000a, 0x2000); in bwn_nrssi_offset()
2987 BWN_PHY_SET(mac, 0x0814, 0x0004); in bwn_nrssi_offset()
2988 BWN_PHY_MASK(mac, 0x0815, 0xfffb); in bwn_nrssi_offset()
2990 BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040); in bwn_nrssi_offset()
2991 BWN_RF_SET(mac, 0x007a, 0x000f); in bwn_nrssi_offset()
2992 bwn_set_all_gains(mac, 3, 0, 1); in bwn_nrssi_offset()
2993 BWN_RF_SETMASK(mac, 0x0043, 0x00f0, 0x000f); in bwn_nrssi_offset()
2995 nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f); in bwn_nrssi_offset()
2996 if (nrssi >= 0x20) in bwn_nrssi_offset()
2997 nrssi -= 0x40; in bwn_nrssi_offset()
2999 for (i = 0; i < 4; i++) { in bwn_nrssi_offset()
3000 BWN_RF_WRITE(mac, 0x007b, i); in bwn_nrssi_offset()
3003 0x047f) >> 8) & 0x003f); in bwn_nrssi_offset()
3004 if (nrssi >= 0x20) in bwn_nrssi_offset()
3005 nrssi -= 0x40; in bwn_nrssi_offset()
3006 if (nrssi > -31 && saved == 0xffff) in bwn_nrssi_offset()
3009 if (saved == 0xffff) in bwn_nrssi_offset()
3012 saved = 0; in bwn_nrssi_offset()
3014 BWN_RF_WRITE(mac, 0x007b, saved); in bwn_nrssi_offset()
3020 for (phy6_idx = 0; phy6_idx < 4; ++phy6_idx) { in bwn_nrssi_offset()
3033 for (i = SAVE_RF_MAX - 1; i >= 0; --i) in bwn_nrssi_offset()
3036 BWN_PHY_WRITE(mac, 0x0802, BWN_PHY_READ(mac, 0x0802) | 0x1 | 0x2); in bwn_nrssi_offset()
3037 BWN_PHY_SET(mac, 0x0429, 0x8000); in bwn_nrssi_offset()
3046 BWN_PHY_WRITE(mac, save_phy_comm_regs[0], save_phy_comm[0]); in bwn_nrssi_offset()
3057 uint16_t start = 0x08, end = 0x18; in bwn_set_all_gains()
3062 start = 0x10; in bwn_set_all_gains()
3063 end = 0x20; in bwn_set_all_gains()
3069 for (i = 0; i < 4; i++) in bwn_set_all_gains()
3077 BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, tmp); in bwn_set_all_gains()
3078 BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, tmp); in bwn_set_all_gains()
3079 BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, tmp); in bwn_set_all_gains()
3081 bwn_dummy_transmission(mac, 0, 1); in bwn_set_all_gains()
3090 uint16_t start = 0x0008, end = 0x0018; in bwn_set_original_gains()
3093 start = 0x0010; in bwn_set_original_gains()
3094 end = 0x0020; in bwn_set_original_gains()
3100 for (i = 0; i < 4; i++) { in bwn_set_original_gains()
3101 tmp = (i & 0xfffc); in bwn_set_original_gains()
3102 tmp |= (i & 0x0001) << 1; in bwn_set_original_gains()
3103 tmp |= (i & 0x0002) >> 1; in bwn_set_original_gains()
3111 BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, 0x4040); in bwn_set_original_gains()
3112 BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, 0x4040); in bwn_set_original_gains()
3113 BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, 0x4000); in bwn_set_original_gains()
3114 bwn_dummy_transmission(mac, 0, 1); in bwn_set_original_gains()
3125 uint8_t old_txctl = 0; in bwn_phy_hwpctl_init()
3134 BWN_PHY_WRITE(mac, 0x0028, 0x8018); in bwn_phy_hwpctl_init()
3136 BWN_WRITE_2(mac, BWN_PHY0, BWN_READ_2(mac, BWN_PHY0) & 0xffdf); in bwn_phy_hwpctl_init()
3141 if (pg->pg_curtssi == 0) { in bwn_phy_hwpctl_init()
3142 if (phy->rf_ver == 0x2050 && phy->analog == 0) { in bwn_phy_hwpctl_init()
3143 BWN_RF_SETMASK(mac, 0x0076, 0x00f7, 0x0084); in bwn_phy_hwpctl_init()
3155 rfatt.padmix = 0; in bwn_phy_hwpctl_init()
3157 bwn_phy_g_set_txpwr_sub(mac, &bbatt, &rfatt, 0); in bwn_phy_hwpctl_init()
3159 bwn_dummy_transmission(mac, 0, 1); in bwn_phy_hwpctl_init()
3161 if (phy->rf_ver == 0x2050 && phy->analog == 0) in bwn_phy_hwpctl_init()
3162 BWN_RF_MASK(mac, 0x0076, 0xff7b); in bwn_phy_hwpctl_init()
3170 bwn_shm_write_2(mac, BWN_SHARED, 0x0058, 0x7f7f); in bwn_phy_hwpctl_init()
3171 bwn_shm_write_2(mac, BWN_SHARED, 0x005a, 0x7f7f); in bwn_phy_hwpctl_init()
3172 bwn_shm_write_2(mac, BWN_SHARED, 0x0070, 0x7f7f); in bwn_phy_hwpctl_init()
3173 bwn_shm_write_2(mac, BWN_SHARED, 0x0072, 0x7f7f); in bwn_phy_hwpctl_init()
3182 BWN_PHY_WRITE(mac, 0x047a, 0xc111); in bwn_hwpctl_early_init()
3186 BWN_PHY_MASK(mac, 0x0036, 0xfeff); in bwn_hwpctl_early_init()
3187 BWN_PHY_WRITE(mac, 0x002f, 0x0202); in bwn_hwpctl_early_init()
3188 BWN_PHY_SET(mac, 0x047c, 0x0002); in bwn_hwpctl_early_init()
3189 BWN_PHY_SET(mac, 0x047a, 0xf000); in bwn_hwpctl_early_init()
3190 if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) { in bwn_hwpctl_early_init()
3191 BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010); in bwn_hwpctl_early_init()
3192 BWN_PHY_SET(mac, 0x005d, 0x8000); in bwn_hwpctl_early_init()
3193 BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010); in bwn_hwpctl_early_init()
3194 BWN_PHY_WRITE(mac, 0x002e, 0xc07f); in bwn_hwpctl_early_init()
3195 BWN_PHY_SET(mac, 0x0036, 0x0400); in bwn_hwpctl_early_init()
3197 BWN_PHY_SET(mac, 0x0036, 0x0200); in bwn_hwpctl_early_init()
3198 BWN_PHY_SET(mac, 0x0036, 0x0400); in bwn_hwpctl_early_init()
3199 BWN_PHY_MASK(mac, 0x005d, 0x7fff); in bwn_hwpctl_early_init()
3200 BWN_PHY_MASK(mac, 0x004f, 0xfffe); in bwn_hwpctl_early_init()
3201 BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010); in bwn_hwpctl_early_init()
3202 BWN_PHY_WRITE(mac, 0x002e, 0xc07f); in bwn_hwpctl_early_init()
3203 BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010); in bwn_hwpctl_early_init()
3214 uint16_t nr_written = 0, tmp, value; in bwn_hwpctl_init_gphy()
3222 BWN_PHY_SETMASK(mac, 0x0036, 0xffc0, in bwn_hwpctl_init_gphy()
3224 BWN_PHY_SETMASK(mac, 0x0478, 0xff00, in bwn_hwpctl_init_gphy()
3227 for (i = 0; i < 32; i++) in bwn_hwpctl_init_gphy()
3228 bwn_ofdmtab_write_2(mac, 0x3c20, i, pg->pg_tssi2dbm[i]); in bwn_hwpctl_init_gphy()
3230 bwn_ofdmtab_write_2(mac, 0x3c00, i - 32, pg->pg_tssi2dbm[i]); in bwn_hwpctl_init_gphy()
3231 for (i = 0; i < 64; i += 2) { in bwn_hwpctl_init_gphy()
3234 BWN_PHY_WRITE(mac, 0x380 + (i / 2), value); in bwn_hwpctl_init_gphy()
3237 for (rf = 0; rf < lo->rfatt.len; rf++) { in bwn_hwpctl_init_gphy()
3238 for (bb = 0; bb < lo->bbatt.len; bb++) { in bwn_hwpctl_init_gphy()
3239 if (nr_written >= 0x40) in bwn_hwpctl_init_gphy()
3244 tmp |= 0x50; in bwn_hwpctl_init_gphy()
3246 tmp |= 0x40; in bwn_hwpctl_init_gphy()
3248 BWN_PHY_WRITE(mac, 0x3c0 + nr_written, tmp); in bwn_hwpctl_init_gphy()
3253 BWN_PHY_MASK(mac, 0x0060, 0xffbf); in bwn_hwpctl_init_gphy()
3254 BWN_PHY_WRITE(mac, 0x0014, 0x0000); in bwn_hwpctl_init_gphy()
3257 BWN_PHY_SET(mac, 0x0478, 0x0800); in bwn_hwpctl_init_gphy()
3258 BWN_PHY_MASK(mac, 0x0478, 0xfeff); in bwn_hwpctl_init_gphy()
3259 BWN_PHY_MASK(mac, 0x0801, 0xffbf); in bwn_hwpctl_init_gphy()
3271 if (spu != 0) in bwn_phy_g_switch_chan()
3299 BWN_READ_2(mac, BWN_CHANNEL_EXT) & 0xf7bf); in bwn_phy_g_switch_chan()
3327 if (tx_bias == 0xff) in bwn_phy_g_set_txpwr_sub()
3328 tx_bias = 0; in bwn_phy_g_set_txpwr_sub()
3332 pg->pg_rfatt.padmix = (txctl & BWN_TXCTL_TXMIX) ? 1 : 0; in bwn_phy_g_set_txpwr_sub()
3336 if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) in bwn_phy_g_set_txpwr_sub()
3337 BWN_RF_WRITE(mac, 0x43, (rf & 0x000f) | (txctl & 0x0070)); in bwn_phy_g_set_txpwr_sub()
3339 BWN_RF_SETMASK(mac, 0x43, 0xfff0, (rf & 0x000f)); in bwn_phy_g_set_txpwr_sub()
3340 BWN_RF_SETMASK(mac, 0x52, ~0x0070, (txctl & 0x0070)); in bwn_phy_g_set_txpwr_sub()
3343 BWN_RF_WRITE(mac, 0x52, tx_magn | tx_bias); in bwn_phy_g_set_txpwr_sub()
3345 BWN_RF_SETMASK(mac, 0x52, 0xfff0, (tx_bias & 0x000f)); in bwn_phy_g_set_txpwr_sub()
3355 if (phy->analog == 0) { in bwn_phy_g_set_bbatt()
3357 (BWN_READ_2(mac, BWN_PHY0) & 0xfff0) | bbatt); in bwn_phy_g_set_bbatt()
3361 BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xffc3, bbatt << 2); in bwn_phy_g_set_bbatt()
3364 BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xff87, bbatt << 3); in bwn_phy_g_set_bbatt()
3377 if (phy->gmode == 0) in bwn_rf_2050_rfoverval()
3378 return (0); in bwn_rf_2050_rfoverval()
3382 max_lb_gain += (phy->rf_rev == 8) ? 0x3e : 0x26; in bwn_rf_2050_rfoverval()
3383 if (max_lb_gain >= 0x46) { in bwn_rf_2050_rfoverval()
3384 extlna = 0x3000; in bwn_rf_2050_rfoverval()
3385 max_lb_gain -= 0x46; in bwn_rf_2050_rfoverval()
3386 } else if (max_lb_gain >= 0x3a) { in bwn_rf_2050_rfoverval()
3387 extlna = 0x1000; in bwn_rf_2050_rfoverval()
3388 max_lb_gain -= 0x3a; in bwn_rf_2050_rfoverval()
3389 } else if (max_lb_gain >= 0x2e) { in bwn_rf_2050_rfoverval()
3390 extlna = 0x2000; in bwn_rf_2050_rfoverval()
3391 max_lb_gain -= 0x2e; in bwn_rf_2050_rfoverval()
3393 extlna = 0; in bwn_rf_2050_rfoverval()
3394 max_lb_gain -= 0x10; in bwn_rf_2050_rfoverval()
3397 for (i = 0; i < 16; i++) { in bwn_rf_2050_rfoverval()
3406 return (0x1b3); in bwn_rf_2050_rfoverval()
3410 case BWN_LPD(0, 1, 1): in bwn_rf_2050_rfoverval()
3411 return (0x0f92); in bwn_rf_2050_rfoverval()
3412 case BWN_LPD(0, 0, 1): in bwn_rf_2050_rfoverval()
3413 case BWN_LPD(1, 0, 1): in bwn_rf_2050_rfoverval()
3414 return (0x0092 | extlna); in bwn_rf_2050_rfoverval()
3415 case BWN_LPD(1, 0, 0): in bwn_rf_2050_rfoverval()
3416 return (0x0093 | extlna); in bwn_rf_2050_rfoverval()
3418 KASSERT(0 == 1, in bwn_rf_2050_rfoverval()
3421 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_rf_2050_rfoverval()
3424 return (0x9b3); in bwn_rf_2050_rfoverval()
3427 extlna |= 0x8000; in bwn_rf_2050_rfoverval()
3430 case BWN_LPD(0, 1, 1): in bwn_rf_2050_rfoverval()
3431 return (0x8f92); in bwn_rf_2050_rfoverval()
3432 case BWN_LPD(0, 0, 1): in bwn_rf_2050_rfoverval()
3433 return (0x8092 | extlna); in bwn_rf_2050_rfoverval()
3434 case BWN_LPD(1, 0, 1): in bwn_rf_2050_rfoverval()
3435 return (0x2092 | extlna); in bwn_rf_2050_rfoverval()
3436 case BWN_LPD(1, 0, 0): in bwn_rf_2050_rfoverval()
3437 return (0x2093 | extlna); in bwn_rf_2050_rfoverval()
3439 KASSERT(0 == 1, in bwn_rf_2050_rfoverval()
3442 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_rf_2050_rfoverval()
3444 return (0); in bwn_rf_2050_rfoverval()
3450 return (0x1b3); in bwn_rf_2050_rfoverval()
3453 case BWN_LPD(0, 1, 1): in bwn_rf_2050_rfoverval()
3454 return (0x0fb2); in bwn_rf_2050_rfoverval()
3455 case BWN_LPD(0, 0, 1): in bwn_rf_2050_rfoverval()
3456 return (0x00b2); in bwn_rf_2050_rfoverval()
3457 case BWN_LPD(1, 0, 1): in bwn_rf_2050_rfoverval()
3458 return (0x30b2); in bwn_rf_2050_rfoverval()
3459 case BWN_LPD(1, 0, 0): in bwn_rf_2050_rfoverval()
3460 return (0x30b3); in bwn_rf_2050_rfoverval()
3462 KASSERT(0 == 1, in bwn_rf_2050_rfoverval()
3465 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_rf_2050_rfoverval()
3468 return (0x9b3); in bwn_rf_2050_rfoverval()
3471 case BWN_LPD(0, 1, 1): in bwn_rf_2050_rfoverval()
3472 return (0x8fb2); in bwn_rf_2050_rfoverval()
3473 case BWN_LPD(0, 0, 1): in bwn_rf_2050_rfoverval()
3474 return (0x80b2); in bwn_rf_2050_rfoverval()
3475 case BWN_LPD(1, 0, 1): in bwn_rf_2050_rfoverval()
3476 return (0x20b2); in bwn_rf_2050_rfoverval()
3477 case BWN_LPD(1, 0, 0): in bwn_rf_2050_rfoverval()
3478 return (0x20b3); in bwn_rf_2050_rfoverval()
3480 KASSERT(0 == 1, in bwn_rf_2050_rfoverval()
3483 KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__)); in bwn_rf_2050_rfoverval()
3485 return (0); in bwn_rf_2050_rfoverval()
3492 if (mac->mac_phy.rf_ver != 0x2050 || mac->mac_phy.rf_rev >= 6) in bwn_spu_workaround()
3509 a = tmp & 0xff; in bwn_phy_shm_tssi_read()
3510 b = (tmp >> 8) & 0xff; in bwn_phy_shm_tssi_read()
3511 c = (tmp >> 16) & 0xff; in bwn_phy_shm_tssi_read()
3512 d = (tmp >> 24) & 0xff; in bwn_phy_shm_tssi_read()
3513 if (a == 0 || a == BWN_TSSI_MAX || b == 0 || b == BWN_TSSI_MAX || in bwn_phy_shm_tssi_read()
3514 c == 0 || c == BWN_TSSI_MAX || d == 0 || d == BWN_TSSI_MAX) in bwn_phy_shm_tssi_read()
3521 a = (a + 32) & 0x3f; in bwn_phy_shm_tssi_read()
3522 b = (b + 32) & 0x3f; in bwn_phy_shm_tssi_read()
3523 c = (c + 32) & 0x3f; in bwn_phy_shm_tssi_read()
3524 d = (d + 32) & 0x3f; in bwn_phy_shm_tssi_read()
3531 avg = (avg >= 13) ? (avg - 13) : 0; in bwn_phy_shm_tssi_read()
3602 bwn_psctl(mac, 0); in bwn_phy_unlock()