Lines Matching +full:usb +full:- +full:dc +full:- +full:cal

1 // SPDX-License-Identifier: GPL-2.0-or-later
24 #include <linux/crc-ccitt.h>
87 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_bbp_write()
104 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_bbp_write()
112 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_bbp_read()
136 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_bbp_read()
146 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_write()
152 switch (rt2x00dev->chip.rt) { in rt2800_rfcsr_write()
179 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_write()
228 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_read()
238 switch (rt2x00dev->chip.rt) { in rt2800_rfcsr_read()
271 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_read()
287 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rf_write()
304 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rf_write()
395 wiphy_name(rt2x00dev->hw->wiphy), word)) in rt2800_eeprom_word_index()
414 wiphy_name(rt2x00dev->hw->wiphy), word); in rt2800_eeprom_word_index()
486 return -EIO; in rt2800_enable_wlan_rt3290()
526 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_mcu_request()
544 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_mcu_request()
561 return -EBUSY; in rt2800_wait_csr_ready()
584 return -EACCES; in rt2800_wait_wpdma_ready()
606 switch (rt2x00dev->chip.rt) { in rt2800_get_txwi_rxwi_size()
637 fw_crc = (data[len - 2] << 8 | data[len - 1]); in rt2800_check_firmware_crc()
646 crc = crc_ccitt(~0, data, len - 2); in rt2800_check_firmware_crc()
649 * There is a small difference between the crc-itu-t + bitrev and in rt2800_check_firmware_crc()
650 * the crc-ccitt crc calculation. In the latter method the 2 bytes in rt2800_check_firmware_crc()
668 * of 8kb. USB devices require firmware files with a length in rt2800_check_firmware()
669 * of 4kb. Certain USB chipsets however require different firmware, in rt2800_check_firmware()
671 * file. Thus for USB devices, firmware files have a length in rt2800_check_firmware()
723 return -EBUSY; in rt2800_load_firmware()
736 return -EBUSY; in rt2800_load_firmware()
770 return -EBUSY; in rt2800_load_firmware()
806 test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); in rt2800_write_tx_data()
808 test_bit(ENTRY_TXD_HT_MIMO_PS, &txdesc->flags)); in rt2800_write_tx_data()
811 test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); in rt2800_write_tx_data()
813 test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); in rt2800_write_tx_data()
815 txdesc->u.ht.mpdu_density); in rt2800_write_tx_data()
816 rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->u.ht.txop); in rt2800_write_tx_data()
817 rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->u.ht.mcs); in rt2800_write_tx_data()
819 test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); in rt2800_write_tx_data()
821 test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); in rt2800_write_tx_data()
822 rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->u.ht.stbc); in rt2800_write_tx_data()
823 rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); in rt2800_write_tx_data()
828 test_bit(ENTRY_TXD_ACK, &txdesc->flags)); in rt2800_write_tx_data()
830 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); in rt2800_write_tx_data()
831 rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->u.ht.ba_size); in rt2800_write_tx_data()
833 test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? in rt2800_write_tx_data()
834 txdesc->key_idx : txdesc->u.ht.wcid); in rt2800_write_tx_data()
836 txdesc->length); in rt2800_write_tx_data()
837 rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, entry->queue->qid); in rt2800_write_tx_data()
838 rt2x00_set_field32(&word, TXWI_W1_PACKETID_ENTRY, (entry->entry_idx % 3) + 1); in rt2800_write_tx_data()
850 for (i = 2; i < entry->queue->winfo_size / sizeof(__le32); i++) in rt2800_write_tx_data()
860 s8 base_val = rt2x00_rt(rt2x00dev, RT6352) ? -2 : -12; in rt2800_agc_to_rssi()
866 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) { in rt2800_agc_to_rssi()
885 rssi0 = (rssi0) ? (base_val - offset0 - rt2x00dev->lna_gain - rssi0) : -128; in rt2800_agc_to_rssi()
886 rssi1 = (rssi1) ? (base_val - offset1 - rt2x00dev->lna_gain - rssi1) : -128; in rt2800_agc_to_rssi()
887 rssi2 = (rssi2) ? (base_val - offset2 - rt2x00dev->lna_gain - rssi2) : -128; in rt2800_agc_to_rssi()
891 * average doesn't deliver a fair answer either since -60:-60 would in rt2800_agc_to_rssi()
892 * be considered equally good as -50:-70 while the second is the one in rt2800_agc_to_rssi()
902 __le32 *rxwi = (__le32 *) entry->skb->data; in rt2800_process_rxwi()
907 rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF); in rt2800_process_rxwi()
908 rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); in rt2800_process_rxwi()
913 rxdesc->enc_flags |= RX_ENC_FLAG_SHORT_GI; in rt2800_process_rxwi()
916 rxdesc->bw = RATE_INFO_BW_40; in rt2800_process_rxwi()
921 rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; in rt2800_process_rxwi()
922 rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS); in rt2800_process_rxwi()
923 rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE); in rt2800_process_rxwi()
928 if (rxdesc->rate_mode == RATE_MODE_CCK) in rt2800_process_rxwi()
929 rxdesc->signal &= ~0x8; in rt2800_process_rxwi()
936 rxdesc->rssi = rt2800_agc_to_rssi(entry->queue->rt2x00dev, word); in rt2800_process_rxwi()
940 skb_pull(entry->skb, entry->queue->winfo_size); in rt2800_process_rxwi()
963 idx -= 8; in rt2800_rate_from_status()
973 skbdesc->tx_rate_idx = idx; in rt2800_rate_from_status()
974 skbdesc->tx_rate_flags = flags; in rt2800_rate_from_status()
989 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) in rt2800_txdone_entry_check()
1009 rt2x00_dbg(entry->queue->rt2x00dev, in rt2800_txdone_entry_check()
1011 entry->queue->qid, entry->entry_idx); in rt2800_txdone_entry_check()
1021 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_txdone_entry()
1022 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_txdone_entry()
1023 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2800_txdone_entry()
1044 * If a frame was meant to be sent as a single non-aggregated MPDU in rt2800_txdone_entry()
1064 rt2800_rate_from_status(skbdesc, status, rt2x00dev->curr_band); in rt2800_txdone_entry()
1084 * mcs - real_mcs in rt2800_txdone_entry()
1087 txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0); in rt2800_txdone_entry()
1095 txdesc.retry = rt2x00dev->long_retry; in rt2800_txdone_entry()
1100 * -> hw used fallback rates in rt2800_txdone_entry()
1106 /* RCU assures non-null sta will not be freed by mac80211. */ in rt2800_txdone_entry()
1109 skbdesc->sta = drv_data->wcid_to_sta[wcid - WCID_START]; in rt2800_txdone_entry()
1111 skbdesc->sta = NULL; in rt2800_txdone_entry()
1128 while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, &reg)) { in rt2800_txdone()
1130 * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is in rt2800_txdone()
1144 if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || in rt2800_txdone()
1145 !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) { in rt2800_txdone()
1147 entry->entry_idx, qid); in rt2800_txdone()
1163 if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) in rt2800_entry_txstatus_timeout()
1166 if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) in rt2800_entry_txstatus_timeout()
1171 ret = time_after(jiffies, entry->last_action + tout); in rt2800_entry_txstatus_timeout()
1173 rt2x00_dbg(entry->queue->rt2x00dev, in rt2800_entry_txstatus_timeout()
1175 entry->entry_idx, entry->queue->qid); in rt2800_entry_txstatus_timeout()
1218 * we loop until we find the first non-IO error entry. This in rt2800_txdone_nostatus()
1227 if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || in rt2800_txdone_nostatus()
1228 !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) in rt2800_txdone_nostatus()
1231 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) || in rt2800_txdone_nostatus()
1245 if (queue->wd_idx != cur_idx) { in rt2800_check_hung()
1246 queue->wd_idx = cur_idx; in rt2800_check_hung()
1247 queue->wd_count = 0; in rt2800_check_hung()
1249 queue->wd_count++; in rt2800_check_hung()
1251 return queue->wd_count > 16; in rt2800_check_hung()
1256 struct ieee80211_channel *chan = rt2x00dev->hw->conf.chandef.chan; in rt2800_update_survey()
1258 &rt2x00dev->chan_survey[chan->hw_value]; in rt2800_update_survey()
1260 chan_survey->time_idle += rt2800_register_read(rt2x00dev, CH_IDLE_STA); in rt2800_update_survey()
1261 chan_survey->time_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA); in rt2800_update_survey()
1262 chan_survey->time_ext_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); in rt2800_update_survey()
1274 switch (queue->qid) { in rt2800_watchdog_hung()
1289 if (rt2x00dev->intf_sta_count == 0) in rt2800_watchdog_hung()
1308 queue->wd_count = 0; in rt2800_watchdog_hung()
1321 rt2x00dev->rxdma_busy++; in rt2800_watchdog_dma_busy()
1323 rt2x00dev->rxdma_busy = 0; in rt2800_watchdog_dma_busy()
1327 rt2x00dev->txdma_busy++; in rt2800_watchdog_dma_busy()
1329 rt2x00dev->txdma_busy = 0; in rt2800_watchdog_dma_busy()
1331 busy_rx = rt2x00dev->rxdma_busy > 30; in rt2800_watchdog_dma_busy()
1332 busy_tx = rt2x00dev->txdma_busy > 30; in rt2800_watchdog_dma_busy()
1343 rt2x00dev->rxdma_busy = 0; in rt2800_watchdog_dma_busy()
1344 rt2x00dev->txdma_busy = 0; in rt2800_watchdog_dma_busy()
1353 if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) in rt2800_watchdog()
1356 if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_DMA_BUSY) in rt2800_watchdog()
1359 if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_HANG) in rt2800_watchdog()
1363 ieee80211_restart_hw(rt2x00dev->hw); in rt2800_watchdog()
1381 struct data_queue *queue = rt2x00dev->bcn; in rt2800_update_beacons_setup()
1390 for (i = 0; i < queue->limit; i++) { in rt2800_update_beacons_setup()
1391 entry = &queue->entries[i]; in rt2800_update_beacons_setup()
1392 if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags)) in rt2800_update_beacons_setup()
1394 off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx); in rt2800_update_beacons_setup()
1407 bcn_num > 0 ? bcn_num - 1 : 0); in rt2800_update_beacons_setup()
1413 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_write_beacon()
1414 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2800_write_beacon()
1418 const int txwi_desc_size = entry->queue->winfo_size; in rt2800_write_beacon()
1432 memset(skb_push(entry->skb, txwi_desc_size), 0, txwi_desc_size); in rt2800_write_beacon()
1437 skbdesc->flags |= SKBDESC_DESC_IN_SKB; in rt2800_write_beacon()
1438 skbdesc->desc = entry->skb->data; in rt2800_write_beacon()
1439 skbdesc->desc_len = txwi_desc_size; in rt2800_write_beacon()
1454 padding_len = roundup(entry->skb->len, 4) - entry->skb->len; in rt2800_write_beacon()
1455 if (padding_len && skb_pad(entry->skb, padding_len)) { in rt2800_write_beacon()
1458 entry->skb = NULL; in rt2800_write_beacon()
1463 beacon_base = rt2800_hw_beacon_base(rt2x00dev, entry->entry_idx); in rt2800_write_beacon()
1465 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, in rt2800_write_beacon()
1466 entry->skb->len + padding_len); in rt2800_write_beacon()
1467 __set_bit(ENTRY_BCN_ENABLED, &entry->flags); in rt2800_write_beacon()
1482 dev_kfree_skb_any(entry->skb); in rt2800_write_beacon()
1483 entry->skb = NULL; in rt2800_write_beacon()
1491 const int txwi_desc_size = rt2x00dev->bcn->winfo_size; in rt2800_clear_beacon_register()
1507 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_clear_beacon()
1522 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx); in rt2800_clear_beacon()
1523 __clear_bit(ENTRY_BCN_ENABLED, &entry->flags); in rt2800_clear_beacon()
1604 (enabled && led->rt2x00dev->curr_band == NL80211_BAND_2GHZ); in rt2800_brightness_set()
1606 rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, in rt2800_brightness_set()
1609 rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, in rt2800_brightness_set()
1614 if (rt2x00_is_soc(led->rt2x00dev)) { in rt2800_brightness_set()
1615 reg = rt2800_register_read(led->rt2x00dev, LED_CFG); in rt2800_brightness_set()
1621 if (led->type == LED_TYPE_RADIO) { in rt2800_brightness_set()
1624 } else if (led->type == LED_TYPE_ASSOC) { in rt2800_brightness_set()
1627 } else if (led->type == LED_TYPE_QUALITY) { in rt2800_brightness_set()
1632 rt2800_register_write(led->rt2x00dev, LED_CFG, reg); in rt2800_brightness_set()
1635 if (led->type == LED_TYPE_RADIO) { in rt2800_brightness_set()
1636 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, in rt2800_brightness_set()
1638 } else if (led->type == LED_TYPE_ASSOC) { in rt2800_brightness_set()
1639 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, in rt2800_brightness_set()
1641 } else if (led->type == LED_TYPE_QUALITY) { in rt2800_brightness_set()
1643 * The brightness is divided into 6 levels (0 - 5), in rt2800_brightness_set()
1648 * (1 << level) - 1 in rt2800_brightness_set()
1650 rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, in rt2800_brightness_set()
1651 (1 << brightness / (LED_FULL / 6)) - 1, in rt2800_brightness_set()
1660 led->rt2x00dev = rt2x00dev; in rt2800_init_led()
1661 led->type = type; in rt2800_init_led()
1662 led->led_dev.brightness_set = rt2800_brightness_set; in rt2800_init_led()
1663 led->flags = LED_INITIALIZED; in rt2800_init_led()
1719 offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx); in rt2800_config_wcid_attr_cipher()
1721 if (crypto->cmd == SET_KEY) { in rt2800_config_wcid_attr_cipher()
1724 !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); in rt2800_config_wcid_attr_cipher()
1731 (crypto->cipher & 0x7)); in rt2800_config_wcid_attr_cipher()
1733 (crypto->cipher & 0x8) >> 3); in rt2800_config_wcid_attr_cipher()
1734 rt2x00_set_field32(&reg, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher); in rt2800_config_wcid_attr_cipher()
1746 if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags)) in rt2800_config_wcid_attr_cipher()
1749 offset = MAC_IVEIV_ENTRY(key->hw_key_idx); in rt2800_config_wcid_attr_cipher()
1752 if ((crypto->cipher == CIPHER_TKIP) || in rt2800_config_wcid_attr_cipher()
1753 (crypto->cipher == CIPHER_TKIP_NO_MIC) || in rt2800_config_wcid_attr_cipher()
1754 (crypto->cipher == CIPHER_AES)) in rt2800_config_wcid_attr_cipher()
1756 iveiv_entry.iv[3] |= key->keyidx << 6; in rt2800_config_wcid_attr_cipher()
1770 if (crypto->cmd == SET_KEY) { in rt2800_config_shared_key()
1771 key->hw_key_idx = (4 * crypto->bssidx) + key->keyidx; in rt2800_config_shared_key()
1773 memcpy(key_entry.key, crypto->key, in rt2800_config_shared_key()
1775 memcpy(key_entry.tx_mic, crypto->tx_mic, in rt2800_config_shared_key()
1777 memcpy(key_entry.rx_mic, crypto->rx_mic, in rt2800_config_shared_key()
1780 offset = SHARED_KEY_ENTRY(key->hw_key_idx); in rt2800_config_shared_key()
1792 field.bit_offset = 4 * (key->hw_key_idx % 8); in rt2800_config_shared_key()
1795 offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8); in rt2800_config_shared_key()
1799 (crypto->cmd == SET_KEY) * crypto->cipher); in rt2800_config_shared_key()
1805 rt2800_config_wcid(rt2x00dev, crypto->address, key->hw_key_idx); in rt2800_config_shared_key()
1806 rt2800_config_wcid_attr_bssidx(rt2x00dev, key->hw_key_idx, in rt2800_config_shared_key()
1807 crypto->bssidx); in rt2800_config_shared_key()
1821 if (crypto->cmd == SET_KEY) { in rt2800_config_pairwise_key()
1826 if (crypto->wcid > WCID_END) in rt2800_config_pairwise_key()
1827 return -ENOSPC; in rt2800_config_pairwise_key()
1828 key->hw_key_idx = crypto->wcid; in rt2800_config_pairwise_key()
1830 memcpy(key_entry.key, crypto->key, in rt2800_config_pairwise_key()
1832 memcpy(key_entry.tx_mic, crypto->tx_mic, in rt2800_config_pairwise_key()
1834 memcpy(key_entry.rx_mic, crypto->rx_mic, in rt2800_config_pairwise_key()
1837 offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx); in rt2800_config_pairwise_key()
1855 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_set_max_psdu_len()
1858 if (drv_data->ampdu_factor_cnt[i] > 0) in rt2800_set_max_psdu_len()
1861 max_psdu = min(drv_data->max_psdu, i); in rt2800_set_max_psdu_len()
1871 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_sta_add()
1872 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_sta_add()
1882 if (sta->deflink.ht_cap.ht_supported) { in rt2800_sta_add()
1883 drv_data->ampdu_factor_cnt[sta->deflink.ht_cap.ampdu_factor & 3]++; in rt2800_sta_add()
1891 wcid = find_first_zero_bit(drv_data->sta_ids, STA_IDS_SIZE) + WCID_START; in rt2800_sta_add()
1897 sta_priv->wcid = wcid; in rt2800_sta_add()
1901 * with the STA -> No error. in rt2800_sta_add()
1906 __set_bit(wcid - WCID_START, drv_data->sta_ids); in rt2800_sta_add()
1907 drv_data->wcid_to_sta[wcid - WCID_START] = sta; in rt2800_sta_add()
1913 rt2800_config_wcid(rt2x00dev, sta->addr, wcid); in rt2800_sta_add()
1923 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_sta_remove()
1924 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_sta_remove()
1926 int wcid = sta_priv->wcid; in rt2800_sta_remove()
1928 if (sta->deflink.ht_cap.ht_supported) { in rt2800_sta_remove()
1929 drv_data->ampdu_factor_cnt[sta->deflink.ht_cap.ampdu_factor & 3]--; in rt2800_sta_remove()
1940 drv_data->wcid_to_sta[wcid - WCID_START] = NULL; in rt2800_sta_remove()
1941 __clear_bit(wcid - WCID_START, drv_data->sta_ids); in rt2800_sta_remove()
1949 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_pre_reset_hw()
1950 struct data_queue *queue = rt2x00dev->bcn; in rt2800_pre_reset_hw()
1955 drv_data->wcid_to_sta[wcid - WCID_START] = NULL; in rt2800_pre_reset_hw()
1956 __clear_bit(wcid - WCID_START, drv_data->sta_ids); in rt2800_pre_reset_hw()
1959 for (i = 0; i < queue->limit; i++) { in rt2800_pre_reset_hw()
1960 entry = &queue->entries[i]; in rt2800_pre_reset_hw()
1961 clear_bit(ENTRY_BCN_ASSIGNED, &entry->flags); in rt2800_pre_reset_hw()
1983 !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); in rt2800_config_filter()
2022 rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_SYNC, conf->sync); in rt2800_config_intf()
2025 if (conf->sync == TSF_SYNC_AP_NONE) { in rt2800_config_intf()
2047 conf->sync == TSF_SYNC_AP_NONE) { in rt2800_config_intf()
2052 memcpy(conf->bssid, conf->mac, sizeof(conf->mac)); in rt2800_config_intf()
2056 if (!is_zero_ether_addr((const u8 *)conf->mac)) { in rt2800_config_intf()
2057 reg = le32_to_cpu(conf->mac[1]); in rt2800_config_intf()
2059 conf->mac[1] = cpu_to_le32(reg); in rt2800_config_intf()
2063 conf->mac, sizeof(conf->mac)); in rt2800_config_intf()
2067 if (!is_zero_ether_addr((const u8 *)conf->bssid)) { in rt2800_config_intf()
2068 reg = le32_to_cpu(conf->bssid[1]); in rt2800_config_intf()
2071 conf->bssid[1] = cpu_to_le32(reg); in rt2800_config_intf()
2075 conf->bssid, sizeof(conf->bssid)); in rt2800_config_intf()
2083 bool any_sta_nongf = !!(erp->ht_opmode & in rt2800_config_ht_opmode()
2085 u8 protection = erp->ht_opmode & IEEE80211_HT_OP_MODE_PROTECTION; in rt2800_config_ht_opmode()
2129 * -> fall through to mixed mode. in rt2800_config_ht_opmode()
2142 if (erp->cts_protection) { in rt2800_config_ht_opmode()
2184 !!erp->short_preamble); in rt2800_config_erp()
2191 erp->cts_protection ? 2 : 0); in rt2800_config_erp()
2197 0xff0 | erp->basic_rates); in rt2800_config_erp()
2204 erp->slot_time); in rt2800_config_erp()
2208 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs); in rt2800_config_erp()
2215 erp->beacon_int * 16); in rt2800_config_erp()
2239 return -EACCES; in rt2800_wait_bbp_rf_ready()
2263 return -EACCES; in rt2800_wait_bbp_ready()
2273 if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) { in rt2800_config_3572bt_ant()
2337 switch (ant->tx_chain_num) { in rt2800_config_ant()
2356 switch (ant->rx_chain_num) { in rt2800_config_ant()
2367 rt2x00dev->default_ant.rx); in rt2800_config_ant()
2376 rt2x00dev->curr_band == NL80211_BAND_5GHZ); in rt2800_config_ant()
2392 if (ant->rx_chain_num == 1) in rt2800_config_ant()
2406 if (libconf->rf.channel <= 14) { in rt2800_config_lna_gain()
2409 } else if (libconf->rf.channel <= 64) { in rt2800_config_lna_gain()
2412 } else if (libconf->rf.channel <= 128) { in rt2800_config_lna_gain()
2436 rt2x00dev->lna_gain = lna_gain; in rt2800_config_lna_gain()
2441 return clk_get_rate(rt2x00dev->clk) == 20000000; in rt2800_clk_is_20mhz()
2451 freq_offset = rt2x00_get_field8(rt2x00dev->freq_offset, RFCSR17_CODE); in rt2800_freq_cal_mode1()
2472 prev_freq_offset--; in rt2800_freq_cal_mode1()
2486 rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); in rt2800_config_channel_rf2xxx()
2488 if (rt2x00dev->default_ant.tx_chain_num == 1) in rt2800_config_channel_rf2xxx()
2489 rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1); in rt2800_config_channel_rf2xxx()
2491 if (rt2x00dev->default_ant.rx_chain_num == 1) { in rt2800_config_channel_rf2xxx()
2492 rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1); in rt2800_config_channel_rf2xxx()
2493 rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); in rt2800_config_channel_rf2xxx()
2494 } else if (rt2x00dev->default_ant.rx_chain_num == 2) in rt2800_config_channel_rf2xxx()
2495 rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); in rt2800_config_channel_rf2xxx()
2497 if (rf->channel > 14) { in rt2800_config_channel_rf2xxx()
2500 * make it a positive value (Minimum value is -7). in rt2800_config_channel_rf2xxx()
2504 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, in rt2800_config_channel_rf2xxx()
2505 (info->default_power1 >= 0)); in rt2800_config_channel_rf2xxx()
2507 if (info->default_power1 < 0) in rt2800_config_channel_rf2xxx()
2508 info->default_power1 += 7; in rt2800_config_channel_rf2xxx()
2510 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, info->default_power1); in rt2800_config_channel_rf2xxx()
2512 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, in rt2800_config_channel_rf2xxx()
2513 (info->default_power2 >= 0)); in rt2800_config_channel_rf2xxx()
2515 if (info->default_power2 < 0) in rt2800_config_channel_rf2xxx()
2516 info->default_power2 += 7; in rt2800_config_channel_rf2xxx()
2518 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, info->default_power2); in rt2800_config_channel_rf2xxx()
2520 rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, info->default_power1); in rt2800_config_channel_rf2xxx()
2521 rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, info->default_power2); in rt2800_config_channel_rf2xxx()
2524 rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); in rt2800_config_channel_rf2xxx()
2526 rt2800_rf_write(rt2x00dev, 1, rf->rf1); in rt2800_config_channel_rf2xxx()
2527 rt2800_rf_write(rt2x00dev, 2, rf->rf2); in rt2800_config_channel_rf2xxx()
2528 rt2800_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); in rt2800_config_channel_rf2xxx()
2529 rt2800_rf_write(rt2x00dev, 4, rf->rf4); in rt2800_config_channel_rf2xxx()
2533 rt2800_rf_write(rt2x00dev, 1, rf->rf1); in rt2800_config_channel_rf2xxx()
2534 rt2800_rf_write(rt2x00dev, 2, rf->rf2); in rt2800_config_channel_rf2xxx()
2535 rt2800_rf_write(rt2x00dev, 3, rf->rf3 | 0x00000004); in rt2800_config_channel_rf2xxx()
2536 rt2800_rf_write(rt2x00dev, 4, rf->rf4); in rt2800_config_channel_rf2xxx()
2540 rt2800_rf_write(rt2x00dev, 1, rf->rf1); in rt2800_config_channel_rf2xxx()
2541 rt2800_rf_write(rt2x00dev, 2, rf->rf2); in rt2800_config_channel_rf2xxx()
2542 rt2800_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); in rt2800_config_channel_rf2xxx()
2543 rt2800_rf_write(rt2x00dev, 4, rf->rf4); in rt2800_config_channel_rf2xxx()
2551 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf3xxx()
2554 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); in rt2800_config_channel_rf3xxx()
2557 rt2x00_set_field8(&rfcsr, RFCSR3_K, rf->rf3); in rt2800_config_channel_rf3xxx()
2561 rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2); in rt2800_config_channel_rf3xxx()
2565 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1); in rt2800_config_channel_rf3xxx()
2569 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2); in rt2800_config_channel_rf3xxx()
2575 rt2x00dev->default_ant.rx_chain_num <= 1); in rt2800_config_channel_rf3xxx()
2577 rt2x00dev->default_ant.rx_chain_num <= 2); in rt2800_config_channel_rf3xxx()
2580 rt2x00dev->default_ant.tx_chain_num <= 1); in rt2800_config_channel_rf3xxx()
2582 rt2x00dev->default_ant.tx_chain_num <= 2); in rt2800_config_channel_rf3xxx()
2586 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); in rt2800_config_channel_rf3xxx()
2594 calib_tx = drv_data->calibration_bw40; in rt2800_config_channel_rf3xxx()
2595 calib_rx = drv_data->calibration_bw40; in rt2800_config_channel_rf3xxx()
2597 calib_tx = drv_data->calibration_bw20; in rt2800_config_channel_rf3xxx()
2598 calib_rx = drv_data->calibration_bw20; in rt2800_config_channel_rf3xxx()
2629 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf3052()
2633 if (rf->channel <= 14) { in rt2800_config_channel_rf3052()
2634 rt2800_bbp_write(rt2x00dev, 25, drv_data->bbp25); in rt2800_config_channel_rf3052()
2635 rt2800_bbp_write(rt2x00dev, 26, drv_data->bbp26); in rt2800_config_channel_rf3052()
2641 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); in rt2800_config_channel_rf3052()
2642 rt2800_rfcsr_write(rt2x00dev, 3, rf->rf3); in rt2800_config_channel_rf3052()
2645 rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2); in rt2800_config_channel_rf3052()
2646 if (rf->channel <= 14) in rt2800_config_channel_rf3052()
2653 if (rf->channel <= 14) in rt2800_config_channel_rf3052()
2660 if (rf->channel <= 14) { in rt2800_config_channel_rf3052()
2663 info->default_power1); in rt2800_config_channel_rf3052()
2667 (info->default_power1 & 0x3) | in rt2800_config_channel_rf3052()
2668 ((info->default_power1 & 0xC) << 1)); in rt2800_config_channel_rf3052()
2673 if (rf->channel <= 14) { in rt2800_config_channel_rf3052()
2676 info->default_power2); in rt2800_config_channel_rf3052()
2680 (info->default_power2 & 0x3) | in rt2800_config_channel_rf3052()
2681 ((info->default_power2 & 0xC) << 1)); in rt2800_config_channel_rf3052()
2693 if (rf->channel <= 14) { in rt2800_config_channel_rf3052()
2700 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_config_channel_rf3052()
2709 switch (rt2x00dev->default_ant.rx_chain_num) { in rt2800_config_channel_rf3052()
2721 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); in rt2800_config_channel_rf3052()
2725 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw40); in rt2800_config_channel_rf3052()
2726 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw40); in rt2800_config_channel_rf3052()
2728 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw20); in rt2800_config_channel_rf3052()
2729 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw20); in rt2800_config_channel_rf3052()
2732 if (rf->channel <= 14) { in rt2800_config_channel_rf3052()
2740 drv_data->txmixer_gain_24g); in rt2800_config_channel_rf3052()
2762 drv_data->txmixer_gain_5g); in rt2800_config_channel_rf3052()
2765 if (rf->channel <= 64) { in rt2800_config_channel_rf3052()
2769 } else if (rf->channel <= 128) { in rt2800_config_channel_rf3052()
2785 if (rf->channel <= 14) in rt2800_config_channel_rf3052()
2801 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf3053()
2818 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
2820 rt2800_bbp_write(rt2x00dev, 25, drv_data->bbp25); in rt2800_config_channel_rf3053()
2821 rt2800_bbp_write(rt2x00dev, 26, drv_data->bbp26); in rt2800_config_channel_rf3053()
2831 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); in rt2800_config_channel_rf3053()
2832 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3 & 0xf); in rt2800_config_channel_rf3053()
2835 rt2x00_set_field8(&rfcsr, RFCSR11_R, (rf->rf2 & 0x3)); in rt2800_config_channel_rf3053()
2840 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
2847 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
2850 info->default_power1 & 0x1f); in rt2800_config_channel_rf3053()
2856 ((info->default_power1 & 0x18) << 1) | in rt2800_config_channel_rf3053()
2857 (info->default_power1 & 7)); in rt2800_config_channel_rf3053()
2862 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
2865 info->default_power2 & 0x1f); in rt2800_config_channel_rf3053()
2871 ((info->default_power2 & 0x18) << 1) | in rt2800_config_channel_rf3053()
2872 (info->default_power2 & 7)); in rt2800_config_channel_rf3053()
2877 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
2880 info->default_power3 & 0x1f); in rt2800_config_channel_rf3053()
2886 ((info->default_power3 & 0x18) << 1) | in rt2800_config_channel_rf3053()
2887 (info->default_power3 & 7)); in rt2800_config_channel_rf3053()
2901 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_config_channel_rf3053()
2913 switch (rt2x00dev->default_ant.rx_chain_num) { in rt2800_config_channel_rf3053()
2929 txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40, in rt2800_config_channel_rf3053()
2931 txrx_h20m = rt2x00_get_field8(drv_data->calibration_bw40, in rt2800_config_channel_rf3053()
2934 txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw20, in rt2800_config_channel_rf3053()
2936 txrx_h20m = rt2x00_get_field8(drv_data->calibration_bw20, in rt2800_config_channel_rf3053()
2946 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
2959 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
2966 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
2973 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
2980 if (rf->channel >= 1 && rf->channel <= 14) in rt2800_config_channel_rf3053()
2982 else if (rf->channel >= 36 && rf->channel <= 64) in rt2800_config_channel_rf3053()
2984 else if (rf->channel >= 100 && rf->channel <= 128) in rt2800_config_channel_rf3053()
2996 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
3009 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
3019 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
3034 if (rf->channel <= 14) in rt2800_config_channel_rf3053()
3040 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
3050 if (rf->channel <= 14) { in rt2800_config_channel_rf3053()
3062 if (rf->channel >= 1 && rf->channel <= 14) { in rt2800_config_channel_rf3053()
3069 } else if (rf->channel >= 36 && rf->channel <= 64) { in rt2800_config_channel_rf3053()
3076 } else if (rf->channel >= 100 && rf->channel <= 128) { in rt2800_config_channel_rf3053()
3106 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3108 else if (rf->channel < 132) in rt2800_config_channel_rf3853()
3113 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); in rt2800_config_channel_rf3853()
3114 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); in rt2800_config_channel_rf3853()
3116 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3121 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3138 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_config_channel_rf3853()
3150 switch (rt2x00dev->default_ant.rx_chain_num) { in rt2800_config_channel_rf3853()
3172 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3182 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3189 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3195 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3197 else if (rf->channel < 100) in rt2800_config_channel_rf3853()
3199 else if (rf->channel < 132) in rt2800_config_channel_rf3853()
3209 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3214 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3216 else if (rf->channel < 100) in rt2800_config_channel_rf3853()
3218 else if (rf->channel < 132) in rt2800_config_channel_rf3853()
3224 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3237 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3243 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3248 if (rf->channel <= 14) { in rt2800_config_channel_rf3853()
3249 pwr1 = info->default_power1 & 0x1f; in rt2800_config_channel_rf3853()
3250 pwr2 = info->default_power2 & 0x1f; in rt2800_config_channel_rf3853()
3251 pwr3 = info->default_power3 & 0x1f; in rt2800_config_channel_rf3853()
3253 pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) | in rt2800_config_channel_rf3853()
3254 (info->default_power1 & 0x7); in rt2800_config_channel_rf3853()
3255 pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) | in rt2800_config_channel_rf3853()
3256 (info->default_power2 & 0x7); in rt2800_config_channel_rf3853()
3257 pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) | in rt2800_config_channel_rf3853()
3258 (info->default_power3 & 0x7); in rt2800_config_channel_rf3853()
3266 rf->channel, pwr1, pwr2, pwr3); in rt2800_config_channel_rf3853()
3268 bbp = (info->default_power1 >> 5) | in rt2800_config_channel_rf3853()
3269 ((info->default_power2 & 0xe0) >> 1); in rt2800_config_channel_rf3853()
3274 bbp |= (info->default_power3 & 0xe0) >> 1; in rt2800_config_channel_rf3853()
3278 if (rf->channel <= 14) in rt2800_config_channel_rf3853()
3308 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); in rt2800_config_channel_rf3290()
3309 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); in rt2800_config_channel_rf3290()
3311 rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf2); in rt2800_config_channel_rf3290()
3315 if (info->default_power1 > POWER_BOUND) in rt2800_config_channel_rf3290()
3318 rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); in rt2800_config_channel_rf3290()
3323 if (rf->channel <= 14) { in rt2800_config_channel_rf3290()
3324 if (rf->channel == 6) in rt2800_config_channel_rf3290()
3329 if (rf->channel >= 1 && rf->channel <= 6) in rt2800_config_channel_rf3290()
3331 else if (rf->channel >= 7 && rf->channel <= 11) in rt2800_config_channel_rf3290()
3333 else if (rf->channel >= 12 && rf->channel <= 14) in rt2800_config_channel_rf3290()
3345 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); in rt2800_config_channel_rf3322()
3346 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); in rt2800_config_channel_rf3322()
3352 if (info->default_power1 > POWER_BOUND) in rt2800_config_channel_rf3322()
3355 rt2800_rfcsr_write(rt2x00dev, 47, info->default_power1); in rt2800_config_channel_rf3322()
3357 if (info->default_power2 > POWER_BOUND) in rt2800_config_channel_rf3322()
3360 rt2800_rfcsr_write(rt2x00dev, 48, info->default_power2); in rt2800_config_channel_rf3322()
3368 if ( rt2x00dev->default_ant.tx_chain_num == 2 ) in rt2800_config_channel_rf3322()
3373 if ( rt2x00dev->default_ant.rx_chain_num == 2 ) in rt2800_config_channel_rf3322()
3392 int idx = rf->channel-1; in rt2800_config_channel_rf53xx()
3394 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); in rt2800_config_channel_rf53xx()
3395 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); in rt2800_config_channel_rf53xx()
3397 rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf2); in rt2800_config_channel_rf53xx()
3401 if (info->default_power1 > POWER_BOUND) in rt2800_config_channel_rf53xx()
3404 rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); in rt2800_config_channel_rf53xx()
3409 if (info->default_power2 > POWER_BOUND) in rt2800_config_channel_rf53xx()
3413 info->default_power2); in rt2800_config_channel_rf53xx()
3499 (rf->channel > 14 || conf_is_ht40(conf)) ? 5 : 0); in rt2800_config_channel_rf55xx()
3503 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1 & 0xff); in rt2800_config_channel_rf55xx()
3506 rt2x00_set_field8(&rfcsr, RFCSR9_K, rf->rf2 & 0xf); in rt2800_config_channel_rf55xx()
3507 rt2x00_set_field8(&rfcsr, RFCSR9_N, (rf->rf1 & 0x100) >> 8); in rt2800_config_channel_rf55xx()
3508 rt2x00_set_field8(&rfcsr, RFCSR9_MOD, ((rf->rf3 - 8) & 0x4) >> 2); in rt2800_config_channel_rf55xx()
3512 rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf4 - 1); in rt2800_config_channel_rf55xx()
3513 rt2x00_set_field8(&rfcsr, RFCSR11_MOD, (rf->rf3 - 8) & 0x3); in rt2800_config_channel_rf55xx()
3516 if (rf->channel <= 14) { in rt2800_config_channel_rf55xx()
3548 /* TODO RF27 <- tssi */ in rt2800_config_channel_rf55xx()
3550 rfcsr = rf->channel <= 10 ? 0x07 : 0x06; in rt2800_config_channel_rf55xx()
3590 /* TODO RF27 <- tssi */ in rt2800_config_channel_rf55xx()
3592 if (rf->channel >= 36 && rf->channel <= 64) { in rt2800_config_channel_rf55xx()
3598 if (rf->channel <= 50) in rt2800_config_channel_rf55xx()
3600 else if (rf->channel >= 52) in rt2800_config_channel_rf55xx()
3609 if (rf->channel <= 50) { in rt2800_config_channel_rf55xx()
3612 } else if (rf->channel >= 52) { in rt2800_config_channel_rf55xx()
3621 } else if (rf->channel >= 100 && rf->channel <= 165) { in rt2800_config_channel_rf55xx()
3626 if (rf->channel <= 153) { in rt2800_config_channel_rf55xx()
3629 } else if (rf->channel >= 155) { in rt2800_config_channel_rf55xx()
3633 if (rf->channel <= 138) { in rt2800_config_channel_rf55xx()
3638 } else if (rf->channel >= 140) { in rt2800_config_channel_rf55xx()
3644 if (rf->channel <= 124) in rt2800_config_channel_rf55xx()
3646 else if (rf->channel >= 126) in rt2800_config_channel_rf55xx()
3648 if (rf->channel <= 138) in rt2800_config_channel_rf55xx()
3650 else if (rf->channel >= 140) in rt2800_config_channel_rf55xx()
3653 if (rf->channel <= 138) in rt2800_config_channel_rf55xx()
3655 else if (rf->channel >= 140) in rt2800_config_channel_rf55xx()
3657 if (rf->channel <= 128) in rt2800_config_channel_rf55xx()
3659 else if (rf->channel >= 130) in rt2800_config_channel_rf55xx()
3661 if (rf->channel <= 116) in rt2800_config_channel_rf55xx()
3663 else if (rf->channel >= 118) in rt2800_config_channel_rf55xx()
3665 if (rf->channel <= 138) in rt2800_config_channel_rf55xx()
3667 else if (rf->channel >= 140) in rt2800_config_channel_rf55xx()
3669 if (rf->channel <= 116) in rt2800_config_channel_rf55xx()
3671 else if (rf->channel >= 118) in rt2800_config_channel_rf55xx()
3680 if (info->default_power1 > power_bound) in rt2800_config_channel_rf55xx()
3683 rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); in rt2800_config_channel_rf55xx()
3689 if (info->default_power2 > power_bound) in rt2800_config_channel_rf55xx()
3692 rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2); in rt2800_config_channel_rf55xx()
3702 rt2x00dev->default_ant.tx_chain_num >= 1); in rt2800_config_channel_rf55xx()
3704 rt2x00dev->default_ant.tx_chain_num == 2); in rt2800_config_channel_rf55xx()
3708 rt2x00dev->default_ant.rx_chain_num >= 1); in rt2800_config_channel_rf55xx()
3710 rt2x00dev->default_ant.rx_chain_num == 2); in rt2800_config_channel_rf55xx()
3735 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel_rf55xx()
3736 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel_rf55xx()
3737 rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel_rf55xx()
3739 rt2800_bbp_write(rt2x00dev, 79, (rf->channel <= 14) ? 0x1C : 0x18); in rt2800_config_channel_rf55xx()
3740 rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08); in rt2800_config_channel_rf55xx()
3741 rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38); in rt2800_config_channel_rf55xx()
3742 rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92); in rt2800_config_channel_rf55xx()
3746 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0xE0 : 0xF0); in rt2800_config_channel_rf55xx()
3748 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x1F : 0x1E); in rt2800_config_channel_rf55xx()
3750 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x38 : 0x28); in rt2800_config_channel_rf55xx()
3752 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); in rt2800_config_channel_rf55xx()
3754 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); in rt2800_config_channel_rf55xx()
3756 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); in rt2800_config_channel_rf55xx()
3764 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf7620()
3778 * R20[7:0] in rf->rf1 in rt2800_config_channel_rf7620()
3782 rfcsr = (rf->rf1 & 0x00ff); in rt2800_config_channel_rf7620()
3804 * Ksd: R17<7:0> in rf->rf2 in rt2800_config_channel_rf7620()
3805 * R18<7:0> in rf->rf3 in rt2800_config_channel_rf7620()
3806 * R19<1:0> in rf->rf4 in rt2800_config_channel_rf7620()
3809 rfcsr = rf->rf2; in rt2800_config_channel_rf7620()
3813 rfcsr = rf->rf3; in rt2800_config_channel_rf7620()
3817 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); in rt2800_config_channel_rf7620()
3831 rt2x00dev->default_ant.tx_chain_num != 1); in rt2800_config_channel_rf7620()
3836 rt2x00dev->default_ant.tx_chain_num != 1); in rt2800_config_channel_rf7620()
3838 rt2x00dev->default_ant.rx_chain_num != 1); in rt2800_config_channel_rf7620()
3843 rt2x00dev->default_ant.tx_chain_num != 1); in rt2800_config_channel_rf7620()
3846 /* RF for DC Cal BW */ in rt2800_config_channel_rf7620()
3871 conf_is_ht40(conf) && (rf->channel == 11)); in rt2800_config_channel_rf7620()
3874 if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { in rt2800_config_channel_rf7620()
3876 rx_agc_fc = drv_data->rx_calibration_bw40; in rt2800_config_channel_rf7620()
3877 tx_agc_fc = drv_data->tx_calibration_bw40; in rt2800_config_channel_rf7620()
3879 rx_agc_fc = drv_data->rx_calibration_bw20; in rt2800_config_channel_rf7620()
3880 tx_agc_fc = drv_data->tx_calibration_bw20; in rt2800_config_channel_rf7620()
3922 int cur_channel = rt2x00dev->rf_channel; in rt2800_config_alc_rt6352()
3934 power_level = (power_level - 3) * 2; in rt2800_config_alc_rt6352()
3945 power_level -= rate_power; in rt2800_config_alc_rt6352()
3952 chan_power = power_group[cnt][cur_channel - 1]; in rt2800_config_alc_rt6352()
3986 if (chan->center_freq > 2457) { in rt2800_config_alc_rt6352()
4016 for (chain = 0; chain < rt2x00dev->default_ant.rx_chain_num; chain++) { in rt2800_bbp_write_with_rx_chain()
4027 u8 cal; in rt2800_iq_calibrate() local
4032 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX0_2G); in rt2800_iq_calibrate()
4034 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4037 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4040 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4043 cal = 0; in rt2800_iq_calibrate()
4044 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4049 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX0_2G); in rt2800_iq_calibrate()
4051 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4054 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4057 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4060 cal = 0; in rt2800_iq_calibrate()
4061 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4066 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX1_2G); in rt2800_iq_calibrate()
4068 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4071 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4074 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4077 cal = 0; in rt2800_iq_calibrate()
4078 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4083 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX1_2G); in rt2800_iq_calibrate()
4085 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4088 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4091 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4094 cal = 0; in rt2800_iq_calibrate()
4095 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4101 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_RF_IQ_COMPENSATION_CONTROL); in rt2800_iq_calibrate()
4102 rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); in rt2800_iq_calibrate()
4106 cal = rt2x00_eeprom_byte(rt2x00dev, in rt2800_iq_calibrate()
4108 rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); in rt2800_iq_calibrate()
4135 bbp = (rf->channel > 14) ? 0x48 : 0x38; in rt3883_bbp_adjust()
4140 if (rf->channel <= 14) { in rt3883_bbp_adjust()
4149 if (rf->channel > 14) { in rt3883_bbp_adjust()
4169 info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4170 info->default_power1); in rt2800_config_channel()
4171 info->default_power2 = rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4172 info->default_power2); in rt2800_config_channel()
4173 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_config_channel()
4174 info->default_power3 = in rt2800_config_channel()
4175 rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4176 info->default_power3); in rt2800_config_channel()
4178 switch (rt2x00dev->chip.rt) { in rt2800_config_channel()
4184 switch (rt2x00dev->chip.rf) { in rt2800_config_channel()
4261 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4262 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4263 rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4266 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); in rt2800_config_channel()
4268 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); in rt2800_config_channel()
4272 if (rf->channel > 14) { in rt2800_config_channel()
4284 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4285 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4286 rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4289 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4290 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4291 rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4293 if (rt2x00dev->default_ant.rx_chain_num > 1) in rt2800_config_channel()
4298 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4299 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4300 rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); in rt2800_config_channel()
4307 if (rf->channel <= 14) { in rt2800_config_channel()
4348 rt2x00_set_field32(&reg, TX_BAND_CFG_A, rf->channel > 14); in rt2800_config_channel()
4349 rt2x00_set_field32(&reg, TX_BAND_CFG_BG, rf->channel <= 14); in rt2800_config_channel()
4362 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_config_channel()
4366 rf->channel > 14); in rt2800_config_channel()
4368 rf->channel <= 14); in rt2800_config_channel()
4373 rf->channel > 14); in rt2800_config_channel()
4375 rf->channel <= 14); in rt2800_config_channel()
4380 rf->channel > 14); in rt2800_config_channel()
4385 rf->channel <= 14); in rt2800_config_channel()
4389 switch (rt2x00dev->default_ant.rx_chain_num) { in rt2800_config_channel()
4416 if (rf->channel <= 14) in rt2800_config_channel()
4417 reg = 0x1c + (2 * rt2x00dev->lna_gain); in rt2800_config_channel()
4419 reg = 0x22 + ((rt2x00dev->lna_gain * 5) / 3); in rt2800_config_channel()
4432 if (rf->channel <= 14) in rt2800_config_channel()
4457 if (rf->channel <= 14) in rt2800_config_channel()
4458 reg = 0x1c + 2 * rt2x00dev->lna_gain; in rt2800_config_channel()
4460 reg = 0x22 + ((rt2x00dev->lna_gain * 5) / 3); in rt2800_config_channel()
4474 if (rf->channel <= 14) in rt2800_config_channel()
4475 reg = 0x2e + rt2x00dev->lna_gain; in rt2800_config_channel()
4477 reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3); in rt2800_config_channel()
4488 bbp = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; in rt2800_config_channel()
4491 rt2800_iq_calibrate(rt2x00dev, rf->channel); in rt2800_config_channel()
4504 if (rt2x00dev->default_ant.rx_chain_num == 1) { in rt2800_config_channel()
4519 bbp = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; in rt2800_config_channel()
4585 * Matching Delta value -4 -3 -2 -1 0 +1 +2 +3 +4 in rt2800_get_gain_calibration_delta()
4588 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) { in rt2800_get_gain_calibration_delta()
4673 for (i = 8; i >= 5; i--) { in rt2800_get_gain_calibration_delta()
4679 return (i - 4) * step; in rt2800_get_gain_calibration_delta()
4696 !test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) in rt2800_get_txpower_bw_comp()
4708 comp_value = -comp_value; in rt2800_get_txpower_bw_comp()
4719 comp_value = -comp_value; in rt2800_get_txpower_bw_comp()
4743 delta = power_level - max_power; in rt2800_get_txpower_reg_delta()
4786 eirp_txpower = eirp_txpower_criterion + (txpower - criterion) + in rt2800_compensate_txpower()
4790 (eirp_txpower - power_level) : 0; in rt2800_compensate_txpower()
4794 txpower = max(0, txpower + delta - reg_limit); in rt2800_compensate_txpower()
4826 enum nl80211_band band = chan->band; in rt2800_config_txpower_rt3593()
4842 if (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) in rt2800_config_txpower_rt3593()
5196 (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) ? in rt2800_config_txpower_rt3593()
5199 (i - TX_PWR_CFG_9_IDX - 1) : i, in rt2800_config_txpower_rt3593()
5212 enum nl80211_band band = chan->band; in rt2800_config_txpower_rt6352()
5225 * Maybe some misunderstanding of what a signed 8-bit value is? Maybe in rt2800_config_txpower_rt6352()
5227 * used a fixed offset between HT20 and HT40 rates they had to work- in rt2800_config_txpower_rt6352()
5272 if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) { in rt2800_config_txpower_rt6352()
5289 * registers. As recent 2T chips use 8-bit instead of 4-bit values for in rt2800_config_txpower_rt6352()
5290 * power-offsets more space would be needed. Ralink decided to keep the in rt2800_config_txpower_rt6352()
5332 * for all rates, but allow to set only 4 discrete values: -12, -6, 0 and 6 dBm.
5345 enum nl80211_band band = chan->band; in rt2800_config_txpower_rt28xx()
5360 switch (rt2x00dev->chip.rt) { in rt2800_config_txpower_rt28xx()
5381 chan->max_power); in rt2800_config_txpower_rt28xx()
5385 * gains -12, -6, 0, +6 dBm by setting values 2, 1, 0, 3 respectively. in rt2800_config_txpower_rt28xx()
5391 if (delta <= -12) { in rt2800_config_txpower_rt28xx()
5394 } else if (delta <= -6) { in rt2800_config_txpower_rt28xx()
5535 rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan, in rt2800_gain_calibration()
5536 rt2x00dev->tx_power); in rt2800_gain_calibration()
5547 * A voltage-controlled oscillator(VCO) is an electronic oscillator in rt2800_vco_calibration()
5558 switch (rt2x00dev->chip.rf) { in rt2800_vco_calibration()
5596 rt2x00dev->chip.rf); in rt2800_vco_calibration()
5604 if (rt2x00dev->rf_channel <= 14) { in rt2800_vco_calibration()
5605 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_vco_calibration()
5618 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_vco_calibration()
5642 libconf->conf->short_frame_max_tx_count); in rt2800_config_retry_limit()
5644 libconf->conf->long_frame_max_tx_count); in rt2800_config_retry_limit()
5652 (libconf->conf->flags & IEEE80211_CONF_PS) ? in rt2800_config_ps()
5662 libconf->conf->listen_interval - 1); in rt2800_config_ps()
5666 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); in rt2800_config_ps()
5674 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); in rt2800_config_ps()
5687 * To provide correct survey data for survey-based ACS algorithm in rt2800_config()
5692 rt2800_config_channel(rt2x00dev, libconf->conf, in rt2800_config()
5693 &libconf->rf, &libconf->channel); in rt2800_config()
5694 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, in rt2800_config()
5695 libconf->conf->power_level); in rt2800_config()
5698 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, in rt2800_config()
5699 libconf->conf->power_level); in rt2800_config()
5718 qual->rx_failed = rt2x00_get_field32(reg, RX_STA_CNT0_CRC_ERR); in rt2800_link_stats()
5726 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) { in rt2800_get_default_vgc()
5738 vgc = 0x1c + (2 * rt2x00dev->lna_gain); in rt2800_get_default_vgc()
5740 vgc = 0x2e + rt2x00dev->lna_gain; in rt2800_get_default_vgc()
5744 vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; in rt2800_get_default_vgc()
5746 vgc = 0x24 + (2 * rt2x00dev->lna_gain); in rt2800_get_default_vgc()
5748 if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) in rt2800_get_default_vgc()
5749 vgc = 0x32 + (rt2x00dev->lna_gain * 5) / 3; in rt2800_get_default_vgc()
5751 vgc = 0x3a + (rt2x00dev->lna_gain * 5) / 3; in rt2800_get_default_vgc()
5761 if (qual->vgc_level != vgc_level) { in rt2800_set_vgc()
5769 rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); in rt2800_set_vgc()
5775 qual->vgc_level = vgc_level; in rt2800_set_vgc()
5776 qual->vgc_level_reg = vgc_level; in rt2800_set_vgc()
5801 switch (rt2x00dev->chip.rt) { in rt2800_link_tuner()
5804 if (qual->rssi > -65) { in rt2800_link_tuner()
5805 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) in rt2800_link_tuner()
5813 if (qual->rssi > -65) in rt2800_link_tuner()
5818 if (qual->rssi > -65) in rt2800_link_tuner()
5823 if (qual->rssi > -80) in rt2800_link_tuner()
5837 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_init_registers()
6049 drv_data->max_psdu = 3; in rt2800_init_registers()
6053 drv_data->max_psdu = 2; in rt2800_init_registers()
6055 drv_data->max_psdu = 1; in rt2800_init_registers()
6057 rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, drv_data->max_psdu); in rt2800_init_registers()
6254 if (!test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags)) in rt2800_init_registers()
6626 /* Use 5-bit ADC for Acquisition and 8-bit ADC for data */ in rt2800_init_bbp_3290()
6811 /* Enable DC filter */ in rt2800_init_bbp_3593()
6976 rt2x00dev->default_ant.rx_chain_num == 2); in rt2800_init_bbp_5592()
7047 rt2x00dev->default_ant.rx_chain_num == 2); in rt2800_init_bbp_6352()
7256 switch (rt2x00dev->chip.rt) { in rt2800_init_bbp()
7369 if ((passband - stopband) <= filter_target) { in rt2800_init_rx_filter()
7371 overtuned += ((passband - stopband) == filter_target); in rt2800_init_rx_filter()
7378 rfcsr24 -= !!overtuned; in rt2800_init_rx_filter()
7399 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_rx_filter_calibration()
7415 drv_data->calibration_bw20 = in rt2800_rx_filter_calibration()
7417 drv_data->calibration_bw40 = in rt2800_rx_filter_calibration()
7423 drv_data->bbp25 = rt2800_bbp_read(rt2x00dev, 25); in rt2800_rx_filter_calibration()
7424 drv_data->bbp26 = rt2800_bbp_read(rt2x00dev, 26); in rt2800_rx_filter_calibration()
7445 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_normal_mode_setup_3xxx()
7461 if (drv_data->txmixer_gain_24g >= min_gain) { in rt2800_normal_mode_setup_3xxx()
7463 drv_data->txmixer_gain_24g); in rt2800_normal_mode_setup_3xxx()
7516 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_normal_mode_setup_3593()
7525 tx_gain = rt2x00_get_field8(drv_data->txmixer_gain_24g, in rt2800_normal_mode_setup_3593()
7751 &rt2x00dev->cap_flags); in rt2800_init_rfcsr_3352()
7753 &rt2x00dev->cap_flags); in rt2800_init_rfcsr_3352()
7963 if (rt2x00dev->default_ant.rx_chain_num == 1) in rt3593_post_bbp_init()
8006 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_init_rfcsr_3593()
8072 drv_data->calibration_bw20 = 0x1f; in rt2800_init_rfcsr_3593()
8073 drv_data->calibration_bw40 = 0x2f; in rt2800_init_rfcsr_3593()
8076 drv_data->bbp25 = rt2800_bbp_read(rt2x00dev, 25); in rt2800_init_rfcsr_3593()
8077 drv_data->bbp26 = rt2800_bbp_read(rt2x00dev, 26); in rt2800_init_rfcsr_3593()
8492 /* Enable DC filter */ in rt2800_init_rfcsr_5592()
8553 int calcode = ((d2 - d1) * 1000) / 43; in rt2800_calcrcalibrationcode()
8631 d1 = bytevalue - 256; in rt2800_r_calibration()
8641 d2 = bytevalue - 256; in rt2800_r_calibration()
8749 for (i = 15; i >= 0; i = i - 1) { in rt2800_do_sqrt_accumulation()
8815 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_rxiq_calibration()
8875 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_rxiq_calibration()
8965 result = (bbptemp & 0xffffff) - 0x1000000; in rt2800_rxiq_calibration()
8981 bbpval1 = si - mi * mi; in rt2800_rxiq_calibration()
9009 sigma_i = rt2800_do_sqrt_accumulation(100 * (si - mi * mi)); in rt2800_rxiq_calibration()
9010 sigma_q = rt2800_do_sqrt_accumulation(100 * (sq - mq * mq)); in rt2800_rxiq_calibration()
9011 r_iq = 10 * (riq - (mi * mq)); in rt2800_rxiq_calibration()
9016 (sigma_i - sigma_q) <= 112 && in rt2800_rxiq_calibration()
9017 (sigma_i - sigma_q) >= -112 && in rt2800_rxiq_calibration()
9018 mi <= 32 && mi >= -32 && in rt2800_rxiq_calibration()
9019 mq <= 32 && mq >= -32) { in rt2800_rxiq_calibration()
9020 r_iq = 10 * (riq - (mi * mq)); in rt2800_rxiq_calibration()
9025 g_imb = ((-2) * 128 * (1000 - g_rx)) / (1000 + g_rx); in rt2800_rxiq_calibration()
9028 if (ph_rx > 20 || ph_rx < -20) { in rt2800_rxiq_calibration()
9033 if (g_imb > 12 || g_imb < -12) { in rt2800_rxiq_calibration()
9292 fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; in rt2800_do_fft_accumulation()
9294 fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; in rt2800_do_fft_accumulation()
9301 tidxi = 0x40 - tidx; in rt2800_do_fft_accumulation()
9312 fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; in rt2800_do_fft_accumulation()
9314 fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; in rt2800_do_fft_accumulation()
9338 fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; in rt2800_read_fft_accumulation()
9340 fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; in rt2800_read_fft_accumulation()
9348 static void rt2800_write_dc(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 alc, u8 iorq, u8 dc) in rt2800_write_dc() argument
9362 bbp = dc; in rt2800_write_dc()
9379 for (bidx = 5; bidx >= 0; bidx--) { in rt2800_loft_search()
9385 idx0 = idxf[iorq] - ibit; in rt2800_loft_search()
9436 for (bidx = 5; bidx >= 1; bidx--) { in rt2800_iq_search()
9452 idx0 = iq_err - ibit; in rt2800_iq_search()
9506 gerr = (gerr & 0x08) ? (gerr & 0x0F) - 0x10 : (gerr & 0x0F); in rt2800_iq_search()
9507 perr = (perr & 0x20) ? (perr & 0x3F) - 0x40 : (perr & 0x3F); in rt2800_iq_search()
9509 gerr = (gerr < -0x07) ? -0x07 : (gerr > 0x05) ? 0x05 : gerr; in rt2800_iq_search()
9510 gsta = gerr - 1; in rt2800_iq_search()
9513 perr = (perr < -0x1f) ? -0x1f : (perr > 0x1d) ? 0x1d : perr; in rt2800_iq_search()
9514 psta = perr - 1; in rt2800_iq_search()
9700 vga_gain[ch_idx] = vga_gain[ch_idx] - 2) { in rt2800_loft_iq_calibration()
9821 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9829 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9848 if (!test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9873 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9883 if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9899 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9918 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
9925 if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
9930 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9934 vga_gain[ch_idx] = vga_gain[ch_idx] - 1; in rt2800_loft_iq_calibration()
9975 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9991 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
10101 cal_val -= 128; in rt2800_lp_tx_filter_bw_cal()
10109 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_bw_filter_calibration()
10186 /* I-3 */ in rt2800_bw_filter_calibration()
10193 /* I-4,5,6,7,8,9 */ in rt2800_bw_filter_calibration()
10278 cal_diff = cal_r32_init - cal_r32_val; in rt2800_bw_filter_calibration()
10301 drv_data->tx_calibration_bw20 = tx_agc_fc; in rt2800_bw_filter_calibration()
10303 drv_data->tx_calibration_bw40 = tx_agc_fc; in rt2800_bw_filter_calibration()
10306 drv_data->rx_calibration_bw20 = rx_agc_fc; in rt2800_bw_filter_calibration()
10308 drv_data->rx_calibration_bw40 = rx_agc_fc; in rt2800_bw_filter_calibration()
10348 2 * test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)); in rt2800_bw_filter_calibration()
10492 rt2800_rfcsr_write(rt2x00dev, 12, rt2x00dev->freq_offset); in rt2800_init_rfcsr_6352()
10673 /* Initialize RF DC calibration register to default value */ in rt2800_init_rfcsr_6352()
10752 switch (rt2x00dev->chip.rt) { in rt2800_init_rfcsr()
10804 return -EIO; in rt2800_enable_radio()
10810 return -EIO; in rt2800_enable_radio()
10826 return -EIO; in rt2800_enable_radio()
10936 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_efuse_read()
10949 *(__le32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); in rt2800_efuse_read()
10951 *(__le32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); in rt2800_efuse_read()
10953 *(__le32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg); in rt2800_efuse_read()
10955 *(__le32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg); in rt2800_efuse_read()
10957 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_efuse_read()
11003 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_validate_eeprom()
11092 drv_data->txmixer_gain_24g = rt2800_get_txmixer_gain_24g(rt2x00dev); in rt2800_validate_eeprom()
11106 drv_data->txmixer_gain_5g = rt2800_get_txmixer_gain_5g(rt2x00dev); in rt2800_validate_eeprom()
11205 return -ENODEV; in rt2800_init_eeprom()
11213 rt2x00dev->default_ant.tx_chain_num = in rt2800_init_eeprom()
11215 rt2x00dev->default_ant.rx_chain_num = in rt2800_init_eeprom()
11230 rt2x00dev->default_ant.tx = ANTENNA_A; in rt2800_init_eeprom()
11231 rt2x00dev->default_ant.rx = ANTENNA_A; in rt2800_init_eeprom()
11234 rt2x00dev->default_ant.tx = ANTENNA_A; in rt2800_init_eeprom()
11235 rt2x00dev->default_ant.rx = ANTENNA_B; in rt2800_init_eeprom()
11239 rt2x00dev->default_ant.tx = ANTENNA_A; in rt2800_init_eeprom()
11240 rt2x00dev->default_ant.rx = ANTENNA_A; in rt2800_init_eeprom()
11246 rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; /* Unused */ in rt2800_init_eeprom()
11247 rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; /* Unused */ in rt2800_init_eeprom()
11254 __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11256 __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11262 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11265 * Detect if this device has Bluetooth co-existence. in rt2800_init_eeprom()
11269 __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11275 rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); in rt2800_init_eeprom()
11281 rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); in rt2800_init_eeprom()
11282 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); in rt2800_init_eeprom()
11283 rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); in rt2800_init_eeprom()
11285 rt2x00dev->led_mcu_reg = eeprom; in rt2800_init_eeprom()
11295 __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11307 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11311 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11320 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11322 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11702 struct hw_mode_spec *spec = &rt2x00dev->spec; in rt2800_probe_hw_mode()
11713 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; in rt2800_probe_hw_mode()
11719 rt2x00dev->hw->wiphy->retry_short = 2; in rt2800_probe_hw_mode()
11720 rt2x00dev->hw->wiphy->retry_long = 2; in rt2800_probe_hw_mode()
11725 ieee80211_hw_set(rt2x00dev->hw, REPORTS_TX_ACK_STATUS); in rt2800_probe_hw_mode()
11726 ieee80211_hw_set(rt2x00dev->hw, AMPDU_AGGREGATION); in rt2800_probe_hw_mode()
11727 ieee80211_hw_set(rt2x00dev->hw, PS_NULLFUNC_STACK); in rt2800_probe_hw_mode()
11728 ieee80211_hw_set(rt2x00dev->hw, SIGNAL_DBM); in rt2800_probe_hw_mode()
11729 ieee80211_hw_set(rt2x00dev->hw, SUPPORTS_PS); in rt2800_probe_hw_mode()
11732 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices in rt2800_probe_hw_mode()
11739 ieee80211_hw_set(rt2x00dev->hw, HOST_BROADCAST_PS_BUFFERING); in rt2800_probe_hw_mode()
11741 ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE); in rt2800_probe_hw_mode()
11743 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); in rt2800_probe_hw_mode()
11744 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, in rt2800_probe_hw_mode()
11757 rt2x00dev->hw->max_rates = 1; in rt2800_probe_hw_mode()
11758 rt2x00dev->hw->max_report_rates = 7; in rt2800_probe_hw_mode()
11759 rt2x00dev->hw->max_rate_tries = 1; in rt2800_probe_hw_mode()
11764 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; in rt2800_probe_hw_mode()
11766 switch (rt2x00dev->chip.rf) { in rt2800_probe_hw_mode()
11769 spec->num_channels = 14; in rt2800_probe_hw_mode()
11770 spec->channels = rf_vals; in rt2800_probe_hw_mode()
11775 spec->num_channels = ARRAY_SIZE(rf_vals); in rt2800_probe_hw_mode()
11776 spec->channels = rf_vals; in rt2800_probe_hw_mode()
11794 spec->num_channels = 14; in rt2800_probe_hw_mode()
11796 spec->channels = rf_vals_3x_xtal20; in rt2800_probe_hw_mode()
11798 spec->channels = rf_vals_3x; in rt2800_probe_hw_mode()
11802 spec->num_channels = ARRAY_SIZE(rf_vals_7620); in rt2800_probe_hw_mode()
11803 spec->channels = rf_vals_7620; in rt2800_probe_hw_mode()
11808 spec->num_channels = ARRAY_SIZE(rf_vals_3x); in rt2800_probe_hw_mode()
11809 spec->channels = rf_vals_3x; in rt2800_probe_hw_mode()
11813 spec->num_channels = ARRAY_SIZE(rf_vals_3853); in rt2800_probe_hw_mode()
11814 spec->channels = rf_vals_3853; in rt2800_probe_hw_mode()
11820 spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40); in rt2800_probe_hw_mode()
11821 spec->channels = rf_vals_5592_xtal40; in rt2800_probe_hw_mode()
11823 spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal20); in rt2800_probe_hw_mode()
11824 spec->channels = rf_vals_5592_xtal20; in rt2800_probe_hw_mode()
11829 if (WARN_ON_ONCE(!spec->channels)) in rt2800_probe_hw_mode()
11830 return -ENODEV; in rt2800_probe_hw_mode()
11832 spec->supported_bands = SUPPORT_BAND_2GHZ; in rt2800_probe_hw_mode()
11833 if (spec->num_channels > 14) in rt2800_probe_hw_mode()
11834 spec->supported_bands |= SUPPORT_BAND_5GHZ; in rt2800_probe_hw_mode()
11840 spec->ht.ht_supported = true; in rt2800_probe_hw_mode()
11842 spec->ht.ht_supported = false; in rt2800_probe_hw_mode()
11844 spec->ht.cap = in rt2800_probe_hw_mode()
11850 tx_chains = rt2x00dev->default_ant.tx_chain_num; in rt2800_probe_hw_mode()
11851 rx_chains = rt2x00dev->default_ant.rx_chain_num; in rt2800_probe_hw_mode()
11854 spec->ht.cap |= IEEE80211_HT_CAP_TX_STBC; in rt2800_probe_hw_mode()
11856 spec->ht.cap |= rx_chains << IEEE80211_HT_CAP_RX_STBC_SHIFT; in rt2800_probe_hw_mode()
11858 spec->ht.ampdu_factor = (rx_chains > 1) ? 3 : 2; in rt2800_probe_hw_mode()
11859 spec->ht.ampdu_density = 4; in rt2800_probe_hw_mode()
11860 spec->ht.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; in rt2800_probe_hw_mode()
11862 spec->ht.mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; in rt2800_probe_hw_mode()
11863 spec->ht.mcs.tx_params |= in rt2800_probe_hw_mode()
11864 (tx_chains - 1) << IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; in rt2800_probe_hw_mode()
11869 spec->ht.mcs.rx_mask[2] = 0xff; in rt2800_probe_hw_mode()
11872 spec->ht.mcs.rx_mask[1] = 0xff; in rt2800_probe_hw_mode()
11875 spec->ht.mcs.rx_mask[0] = 0xff; in rt2800_probe_hw_mode()
11876 spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */ in rt2800_probe_hw_mode()
11883 info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); in rt2800_probe_hw_mode()
11885 return -ENOMEM; in rt2800_probe_hw_mode()
11887 rt2x00dev->chan_survey = in rt2800_probe_hw_mode()
11888 kcalloc(spec->num_channels, sizeof(struct rt2x00_chan_survey), in rt2800_probe_hw_mode()
11890 if (!rt2x00dev->chan_survey) { in rt2800_probe_hw_mode()
11892 return -ENOMEM; in rt2800_probe_hw_mode()
11895 spec->channels_info = info; in rt2800_probe_hw_mode()
11900 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_probe_hw_mode()
11913 if (spec->num_channels > 14) { in rt2800_probe_hw_mode()
11919 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_probe_hw_mode()
11926 for (i = 14; i < spec->num_channels; i++) { in rt2800_probe_hw_mode()
11927 info[i].default_power1 = default_power1[i - 14]; in rt2800_probe_hw_mode()
11928 info[i].default_power2 = default_power2[i - 14]; in rt2800_probe_hw_mode()
11930 info[i].default_power3 = default_power3[i - 14]; in rt2800_probe_hw_mode()
11934 switch (rt2x00dev->chip.rf) { in rt2800_probe_hw_mode()
11954 __set_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags); in rt2800_probe_hw_mode()
11996 return -ENODEV; in rt2800_probe_rt()
12045 __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12046 __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12048 __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12054 __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12055 __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12056 __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12058 __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12059 __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12060 __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12062 __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12064 __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12065 __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12068 rt2x00dev->link.watchdog = modparam_watchdog; in rt2800_probe_hw()
12069 /* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */ in rt2800_probe_hw()
12071 rt2x00dev->link.watchdog &= ~RT2800_WATCHDOG_DMA_BUSY; in rt2800_probe_hw()
12072 if (rt2x00dev->link.watchdog) { in rt2800_probe_hw()
12073 __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12074 rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); in rt2800_probe_hw()
12080 rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; in rt2800_probe_hw()
12093 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_get_key_seq()
12097 if (key->cipher != WLAN_CIPHER_SUITE_TKIP) in rt2800_get_key_seq()
12100 offset = MAC_IVEIV_ENTRY(key->hw_key_idx); in rt2800_get_key_seq()
12104 memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2); in rt2800_get_key_seq()
12105 memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4); in rt2800_get_key_seq()
12111 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_set_rts_threshold()
12152 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_conf_tx()
12184 rt2x00_set_field32(&reg, field, queue->txop); in rt2800_conf_tx()
12192 rt2x00_set_field32(&reg, field, queue->aifs); in rt2800_conf_tx()
12196 rt2x00_set_field32(&reg, field, queue->cw_min); in rt2800_conf_tx()
12200 rt2x00_set_field32(&reg, field, queue->cw_max); in rt2800_conf_tx()
12207 rt2x00_set_field32(&reg, EDCA_AC0_CFG_TX_OP, queue->txop); in rt2800_conf_tx()
12208 rt2x00_set_field32(&reg, EDCA_AC0_CFG_AIFSN, queue->aifs); in rt2800_conf_tx()
12209 rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMIN, queue->cw_min); in rt2800_conf_tx()
12210 rt2x00_set_field32(&reg, EDCA_AC0_CFG_CWMAX, queue->cw_max); in rt2800_conf_tx()
12219 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_get_tsf()
12235 struct ieee80211_sta *sta = params->sta; in rt2800_ampdu_action()
12236 enum ieee80211_ampdu_mlme_action action = params->action; in rt2800_ampdu_action()
12237 u16 tid = params->tid; in rt2800_ampdu_action()
12238 struct rt2x00_sta *sta_priv = (struct rt2x00_sta *)sta->drv_priv; in rt2800_ampdu_action()
12248 if (sta_priv->wcid > WCID_END) in rt2800_ampdu_action()
12249 return -ENOSPC; in rt2800_ampdu_action()
12267 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); in rt2800_ampdu_action()
12272 rt2x00_warn((struct rt2x00_dev *)hw->priv, in rt2800_ampdu_action()
12283 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_get_survey()
12285 &rt2x00dev->chan_survey[idx]; in rt2800_get_survey()
12288 if (idx >= rt2x00dev->bands[band].n_channels) { in rt2800_get_survey()
12289 idx -= rt2x00dev->bands[band].n_channels; in rt2800_get_survey()
12293 if (idx >= rt2x00dev->bands[band].n_channels) in rt2800_get_survey()
12294 return -ENOENT; in rt2800_get_survey()
12299 survey->channel = &rt2x00dev->bands[band].channels[idx]; in rt2800_get_survey()
12301 survey->filled = SURVEY_INFO_TIME | in rt2800_get_survey()
12305 survey->time = div_u64(chan_survey->time_idle + chan_survey->time_busy, 1000); in rt2800_get_survey()
12306 survey->time_busy = div_u64(chan_survey->time_busy, 1000); in rt2800_get_survey()
12307 survey->time_ext_busy = div_u64(chan_survey->time_ext_busy, 1000); in rt2800_get_survey()
12309 if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) in rt2800_get_survey()
12310 survey->filled |= SURVEY_INFO_IN_USE; in rt2800_get_survey()