Lines Matching refs:ah
114 ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum nl80211_band band, in ath5k_hw_get_frame_duration() argument
122 if (!ah->ah_bwmode) { in ath5k_hw_get_frame_duration()
123 __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw, in ath5k_hw_get_frame_duration()
139 switch (ah->ah_bwmode) { in ath5k_hw_get_frame_duration()
176 ath5k_hw_get_default_slottime(struct ath5k_hw *ah) in ath5k_hw_get_default_slottime() argument
178 struct ieee80211_channel *channel = ah->ah_current_channel; in ath5k_hw_get_default_slottime()
181 switch (ah->ah_bwmode) { in ath5k_hw_get_default_slottime()
194 if ((channel->hw_value == AR5K_MODE_11B) && !ah->ah_short_slot) in ath5k_hw_get_default_slottime()
207 ath5k_hw_get_default_sifs(struct ath5k_hw *ah) in ath5k_hw_get_default_sifs() argument
209 struct ieee80211_channel *channel = ah->ah_current_channel; in ath5k_hw_get_default_sifs()
212 switch (ah->ah_bwmode) { in ath5k_hw_get_default_sifs()
244 ath5k_hw_update_mib_counters(struct ath5k_hw *ah) in ath5k_hw_update_mib_counters() argument
246 struct ath5k_statistics *stats = &ah->stats; in ath5k_hw_update_mib_counters()
249 stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL); in ath5k_hw_update_mib_counters()
250 stats->rts_fail += ath5k_hw_reg_read(ah, AR5K_RTS_FAIL); in ath5k_hw_update_mib_counters()
251 stats->rts_ok += ath5k_hw_reg_read(ah, AR5K_RTS_OK); in ath5k_hw_update_mib_counters()
252 stats->fcs_error += ath5k_hw_reg_read(ah, AR5K_FCS_FAIL); in ath5k_hw_update_mib_counters()
253 stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT); in ath5k_hw_update_mib_counters()
278 ath5k_hw_write_rate_duration(struct ath5k_hw *ah) in ath5k_hw_write_rate_duration() argument
286 for (i = 0; i < ah->sbands[band].n_bitrates; i++) { in ath5k_hw_write_rate_duration()
290 if (ah->ah_ack_bitrate_high) in ath5k_hw_write_rate_duration()
291 rate = &ah->sbands[band].bitrates[ack_rates_high[i]]; in ath5k_hw_write_rate_duration()
294 rate = &ah->sbands[band].bitrates[0]; in ath5k_hw_write_rate_duration()
297 rate = &ah->sbands[band].bitrates[4]; in ath5k_hw_write_rate_duration()
308 tx_time = ath5k_hw_get_frame_duration(ah, band, 10, in ath5k_hw_write_rate_duration()
311 ath5k_hw_reg_write(ah, tx_time, reg); in ath5k_hw_write_rate_duration()
316 tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, true); in ath5k_hw_write_rate_duration()
317 ath5k_hw_reg_write(ah, tx_time, in ath5k_hw_write_rate_duration()
328 ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout) in ath5k_hw_set_ack_timeout() argument
330 if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_ACK)) in ath5k_hw_set_ack_timeout()
334 AR5K_REG_WRITE_BITS(ah, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK, in ath5k_hw_set_ack_timeout()
335 ath5k_hw_htoclock(ah, timeout)); in ath5k_hw_set_ack_timeout()
346 ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout) in ath5k_hw_set_cts_timeout() argument
348 if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_CTS)) in ath5k_hw_set_cts_timeout()
352 AR5K_REG_WRITE_BITS(ah, AR5K_TIME_OUT, AR5K_TIME_OUT_CTS, in ath5k_hw_set_cts_timeout()
353 ath5k_hw_htoclock(ah, timeout)); in ath5k_hw_set_cts_timeout()
371 ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) in ath5k_hw_set_lladdr() argument
373 struct ath_common *common = ath5k_hw_common(ah); in ath5k_hw_set_lladdr()
380 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; in ath5k_hw_set_lladdr()
385 ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); in ath5k_hw_set_lladdr()
386 ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); in ath5k_hw_set_lladdr()
399 ath5k_hw_set_bssid(struct ath5k_hw *ah) in ath5k_hw_set_bssid() argument
401 struct ath_common *common = ath5k_hw_common(ah); in ath5k_hw_set_bssid()
407 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_bssid()
413 ath5k_hw_reg_write(ah, in ath5k_hw_set_bssid()
416 ath5k_hw_reg_write(ah, in ath5k_hw_set_bssid()
422 ath5k_hw_disable_pspoll(ah); in ath5k_hw_set_bssid()
426 AR5K_REG_WRITE_BITS(ah, AR5K_BEACON, AR5K_BEACON_TIM, in ath5k_hw_set_bssid()
429 ath5k_hw_enable_pspoll(ah, NULL, 0); in ath5k_hw_set_bssid()
448 ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask) in ath5k_hw_set_bssid_mask() argument
450 struct ath_common *common = ath5k_hw_common(ah); in ath5k_hw_set_bssid_mask()
455 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_bssid_mask()
466 ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1) in ath5k_hw_set_mcast_filter() argument
468 ath5k_hw_reg_write(ah, filter0, AR5K_MCAST_FILTER0); in ath5k_hw_set_mcast_filter()
469 ath5k_hw_reg_write(ah, filter1, AR5K_MCAST_FILTER1); in ath5k_hw_set_mcast_filter()
483 ath5k_hw_get_rx_filter(struct ath5k_hw *ah) in ath5k_hw_get_rx_filter() argument
487 filter = ath5k_hw_reg_read(ah, AR5K_RX_FILTER); in ath5k_hw_get_rx_filter()
490 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_get_rx_filter()
491 data = ath5k_hw_reg_read(ah, AR5K_PHY_ERR_FIL); in ath5k_hw_get_rx_filter()
512 ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter) in ath5k_hw_set_rx_filter() argument
517 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_set_rx_filter()
527 if (ah->ah_version == AR5K_AR5210 && in ath5k_hw_set_rx_filter()
535 AR5K_REG_ENABLE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_ZLFDMA); in ath5k_hw_set_rx_filter()
537 AR5K_REG_DISABLE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_ZLFDMA); in ath5k_hw_set_rx_filter()
540 ath5k_hw_reg_write(ah, filter & 0xff, AR5K_RX_FILTER); in ath5k_hw_set_rx_filter()
543 if (ah->ah_version == AR5K_AR5212) in ath5k_hw_set_rx_filter()
544 ath5k_hw_reg_write(ah, data, AR5K_PHY_ERR_FIL); in ath5k_hw_set_rx_filter()
562 ath5k_hw_get_tsf64(struct ath5k_hw *ah) in ath5k_hw_get_tsf64() argument
583 tsf_upper1 = ath5k_hw_reg_read(ah, AR5K_TSF_U32); in ath5k_hw_get_tsf64()
585 tsf_lower = ath5k_hw_reg_read(ah, AR5K_TSF_L32); in ath5k_hw_get_tsf64()
586 tsf_upper2 = ath5k_hw_reg_read(ah, AR5K_TSF_U32); in ath5k_hw_get_tsf64()
609 ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64) in ath5k_hw_set_tsf64() argument
611 ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32); in ath5k_hw_set_tsf64()
612 ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32); in ath5k_hw_set_tsf64()
622 ath5k_hw_reset_tsf(struct ath5k_hw *ah) in ath5k_hw_reset_tsf() argument
626 val = ath5k_hw_reg_read(ah, AR5K_BEACON) | AR5K_BEACON_RESET_TSF; in ath5k_hw_reset_tsf()
634 ath5k_hw_reg_write(ah, val, AR5K_BEACON); in ath5k_hw_reset_tsf()
635 ath5k_hw_reg_write(ah, val, AR5K_BEACON); in ath5k_hw_reset_tsf()
648 ath5k_hw_init_beacon_timers(struct ath5k_hw *ah, u32 next_beacon, u32 interval) in ath5k_hw_init_beacon_timers() argument
655 switch (ah->opmode) { in ath5k_hw_init_beacon_timers()
662 if (ah->ah_version == AR5K_AR5210) { in ath5k_hw_init_beacon_timers()
670 AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PCF); in ath5k_hw_init_beacon_timers()
673 AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_ADHOC_BCN_ATIM); in ath5k_hw_init_beacon_timers()
693 if (ah->opmode == NL80211_IFTYPE_AP || in ath5k_hw_init_beacon_timers()
694 ah->opmode == NL80211_IFTYPE_MESH_POINT) in ath5k_hw_init_beacon_timers()
695 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); in ath5k_hw_init_beacon_timers()
697 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); in ath5k_hw_init_beacon_timers()
698 ath5k_hw_reg_write(ah, timer1, AR5K_TIMER1); in ath5k_hw_init_beacon_timers()
699 ath5k_hw_reg_write(ah, timer2, AR5K_TIMER2); in ath5k_hw_init_beacon_timers()
700 ath5k_hw_reg_write(ah, timer3, AR5K_TIMER3); in ath5k_hw_init_beacon_timers()
704 ath5k_hw_reset_tsf(ah); in ath5k_hw_init_beacon_timers()
706 ath5k_hw_reg_write(ah, interval & (AR5K_BEACON_PERIOD | in ath5k_hw_init_beacon_timers()
715 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_init_beacon_timers()
716 ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_ISR); in ath5k_hw_init_beacon_timers()
718 ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_PISR); in ath5k_hw_init_beacon_timers()
723 AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PWR_SV); in ath5k_hw_init_beacon_timers()
797 ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval) in ath5k_hw_check_beacon_timers() argument
801 nbtt = ath5k_hw_reg_read(ah, AR5K_TIMER0); in ath5k_hw_check_beacon_timers()
802 atim = ath5k_hw_reg_read(ah, AR5K_TIMER3); in ath5k_hw_check_beacon_timers()
803 dma = ath5k_hw_reg_read(ah, AR5K_TIMER1) >> 3; in ath5k_hw_check_beacon_timers()
824 ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class) in ath5k_hw_set_coverage_class() argument
827 int slot_time = ath5k_hw_get_default_slottime(ah) + 3 * coverage_class; in ath5k_hw_set_coverage_class()
828 int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time; in ath5k_hw_set_coverage_class()
831 ath5k_hw_set_ifs_intervals(ah, slot_time); in ath5k_hw_set_coverage_class()
832 ath5k_hw_set_ack_timeout(ah, ack_timeout); in ath5k_hw_set_coverage_class()
833 ath5k_hw_set_cts_timeout(ah, cts_timeout); in ath5k_hw_set_coverage_class()
835 ah->ah_coverage_class = coverage_class; in ath5k_hw_set_coverage_class()
852 ath5k_hw_start_rx_pcu(struct ath5k_hw *ah) in ath5k_hw_start_rx_pcu() argument
854 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); in ath5k_hw_start_rx_pcu()
864 ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah) in ath5k_hw_stop_rx_pcu() argument
866 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); in ath5k_hw_stop_rx_pcu()
877 ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) in ath5k_hw_set_opmode() argument
879 struct ath_common *common = ath5k_hw_common(ah); in ath5k_hw_set_opmode()
882 ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); in ath5k_hw_set_opmode()
885 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; in ath5k_hw_set_opmode()
888 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
897 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
900 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); in ath5k_hw_set_opmode()
907 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
910 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); in ath5k_hw_set_opmode()
915 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
920 | (ah->ah_version == AR5K_AR5210 ? in ath5k_hw_set_opmode()
933 ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); in ath5k_hw_set_opmode()
934 ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); in ath5k_hw_set_opmode()
939 if (ah->ah_version == AR5K_AR5210) in ath5k_hw_set_opmode()
940 ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR); in ath5k_hw_set_opmode()
954 ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode) in ath5k_hw_pcu_init() argument
957 ath5k_hw_set_bssid(ah); in ath5k_hw_pcu_init()
960 ath5k_hw_set_opmode(ah, op_mode); in ath5k_hw_pcu_init()
966 if (ah->ah_version == AR5K_AR5212 && in ath5k_hw_pcu_init()
967 ah->nvifs) in ath5k_hw_pcu_init()
968 ath5k_hw_write_rate_duration(ah); in ath5k_hw_pcu_init()
978 ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES | in ath5k_hw_pcu_init()
984 if (ah->ah_mac_srev >= AR5K_SREV_AR2413) { in ath5k_hw_pcu_init()
985 ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL); in ath5k_hw_pcu_init()
986 ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL); in ath5k_hw_pcu_init()
990 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_pcu_init()
991 ath5k_hw_reg_write(ah, in ath5k_hw_pcu_init()
999 if (ah->ah_coverage_class > 0) in ath5k_hw_pcu_init()
1000 ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class); in ath5k_hw_pcu_init()
1003 if (ah->ah_version == AR5K_AR5212) { in ath5k_hw_pcu_init()
1005 if (ah->ah_ack_bitrate_high) in ath5k_hw_pcu_init()
1006 AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val); in ath5k_hw_pcu_init()
1008 AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val); in ath5k_hw_pcu_init()