Lines Matching full:mac
118 bwi_tmplt_write_4(struct bwi_mac *mac, uint32_t ofs, uint32_t val) in bwi_tmplt_write_4() argument
120 struct bwi_softc *sc = mac->mac_sc; in bwi_tmplt_write_4()
122 if (mac->mac_flags & BWI_MAC_F_BSWAP) in bwi_tmplt_write_4()
130 bwi_hostflags_write(struct bwi_mac *mac, uint64_t flags) in bwi_hostflags_write() argument
135 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_HFLAGS_LO, val); in bwi_hostflags_write()
138 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_HFLAGS_MI, val); in bwi_hostflags_write()
144 bwi_hostflags_read(struct bwi_mac *mac) in bwi_hostflags_read() argument
151 val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_HFLAGS_MI); in bwi_hostflags_read()
154 val = MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_HFLAGS_LO); in bwi_hostflags_read()
161 bwi_memobj_read_2(struct bwi_mac *mac, uint16_t obj_id, uint16_t ofs0) in bwi_memobj_read_2() argument
163 struct bwi_softc *sc = mac->mac_sc; in bwi_memobj_read_2()
178 bwi_memobj_read_4(struct bwi_mac *mac, uint16_t obj_id, uint16_t ofs0) in bwi_memobj_read_4() argument
180 struct bwi_softc *sc = mac->mac_sc; in bwi_memobj_read_4()
203 bwi_memobj_write_2(struct bwi_mac *mac, uint16_t obj_id, uint16_t ofs0, in bwi_memobj_write_2() argument
206 struct bwi_softc *sc = mac->mac_sc; in bwi_memobj_write_2()
221 bwi_memobj_write_4(struct bwi_mac *mac, uint16_t obj_id, uint16_t ofs0, in bwi_memobj_write_4() argument
224 struct bwi_softc *sc = mac->mac_sc; in bwi_memobj_write_4()
242 bwi_mac_lateattach(struct bwi_mac *mac) in bwi_mac_lateattach() argument
246 if (mac->mac_rev >= 5) in bwi_mac_lateattach()
247 CSR_READ_4(mac->mac_sc, BWI_STATE_HI); /* dummy read */ in bwi_mac_lateattach()
249 bwi_mac_reset(mac, 1); in bwi_mac_lateattach()
251 error = bwi_phy_attach(mac); in bwi_mac_lateattach()
255 error = bwi_rf_attach(mac); in bwi_mac_lateattach()
260 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11A) in bwi_mac_lateattach()
261 bwi_mac_reset(mac, 0); in bwi_mac_lateattach()
263 bwi_mac_reset(mac, 1); in bwi_mac_lateattach()
265 error = bwi_mac_test(mac); in bwi_mac_lateattach()
269 error = bwi_mac_get_property(mac); in bwi_mac_lateattach()
273 error = bwi_rf_map_txpower(mac); in bwi_mac_lateattach()
277 bwi_rf_off(mac); in bwi_mac_lateattach()
278 CSR_WRITE_2(mac->mac_sc, BWI_BBP_ATTEN, BWI_BBP_ATTEN_MAGIC); in bwi_mac_lateattach()
279 bwi_regwin_disable(mac->mac_sc, &mac->mac_regwin, 0); in bwi_mac_lateattach()
285 bwi_mac_init(struct bwi_mac *mac) in bwi_mac_init() argument
287 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_init()
290 /* Clear MAC/PHY/RF states */ in bwi_mac_init()
291 bwi_mac_setup_tpctl(mac); in bwi_mac_init()
292 bwi_rf_clear_state(&mac->mac_rf); in bwi_mac_init()
293 bwi_phy_clear_state(&mac->mac_phy); in bwi_mac_init()
295 /* Enable MAC and linked it to PHY */ in bwi_mac_init()
296 if (!bwi_regwin_is_enabled(sc, &mac->mac_regwin)) in bwi_mac_init()
297 bwi_mac_reset(mac, 1); in bwi_mac_init()
300 error = bwi_bus_init(sc, mac); in bwi_mac_init()
313 error = bwi_phy_calibrate(mac); in bwi_mac_init()
327 error = bwi_mac_fw_load(mac); in bwi_mac_init()
331 error = bwi_mac_gpio_init(mac); in bwi_mac_init()
335 error = bwi_mac_fw_init(mac); in bwi_mac_init()
342 bwi_rf_on(mac); in bwi_mac_init()
350 bwi_phy_init(mac); in bwi_mac_init()
357 bwi_rf_set_ant_mode(mac, mac->mac_rf.rf_ant_mode); in bwi_mac_init()
362 bwi_mac_opmode_init(mac); in bwi_mac_init()
365 if (mac->mac_rev < 3) { in bwi_mac_init()
389 /* allow the MAC to control the PHY clock (dynamic on/off) */ in bwi_mac_init()
392 /* Setup MAC power up delay */ in bwi_mac_init()
395 /* Set MAC regwin revision */ in bwi_mac_init()
396 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_MACREV, mac->mac_rev); in bwi_mac_init()
401 bwi_mac_hostflags_init(mac); in bwi_mac_init()
406 bwi_mac_bss_param_init(mac); in bwi_mac_init()
430 * Initialize TX stats if the current MAC uses that in bwi_mac_init()
432 if (mac->mac_flags & BWI_MAC_F_HAS_TXSTATS) { in bwi_mac_init()
443 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, 0x416, 0x50); in bwi_mac_init()
444 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, 0x414, 0x1f4); in bwi_mac_init()
446 mac->mac_flags |= BWI_MAC_F_INITED; in bwi_mac_init()
451 bwi_mac_reset(struct bwi_mac *mac, int link_phy) in bwi_mac_reset() argument
453 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_reset()
459 bwi_regwin_enable(sc, &mac->mac_regwin, flags); in bwi_mac_reset()
490 mac->mac_phy.phy_flags |= BWI_PHY_F_LINKED; in bwi_mac_reset()
494 mac->mac_phy.phy_flags &= ~BWI_PHY_F_LINKED; in bwi_mac_reset()
499 bwi_mac_set_tpctl_11bg(struct bwi_mac *mac, const struct bwi_tpctl *new_tpctl) in bwi_mac_set_tpctl_11bg() argument
501 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_set_tpctl_11bg()
502 struct bwi_tpctl *tpctl = &mac->mac_tpctl; in bwi_mac_set_tpctl_11bg()
520 bwi_phy_set_bbp_atten(mac, tpctl->bbp_atten); in bwi_mac_set_tpctl_11bg()
523 RF_WRITE(mac, BWI_RFR_ATTEN, tpctl->rf_atten); in bwi_mac_set_tpctl_11bg()
524 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_RF_ATTEN, in bwi_mac_set_tpctl_11bg()
529 RF_FILT_SETBITS(mac, BWI_RFR_TXPWR, ~BWI_RFR_TXPWR1_MASK, in bwi_mac_set_tpctl_11bg()
534 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11G) in bwi_mac_set_tpctl_11bg()
535 bwi_rf_lo_adjust(mac, tpctl); in bwi_mac_set_tpctl_11bg()
539 bwi_mac_test(struct bwi_mac *mac) in bwi_mac_test() argument
541 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_test()
548 orig_val = MOBJ_READ_4(mac, BWI_COMM_MOBJ, 0); in bwi_mac_test()
551 MOBJ_WRITE_4(mac, BWI_COMM_MOBJ, 0, TEST_VAL1); in bwi_mac_test()
552 val = MOBJ_READ_4(mac, BWI_COMM_MOBJ, 0); in bwi_mac_test()
559 MOBJ_WRITE_4(mac, BWI_COMM_MOBJ, 0, TEST_VAL2); in bwi_mac_test()
560 val = MOBJ_READ_4(mac, BWI_COMM_MOBJ, 0); in bwi_mac_test()
567 MOBJ_WRITE_4(mac, BWI_COMM_MOBJ, 0, orig_val); in bwi_mac_test()
571 device_printf(sc->sc_dev, "%s failed, MAC status 0x%08x\n", in bwi_mac_test()
590 bwi_mac_setup_tpctl(struct bwi_mac *mac) in bwi_mac_setup_tpctl() argument
592 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_setup_tpctl()
593 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_setup_tpctl()
594 struct bwi_phy *phy = &mac->mac_phy; in bwi_mac_setup_tpctl()
595 struct bwi_tpctl *tpctl = &mac->mac_tpctl; in bwi_mac_setup_tpctl()
691 bwi_mac_dummy_xmit(struct bwi_mac *mac) in bwi_mac_dummy_xmit() argument
699 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_dummy_xmit()
700 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_dummy_xmit()
705 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11A) { in bwi_mac_dummy_xmit()
716 TMPLT_WRITE_4(mac, i * 4, packet[i]); in bwi_mac_dummy_xmit()
732 RF_WRITE(mac, 0x51, 0x17); in bwi_mac_dummy_xmit()
751 RF_WRITE(mac, 0x51, 0x37); in bwi_mac_dummy_xmit()
756 bwi_mac_init_tpctl_11bg(struct bwi_mac *mac) in bwi_mac_init_tpctl_11bg() argument
758 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_init_tpctl_11bg()
759 struct bwi_phy *phy = &mac->mac_phy; in bwi_mac_init_tpctl_11bg()
760 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_init_tpctl_11bg()
770 PHY_WRITE(mac, 0x28, 0x8018); in bwi_mac_init_tpctl_11bg()
776 PHY_WRITE(mac, 0x47a, 0xc111); in bwi_mac_init_tpctl_11bg()
778 if (mac->mac_flags & BWI_MAC_F_TPCTL_INITED) in bwi_mac_init_tpctl_11bg()
783 RF_SETBITS(mac, 0x76, 0x84); in bwi_mac_init_tpctl_11bg()
788 bcopy(&mac->mac_tpctl, &tpctl_orig, sizeof(tpctl_orig)); in bwi_mac_init_tpctl_11bg()
791 bcopy(&mac->mac_tpctl, &tpctl, sizeof(tpctl)); in bwi_mac_init_tpctl_11bg()
801 bwi_mac_set_tpctl_11bg(mac, &tpctl); in bwi_mac_init_tpctl_11bg()
804 bwi_mac_dummy_xmit(mac); in bwi_mac_init_tpctl_11bg()
806 mac->mac_flags |= BWI_MAC_F_TPCTL_INITED; in bwi_mac_init_tpctl_11bg()
807 rf->rf_base_tssi = PHY_READ(mac, 0x29); in bwi_mac_init_tpctl_11bg()
813 mac->mac_flags |= BWI_MAC_F_TPCTL_ERROR; in bwi_mac_init_tpctl_11bg()
817 bwi_mac_set_tpctl_11bg(mac, &tpctl_orig); in bwi_mac_init_tpctl_11bg()
819 RF_CLRBITS(mac, 0x76, 0x84); in bwi_mac_init_tpctl_11bg()
821 bwi_rf_clear_tssi(mac); in bwi_mac_init_tpctl_11bg()
825 bwi_mac_detach(struct bwi_mac *mac) in bwi_mac_detach() argument
827 bwi_mac_fw_free(mac); in bwi_mac_detach()
879 bwi_mac_fw_alloc(struct bwi_mac *mac) in bwi_mac_fw_alloc() argument
881 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_fw_alloc()
889 if (mac->mac_stub == NULL) { in bwi_mac_fw_alloc()
892 mac->mac_stub = firmware_get(fwname); in bwi_mac_fw_alloc()
893 if (mac->mac_stub == NULL) in bwi_mac_fw_alloc()
897 if (mac->mac_ucode == NULL) { in bwi_mac_fw_alloc()
900 mac->mac_rev >= 5 ? 5 : mac->mac_rev); in bwi_mac_fw_alloc()
902 mac->mac_ucode = firmware_get(fwname); in bwi_mac_fw_alloc()
903 if (mac->mac_ucode == NULL) in bwi_mac_fw_alloc()
905 if (!bwi_fwimage_is_valid(sc, mac->mac_ucode, BWI_FW_T_UCODE)) in bwi_mac_fw_alloc()
909 if (mac->mac_pcm == NULL) { in bwi_mac_fw_alloc()
912 mac->mac_rev < 5 ? 4 : 5); in bwi_mac_fw_alloc()
914 mac->mac_pcm = firmware_get(fwname); in bwi_mac_fw_alloc()
915 if (mac->mac_pcm == NULL) in bwi_mac_fw_alloc()
917 if (!bwi_fwimage_is_valid(sc, mac->mac_pcm, BWI_FW_T_PCM)) in bwi_mac_fw_alloc()
921 if (mac->mac_iv == NULL) { in bwi_mac_fw_alloc()
923 if (mac->mac_rev == 2 || mac->mac_rev == 4) { in bwi_mac_fw_alloc()
925 } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { in bwi_mac_fw_alloc()
929 "no suitible IV for MAC rev %d\n", mac->mac_rev); in bwi_mac_fw_alloc()
936 mac->mac_iv = firmware_get(fwname); in bwi_mac_fw_alloc()
937 if (mac->mac_iv == NULL) in bwi_mac_fw_alloc()
939 if (!bwi_fwimage_is_valid(sc, mac->mac_iv, BWI_FW_T_IV)) in bwi_mac_fw_alloc()
943 if (mac->mac_iv_ext == NULL) { in bwi_mac_fw_alloc()
945 if (mac->mac_rev == 2 || mac->mac_rev == 4 || in bwi_mac_fw_alloc()
946 mac->mac_rev >= 11) { in bwi_mac_fw_alloc()
949 } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { in bwi_mac_fw_alloc()
953 "no suitible ExtIV for MAC rev %d\n", mac->mac_rev); in bwi_mac_fw_alloc()
960 mac->mac_iv_ext = firmware_get(fwname); in bwi_mac_fw_alloc()
961 if (mac->mac_iv_ext == NULL) in bwi_mac_fw_alloc()
963 if (!bwi_fwimage_is_valid(sc, mac->mac_iv_ext, BWI_FW_T_IV)) in bwi_mac_fw_alloc()
974 bwi_mac_fw_free(struct bwi_mac *mac) in bwi_mac_fw_free() argument
976 if (mac->mac_ucode != NULL) { in bwi_mac_fw_free()
977 firmware_put(mac->mac_ucode, FIRMWARE_UNLOAD); in bwi_mac_fw_free()
978 mac->mac_ucode = NULL; in bwi_mac_fw_free()
981 if (mac->mac_pcm != NULL) { in bwi_mac_fw_free()
982 firmware_put(mac->mac_pcm, FIRMWARE_UNLOAD); in bwi_mac_fw_free()
983 mac->mac_pcm = NULL; in bwi_mac_fw_free()
986 if (mac->mac_iv != NULL) { in bwi_mac_fw_free()
987 firmware_put(mac->mac_iv, FIRMWARE_UNLOAD); in bwi_mac_fw_free()
988 mac->mac_iv = NULL; in bwi_mac_fw_free()
991 if (mac->mac_iv_ext != NULL) { in bwi_mac_fw_free()
992 firmware_put(mac->mac_iv_ext, FIRMWARE_UNLOAD); in bwi_mac_fw_free()
993 mac->mac_iv_ext = NULL; in bwi_mac_fw_free()
996 if (mac->mac_stub != NULL) { in bwi_mac_fw_free()
997 firmware_put(mac->mac_stub, FIRMWARE_UNLOAD); in bwi_mac_fw_free()
998 mac->mac_stub = NULL; in bwi_mac_fw_free()
1003 bwi_mac_fw_load(struct bwi_mac *mac) in bwi_mac_fw_load() argument
1005 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_fw_load()
1014 ((const uint8_t *)mac->mac_ucode->data + BWI_FWHDR_SZ); in bwi_mac_fw_load()
1015 fw_len = (mac->mac_ucode->datasize - BWI_FWHDR_SZ) / sizeof(uint32_t); in bwi_mac_fw_load()
1029 ((const uint8_t *)mac->mac_pcm->data + BWI_FWHDR_SZ); in bwi_mac_fw_load()
1030 fw_len = (mac->mac_pcm->datasize - BWI_FWHDR_SZ) / sizeof(uint32_t); in bwi_mac_fw_load()
1069 fw_rev = MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_FWREV); in bwi_mac_fw_load()
1078 MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_FWPATCHLV)); in bwi_mac_fw_load()
1083 bwi_mac_gpio_init(struct bwi_mac *mac) in bwi_mac_gpio_init() argument
1085 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_gpio_init()
1118 bwi_mac_gpio_fini(struct bwi_mac *mac) in bwi_mac_gpio_fini() argument
1120 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_gpio_fini()
1135 bwi_mac_fw_load_iv(struct bwi_mac *mac, const struct firmware *fw) in bwi_mac_fw_load_iv() argument
1137 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_fw_load_iv()
1215 bwi_mac_fw_init(struct bwi_mac *mac) in bwi_mac_fw_init() argument
1217 device_t dev = mac->mac_sc->sc_dev; in bwi_mac_fw_init()
1220 error = bwi_mac_fw_load_iv(mac, mac->mac_iv); in bwi_mac_fw_init()
1226 if (mac->mac_iv_ext != NULL) { in bwi_mac_fw_init()
1227 error = bwi_mac_fw_load_iv(mac, mac->mac_iv_ext); in bwi_mac_fw_init()
1235 bwi_mac_opmode_init(struct bwi_mac *mac) in bwi_mac_opmode_init() argument
1237 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_opmode_init()
1246 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_PROBE_RESP_TO, 0); in bwi_mac_opmode_init()
1262 if (mac->mac_rev < 5) in bwi_mac_opmode_init()
1305 bwi_mac_hostflags_init(struct bwi_mac *mac) in bwi_mac_hostflags_init() argument
1307 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_hostflags_init()
1308 struct bwi_phy *phy = &mac->mac_phy; in bwi_mac_hostflags_init()
1309 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_hostflags_init()
1315 host_flags = HFLAGS_READ(mac); in bwi_mac_hostflags_init()
1330 HFLAGS_WRITE(mac, host_flags); in bwi_mac_hostflags_init()
1334 bwi_mac_bss_param_init(struct bwi_mac *mac) in bwi_mac_bss_param_init() argument
1336 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_bss_param_init()
1337 struct bwi_phy *phy = &mac->mac_phy; in bwi_mac_bss_param_init()
1351 bwi_mac_set_retry_lim(mac, &lim); in bwi_mac_bss_param_init()
1357 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_PROBE_RESP_TO, 1); in bwi_mac_bss_param_init()
1360 * XXX MAC level acknowledge and CW min/max should depend in bwi_mac_bss_param_init()
1367 bwi_mac_set_ackrates(mac, rt, in bwi_mac_bss_param_init()
1372 bwi_mac_set_ackrates(mac, rt, in bwi_mac_bss_param_init()
1383 MOBJ_WRITE_2(mac, BWI_80211_MOBJ, BWI_80211_MOBJ_CWMIN, cw_min); in bwi_mac_bss_param_init()
1388 MOBJ_WRITE_2(mac, BWI_80211_MOBJ, BWI_80211_MOBJ_CWMAX, in bwi_mac_bss_param_init()
1393 bwi_mac_set_retry_lim(struct bwi_mac *mac, const struct bwi_retry_lim *lim) in bwi_mac_set_retry_lim() argument
1396 MOBJ_WRITE_2(mac, BWI_80211_MOBJ, BWI_80211_MOBJ_SHRETRY, in bwi_mac_set_retry_lim()
1398 MOBJ_WRITE_2(mac, BWI_80211_MOBJ, BWI_80211_MOBJ_LGRETRY, in bwi_mac_set_retry_lim()
1402 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_SHRETRY_FB, in bwi_mac_set_retry_lim()
1404 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_LGRETEY_FB, in bwi_mac_set_retry_lim()
1409 bwi_mac_set_ackrates(struct bwi_mac *mac, const struct ieee80211_rate_table *rt, in bwi_mac_set_ackrates() argument
1435 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, ofs + 0x20, in bwi_mac_set_ackrates()
1436 MOBJ_READ_2(mac, BWI_COMM_MOBJ, ofs)); in bwi_mac_set_ackrates()
1441 bwi_mac_start(struct bwi_mac *mac) in bwi_mac_start() argument
1443 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_start()
1452 return bwi_mac_config_ps(mac); in bwi_mac_start()
1456 bwi_mac_stop(struct bwi_mac *mac) in bwi_mac_stop() argument
1458 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_stop()
1461 error = bwi_mac_config_ps(mac); in bwi_mac_stop()
1477 device_printf(sc->sc_dev, "can't stop MAC\n"); in bwi_mac_stop()
1486 bwi_mac_config_ps(struct bwi_mac *mac) in bwi_mac_config_ps() argument
1488 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_config_ps()
1500 if (mac->mac_rev >= 5) { in bwi_mac_config_ps()
1505 if (MOBJ_READ_2(mac, BWI_COMM_MOBJ, in bwi_mac_config_ps()
1520 bwi_mac_reset_hwkeys(struct bwi_mac *mac) in bwi_mac_reset_hwkeys() argument
1523 MOBJ_READ_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_KEYTABLE_OFS); in bwi_mac_reset_hwkeys()
1527 bwi_mac_shutdown(struct bwi_mac *mac) in bwi_mac_shutdown() argument
1529 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_shutdown()
1532 if (mac->mac_flags & BWI_MAC_F_HAS_TXSTATS) in bwi_mac_shutdown()
1540 bwi_rf_off(mac); in bwi_mac_shutdown()
1544 bwi_mac_gpio_fini(mac); in bwi_mac_shutdown()
1546 bwi_rf_off(mac); /* XXX again */ in bwi_mac_shutdown()
1548 bwi_regwin_disable(sc, &mac->mac_regwin, 0); in bwi_mac_shutdown()
1550 mac->mac_flags &= ~BWI_MAC_F_INITED; in bwi_mac_shutdown()
1554 bwi_mac_get_property(struct bwi_mac *mac) in bwi_mac_get_property() argument
1556 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_get_property()
1567 mac->mac_flags |= BWI_MAC_F_BSWAP; in bwi_mac_get_property()
1607 bwi_mac_updateslot(struct bwi_mac *mac, int shslot) in bwi_mac_updateslot() argument
1611 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11B) in bwi_mac_updateslot()
1619 CSR_WRITE_2(mac->mac_sc, BWI_MAC_SLOTTIME, in bwi_mac_updateslot()
1621 MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, BWI_COMM_MOBJ_SLOTTIME, slot_time); in bwi_mac_updateslot()
1627 struct bwi_mac *mac; in bwi_mac_attach() local
1639 * More than one MAC is only supported by BCM4309 in bwi_mac_attach()
1644 "ignore second MAC"); in bwi_mac_attach()
1648 mac = &sc->sc_mac[sc->sc_nmac]; in bwi_mac_attach()
1651 if (BWI_REGWIN_EXIST(&mac->mac_regwin)) { in bwi_mac_attach()
1652 device_printf(sc->sc_dev, "%dth MAC already attached\n", in bwi_mac_attach()
1658 * Test whether the revision of this MAC is supported in bwi_mac_attach()
1665 device_printf(sc->sc_dev, "MAC rev %u is " in bwi_mac_attach()
1670 BWI_CREATE_MAC(mac, sc, id, rev); in bwi_mac_attach()
1673 if (mac->mac_rev < 5) { in bwi_mac_attach()
1674 mac->mac_flags |= BWI_MAC_F_HAS_TXSTATS; in bwi_mac_attach()
1678 mac->mac_flags |= BWI_MAC_F_PHYE_RESET; in bwi_mac_attach()
1681 device_printf(sc->sc_dev, "MAC: rev %u\n", rev); in bwi_mac_attach()
1745 bwi_mac_adjust_tpctl(struct bwi_mac *mac, int rf_atten_adj, int bbp_atten_adj) in bwi_mac_adjust_tpctl() argument
1747 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_adjust_tpctl()
1748 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_adjust_tpctl()
1752 bcopy(&mac->mac_tpctl, &tpctl, sizeof(tpctl)); in bwi_mac_adjust_tpctl()
1792 bwi_mac_lock(mac); in bwi_mac_adjust_tpctl()
1793 bwi_mac_set_tpctl_11bg(mac, &tpctl); in bwi_mac_adjust_tpctl()
1794 bwi_mac_unlock(mac); in bwi_mac_adjust_tpctl()
1801 bwi_mac_calibrate_txpower(struct bwi_mac *mac, enum bwi_txpwrcb_type type) in bwi_mac_calibrate_txpower() argument
1803 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_calibrate_txpower()
1804 struct bwi_rf *rf = &mac->mac_rf; in bwi_mac_calibrate_txpower()
1812 if (mac->mac_flags & BWI_MAC_F_TPCTL_ERROR) { in bwi_mac_calibrate_txpower()
1828 error = bwi_rf_get_latest_tssi(mac, tssi, BWI_COMM_MOBJ_TSSI_DS); in bwi_mac_calibrate_txpower()
1833 if (mac->mac_phy.phy_mode == IEEE80211_MODE_11B) { in bwi_mac_calibrate_txpower()
1843 error = bwi_rf_get_latest_tssi(mac, tssi, in bwi_mac_calibrate_txpower()
1863 bwi_rf_clear_tssi(mac); in bwi_mac_calibrate_txpower()
1876 if (ofdm_tssi && (HFLAGS_READ(mac) & BWI_HFLAG_PWR_BOOST_DS)) in bwi_mac_calibrate_txpower()
1881 error = bwi_rf_tssi2dbm(mac, tssi_avg, &cur_txpwr); in bwi_mac_calibrate_txpower()
1911 bwi_mac_adjust_tpctl(mac, rf_atten_adj, bbp_atten_adj); in bwi_mac_calibrate_txpower()
1916 bwi_mac_lock(struct bwi_mac *mac) in bwi_mac_lock() argument
1918 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_lock()
1921 KASSERT((mac->mac_flags & BWI_MAC_F_LOCKED) == 0, in bwi_mac_lock()
1922 ("mac_flags 0x%x", mac->mac_flags)); in bwi_mac_lock()
1924 if (mac->mac_rev < 3) in bwi_mac_lock()
1925 bwi_mac_stop(mac); in bwi_mac_lock()
1927 bwi_mac_config_ps(mac); in bwi_mac_lock()
1935 mac->mac_flags |= BWI_MAC_F_LOCKED; in bwi_mac_lock()
1939 bwi_mac_unlock(struct bwi_mac *mac) in bwi_mac_unlock() argument
1941 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_unlock()
1944 KASSERT(mac->mac_flags & BWI_MAC_F_LOCKED, in bwi_mac_unlock()
1945 ("mac_flags 0x%x", mac->mac_flags)); in bwi_mac_unlock()
1951 if (mac->mac_rev < 3) in bwi_mac_unlock()
1952 bwi_mac_start(mac); in bwi_mac_unlock()
1954 bwi_mac_config_ps(mac); in bwi_mac_unlock()
1956 mac->mac_flags &= ~BWI_MAC_F_LOCKED; in bwi_mac_unlock()
1960 bwi_mac_set_promisc(struct bwi_mac *mac, int promisc) in bwi_mac_set_promisc() argument
1962 struct bwi_softc *sc = mac->mac_sc; in bwi_mac_set_promisc()
1964 if (mac->mac_rev < 5) /* Promisc is always on */ in bwi_mac_set_promisc()