Lines Matching refs:rt2x00dev
65 static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev) in rt2800_is_305x_soc() argument
68 if (!rt2x00_is_soc(rt2x00dev) || in rt2800_is_305x_soc()
69 !rt2x00_rt(rt2x00dev, RT2872)) in rt2800_is_305x_soc()
73 if (rt2x00_rf(rt2x00dev, RF3020) || in rt2800_is_305x_soc()
74 rt2x00_rf(rt2x00dev, RF3021) || in rt2800_is_305x_soc()
75 rt2x00_rf(rt2x00dev, RF3022)) in rt2800_is_305x_soc()
78 rt2x00_warn(rt2x00dev, "Unknown RF chipset on rt305x\n"); in rt2800_is_305x_soc()
82 static void rt2800_bbp_write(struct rt2x00_dev *rt2x00dev, in rt2800_bbp_write() argument
87 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_bbp_write()
93 if (WAIT_FOR_BBP(rt2x00dev, ®)) { in rt2800_bbp_write()
101 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); in rt2800_bbp_write()
104 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_bbp_write()
107 static u8 rt2800_bbp_read(struct rt2x00_dev *rt2x00dev, const unsigned int word) in rt2800_bbp_read() argument
112 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_bbp_read()
122 if (WAIT_FOR_BBP(rt2x00dev, ®)) { in rt2800_bbp_read()
129 rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); in rt2800_bbp_read()
131 WAIT_FOR_BBP(rt2x00dev, ®); in rt2800_bbp_read()
136 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_bbp_read()
141 static void rt2800_rfcsr_write(struct rt2x00_dev *rt2x00dev, in rt2800_rfcsr_write() argument
146 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_write()
152 switch (rt2x00dev->chip.rt) { in rt2800_rfcsr_write()
154 if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, ®)) { in rt2800_rfcsr_write()
162 rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); in rt2800_rfcsr_write()
167 if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { in rt2800_rfcsr_write()
174 rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); in rt2800_rfcsr_write()
179 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_write()
182 static void rt2800_rfcsr_write_bank(struct rt2x00_dev *rt2x00dev, const u8 bank, in rt2800_rfcsr_write_bank() argument
185 rt2800_rfcsr_write(rt2x00dev, (reg | (bank << 6)), value); in rt2800_rfcsr_write_bank()
188 static void rt2800_rfcsr_write_chanreg(struct rt2x00_dev *rt2x00dev, in rt2800_rfcsr_write_chanreg() argument
191 rt2800_rfcsr_write_bank(rt2x00dev, 4, reg, value); in rt2800_rfcsr_write_chanreg()
192 rt2800_rfcsr_write_bank(rt2x00dev, 6, reg, value); in rt2800_rfcsr_write_chanreg()
195 static void rt2800_rfcsr_write_dccal(struct rt2x00_dev *rt2x00dev, in rt2800_rfcsr_write_dccal() argument
198 rt2800_rfcsr_write_bank(rt2x00dev, 5, reg, value); in rt2800_rfcsr_write_dccal()
199 rt2800_rfcsr_write_bank(rt2x00dev, 7, reg, value); in rt2800_rfcsr_write_dccal()
202 static void rt2800_bbp_dcoc_write(struct rt2x00_dev *rt2x00dev, in rt2800_bbp_dcoc_write() argument
205 rt2800_bbp_write(rt2x00dev, 158, reg); in rt2800_bbp_dcoc_write()
206 rt2800_bbp_write(rt2x00dev, 159, value); in rt2800_bbp_dcoc_write()
209 static u8 rt2800_bbp_dcoc_read(struct rt2x00_dev *rt2x00dev, const u8 reg) in rt2800_bbp_dcoc_read() argument
211 rt2800_bbp_write(rt2x00dev, 158, reg); in rt2800_bbp_dcoc_read()
212 return rt2800_bbp_read(rt2x00dev, 159); in rt2800_bbp_dcoc_read()
215 static void rt2800_bbp_glrt_write(struct rt2x00_dev *rt2x00dev, in rt2800_bbp_glrt_write() argument
218 rt2800_bbp_write(rt2x00dev, 195, reg); in rt2800_bbp_glrt_write()
219 rt2800_bbp_write(rt2x00dev, 196, value); in rt2800_bbp_glrt_write()
222 static u8 rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev, in rt2800_rfcsr_read() argument
228 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_read()
238 switch (rt2x00dev->chip.rt) { in rt2800_rfcsr_read()
240 if (WAIT_FOR_RFCSR_MT7620(rt2x00dev, ®)) { in rt2800_rfcsr_read()
247 rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); in rt2800_rfcsr_read()
249 WAIT_FOR_RFCSR_MT7620(rt2x00dev, ®); in rt2800_rfcsr_read()
256 if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { in rt2800_rfcsr_read()
262 rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); in rt2800_rfcsr_read()
264 WAIT_FOR_RFCSR(rt2x00dev, ®); in rt2800_rfcsr_read()
271 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rfcsr_read()
276 static u8 rt2800_rfcsr_read_bank(struct rt2x00_dev *rt2x00dev, const u8 bank, in rt2800_rfcsr_read_bank() argument
279 return rt2800_rfcsr_read(rt2x00dev, (reg | (bank << 6))); in rt2800_rfcsr_read_bank()
282 static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev, in rt2800_rf_write() argument
287 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_rf_write()
293 if (WAIT_FOR_RF(rt2x00dev, ®)) { in rt2800_rf_write()
300 rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG0, reg); in rt2800_rf_write()
301 rt2x00_rf_write(rt2x00dev, word, value); in rt2800_rf_write()
304 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_rf_write()
387 static unsigned int rt2800_eeprom_word_index(struct rt2x00_dev *rt2x00dev, in rt2800_eeprom_word_index() argument
395 wiphy_name(rt2x00dev->hw->wiphy), word)) in rt2800_eeprom_word_index()
398 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_eeprom_word_index()
399 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_eeprom_word_index()
414 wiphy_name(rt2x00dev->hw->wiphy), word); in rt2800_eeprom_word_index()
419 static void *rt2800_eeprom_addr(struct rt2x00_dev *rt2x00dev, in rt2800_eeprom_addr() argument
424 index = rt2800_eeprom_word_index(rt2x00dev, word); in rt2800_eeprom_addr()
425 return rt2x00_eeprom_addr(rt2x00dev, index); in rt2800_eeprom_addr()
428 static u16 rt2800_eeprom_read(struct rt2x00_dev *rt2x00dev, in rt2800_eeprom_read() argument
433 index = rt2800_eeprom_word_index(rt2x00dev, word); in rt2800_eeprom_read()
434 return rt2x00_eeprom_read(rt2x00dev, index); in rt2800_eeprom_read()
437 static void rt2800_eeprom_write(struct rt2x00_dev *rt2x00dev, in rt2800_eeprom_write() argument
442 index = rt2800_eeprom_word_index(rt2x00dev, word); in rt2800_eeprom_write()
443 rt2x00_eeprom_write(rt2x00dev, index, data); in rt2800_eeprom_write()
446 static u16 rt2800_eeprom_read_from_array(struct rt2x00_dev *rt2x00dev, in rt2800_eeprom_read_from_array() argument
452 index = rt2800_eeprom_word_index(rt2x00dev, array); in rt2800_eeprom_read_from_array()
453 return rt2x00_eeprom_read(rt2x00dev, index + offset); in rt2800_eeprom_read_from_array()
456 static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev) in rt2800_enable_wlan_rt3290() argument
461 reg = rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL); in rt2800_enable_wlan_rt3290()
466 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); in rt2800_enable_wlan_rt3290()
476 reg = rt2800_register_read(rt2x00dev, CMB_CTRL); in rt2800_enable_wlan_rt3290()
488 rt2800_register_write(rt2x00dev, 0x58, 0x018); in rt2800_enable_wlan_rt3290()
490 rt2800_register_write(rt2x00dev, 0x58, 0x418); in rt2800_enable_wlan_rt3290()
492 rt2800_register_write(rt2x00dev, 0x58, 0x618); in rt2800_enable_wlan_rt3290()
499 reg = rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL); in rt2800_enable_wlan_rt3290()
503 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); in rt2800_enable_wlan_rt3290()
506 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); in rt2800_enable_wlan_rt3290()
508 rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff); in rt2800_enable_wlan_rt3290()
514 void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, in rt2800_mcu_request() argument
523 if (rt2x00_is_soc(rt2x00dev)) in rt2800_mcu_request()
526 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_mcu_request()
532 if (WAIT_FOR_MCU(rt2x00dev, ®)) { in rt2800_mcu_request()
537 rt2800_register_write_lock(rt2x00dev, H2M_MAILBOX_CSR, reg); in rt2800_mcu_request()
541 rt2800_register_write_lock(rt2x00dev, HOST_CMD_CSR, reg); in rt2800_mcu_request()
544 mutex_unlock(&rt2x00dev->csr_mutex); in rt2800_mcu_request()
548 int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev) in rt2800_wait_csr_ready() argument
554 reg = rt2800_register_read(rt2x00dev, MAC_CSR0); in rt2800_wait_csr_ready()
560 rt2x00_err(rt2x00dev, "Unstable hardware\n"); in rt2800_wait_csr_ready()
565 int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) in rt2800_wait_wpdma_ready() argument
575 reg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); in rt2800_wait_wpdma_ready()
583 rt2x00_err(rt2x00dev, "WPDMA TX/RX busy [0x%08x]\n", reg); in rt2800_wait_wpdma_ready()
588 void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev) in rt2800_disable_wpdma() argument
592 reg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); in rt2800_disable_wpdma()
598 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); in rt2800_disable_wpdma()
602 void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev, in rt2800_get_txwi_rxwi_size() argument
606 switch (rt2x00dev->chip.rt) { in rt2800_get_txwi_rxwi_size()
659 int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, in rt2800_check_firmware() argument
675 if (rt2x00_is_usb(rt2x00dev) || rt2x00_rt(rt2x00dev, RT3290)) in rt2800_check_firmware()
691 if (rt2x00_is_usb(rt2x00dev) && in rt2800_check_firmware()
692 !rt2x00_rt(rt2x00dev, RT2860) && in rt2800_check_firmware()
693 !rt2x00_rt(rt2x00dev, RT2872) && in rt2800_check_firmware()
694 !rt2x00_rt(rt2x00dev, RT3070) && in rt2800_check_firmware()
713 int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, in rt2800_load_firmware() argument
720 if (rt2x00_rt(rt2x00dev, RT3290)) { in rt2800_load_firmware()
721 retval = rt2800_enable_wlan_rt3290(rt2x00dev); in rt2800_load_firmware()
730 rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0x00000000); in rt2800_load_firmware()
735 if (rt2800_wait_csr_ready(rt2x00dev)) in rt2800_load_firmware()
738 if (rt2x00_is_pci(rt2x00dev)) { in rt2800_load_firmware()
739 if (rt2x00_rt(rt2x00dev, RT3290) || in rt2800_load_firmware()
740 rt2x00_rt(rt2x00dev, RT3572) || in rt2800_load_firmware()
741 rt2x00_rt(rt2x00dev, RT5390) || in rt2800_load_firmware()
742 rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_load_firmware()
743 reg = rt2800_register_read(rt2x00dev, AUX_CTRL); in rt2800_load_firmware()
746 rt2800_register_write(rt2x00dev, AUX_CTRL, reg); in rt2800_load_firmware()
748 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); in rt2800_load_firmware()
751 rt2800_disable_wpdma(rt2x00dev); in rt2800_load_firmware()
756 rt2800_drv_write_firmware(rt2x00dev, data, len); in rt2800_load_firmware()
762 reg = rt2800_register_read(rt2x00dev, PBF_SYS_CTRL); in rt2800_load_firmware()
769 rt2x00_err(rt2x00dev, "PBF system register not ready\n"); in rt2800_load_firmware()
777 rt2800_disable_wpdma(rt2x00dev); in rt2800_load_firmware()
782 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); in rt2800_load_firmware()
783 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); in rt2800_load_firmware()
784 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_load_firmware()
785 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); in rt2800_load_firmware()
786 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); in rt2800_load_firmware()
855 static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2) in rt2800_agc_to_rssi() argument
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()
867 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG); in rt2800_agc_to_rssi()
870 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); in rt2800_agc_to_rssi()
873 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A); in rt2800_agc_to_rssi()
876 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); 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()
936 rxdesc->rssi = rt2800_agc_to_rssi(entry->queue->rt2x00dev, word); in rt2800_process_rxwi()
1009 rt2x00_dbg(entry->queue->rt2x00dev, in rt2800_txdone_entry_check()
1021 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_txdone_entry() local
1022 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_txdone_entry()
1064 rt2800_rate_from_status(skbdesc, status, rt2x00dev->curr_band); in rt2800_txdone_entry()
1095 txdesc.retry = rt2x00dev->long_retry; in rt2800_txdone_entry()
1120 void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota) in rt2800_txdone() argument
1128 while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { in rt2800_txdone()
1134 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); in rt2800_txdone()
1137 rt2x00_dbg(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", in rt2800_txdone()
1146 rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n", in rt2800_txdone()
1157 static inline bool rt2800_entry_txstatus_timeout(struct rt2x00_dev *rt2x00dev, in rt2800_entry_txstatus_timeout() argument
1166 if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) in rt2800_entry_txstatus_timeout()
1173 rt2x00_dbg(entry->queue->rt2x00dev, in rt2800_entry_txstatus_timeout()
1179 bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev) in rt2800_txstatus_timeout() argument
1184 tx_queue_for_each(rt2x00dev, queue) { in rt2800_txstatus_timeout()
1186 if (rt2800_entry_txstatus_timeout(rt2x00dev, entry)) in rt2800_txstatus_timeout()
1198 bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev) in rt2800_txstatus_pending() argument
1202 tx_queue_for_each(rt2x00dev, queue) { in rt2800_txstatus_pending()
1211 void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev) in rt2800_txdone_nostatus() argument
1223 tx_queue_for_each(rt2x00dev, queue) { in rt2800_txdone_nostatus()
1232 rt2800_entry_txstatus_timeout(rt2x00dev, entry)) in rt2800_txdone_nostatus()
1254 static void rt2800_update_survey(struct rt2x00_dev *rt2x00dev) in rt2800_update_survey() argument
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()
1265 static bool rt2800_watchdog_hung(struct rt2x00_dev *rt2x00dev) in rt2800_watchdog_hung() argument
1271 rt2800_update_survey(rt2x00dev); in rt2800_watchdog_hung()
1273 queue_for_each(rt2x00dev, queue) { in rt2800_watchdog_hung()
1289 if (rt2x00dev->intf_sta_count == 0) in rt2800_watchdog_hung()
1302 rt2x00_warn(rt2x00dev, "Watchdog TX hung detected\n"); in rt2800_watchdog_hung()
1305 rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); in rt2800_watchdog_hung()
1307 queue_for_each(rt2x00dev, queue) in rt2800_watchdog_hung()
1313 static bool rt2800_watchdog_dma_busy(struct rt2x00_dev *rt2x00dev) in rt2800_watchdog_dma_busy() argument
1316 u32 reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); in rt2800_watchdog_dma_busy()
1317 u32 reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); in rt2800_watchdog_dma_busy()
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()
1338 rt2x00_warn(rt2x00dev, "Watchdog RX DMA busy detected\n"); in rt2800_watchdog_dma_busy()
1341 rt2x00_warn(rt2x00dev, "Watchdog TX DMA busy detected\n"); 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()
1349 void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) in rt2800_watchdog() argument
1353 if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) in rt2800_watchdog()
1356 if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_DMA_BUSY) in rt2800_watchdog()
1357 reset = rt2800_watchdog_dma_busy(rt2x00dev); in rt2800_watchdog()
1359 if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_HANG) in rt2800_watchdog()
1360 reset = rt2800_watchdog_hung(rt2x00dev) || reset; in rt2800_watchdog()
1363 ieee80211_restart_hw(rt2x00dev->hw); in rt2800_watchdog()
1367 static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, in rt2800_hw_beacon_base() argument
1373 static inline u8 rt2800_get_beacon_offset(struct rt2x00_dev *rt2x00dev, in rt2800_get_beacon_offset() argument
1376 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index)); in rt2800_get_beacon_offset()
1379 static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev) in rt2800_update_beacons_setup() argument
1381 struct data_queue *queue = rt2x00dev->bcn; in rt2800_update_beacons_setup()
1394 off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx); in rt2800_update_beacons_setup()
1399 rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg); in rt2800_update_beacons_setup()
1400 rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32)); in rt2800_update_beacons_setup()
1405 bssid_dw1 = rt2800_register_read(rt2x00dev, MAC_BSSID_DW1); in rt2800_update_beacons_setup()
1408 rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1); in rt2800_update_beacons_setup()
1413 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_write_beacon() local
1424 reg = rt2800_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800_write_beacon()
1427 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800_write_beacon()
1449 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry); in rt2800_write_beacon()
1456 rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n"); in rt2800_write_beacon()
1459 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); 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()
1472 rt2800_update_beacons_setup(rt2x00dev); in rt2800_write_beacon()
1477 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); in rt2800_write_beacon()
1487 static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, in rt2800_clear_beacon_register() argument
1491 const int txwi_desc_size = rt2x00dev->bcn->winfo_size; in rt2800_clear_beacon_register()
1494 beacon_base = rt2800_hw_beacon_base(rt2x00dev, index); in rt2800_clear_beacon_register()
1502 rt2800_register_write(rt2x00dev, beacon_base + i, 0); in rt2800_clear_beacon_register()
1507 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800_clear_beacon() local
1514 orig_reg = rt2800_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800_clear_beacon()
1517 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800_clear_beacon()
1522 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx); in rt2800_clear_beacon()
1528 rt2800_update_beacons_setup(rt2x00dev); in rt2800_clear_beacon()
1532 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); in rt2800_clear_beacon()
1582 int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev) in rt2800_rfkill_poll() argument
1586 if (rt2x00_rt(rt2x00dev, RT3290)) { in rt2800_rfkill_poll()
1587 reg = rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL); in rt2800_rfkill_poll()
1590 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_rfkill_poll()
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()
1632 rt2800_register_write(led->rt2x00dev, LED_CFG, reg); in rt2800_brightness_set()
1636 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, in rt2800_brightness_set()
1639 rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, in rt2800_brightness_set()
1650 rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, in rt2800_brightness_set()
1657 static void rt2800_init_led(struct rt2x00_dev *rt2x00dev, in rt2800_init_led() argument
1660 led->rt2x00dev = rt2x00dev; in rt2800_init_led()
1670 static void rt2800_config_wcid(struct rt2x00_dev *rt2x00dev, in rt2800_config_wcid() argument
1683 rt2800_register_multiwrite(rt2x00dev, offset, in rt2800_config_wcid()
1687 static void rt2800_delete_wcid_attr(struct rt2x00_dev *rt2x00dev, int wcid) in rt2800_delete_wcid_attr() argument
1691 rt2800_register_write(rt2x00dev, offset, 0); in rt2800_delete_wcid_attr()
1694 static void rt2800_config_wcid_attr_bssidx(struct rt2x00_dev *rt2x00dev, in rt2800_config_wcid_attr_bssidx() argument
1704 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_config_wcid_attr_bssidx()
1708 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_config_wcid_attr_bssidx()
1711 static void rt2800_config_wcid_attr_cipher(struct rt2x00_dev *rt2x00dev, in rt2800_config_wcid_attr_cipher() argument
1722 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_config_wcid_attr_cipher()
1735 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_config_wcid_attr_cipher()
1738 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_config_wcid_attr_cipher()
1743 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_config_wcid_attr_cipher()
1746 if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags)) in rt2800_config_wcid_attr_cipher()
1757 rt2800_register_multiwrite(rt2x00dev, offset, in rt2800_config_wcid_attr_cipher()
1761 int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, in rt2800_config_shared_key() argument
1781 rt2800_register_multiwrite(rt2x00dev, offset, in rt2800_config_shared_key()
1797 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_config_shared_key()
1800 rt2800_register_write(rt2x00dev, offset, reg); 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()
1808 rt2800_config_wcid_attr_cipher(rt2x00dev, crypto, key); in rt2800_config_shared_key()
1814 int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, in rt2800_config_pairwise_key() argument
1838 rt2800_register_multiwrite(rt2x00dev, offset, in rt2800_config_pairwise_key()
1845 rt2800_config_wcid_attr_cipher(rt2x00dev, crypto, key); in rt2800_config_pairwise_key()
1851 static void rt2800_set_max_psdu_len(struct rt2x00_dev *rt2x00dev) in rt2800_set_max_psdu_len() argument
1855 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_set_max_psdu_len()
1863 reg = rt2800_register_read(rt2x00dev, MAX_LEN_CFG); in rt2800_set_max_psdu_len()
1865 rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg); in rt2800_set_max_psdu_len()
1871 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_sta_add() local
1872 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_sta_add()
1884 rt2800_set_max_psdu_len(rt2x00dev); in rt2800_sta_add()
1912 rt2800_delete_wcid_attr(rt2x00dev, wcid); in rt2800_sta_add()
1913 rt2800_config_wcid(rt2x00dev, sta->addr, wcid); in rt2800_sta_add()
1914 rt2800_config_wcid_attr_bssidx(rt2x00dev, wcid, in rt2800_sta_add()
1915 rt2x00lib_get_bssidx(rt2x00dev, vif)); in rt2800_sta_add()
1923 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_sta_remove() local
1924 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_sta_remove()
1930 rt2800_set_max_psdu_len(rt2x00dev); in rt2800_sta_remove()
1939 rt2800_config_wcid(rt2x00dev, NULL, wcid); in rt2800_sta_remove()
1947 void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev) in rt2800_pre_reset_hw() argument
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()
1966 void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, in rt2800_config_filter() argument
1977 reg = rt2800_register_read(rt2x00dev, RX_FILTER_CFG); in rt2800_config_filter()
1983 !test_bit(CONFIG_MONITORING, &rt2x00dev->flags)); in rt2800_config_filter()
2007 rt2800_register_write(rt2x00dev, RX_FILTER_CFG, reg); in rt2800_config_filter()
2011 void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, in rt2800_config_intf() argument
2021 reg = rt2800_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800_config_intf()
2023 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800_config_intf()
2029 reg = rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG); in rt2800_config_intf()
2034 rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg); in rt2800_config_intf()
2036 reg = rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG); in rt2800_config_intf()
2041 rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg); in rt2800_config_intf()
2062 rt2800_register_multiwrite(rt2x00dev, MAC_ADDR_DW0, in rt2800_config_intf()
2074 rt2800_register_multiwrite(rt2x00dev, MAC_BSSID_DW0, in rt2800_config_intf()
2080 static void rt2800_config_ht_opmode(struct rt2x00_dev *rt2x00dev, in rt2800_config_ht_opmode() argument
2155 reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); in rt2800_config_ht_opmode()
2158 rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); in rt2800_config_ht_opmode()
2160 reg = rt2800_register_read(rt2x00dev, MM40_PROT_CFG); in rt2800_config_ht_opmode()
2163 rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); in rt2800_config_ht_opmode()
2165 reg = rt2800_register_read(rt2x00dev, GF20_PROT_CFG); in rt2800_config_ht_opmode()
2168 rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); in rt2800_config_ht_opmode()
2170 reg = rt2800_register_read(rt2x00dev, GF40_PROT_CFG); in rt2800_config_ht_opmode()
2173 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); in rt2800_config_ht_opmode()
2176 void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp, in rt2800_config_erp() argument
2182 reg = rt2800_register_read(rt2x00dev, AUTO_RSP_CFG); in rt2800_config_erp()
2185 rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg); in rt2800_config_erp()
2189 reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); in rt2800_config_erp()
2192 rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); in rt2800_config_erp()
2196 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, in rt2800_config_erp()
2198 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); in rt2800_config_erp()
2202 reg = rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG); in rt2800_config_erp()
2205 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); in rt2800_config_erp()
2207 reg = rt2800_register_read(rt2x00dev, XIFS_TIME_CFG); in rt2800_config_erp()
2209 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); in rt2800_config_erp()
2213 reg = rt2800_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800_config_erp()
2216 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800_config_erp()
2220 rt2800_config_ht_opmode(rt2x00dev, erp); in rt2800_config_erp()
2224 static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev, in rt2800_wait_bbp_rf_ready() argument
2231 reg = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); in rt2800_wait_bbp_rf_ready()
2238 rt2x00_err(rt2x00dev, "BBP/RF register access failed, aborting\n"); in rt2800_wait_bbp_rf_ready()
2242 static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) in rt2800_wait_bbp_ready() argument
2251 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); in rt2800_wait_bbp_ready()
2252 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); in rt2800_wait_bbp_ready()
2256 value = rt2800_bbp_read(rt2x00dev, 0); in rt2800_wait_bbp_ready()
2262 rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); in rt2800_wait_bbp_ready()
2266 static void rt2800_config_3572bt_ant(struct rt2x00_dev *rt2x00dev) in rt2800_config_3572bt_ant() argument
2272 reg = rt2800_register_read(rt2x00dev, GPIO_SWITCH); in rt2800_config_3572bt_ant()
2273 if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) { in rt2800_config_3572bt_ant()
2280 rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); in rt2800_config_3572bt_ant()
2282 reg = rt2800_register_read(rt2x00dev, LED_CFG); in rt2800_config_3572bt_ant()
2287 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ); in rt2800_config_3572bt_ant()
2292 rt2800_register_write(rt2x00dev, LED_CFG, reg); in rt2800_config_3572bt_ant()
2294 rt2800_mcu_request(rt2x00dev, MCU_BAND_SELECT, 0xff, in rt2800_config_3572bt_ant()
2300 static void rt2800_set_ant_diversity(struct rt2x00_dev *rt2x00dev, in rt2800_set_ant_diversity() argument
2307 if (rt2x00_is_pci(rt2x00dev)) { in rt2800_set_ant_diversity()
2308 reg = rt2800_register_read(rt2x00dev, E2PROM_CSR); in rt2800_set_ant_diversity()
2310 rt2800_register_write(rt2x00dev, E2PROM_CSR, reg); in rt2800_set_ant_diversity()
2311 } else if (rt2x00_is_usb(rt2x00dev)) in rt2800_set_ant_diversity()
2312 rt2800_mcu_request(rt2x00dev, MCU_ANT_SELECT, 0xff, in rt2800_set_ant_diversity()
2315 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_set_ant_diversity()
2318 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); in rt2800_set_ant_diversity()
2321 void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant) in rt2800_config_ant() argument
2327 r1 = rt2800_bbp_read(rt2x00dev, 1); in rt2800_config_ant()
2328 r3 = rt2800_bbp_read(rt2x00dev, 3); in rt2800_config_ant()
2330 if (rt2x00_rt(rt2x00dev, RT3572) && in rt2800_config_ant()
2331 rt2x00_has_cap_bt_coexist(rt2x00dev)) in rt2800_config_ant()
2332 rt2800_config_3572bt_ant(rt2x00dev); in rt2800_config_ant()
2342 if (rt2x00_rt(rt2x00dev, RT3572) && in rt2800_config_ant()
2343 rt2x00_has_cap_bt_coexist(rt2x00dev)) in rt2800_config_ant()
2358 if (rt2x00_rt(rt2x00dev, RT3070) || in rt2800_config_ant()
2359 rt2x00_rt(rt2x00dev, RT3090) || in rt2800_config_ant()
2360 rt2x00_rt(rt2x00dev, RT3352) || in rt2800_config_ant()
2361 rt2x00_rt(rt2x00dev, RT3390)) { in rt2800_config_ant()
2362 eeprom = rt2800_eeprom_read(rt2x00dev, in rt2800_config_ant()
2366 rt2800_set_ant_diversity(rt2x00dev, in rt2800_config_ant()
2367 rt2x00dev->default_ant.rx); in rt2800_config_ant()
2372 if (rt2x00_rt(rt2x00dev, RT3572) && in rt2800_config_ant()
2373 rt2x00_has_cap_bt_coexist(rt2x00dev)) { in rt2800_config_ant()
2376 rt2x00dev->curr_band == NL80211_BAND_5GHZ); in rt2800_config_ant()
2377 rt2800_set_ant_diversity(rt2x00dev, ANTENNA_B); in rt2800_config_ant()
2387 rt2800_bbp_write(rt2x00dev, 3, r3); in rt2800_config_ant()
2388 rt2800_bbp_write(rt2x00dev, 1, r1); in rt2800_config_ant()
2390 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_ant()
2391 rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_config_ant()
2393 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_config_ant()
2395 rt2800_bbp_write(rt2x00dev, 86, 0x46); in rt2800_config_ant()
2400 static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev, in rt2800_config_lna_gain() argument
2407 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); in rt2800_config_lna_gain()
2410 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); in rt2800_config_lna_gain()
2413 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_lna_gain()
2414 rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_config_lna_gain()
2415 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); in rt2800_config_lna_gain()
2419 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); in rt2800_config_lna_gain()
2424 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_lna_gain()
2425 rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_config_lna_gain()
2426 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); in rt2800_config_lna_gain()
2430 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); in rt2800_config_lna_gain()
2436 rt2x00dev->lna_gain = lna_gain; in rt2800_config_lna_gain()
2439 static inline bool rt2800_clk_is_20mhz(struct rt2x00_dev *rt2x00dev) in rt2800_clk_is_20mhz() argument
2441 return clk_get_rate(rt2x00dev->clk) == 20000000; in rt2800_clk_is_20mhz()
2446 static void rt2800_freq_cal_mode1(struct rt2x00_dev *rt2x00dev) in rt2800_freq_cal_mode1() argument
2451 freq_offset = rt2x00_get_field8(rt2x00dev->freq_offset, RFCSR17_CODE); in rt2800_freq_cal_mode1()
2454 rfcsr = rt2800_rfcsr_read(rt2x00dev, 17); in rt2800_freq_cal_mode1()
2461 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_freq_cal_mode1()
2462 rt2800_mcu_request(rt2x00dev, MCU_FREQ_OFFSET, 0xff, in rt2800_freq_cal_mode1()
2475 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); in rt2800_freq_cal_mode1()
2481 static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf2xxx() argument
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()
2491 if (rt2x00dev->default_ant.rx_chain_num == 1) { in rt2800_config_channel_rf2xxx()
2494 } else if (rt2x00dev->default_ant.rx_chain_num == 2) 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()
2546 static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3xxx() argument
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()
2556 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_config_channel_rf3xxx()
2558 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); in rt2800_config_channel_rf3xxx()
2560 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_config_channel_rf3xxx()
2562 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_config_channel_rf3xxx()
2564 rfcsr = rt2800_rfcsr_read(rt2x00dev, 12); in rt2800_config_channel_rf3xxx()
2566 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); in rt2800_config_channel_rf3xxx()
2568 rfcsr = rt2800_rfcsr_read(rt2x00dev, 13); in rt2800_config_channel_rf3xxx()
2570 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); in rt2800_config_channel_rf3xxx()
2572 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); 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()
2583 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf3xxx()
2585 rfcsr = rt2800_rfcsr_read(rt2x00dev, 23); in rt2800_config_channel_rf3xxx()
2586 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); in rt2800_config_channel_rf3xxx()
2587 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); in rt2800_config_channel_rf3xxx()
2589 if (rt2x00_rt(rt2x00dev, RT3390)) { in rt2800_config_channel_rf3xxx()
2602 rfcsr = rt2800_rfcsr_read(rt2x00dev, 24); in rt2800_config_channel_rf3xxx()
2604 rt2800_rfcsr_write(rt2x00dev, 24, rfcsr); in rt2800_config_channel_rf3xxx()
2606 rfcsr = rt2800_rfcsr_read(rt2x00dev, 31); in rt2800_config_channel_rf3xxx()
2608 rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); in rt2800_config_channel_rf3xxx()
2610 rfcsr = rt2800_rfcsr_read(rt2x00dev, 7); in rt2800_config_channel_rf3xxx()
2612 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); in rt2800_config_channel_rf3xxx()
2614 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_config_channel_rf3xxx()
2616 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel_rf3xxx()
2621 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel_rf3xxx()
2624 static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3052() argument
2629 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; 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()
2637 rt2800_bbp_write(rt2x00dev, 25, 0x09); in rt2800_config_channel_rf3052()
2638 rt2800_bbp_write(rt2x00dev, 26, 0xff); 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()
2644 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_config_channel_rf3052()
2650 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_config_channel_rf3052()
2652 rfcsr = rt2800_rfcsr_read(rt2x00dev, 5); in rt2800_config_channel_rf3052()
2657 rt2800_rfcsr_write(rt2x00dev, 5, rfcsr); in rt2800_config_channel_rf3052()
2659 rfcsr = rt2800_rfcsr_read(rt2x00dev, 12); in rt2800_config_channel_rf3052()
2670 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); in rt2800_config_channel_rf3052()
2672 rfcsr = rt2800_rfcsr_read(rt2x00dev, 13); in rt2800_config_channel_rf3052()
2683 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); in rt2800_config_channel_rf3052()
2685 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_config_channel_rf3052()
2692 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { 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()
2718 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf3052()
2720 rfcsr = rt2800_rfcsr_read(rt2x00dev, 23); in rt2800_config_channel_rf3052()
2721 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); in rt2800_config_channel_rf3052()
2722 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); 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()
2733 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); in rt2800_config_channel_rf3052()
2734 rt2800_rfcsr_write(rt2x00dev, 9, 0xc3); in rt2800_config_channel_rf3052()
2735 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); in rt2800_config_channel_rf3052()
2736 rt2800_rfcsr_write(rt2x00dev, 11, 0xb9); in rt2800_config_channel_rf3052()
2737 rt2800_rfcsr_write(rt2x00dev, 15, 0x53); in rt2800_config_channel_rf3052()
2741 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); in rt2800_config_channel_rf3052()
2742 rt2800_rfcsr_write(rt2x00dev, 17, 0x23); in rt2800_config_channel_rf3052()
2743 rt2800_rfcsr_write(rt2x00dev, 19, 0x93); in rt2800_config_channel_rf3052()
2744 rt2800_rfcsr_write(rt2x00dev, 20, 0xb3); in rt2800_config_channel_rf3052()
2745 rt2800_rfcsr_write(rt2x00dev, 25, 0x15); in rt2800_config_channel_rf3052()
2746 rt2800_rfcsr_write(rt2x00dev, 26, 0x85); in rt2800_config_channel_rf3052()
2747 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_config_channel_rf3052()
2748 rt2800_rfcsr_write(rt2x00dev, 29, 0x9b); in rt2800_config_channel_rf3052()
2750 rfcsr = rt2800_rfcsr_read(rt2x00dev, 7); in rt2800_config_channel_rf3052()
2755 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); in rt2800_config_channel_rf3052()
2756 rt2800_rfcsr_write(rt2x00dev, 9, 0xc0); in rt2800_config_channel_rf3052()
2757 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); in rt2800_config_channel_rf3052()
2758 rt2800_rfcsr_write(rt2x00dev, 11, 0x00); in rt2800_config_channel_rf3052()
2759 rt2800_rfcsr_write(rt2x00dev, 15, 0x43); in rt2800_config_channel_rf3052()
2763 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); in rt2800_config_channel_rf3052()
2764 rt2800_rfcsr_write(rt2x00dev, 17, 0x23); in rt2800_config_channel_rf3052()
2766 rt2800_rfcsr_write(rt2x00dev, 19, 0xb7); in rt2800_config_channel_rf3052()
2767 rt2800_rfcsr_write(rt2x00dev, 20, 0xf6); in rt2800_config_channel_rf3052()
2768 rt2800_rfcsr_write(rt2x00dev, 25, 0x3d); in rt2800_config_channel_rf3052()
2770 rt2800_rfcsr_write(rt2x00dev, 19, 0x74); in rt2800_config_channel_rf3052()
2771 rt2800_rfcsr_write(rt2x00dev, 20, 0xf4); in rt2800_config_channel_rf3052()
2772 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); in rt2800_config_channel_rf3052()
2774 rt2800_rfcsr_write(rt2x00dev, 19, 0x72); in rt2800_config_channel_rf3052()
2775 rt2800_rfcsr_write(rt2x00dev, 20, 0xf3); in rt2800_config_channel_rf3052()
2776 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); in rt2800_config_channel_rf3052()
2778 rt2800_rfcsr_write(rt2x00dev, 26, 0x87); in rt2800_config_channel_rf3052()
2779 rt2800_rfcsr_write(rt2x00dev, 27, 0x01); in rt2800_config_channel_rf3052()
2780 rt2800_rfcsr_write(rt2x00dev, 29, 0x9f); in rt2800_config_channel_rf3052()
2783 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_config_channel_rf3052()
2789 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); in rt2800_config_channel_rf3052()
2791 rfcsr = rt2800_rfcsr_read(rt2x00dev, 7); in rt2800_config_channel_rf3052()
2793 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); in rt2800_config_channel_rf3052()
2796 static void rt2800_config_channel_rf3053(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3053() argument
2801 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf3053()
2809 bbp = rt2800_bbp_read(rt2x00dev, 109); in rt2800_config_channel_rf3053()
2812 rt2800_bbp_write(rt2x00dev, 109, bbp); in rt2800_config_channel_rf3053()
2814 bbp = rt2800_bbp_read(rt2x00dev, 110); in rt2800_config_channel_rf3053()
2816 rt2800_bbp_write(rt2x00dev, 110, bbp); 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()
2826 rt2800_bbp_write(rt2x00dev, 25, 0x09); in rt2800_config_channel_rf3053()
2828 rt2800_bbp_write(rt2x00dev, 26, 0xff); 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()
2834 rfcsr = rt2800_rfcsr_read(rt2x00dev, 11); in rt2800_config_channel_rf3053()
2836 rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); in rt2800_config_channel_rf3053()
2838 rfcsr = rt2800_rfcsr_read(rt2x00dev, 11); in rt2800_config_channel_rf3053()
2844 rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); in rt2800_config_channel_rf3053()
2846 rfcsr = rt2800_rfcsr_read(rt2x00dev, 53); in rt2800_config_channel_rf3053()
2852 if (rt2x00_is_usb(rt2x00dev)) in rt2800_config_channel_rf3053()
2859 rt2800_rfcsr_write(rt2x00dev, 53, rfcsr); in rt2800_config_channel_rf3053()
2861 rfcsr = rt2800_rfcsr_read(rt2x00dev, 55); in rt2800_config_channel_rf3053()
2867 if (rt2x00_is_usb(rt2x00dev)) in rt2800_config_channel_rf3053()
2874 rt2800_rfcsr_write(rt2x00dev, 55, rfcsr); in rt2800_config_channel_rf3053()
2876 rfcsr = rt2800_rfcsr_read(rt2x00dev, 54); in rt2800_config_channel_rf3053()
2882 if (rt2x00_is_usb(rt2x00dev)) in rt2800_config_channel_rf3053()
2889 rt2800_rfcsr_write(rt2x00dev, 54, rfcsr); in rt2800_config_channel_rf3053()
2891 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); 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()
2924 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf3053()
2926 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf3053()
2943 rfcsr = rt2800_rfcsr_read(rt2x00dev, 32); in rt2800_config_channel_rf3053()
2950 rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); in rt2800_config_channel_rf3053()
2952 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_config_channel_rf3053()
2955 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel_rf3053()
2958 rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); in rt2800_config_channel_rf3053()
2963 rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); in rt2800_config_channel_rf3053()
2965 rfcsr = rt2800_rfcsr_read(rt2x00dev, 34); in rt2800_config_channel_rf3053()
2970 rt2800_rfcsr_write(rt2x00dev, 34, rfcsr); in rt2800_config_channel_rf3053()
2972 rfcsr = rt2800_rfcsr_read(rt2x00dev, 12); in rt2800_config_channel_rf3053()
2977 rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); in rt2800_config_channel_rf3053()
2979 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_config_channel_rf3053()
2988 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_config_channel_rf3053()
2990 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_config_channel_rf3053()
2992 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel_rf3053()
2994 rt2800_rfcsr_write(rt2x00dev, 46, 0x60); in rt2800_config_channel_rf3053()
2997 rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); in rt2800_config_channel_rf3053()
2998 rt2800_rfcsr_write(rt2x00dev, 13, 0x12); in rt2800_config_channel_rf3053()
3000 rt2800_rfcsr_write(rt2x00dev, 10, 0xd8); in rt2800_config_channel_rf3053()
3001 rt2800_rfcsr_write(rt2x00dev, 13, 0x23); in rt2800_config_channel_rf3053()
3004 rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); in rt2800_config_channel_rf3053()
3006 rt2800_rfcsr_write(rt2x00dev, 51, rfcsr); in rt2800_config_channel_rf3053()
3008 rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); in rt2800_config_channel_rf3053()
3016 rt2800_rfcsr_write(rt2x00dev, 51, rfcsr); in rt2800_config_channel_rf3053()
3018 rfcsr = rt2800_rfcsr_read(rt2x00dev, 49); in rt2800_config_channel_rf3053()
3027 rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); in rt2800_config_channel_rf3053()
3029 rfcsr = rt2800_rfcsr_read(rt2x00dev, 50); in rt2800_config_channel_rf3053()
3031 rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); in rt2800_config_channel_rf3053()
3033 rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); in rt2800_config_channel_rf3053()
3038 rt2800_rfcsr_write(rt2x00dev, 57, rfcsr); in rt2800_config_channel_rf3053()
3041 rt2800_rfcsr_write(rt2x00dev, 44, 0x93); in rt2800_config_channel_rf3053()
3042 rt2800_rfcsr_write(rt2x00dev, 52, 0x45); in rt2800_config_channel_rf3053()
3044 rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); in rt2800_config_channel_rf3053()
3045 rt2800_rfcsr_write(rt2x00dev, 52, 0x05); in rt2800_config_channel_rf3053()
3049 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_config_channel_rf3053()
3060 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); in rt2800_config_channel_rf3053()
3066 rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); in rt2800_config_channel_rf3053()
3068 rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); in rt2800_config_channel_rf3053()
3073 rt2800_rfcsr_write(rt2x00dev, 39, 0x36); in rt2800_config_channel_rf3053()
3075 rt2800_rfcsr_write(rt2x00dev, 45, 0xeb); in rt2800_config_channel_rf3053()
3080 rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); in rt2800_config_channel_rf3053()
3082 rt2800_rfcsr_write(rt2x00dev, 45, 0xb3); in rt2800_config_channel_rf3053()
3087 rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); in rt2800_config_channel_rf3053()
3089 rt2800_rfcsr_write(rt2x00dev, 45, 0x9b); in rt2800_config_channel_rf3053()
3093 static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3853() argument
3107 rt2800_rfcsr_write(rt2x00dev, 6, 0x40); in rt2800_config_channel_rf3853()
3109 rt2800_rfcsr_write(rt2x00dev, 6, 0x80); in rt2800_config_channel_rf3853()
3111 rt2800_rfcsr_write(rt2x00dev, 6, 0x40); 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()
3117 rt2800_rfcsr_write(rt2x00dev, 11, 0x46); in rt2800_config_channel_rf3853()
3119 rt2800_rfcsr_write(rt2x00dev, 11, 0x48); in rt2800_config_channel_rf3853()
3122 rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); in rt2800_config_channel_rf3853()
3124 rt2800_rfcsr_write(rt2x00dev, 12, 0x52); in rt2800_config_channel_rf3853()
3126 rt2800_rfcsr_write(rt2x00dev, 13, 0x12); in rt2800_config_channel_rf3853()
3128 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); 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()
3161 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf3853()
3163 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf3853()
3165 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_config_channel_rf3853()
3170 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel_rf3853()
3173 rt2800_rfcsr_write(rt2x00dev, 31, 0xa0); in rt2800_config_channel_rf3853()
3175 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_config_channel_rf3853()
3178 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_config_channel_rf3853()
3180 rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); in rt2800_config_channel_rf3853()
3183 rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); in rt2800_config_channel_rf3853()
3185 rt2800_rfcsr_write(rt2x00dev, 34, 0x20); in rt2800_config_channel_rf3853()
3188 rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); in rt2800_config_channel_rf3853()
3193 rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); in rt2800_config_channel_rf3853()
3207 rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); in rt2800_config_channel_rf3853()
3210 rt2800_rfcsr_write(rt2x00dev, 44, 0x93); in rt2800_config_channel_rf3853()
3212 rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); in rt2800_config_channel_rf3853()
3222 rt2800_rfcsr_write(rt2x00dev, 45, rfcsr); in rt2800_config_channel_rf3853()
3232 rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); in rt2800_config_channel_rf3853()
3234 rt2800_rfcsr_write(rt2x00dev, 50, 0x86); in rt2800_config_channel_rf3853()
3236 rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); in rt2800_config_channel_rf3853()
3238 rt2800_rfcsr_write(rt2x00dev, 51, 0x75); in rt2800_config_channel_rf3853()
3240 rt2800_rfcsr_write(rt2x00dev, 51, 0x51); in rt2800_config_channel_rf3853()
3242 rfcsr = rt2800_rfcsr_read(rt2x00dev, 52); in rt2800_config_channel_rf3853()
3244 rt2800_rfcsr_write(rt2x00dev, 52, 0x45); in rt2800_config_channel_rf3853()
3246 rt2800_rfcsr_write(rt2x00dev, 52, 0x05); in rt2800_config_channel_rf3853()
3261 rt2800_rfcsr_write(rt2x00dev, 53, pwr1); in rt2800_config_channel_rf3853()
3262 rt2800_rfcsr_write(rt2x00dev, 54, pwr2); in rt2800_config_channel_rf3853()
3263 rt2800_rfcsr_write(rt2x00dev, 55, pwr3); in rt2800_config_channel_rf3853()
3265 rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n", in rt2800_config_channel_rf3853()
3270 rt2800_bbp_write(rt2x00dev, 109, bbp); in rt2800_config_channel_rf3853()
3272 bbp = rt2800_bbp_read(rt2x00dev, 110); in rt2800_config_channel_rf3853()
3275 rt2800_bbp_write(rt2x00dev, 110, bbp); in rt2800_config_channel_rf3853()
3277 rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); in rt2800_config_channel_rf3853()
3279 rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); in rt2800_config_channel_rf3853()
3281 rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); in rt2800_config_channel_rf3853()
3284 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_config_channel_rf3853()
3286 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); in rt2800_config_channel_rf3853()
3290 bbp = rt2800_bbp_read(rt2x00dev, 49); in rt2800_config_channel_rf3853()
3292 rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe); in rt2800_config_channel_rf3853()
3293 rt2800_bbp_write(rt2x00dev, 49, bbp); in rt2800_config_channel_rf3853()
3301 static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3290() argument
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()
3310 rfcsr = rt2800_rfcsr_read(rt2x00dev, 11); in rt2800_config_channel_rf3290()
3312 rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); in rt2800_config_channel_rf3290()
3314 rfcsr = rt2800_rfcsr_read(rt2x00dev, 49); in rt2800_config_channel_rf3290()
3319 rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); in rt2800_config_channel_rf3290()
3321 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf3290()
3325 rt2800_bbp_write(rt2x00dev, 68, 0x0c); in rt2800_config_channel_rf3290()
3327 rt2800_bbp_write(rt2x00dev, 68, 0x0b); in rt2800_config_channel_rf3290()
3330 rt2800_bbp_write(rt2x00dev, 59, 0x0f); in rt2800_config_channel_rf3290()
3332 rt2800_bbp_write(rt2x00dev, 59, 0x0e); in rt2800_config_channel_rf3290()
3334 rt2800_bbp_write(rt2x00dev, 59, 0x0d); in rt2800_config_channel_rf3290()
3338 static void rt2800_config_channel_rf3322(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf3322() argument
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()
3348 rt2800_rfcsr_write(rt2x00dev, 11, 0x42); in rt2800_config_channel_rf3322()
3349 rt2800_rfcsr_write(rt2x00dev, 12, 0x1c); in rt2800_config_channel_rf3322()
3350 rt2800_rfcsr_write(rt2x00dev, 13, 0x00); in rt2800_config_channel_rf3322()
3353 rt2800_rfcsr_write(rt2x00dev, 47, POWER_BOUND); in rt2800_config_channel_rf3322()
3355 rt2800_rfcsr_write(rt2x00dev, 47, info->default_power1); in rt2800_config_channel_rf3322()
3358 rt2800_rfcsr_write(rt2x00dev, 48, POWER_BOUND); in rt2800_config_channel_rf3322()
3360 rt2800_rfcsr_write(rt2x00dev, 48, info->default_power2); in rt2800_config_channel_rf3322()
3362 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf3322()
3364 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); 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()
3381 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf3322()
3383 rt2800_rfcsr_write(rt2x00dev, 31, 80); in rt2800_config_channel_rf3322()
3386 static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf53xx() argument
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()
3396 rfcsr = rt2800_rfcsr_read(rt2x00dev, 11); in rt2800_config_channel_rf53xx()
3398 rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); in rt2800_config_channel_rf53xx()
3400 rfcsr = rt2800_rfcsr_read(rt2x00dev, 49); in rt2800_config_channel_rf53xx()
3405 rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); in rt2800_config_channel_rf53xx()
3407 if (rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_config_channel_rf53xx()
3408 rfcsr = rt2800_rfcsr_read(rt2x00dev, 50); in rt2800_config_channel_rf53xx()
3414 rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); in rt2800_config_channel_rf53xx()
3417 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_config_channel_rf53xx()
3418 if (rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_config_channel_rf53xx()
3426 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf53xx()
3428 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf53xx()
3430 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { in rt2800_config_channel_rf53xx()
3431 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { in rt2800_config_channel_rf53xx()
3440 rt2800_rfcsr_write(rt2x00dev, 55, in rt2800_config_channel_rf53xx()
3442 rt2800_rfcsr_write(rt2x00dev, 59, in rt2800_config_channel_rf53xx()
3449 rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]); in rt2800_config_channel_rf53xx()
3452 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { in rt2800_config_channel_rf53xx()
3460 rt2800_rfcsr_write(rt2x00dev, 55, in rt2800_config_channel_rf53xx()
3462 rt2800_rfcsr_write(rt2x00dev, 59, in rt2800_config_channel_rf53xx()
3464 } else if (rt2x00_rt(rt2x00dev, RT5390) || in rt2800_config_channel_rf53xx()
3465 rt2x00_rt(rt2x00dev, RT5392) || in rt2800_config_channel_rf53xx()
3466 rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_config_channel_rf53xx()
3471 rt2800_rfcsr_write(rt2x00dev, 59, in rt2800_config_channel_rf53xx()
3473 } else if (rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_config_channel_rf53xx()
3478 rt2800_rfcsr_write(rt2x00dev, 59, in rt2800_config_channel_rf53xx()
3484 static void rt2800_config_channel_rf55xx(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf55xx() argument
3497 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_config_channel_rf55xx()
3500 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_config_channel_rf55xx()
3503 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1 & 0xff); in rt2800_config_channel_rf55xx()
3505 rfcsr = rt2800_rfcsr_read(rt2x00dev, 9); in rt2800_config_channel_rf55xx()
3509 rt2800_rfcsr_write(rt2x00dev, 9, rfcsr); in rt2800_config_channel_rf55xx()
3511 rfcsr = rt2800_rfcsr_read(rt2x00dev, 11); in rt2800_config_channel_rf55xx()
3514 rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); in rt2800_config_channel_rf55xx()
3517 rt2800_rfcsr_write(rt2x00dev, 10, 0x90); in rt2800_config_channel_rf55xx()
3519 rt2800_rfcsr_write(rt2x00dev, 11, 0x4A); in rt2800_config_channel_rf55xx()
3520 rt2800_rfcsr_write(rt2x00dev, 12, 0x52); in rt2800_config_channel_rf55xx()
3521 rt2800_rfcsr_write(rt2x00dev, 13, 0x42); in rt2800_config_channel_rf55xx()
3522 rt2800_rfcsr_write(rt2x00dev, 22, 0x40); in rt2800_config_channel_rf55xx()
3523 rt2800_rfcsr_write(rt2x00dev, 24, 0x4A); in rt2800_config_channel_rf55xx()
3524 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); in rt2800_config_channel_rf55xx()
3525 rt2800_rfcsr_write(rt2x00dev, 27, 0x42); in rt2800_config_channel_rf55xx()
3526 rt2800_rfcsr_write(rt2x00dev, 36, 0x80); in rt2800_config_channel_rf55xx()
3527 rt2800_rfcsr_write(rt2x00dev, 37, 0x08); in rt2800_config_channel_rf55xx()
3528 rt2800_rfcsr_write(rt2x00dev, 38, 0x89); in rt2800_config_channel_rf55xx()
3529 rt2800_rfcsr_write(rt2x00dev, 39, 0x1B); in rt2800_config_channel_rf55xx()
3530 rt2800_rfcsr_write(rt2x00dev, 40, 0x0D); in rt2800_config_channel_rf55xx()
3531 rt2800_rfcsr_write(rt2x00dev, 41, 0x9B); in rt2800_config_channel_rf55xx()
3532 rt2800_rfcsr_write(rt2x00dev, 42, 0xD5); in rt2800_config_channel_rf55xx()
3533 rt2800_rfcsr_write(rt2x00dev, 43, 0x72); in rt2800_config_channel_rf55xx()
3534 rt2800_rfcsr_write(rt2x00dev, 44, 0x0E); in rt2800_config_channel_rf55xx()
3535 rt2800_rfcsr_write(rt2x00dev, 45, 0xA2); in rt2800_config_channel_rf55xx()
3536 rt2800_rfcsr_write(rt2x00dev, 46, 0x6B); in rt2800_config_channel_rf55xx()
3537 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); in rt2800_config_channel_rf55xx()
3538 rt2800_rfcsr_write(rt2x00dev, 51, 0x3E); in rt2800_config_channel_rf55xx()
3539 rt2800_rfcsr_write(rt2x00dev, 52, 0x48); in rt2800_config_channel_rf55xx()
3540 rt2800_rfcsr_write(rt2x00dev, 54, 0x38); in rt2800_config_channel_rf55xx()
3541 rt2800_rfcsr_write(rt2x00dev, 56, 0xA1); in rt2800_config_channel_rf55xx()
3542 rt2800_rfcsr_write(rt2x00dev, 57, 0x00); in rt2800_config_channel_rf55xx()
3543 rt2800_rfcsr_write(rt2x00dev, 58, 0x39); in rt2800_config_channel_rf55xx()
3544 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); in rt2800_config_channel_rf55xx()
3545 rt2800_rfcsr_write(rt2x00dev, 61, 0x91); in rt2800_config_channel_rf55xx()
3546 rt2800_rfcsr_write(rt2x00dev, 62, 0x39); in rt2800_config_channel_rf55xx()
3551 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); in rt2800_config_channel_rf55xx()
3552 rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); in rt2800_config_channel_rf55xx()
3556 rt2800_rfcsr_write(rt2x00dev, 31, 0xF8); in rt2800_config_channel_rf55xx()
3557 rt2800_rfcsr_write(rt2x00dev, 32, 0xC0); in rt2800_config_channel_rf55xx()
3559 rt2800_rfcsr_write(rt2x00dev, 55, 0x06); in rt2800_config_channel_rf55xx()
3561 rt2800_rfcsr_write(rt2x00dev, 55, 0x47); in rt2800_config_channel_rf55xx()
3565 rt2800_rfcsr_write(rt2x00dev, 55, 0x03); in rt2800_config_channel_rf55xx()
3567 rt2800_rfcsr_write(rt2x00dev, 55, 0x43); in rt2800_config_channel_rf55xx()
3573 rt2800_rfcsr_write(rt2x00dev, 10, 0x97); in rt2800_config_channel_rf55xx()
3575 rt2800_rfcsr_write(rt2x00dev, 11, 0x40); in rt2800_config_channel_rf55xx()
3576 rt2800_rfcsr_write(rt2x00dev, 25, 0xBF); in rt2800_config_channel_rf55xx()
3577 rt2800_rfcsr_write(rt2x00dev, 27, 0x42); in rt2800_config_channel_rf55xx()
3578 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_config_channel_rf55xx()
3579 rt2800_rfcsr_write(rt2x00dev, 37, 0x04); in rt2800_config_channel_rf55xx()
3580 rt2800_rfcsr_write(rt2x00dev, 38, 0x85); in rt2800_config_channel_rf55xx()
3581 rt2800_rfcsr_write(rt2x00dev, 40, 0x42); in rt2800_config_channel_rf55xx()
3582 rt2800_rfcsr_write(rt2x00dev, 41, 0xBB); in rt2800_config_channel_rf55xx()
3583 rt2800_rfcsr_write(rt2x00dev, 42, 0xD7); in rt2800_config_channel_rf55xx()
3584 rt2800_rfcsr_write(rt2x00dev, 45, 0x41); in rt2800_config_channel_rf55xx()
3585 rt2800_rfcsr_write(rt2x00dev, 48, 0x00); in rt2800_config_channel_rf55xx()
3586 rt2800_rfcsr_write(rt2x00dev, 57, 0x77); in rt2800_config_channel_rf55xx()
3587 rt2800_rfcsr_write(rt2x00dev, 60, 0x05); in rt2800_config_channel_rf55xx()
3588 rt2800_rfcsr_write(rt2x00dev, 61, 0x01); in rt2800_config_channel_rf55xx()
3594 rt2800_rfcsr_write(rt2x00dev, 12, 0x2E); in rt2800_config_channel_rf55xx()
3595 rt2800_rfcsr_write(rt2x00dev, 13, 0x22); in rt2800_config_channel_rf55xx()
3596 rt2800_rfcsr_write(rt2x00dev, 22, 0x60); in rt2800_config_channel_rf55xx()
3597 rt2800_rfcsr_write(rt2x00dev, 23, 0x7F); in rt2800_config_channel_rf55xx()
3599 rt2800_rfcsr_write(rt2x00dev, 24, 0x09); in rt2800_config_channel_rf55xx()
3601 rt2800_rfcsr_write(rt2x00dev, 24, 0x07); in rt2800_config_channel_rf55xx()
3602 rt2800_rfcsr_write(rt2x00dev, 39, 0x1C); in rt2800_config_channel_rf55xx()
3603 rt2800_rfcsr_write(rt2x00dev, 43, 0x5B); in rt2800_config_channel_rf55xx()
3604 rt2800_rfcsr_write(rt2x00dev, 44, 0X40); in rt2800_config_channel_rf55xx()
3605 rt2800_rfcsr_write(rt2x00dev, 46, 0X00); in rt2800_config_channel_rf55xx()
3606 rt2800_rfcsr_write(rt2x00dev, 51, 0xFE); in rt2800_config_channel_rf55xx()
3607 rt2800_rfcsr_write(rt2x00dev, 52, 0x0C); in rt2800_config_channel_rf55xx()
3608 rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); in rt2800_config_channel_rf55xx()
3610 rt2800_rfcsr_write(rt2x00dev, 55, 0x06), in rt2800_config_channel_rf55xx()
3611 rt2800_rfcsr_write(rt2x00dev, 56, 0xD3); in rt2800_config_channel_rf55xx()
3613 rt2800_rfcsr_write(rt2x00dev, 55, 0x04); in rt2800_config_channel_rf55xx()
3614 rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); in rt2800_config_channel_rf55xx()
3617 rt2800_rfcsr_write(rt2x00dev, 58, 0x15); in rt2800_config_channel_rf55xx()
3618 rt2800_rfcsr_write(rt2x00dev, 59, 0x7F); in rt2800_config_channel_rf55xx()
3619 rt2800_rfcsr_write(rt2x00dev, 62, 0x15); in rt2800_config_channel_rf55xx()
3623 rt2800_rfcsr_write(rt2x00dev, 12, 0x0E); in rt2800_config_channel_rf55xx()
3624 rt2800_rfcsr_write(rt2x00dev, 13, 0x42); in rt2800_config_channel_rf55xx()
3625 rt2800_rfcsr_write(rt2x00dev, 22, 0x40); in rt2800_config_channel_rf55xx()
3627 rt2800_rfcsr_write(rt2x00dev, 23, 0x3C); in rt2800_config_channel_rf55xx()
3628 rt2800_rfcsr_write(rt2x00dev, 24, 0x06); in rt2800_config_channel_rf55xx()
3630 rt2800_rfcsr_write(rt2x00dev, 23, 0x38); in rt2800_config_channel_rf55xx()
3631 rt2800_rfcsr_write(rt2x00dev, 24, 0x05); in rt2800_config_channel_rf55xx()
3634 rt2800_rfcsr_write(rt2x00dev, 39, 0x1A); in rt2800_config_channel_rf55xx()
3635 rt2800_rfcsr_write(rt2x00dev, 43, 0x3B); in rt2800_config_channel_rf55xx()
3636 rt2800_rfcsr_write(rt2x00dev, 44, 0x20); in rt2800_config_channel_rf55xx()
3637 rt2800_rfcsr_write(rt2x00dev, 46, 0x18); in rt2800_config_channel_rf55xx()
3639 rt2800_rfcsr_write(rt2x00dev, 39, 0x18); in rt2800_config_channel_rf55xx()
3640 rt2800_rfcsr_write(rt2x00dev, 43, 0x1B); in rt2800_config_channel_rf55xx()
3641 rt2800_rfcsr_write(rt2x00dev, 44, 0x10); in rt2800_config_channel_rf55xx()
3642 rt2800_rfcsr_write(rt2x00dev, 46, 0X08); in rt2800_config_channel_rf55xx()
3645 rt2800_rfcsr_write(rt2x00dev, 51, 0xFC); in rt2800_config_channel_rf55xx()
3647 rt2800_rfcsr_write(rt2x00dev, 51, 0xEC); in rt2800_config_channel_rf55xx()
3649 rt2800_rfcsr_write(rt2x00dev, 52, 0x06); in rt2800_config_channel_rf55xx()
3651 rt2800_rfcsr_write(rt2x00dev, 52, 0x06); in rt2800_config_channel_rf55xx()
3652 rt2800_rfcsr_write(rt2x00dev, 54, 0xEB); in rt2800_config_channel_rf55xx()
3654 rt2800_rfcsr_write(rt2x00dev, 55, 0x01); in rt2800_config_channel_rf55xx()
3656 rt2800_rfcsr_write(rt2x00dev, 55, 0x00); in rt2800_config_channel_rf55xx()
3658 rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); in rt2800_config_channel_rf55xx()
3660 rt2800_rfcsr_write(rt2x00dev, 56, 0xAB); in rt2800_config_channel_rf55xx()
3662 rt2800_rfcsr_write(rt2x00dev, 58, 0x1D); in rt2800_config_channel_rf55xx()
3664 rt2800_rfcsr_write(rt2x00dev, 58, 0x15); in rt2800_config_channel_rf55xx()
3666 rt2800_rfcsr_write(rt2x00dev, 59, 0x3F); in rt2800_config_channel_rf55xx()
3668 rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); in rt2800_config_channel_rf55xx()
3670 rt2800_rfcsr_write(rt2x00dev, 62, 0x1D); in rt2800_config_channel_rf55xx()
3672 rt2800_rfcsr_write(rt2x00dev, 62, 0x15); in rt2800_config_channel_rf55xx()
3679 rfcsr = rt2800_rfcsr_read(rt2x00dev, 49); in rt2800_config_channel_rf55xx()
3686 rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); in rt2800_config_channel_rf55xx()
3688 rfcsr = rt2800_rfcsr_read(rt2x00dev, 50); in rt2800_config_channel_rf55xx()
3695 rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); in rt2800_config_channel_rf55xx()
3697 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); 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()
3713 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf55xx()
3714 rt2800_rfcsr_write(rt2x00dev, 6, 0xe4); in rt2800_config_channel_rf55xx()
3717 rt2800_rfcsr_write(rt2x00dev, 30, 0x16); in rt2800_config_channel_rf55xx()
3719 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_config_channel_rf55xx()
3722 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_config_channel_rf55xx()
3723 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_config_channel_rf55xx()
3727 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_config_channel_rf55xx()
3730 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_config_channel_rf55xx()
3732 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); 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()
3745 rt2800_bbp_write(rt2x00dev, 195, 128); in rt2800_config_channel_rf55xx()
3746 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0xE0 : 0xF0); in rt2800_config_channel_rf55xx()
3747 rt2800_bbp_write(rt2x00dev, 195, 129); in rt2800_config_channel_rf55xx()
3748 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x1F : 0x1E); in rt2800_config_channel_rf55xx()
3749 rt2800_bbp_write(rt2x00dev, 195, 130); in rt2800_config_channel_rf55xx()
3750 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x38 : 0x28); in rt2800_config_channel_rf55xx()
3751 rt2800_bbp_write(rt2x00dev, 195, 131); in rt2800_config_channel_rf55xx()
3752 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); in rt2800_config_channel_rf55xx()
3753 rt2800_bbp_write(rt2x00dev, 195, 133); in rt2800_config_channel_rf55xx()
3754 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); in rt2800_config_channel_rf55xx()
3755 rt2800_bbp_write(rt2x00dev, 195, 124); in rt2800_config_channel_rf55xx()
3756 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); in rt2800_config_channel_rf55xx()
3759 static void rt2800_config_channel_rf7620(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel_rf7620() argument
3764 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_config_channel_rf7620()
3772 rfcsr = rt2800_rfcsr_read(rt2x00dev, 13); in rt2800_config_channel_rf7620()
3774 rt2800_clk_is_20mhz(rt2x00dev) ? 3 : 0); in rt2800_config_channel_rf7620()
3775 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); in rt2800_config_channel_rf7620()
3781 rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); in rt2800_config_channel_rf7620()
3783 rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); in rt2800_config_channel_rf7620()
3785 rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); in rt2800_config_channel_rf7620()
3787 rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); in rt2800_config_channel_rf7620()
3792 rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); in rt2800_config_channel_rf7620()
3794 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); in rt2800_config_channel_rf7620()
3799 rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); in rt2800_config_channel_rf7620()
3801 rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); in rt2800_config_channel_rf7620()
3808 rfcsr = rt2800_rfcsr_read(rt2x00dev, 17); in rt2800_config_channel_rf7620()
3810 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); in rt2800_config_channel_rf7620()
3812 rfcsr = rt2800_rfcsr_read(rt2x00dev, 18); in rt2800_config_channel_rf7620()
3814 rt2800_rfcsr_write(rt2x00dev, 18, rfcsr); in rt2800_config_channel_rf7620()
3816 rfcsr = rt2800_rfcsr_read(rt2x00dev, 19); in rt2800_config_channel_rf7620()
3818 rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); in rt2800_config_channel_rf7620()
3821 rfcsr = rt2800_rfcsr_read(rt2x00dev, 16); in rt2800_config_channel_rf7620()
3823 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); in rt2800_config_channel_rf7620()
3825 rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); in rt2800_config_channel_rf7620()
3827 rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); in rt2800_config_channel_rf7620()
3829 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_config_channel_rf7620()
3831 rt2x00dev->default_ant.tx_chain_num != 1); in rt2800_config_channel_rf7620()
3832 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_config_channel_rf7620()
3834 rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); 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()
3839 rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); in rt2800_config_channel_rf7620()
3841 rfcsr = rt2800_rfcsr_read(rt2x00dev, 42); in rt2800_config_channel_rf7620()
3843 rt2x00dev->default_ant.tx_chain_num != 1); in rt2800_config_channel_rf7620()
3844 rt2800_rfcsr_write(rt2x00dev, 42, rfcsr); in rt2800_config_channel_rf7620()
3848 rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x10); in rt2800_config_channel_rf7620()
3849 rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x10); in rt2800_config_channel_rf7620()
3850 rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x04); in rt2800_config_channel_rf7620()
3851 rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x10); in rt2800_config_channel_rf7620()
3852 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x10); in rt2800_config_channel_rf7620()
3854 rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x20); in rt2800_config_channel_rf7620()
3855 rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x20); in rt2800_config_channel_rf7620()
3856 rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x00); in rt2800_config_channel_rf7620()
3857 rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x20); in rt2800_config_channel_rf7620()
3858 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); in rt2800_config_channel_rf7620()
3862 rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x08); in rt2800_config_channel_rf7620()
3863 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x08); in rt2800_config_channel_rf7620()
3865 rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x28); in rt2800_config_channel_rf7620()
3866 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x28); in rt2800_config_channel_rf7620()
3869 rfcsr = rt2800_rfcsr_read(rt2x00dev, 28); in rt2800_config_channel_rf7620()
3872 rt2800_rfcsr_write(rt2x00dev, 28, rfcsr); in rt2800_config_channel_rf7620()
3874 if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { in rt2800_config_channel_rf7620()
3882 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 5, 6); in rt2800_config_channel_rf7620()
3885 rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rfcsr); in rt2800_config_channel_rf7620()
3886 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 5, 7); in rt2800_config_channel_rf7620()
3889 rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rfcsr); in rt2800_config_channel_rf7620()
3890 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 7, 6); in rt2800_config_channel_rf7620()
3893 rt2800_rfcsr_write_bank(rt2x00dev, 7, 6, rfcsr); in rt2800_config_channel_rf7620()
3894 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 7, 7); in rt2800_config_channel_rf7620()
3897 rt2800_rfcsr_write_bank(rt2x00dev, 7, 7, rfcsr); in rt2800_config_channel_rf7620()
3899 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 5, 58); in rt2800_config_channel_rf7620()
3902 rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rfcsr); in rt2800_config_channel_rf7620()
3903 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 5, 59); in rt2800_config_channel_rf7620()
3906 rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rfcsr); in rt2800_config_channel_rf7620()
3907 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 7, 58); in rt2800_config_channel_rf7620()
3910 rt2800_rfcsr_write_bank(rt2x00dev, 7, 58, rfcsr); in rt2800_config_channel_rf7620()
3911 rfcsr = rt2800_rfcsr_read_bank(rt2x00dev, 7, 59); in rt2800_config_channel_rf7620()
3914 rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); in rt2800_config_channel_rf7620()
3918 static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, in rt2800_config_alc_rt6352() argument
3922 int cur_channel = rt2x00dev->rf_channel; in rt2800_config_alc_rt6352()
3942 rate_power = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_config_alc_rt6352()
3949 power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); in rt2800_config_alc_rt6352()
3950 power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); in rt2800_config_alc_rt6352()
3958 reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0); in rt2800_config_alc_rt6352()
3964 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_config_alc_rt6352()
3967 target_power = rt2800_eeprom_read(rt2x00dev, in rt2800_config_alc_rt6352()
3972 rt2800_register_write(rt2x00dev, TX_ALC_CFG_0, reg); in rt2800_config_alc_rt6352()
3974 reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); in rt2800_config_alc_rt6352()
3976 rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); in rt2800_config_alc_rt6352()
3979 mac_sys_ctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_config_alc_rt6352()
3981 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0); in rt2800_config_alc_rt6352()
3983 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) in rt2800_config_alc_rt6352()
3984 rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); in rt2800_config_alc_rt6352()
3987 bbp = rt2800_bbp_read(rt2x00dev, 30); in rt2800_config_alc_rt6352()
3989 rt2800_bbp_write(rt2x00dev, 30, bbp); in rt2800_config_alc_rt6352()
3990 rt2800_rfcsr_write(rt2x00dev, 39, 0); in rt2800_config_alc_rt6352()
3991 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) in rt2800_config_alc_rt6352()
3992 rt2800_rfcsr_write(rt2x00dev, 42, 0xfb); in rt2800_config_alc_rt6352()
3994 rt2800_rfcsr_write(rt2x00dev, 42, 0x7b); in rt2800_config_alc_rt6352()
3996 bbp = rt2800_bbp_read(rt2x00dev, 30); in rt2800_config_alc_rt6352()
3998 rt2800_bbp_write(rt2x00dev, 30, bbp); in rt2800_config_alc_rt6352()
3999 rt2800_rfcsr_write(rt2x00dev, 39, 0x80); in rt2800_config_alc_rt6352()
4000 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) in rt2800_config_alc_rt6352()
4001 rt2800_rfcsr_write(rt2x00dev, 42, 0xdb); in rt2800_config_alc_rt6352()
4003 rt2800_rfcsr_write(rt2x00dev, 42, 0x5b); in rt2800_config_alc_rt6352()
4005 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); in rt2800_config_alc_rt6352()
4007 rt2800_vco_calibration(rt2x00dev); in rt2800_config_alc_rt6352()
4010 static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev, in rt2800_bbp_write_with_rx_chain() argument
4016 for (chain = 0; chain < rt2x00dev->default_ant.rx_chain_num; chain++) { in rt2800_bbp_write_with_rx_chain()
4017 reg = rt2800_bbp_read(rt2x00dev, 27); in rt2800_bbp_write_with_rx_chain()
4019 rt2800_bbp_write(rt2x00dev, 27, reg); in rt2800_bbp_write_with_rx_chain()
4021 rt2800_bbp_write(rt2x00dev, word, value); in rt2800_bbp_write_with_rx_chain()
4025 static void rt2800_iq_calibrate(struct rt2x00_dev *rt2x00dev, int channel) in rt2800_iq_calibrate() argument
4030 rt2800_bbp_write(rt2x00dev, 158, 0x2c); in rt2800_iq_calibrate()
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()
4044 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4047 rt2800_bbp_write(rt2x00dev, 158, 0x2d); 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()
4061 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4064 rt2800_bbp_write(rt2x00dev, 158, 0x4a); 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()
4078 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4081 rt2800_bbp_write(rt2x00dev, 158, 0x4b); 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()
4095 rt2800_bbp_write(rt2x00dev, 159, cal); in rt2800_iq_calibrate()
4100 rt2800_bbp_write(rt2x00dev, 158, 0x04); 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()
4105 rt2800_bbp_write(rt2x00dev, 158, 0x03); 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()
4111 static s8 rt2800_txpower_to_dev(struct rt2x00_dev *rt2x00dev, in rt2800_txpower_to_dev() argument
4115 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_txpower_to_dev()
4116 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_txpower_to_dev()
4122 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_txpower_to_dev()
4123 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_txpower_to_dev()
4130 static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, in rt3883_bbp_adjust() argument
4136 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); in rt3883_bbp_adjust()
4138 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt3883_bbp_adjust()
4141 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt3883_bbp_adjust()
4144 rt2800_bbp_write(rt2x00dev, 70, 0x00); in rt3883_bbp_adjust()
4147 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt3883_bbp_adjust()
4150 rt2800_bbp_write(rt2x00dev, 62, 0x1d); in rt3883_bbp_adjust()
4151 rt2800_bbp_write(rt2x00dev, 63, 0x1d); in rt3883_bbp_adjust()
4152 rt2800_bbp_write(rt2x00dev, 64, 0x1d); in rt3883_bbp_adjust()
4154 rt2800_bbp_write(rt2x00dev, 62, 0x2d); in rt3883_bbp_adjust()
4155 rt2800_bbp_write(rt2x00dev, 63, 0x2d); in rt3883_bbp_adjust()
4156 rt2800_bbp_write(rt2x00dev, 64, 0x2d); in rt3883_bbp_adjust()
4160 static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, in rt2800_config_channel() argument
4169 info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4171 info->default_power2 = rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4173 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_config_channel()
4175 rt2800_txpower_to_dev(rt2x00dev, rf->channel, in rt2800_config_channel()
4178 switch (rt2x00dev->chip.rt) { in rt2800_config_channel()
4180 rt3883_bbp_adjust(rt2x00dev, rf); in rt2800_config_channel()
4184 switch (rt2x00dev->chip.rf) { in rt2800_config_channel()
4190 rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4193 rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4196 rt2800_config_channel_rf3053(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4199 rt2800_config_channel_rf3290(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4202 rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4205 rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4215 rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4218 rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4221 rt2800_config_channel_rf7620(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4224 rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); in rt2800_config_channel()
4227 if (rt2x00_rf(rt2x00dev, RF3070) || in rt2800_config_channel()
4228 rt2x00_rf(rt2x00dev, RF3290) || in rt2800_config_channel()
4229 rt2x00_rf(rt2x00dev, RF3322) || in rt2800_config_channel()
4230 rt2x00_rf(rt2x00dev, RF5350) || in rt2800_config_channel()
4231 rt2x00_rf(rt2x00dev, RF5360) || in rt2800_config_channel()
4232 rt2x00_rf(rt2x00dev, RF5362) || in rt2800_config_channel()
4233 rt2x00_rf(rt2x00dev, RF5370) || in rt2800_config_channel()
4234 rt2x00_rf(rt2x00dev, RF5372) || in rt2800_config_channel()
4235 rt2x00_rf(rt2x00dev, RF5390) || in rt2800_config_channel()
4236 rt2x00_rf(rt2x00dev, RF5392)) { in rt2800_config_channel()
4237 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_config_channel()
4238 if (rt2x00_rf(rt2x00dev, RF3322)) { in rt2800_config_channel()
4249 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_config_channel()
4251 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_config_channel()
4253 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); in rt2800_config_channel()
4260 if (rt2x00_rt(rt2x00dev, RT3352)) { 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()
4265 rt2800_bbp_write(rt2x00dev, 27, 0x0); in rt2800_config_channel()
4266 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); in rt2800_config_channel()
4267 rt2800_bbp_write(rt2x00dev, 27, 0x20); in rt2800_config_channel()
4268 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); in rt2800_config_channel()
4269 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_config_channel()
4270 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_config_channel()
4271 } else if (rt2x00_rt(rt2x00dev, RT3593)) { in rt2800_config_channel()
4274 rt2800_bbp_write(rt2x00dev, 70, 0x00); in rt2800_config_channel()
4276 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_config_channel()
4280 rt2800_bbp_write(rt2x00dev, 105, 0x04); in rt2800_config_channel()
4282 rt2800_bbp_write(rt2x00dev, 105, 0x34); 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()
4287 rt2800_bbp_write(rt2x00dev, 77, 0x98); in rt2800_config_channel()
4288 } else if (rt2x00_rt(rt2x00dev, RT3883)) { 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()
4294 rt2800_bbp_write(rt2x00dev, 86, 0x46); in rt2800_config_channel()
4296 rt2800_bbp_write(rt2x00dev, 86, 0); 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()
4301 if (rt2x00_rt(rt2x00dev, RT6352)) in rt2800_config_channel()
4302 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_config_channel()
4304 rt2800_bbp_write(rt2x00dev, 86, 0); in rt2800_config_channel()
4308 if (!rt2x00_rt(rt2x00dev, RT5390) && in rt2800_config_channel()
4309 !rt2x00_rt(rt2x00dev, RT5392) && in rt2800_config_channel()
4310 !rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_config_channel()
4311 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { in rt2800_config_channel()
4312 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_config_channel()
4313 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_config_channel()
4314 rt2800_bbp_write(rt2x00dev, 75, 0x46); in rt2800_config_channel()
4316 if (rt2x00_rt(rt2x00dev, RT3593)) in rt2800_config_channel()
4317 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_config_channel()
4319 rt2800_bbp_write(rt2x00dev, 82, 0x84); in rt2800_config_channel()
4320 rt2800_bbp_write(rt2x00dev, 75, 0x50); in rt2800_config_channel()
4322 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_channel()
4323 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_config_channel()
4324 rt2800_bbp_write(rt2x00dev, 83, 0x8a); in rt2800_config_channel()
4328 if (rt2x00_rt(rt2x00dev, RT3572)) in rt2800_config_channel()
4329 rt2800_bbp_write(rt2x00dev, 82, 0x94); in rt2800_config_channel()
4330 else if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_channel()
4331 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_config_channel()
4332 rt2800_bbp_write(rt2x00dev, 82, 0x82); in rt2800_config_channel()
4333 else if (!rt2x00_rt(rt2x00dev, RT6352)) in rt2800_config_channel()
4334 rt2800_bbp_write(rt2x00dev, 82, 0xf2); in rt2800_config_channel()
4336 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_channel()
4337 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_config_channel()
4338 rt2800_bbp_write(rt2x00dev, 83, 0x9a); in rt2800_config_channel()
4340 if (rt2x00_has_cap_external_lna_a(rt2x00dev)) in rt2800_config_channel()
4341 rt2800_bbp_write(rt2x00dev, 75, 0x46); in rt2800_config_channel()
4343 rt2800_bbp_write(rt2x00dev, 75, 0x50); in rt2800_config_channel()
4346 reg = rt2800_register_read(rt2x00dev, TX_BAND_CFG); in rt2800_config_channel()
4350 rt2800_register_write(rt2x00dev, TX_BAND_CFG, reg); in rt2800_config_channel()
4352 if (rt2x00_rt(rt2x00dev, RT3572)) in rt2800_config_channel()
4353 rt2800_rfcsr_write(rt2x00dev, 8, 0); in rt2800_config_channel()
4355 if (rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_config_channel()
4356 tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG); in rt2800_config_channel()
4362 switch (rt2x00dev->default_ant.tx_chain_num) { in rt2800_config_channel()
4381 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) in rt2800_config_channel()
4389 switch (rt2x00dev->default_ant.rx_chain_num) { in rt2800_config_channel()
4410 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); in rt2800_config_channel()
4412 if (rt2x00_rt(rt2x00dev, RT3572)) { in rt2800_config_channel()
4413 rt2800_rfcsr_write(rt2x00dev, 8, 0x80); 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()
4421 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); in rt2800_config_channel()
4424 if (rt2x00_rt(rt2x00dev, RT3593)) { in rt2800_config_channel()
4425 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_config_channel()
4428 if (rt2x00_is_usb(rt2x00dev) || in rt2800_config_channel()
4429 rt2x00_is_pcie(rt2x00dev)) { in rt2800_config_channel()
4439 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_config_channel()
4448 } else if (rt2x00_is_pcie(rt2x00dev)) { in rt2800_config_channel()
4454 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); 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()
4462 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); in rt2800_config_channel()
4467 if (rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_config_channel()
4469 rt2800_bbp_write(rt2x00dev, 105, 0x34); in rt2800_config_channel()
4471 rt2800_bbp_write(rt2x00dev, 105, 0x04); 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()
4479 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); in rt2800_config_channel()
4484 if (rt2x00_rt(rt2x00dev, RT5592)) { in rt2800_config_channel()
4486 rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); in rt2800_config_channel()
4488 bbp = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; in rt2800_config_channel()
4489 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); in rt2800_config_channel()
4491 rt2800_iq_calibrate(rt2x00dev, rf->channel); in rt2800_config_channel()
4494 if (rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_config_channel()
4497 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? in rt2800_config_channel()
4499 rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); in rt2800_config_channel()
4502 rt2800_bbp_glrt_write(rt2x00dev, 157, bbp); in rt2800_config_channel()
4504 if (rt2x00dev->default_ant.rx_chain_num == 1) { in rt2800_config_channel()
4505 rt2800_bbp_write(rt2x00dev, 91, 0x07); in rt2800_config_channel()
4506 rt2800_bbp_write(rt2x00dev, 95, 0x1a); in rt2800_config_channel()
4507 rt2800_bbp_glrt_write(rt2x00dev, 128, 0xa0); in rt2800_config_channel()
4508 rt2800_bbp_glrt_write(rt2x00dev, 170, 0x12); in rt2800_config_channel()
4509 rt2800_bbp_glrt_write(rt2x00dev, 171, 0x10); in rt2800_config_channel()
4511 rt2800_bbp_write(rt2x00dev, 91, 0x06); in rt2800_config_channel()
4512 rt2800_bbp_write(rt2x00dev, 95, 0x9a); in rt2800_config_channel()
4513 rt2800_bbp_glrt_write(rt2x00dev, 128, 0xe0); in rt2800_config_channel()
4514 rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30); in rt2800_config_channel()
4515 rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30); in rt2800_config_channel()
4519 bbp = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; in rt2800_config_channel()
4520 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); in rt2800_config_channel()
4525 bbp = rt2800_bbp_read(rt2x00dev, 4); in rt2800_config_channel()
4527 rt2800_bbp_write(rt2x00dev, 4, bbp); in rt2800_config_channel()
4529 bbp = rt2800_bbp_read(rt2x00dev, 3); in rt2800_config_channel()
4531 rt2800_bbp_write(rt2x00dev, 3, bbp); in rt2800_config_channel()
4533 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { in rt2800_config_channel()
4535 rt2800_bbp_write(rt2x00dev, 69, 0x1a); in rt2800_config_channel()
4536 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_config_channel()
4537 rt2800_bbp_write(rt2x00dev, 73, 0x16); in rt2800_config_channel()
4539 rt2800_bbp_write(rt2x00dev, 69, 0x16); in rt2800_config_channel()
4540 rt2800_bbp_write(rt2x00dev, 70, 0x08); in rt2800_config_channel()
4541 rt2800_bbp_write(rt2x00dev, 73, 0x11); in rt2800_config_channel()
4550 reg = rt2800_register_read(rt2x00dev, CH_IDLE_STA); in rt2800_config_channel()
4551 reg = rt2800_register_read(rt2x00dev, CH_BUSY_STA); in rt2800_config_channel()
4552 reg = rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); in rt2800_config_channel()
4557 if (rt2x00_rt(rt2x00dev, RT3352) || in rt2800_config_channel()
4558 rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_config_channel()
4559 bbp = rt2800_bbp_read(rt2x00dev, 49); in rt2800_config_channel()
4561 rt2800_bbp_write(rt2x00dev, 49, bbp); in rt2800_config_channel()
4565 static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) in rt2800_get_gain_calibration_delta() argument
4576 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_get_gain_calibration_delta()
4588 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) { in rt2800_get_gain_calibration_delta()
4589 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG1); in rt2800_get_gain_calibration_delta()
4595 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG2); in rt2800_get_gain_calibration_delta()
4601 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG3); in rt2800_get_gain_calibration_delta()
4607 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG4); in rt2800_get_gain_calibration_delta()
4613 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG5); in rt2800_get_gain_calibration_delta()
4620 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A1); in rt2800_get_gain_calibration_delta()
4626 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A2); in rt2800_get_gain_calibration_delta()
4632 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A3); in rt2800_get_gain_calibration_delta()
4638 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A4); in rt2800_get_gain_calibration_delta()
4644 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A5); in rt2800_get_gain_calibration_delta()
4661 current_tssi = rt2800_bbp_read(rt2x00dev, 49); in rt2800_get_gain_calibration_delta()
4682 static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev, in rt2800_get_txpower_bw_comp() argument
4690 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_TXPOWER_DELTA); in rt2800_get_txpower_bw_comp()
4696 !test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) in rt2800_get_txpower_bw_comp()
4726 static int rt2800_get_txpower_reg_delta(struct rt2x00_dev *rt2x00dev, in rt2800_get_txpower_reg_delta() argument
4731 if (rt2x00_has_cap_power_limit(rt2x00dev)) in rt2800_get_txpower_reg_delta()
4747 static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b, in rt2800_compensate_txpower() argument
4757 if (rt2x00_rt(rt2x00dev, RT3593)) in rt2800_compensate_txpower()
4760 if (rt2x00_rt(rt2x00dev, RT3883)) in rt2800_compensate_txpower()
4763 if (rt2x00_has_cap_power_limit(rt2x00dev)) { in rt2800_compensate_txpower()
4771 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_compensate_txpower()
4777 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER); in rt2800_compensate_txpower()
4818 static void rt2800_config_txpower_rt3593(struct rt2x00_dev *rt2x00dev, in rt2800_config_txpower_rt3593() argument
4835 delta = rt2800_get_gain_calibration_delta(rt2x00dev); in rt2800_config_txpower_rt3593()
4842 if (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) in rt2800_config_txpower_rt3593()
4846 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
4851 txpower = rt2800_compensate_txpower(rt2x00dev, 1, band, power_level, in rt2800_config_txpower_rt3593()
4862 txpower = rt2800_compensate_txpower(rt2x00dev, 1, band, power_level, in rt2800_config_txpower_rt3593()
4873 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4884 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4894 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
4899 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4910 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4921 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4931 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
4936 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4947 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4958 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4969 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4979 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
4984 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
4995 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5006 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5017 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5027 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
5032 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5043 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5054 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5065 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5075 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
5080 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5091 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5102 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5112 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
5117 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5128 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5139 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5148 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5156 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, EEPROM_TXPOWER_BYRATE, in rt2800_config_txpower_rt3593()
5161 txpower = rt2800_compensate_txpower(rt2x00dev, 0, band, power_level, in rt2800_config_txpower_rt3593()
5170 rt2800_register_write(rt2x00dev, TX_PWR_CFG_0, regs[TX_PWR_CFG_0_IDX]); in rt2800_config_txpower_rt3593()
5171 rt2800_register_write(rt2x00dev, TX_PWR_CFG_1, regs[TX_PWR_CFG_1_IDX]); in rt2800_config_txpower_rt3593()
5172 rt2800_register_write(rt2x00dev, TX_PWR_CFG_2, regs[TX_PWR_CFG_2_IDX]); in rt2800_config_txpower_rt3593()
5173 rt2800_register_write(rt2x00dev, TX_PWR_CFG_3, regs[TX_PWR_CFG_3_IDX]); in rt2800_config_txpower_rt3593()
5174 rt2800_register_write(rt2x00dev, TX_PWR_CFG_4, regs[TX_PWR_CFG_4_IDX]); in rt2800_config_txpower_rt3593()
5175 rt2800_register_write(rt2x00dev, TX_PWR_CFG_5, regs[TX_PWR_CFG_5_IDX]); in rt2800_config_txpower_rt3593()
5176 rt2800_register_write(rt2x00dev, TX_PWR_CFG_6, regs[TX_PWR_CFG_6_IDX]); in rt2800_config_txpower_rt3593()
5177 rt2800_register_write(rt2x00dev, TX_PWR_CFG_7, regs[TX_PWR_CFG_7_IDX]); in rt2800_config_txpower_rt3593()
5178 rt2800_register_write(rt2x00dev, TX_PWR_CFG_8, regs[TX_PWR_CFG_8_IDX]); in rt2800_config_txpower_rt3593()
5179 rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, regs[TX_PWR_CFG_9_IDX]); in rt2800_config_txpower_rt3593()
5181 rt2800_register_write(rt2x00dev, TX_PWR_CFG_0_EXT, in rt2800_config_txpower_rt3593()
5183 rt2800_register_write(rt2x00dev, TX_PWR_CFG_1_EXT, in rt2800_config_txpower_rt3593()
5185 rt2800_register_write(rt2x00dev, TX_PWR_CFG_2_EXT, in rt2800_config_txpower_rt3593()
5187 rt2800_register_write(rt2x00dev, TX_PWR_CFG_3_EXT, in rt2800_config_txpower_rt3593()
5189 rt2800_register_write(rt2x00dev, TX_PWR_CFG_4_EXT, in rt2800_config_txpower_rt3593()
5193 rt2x00_dbg(rt2x00dev, in rt2800_config_txpower_rt3593()
5196 (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) ? in rt2800_config_txpower_rt3593()
5204 static void rt2800_config_txpower_rt6352(struct rt2x00_dev *rt2x00dev, in rt2800_config_txpower_rt6352() argument
5216 delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); in rt2800_config_txpower_rt6352()
5219 rt2x00_warn(rt2x00dev, "ignoring EEPROM HT40 power delta: %d\n", in rt2800_config_txpower_rt6352()
5237 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_config_txpower_rt6352()
5255 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_config_txpower_rt6352()
5272 if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) { in rt2800_config_txpower_rt6352()
5275 rt2800_register_write(rt2x00dev, in rt2800_config_txpower_rt6352()
5281 rt2800_register_write(rt2x00dev, in rt2800_config_txpower_rt6352()
5299 reg = rt2800_register_read(rt2x00dev, TX_PWR_CFG_1); in rt2800_config_txpower_rt6352()
5304 reg = rt2800_register_read(rt2x00dev, TX_PWR_CFG_2); in rt2800_config_txpower_rt6352()
5307 rt2800_register_write(rt2x00dev, TX_PWR_CFG_7, pwreg); in rt2800_config_txpower_rt6352()
5311 reg = rt2800_register_read(rt2x00dev, TX_PWR_CFG_3); in rt2800_config_txpower_rt6352()
5314 rt2800_register_write(rt2x00dev, TX_PWR_CFG_8, pwreg); in rt2800_config_txpower_rt6352()
5318 reg = rt2800_register_read(rt2x00dev, TX_PWR_CFG_4); in rt2800_config_txpower_rt6352()
5321 rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg); in rt2800_config_txpower_rt6352()
5323 rt2800_config_alc_rt6352(rt2x00dev, chan, power_level); in rt2800_config_txpower_rt6352()
5337 static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev, in rt2800_config_txpower_rt28xx() argument
5351 delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); in rt2800_config_txpower_rt28xx()
5360 switch (rt2x00dev->chip.rt) { in rt2800_config_txpower_rt28xx()
5368 delta += rt2800_get_gain_calibration_delta(rt2x00dev); in rt2800_config_txpower_rt28xx()
5380 delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level, in rt2800_config_txpower_rt28xx()
5400 r1 = rt2800_bbp_read(rt2x00dev, 1); in rt2800_config_txpower_rt28xx()
5402 rt2800_bbp_write(rt2x00dev, 1, r1); in rt2800_config_txpower_rt28xx()
5411 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_config_txpower_rt28xx()
5414 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_config_txpower_rt28xx()
5426 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5437 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5448 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5459 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5464 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_config_txpower_rt28xx()
5476 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5487 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5498 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5509 txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, in rt2800_config_txpower_rt28xx()
5513 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_config_txpower_rt28xx()
5520 static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, in rt2800_config_txpower() argument
5524 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_config_txpower()
5525 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_config_txpower()
5526 rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level); in rt2800_config_txpower()
5527 else if (rt2x00_rt(rt2x00dev, RT6352)) in rt2800_config_txpower()
5528 rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level); in rt2800_config_txpower()
5530 rt2800_config_txpower_rt28xx(rt2x00dev, chan, power_level); in rt2800_config_txpower()
5533 void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_gain_calibration() argument
5535 rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan, in rt2800_gain_calibration()
5536 rt2x00dev->tx_power); in rt2800_gain_calibration()
5540 void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_vco_calibration() argument
5554 tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG); in rt2800_vco_calibration()
5556 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); in rt2800_vco_calibration()
5558 switch (rt2x00dev->chip.rf) { in rt2800_vco_calibration()
5565 rfcsr = rt2800_rfcsr_read(rt2x00dev, 7); in rt2800_vco_calibration()
5567 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); in rt2800_vco_calibration()
5581 rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); in rt2800_vco_calibration()
5583 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); in rt2800_vco_calibration()
5587 rt2800_rfcsr_write(rt2x00dev, 5, 0x40); in rt2800_vco_calibration()
5588 rt2800_rfcsr_write(rt2x00dev, 4, 0x0C); in rt2800_vco_calibration()
5589 rfcsr = rt2800_rfcsr_read(rt2x00dev, 4); in rt2800_vco_calibration()
5591 rt2800_rfcsr_write(rt2x00dev, 4, rfcsr); in rt2800_vco_calibration()
5596 rt2x00dev->chip.rf); in rt2800_vco_calibration()
5603 tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG); 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()
5631 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); in rt2800_vco_calibration()
5635 static void rt2800_config_retry_limit(struct rt2x00_dev *rt2x00dev, in rt2800_config_retry_limit() argument
5640 reg = rt2800_register_read(rt2x00dev, TX_RTY_CFG); in rt2800_config_retry_limit()
5645 rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg); in rt2800_config_retry_limit()
5648 static void rt2800_config_ps(struct rt2x00_dev *rt2x00dev, in rt2800_config_ps() argument
5657 rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0); in rt2800_config_ps()
5659 reg = rt2800_register_read(rt2x00dev, AUTOWAKEUP_CFG); in rt2800_config_ps()
5664 rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); in rt2800_config_ps()
5666 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); in rt2800_config_ps()
5668 reg = rt2800_register_read(rt2x00dev, AUTOWAKEUP_CFG); in rt2800_config_ps()
5672 rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); in rt2800_config_ps()
5674 rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); in rt2800_config_ps()
5678 void rt2800_config(struct rt2x00_dev *rt2x00dev, in rt2800_config() argument
5683 rt2800_config_lna_gain(rt2x00dev, libconf); in rt2800_config()
5690 rt2800_update_survey(rt2x00dev); in rt2800_config()
5692 rt2800_config_channel(rt2x00dev, libconf->conf, in rt2800_config()
5694 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, in rt2800_config()
5698 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, in rt2800_config()
5701 rt2800_config_retry_limit(rt2x00dev, libconf); in rt2800_config()
5703 rt2800_config_ps(rt2x00dev, libconf); in rt2800_config()
5710 void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual) in rt2800_link_stats() argument
5717 reg = rt2800_register_read(rt2x00dev, RX_STA_CNT0); in rt2800_link_stats()
5722 static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) in rt2800_get_default_vgc() argument
5726 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) { in rt2800_get_default_vgc()
5727 if (rt2x00_rt(rt2x00dev, RT3070) || in rt2800_get_default_vgc()
5728 rt2x00_rt(rt2x00dev, RT3071) || in rt2800_get_default_vgc()
5729 rt2x00_rt(rt2x00dev, RT3090) || in rt2800_get_default_vgc()
5730 rt2x00_rt(rt2x00dev, RT3290) || in rt2800_get_default_vgc()
5731 rt2x00_rt(rt2x00dev, RT3390) || in rt2800_get_default_vgc()
5732 rt2x00_rt(rt2x00dev, RT3572) || in rt2800_get_default_vgc()
5733 rt2x00_rt(rt2x00dev, RT3593) || in rt2800_get_default_vgc()
5734 rt2x00_rt(rt2x00dev, RT5390) || in rt2800_get_default_vgc()
5735 rt2x00_rt(rt2x00dev, RT5392) || in rt2800_get_default_vgc()
5736 rt2x00_rt(rt2x00dev, RT5592) || in rt2800_get_default_vgc()
5737 rt2x00_rt(rt2x00dev, RT6352)) 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()
5742 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_get_default_vgc()
5743 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_get_default_vgc()
5744 vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; in rt2800_get_default_vgc()
5745 else if (rt2x00_rt(rt2x00dev, RT5592)) 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()
5758 static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, in rt2800_set_vgc() argument
5762 if (rt2x00_rt(rt2x00dev, RT3572) || in rt2800_set_vgc()
5763 rt2x00_rt(rt2x00dev, RT3593) || in rt2800_set_vgc()
5764 rt2x00_rt(rt2x00dev, RT3883) || in rt2800_set_vgc()
5765 rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_set_vgc()
5766 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, in rt2800_set_vgc()
5768 } else if (rt2x00_rt(rt2x00dev, RT5592)) { in rt2800_set_vgc()
5769 rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); in rt2800_set_vgc()
5770 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); in rt2800_set_vgc()
5772 rt2800_bbp_write(rt2x00dev, 66, vgc_level); in rt2800_set_vgc()
5780 void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual) in rt2800_reset_tuner() argument
5782 rt2800_set_vgc(rt2x00dev, qual, rt2800_get_default_vgc(rt2x00dev)); in rt2800_reset_tuner()
5786 void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, in rt2800_link_tuner() argument
5791 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) in rt2800_link_tuner()
5799 vgc = rt2800_get_default_vgc(rt2x00dev); in rt2800_link_tuner()
5801 switch (rt2x00dev->chip.rt) { in rt2800_link_tuner()
5805 if (rt2x00dev->curr_band == NL80211_BAND_2GHZ) in rt2800_link_tuner()
5828 rt2800_set_vgc(rt2x00dev, qual, vgc); in rt2800_link_tuner()
5835 static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) in rt2800_init_registers() argument
5837 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_init_registers()
5844 rt2800_disable_wpdma(rt2x00dev); in rt2800_init_registers()
5846 ret = rt2800_drv_init_registers(rt2x00dev); in rt2800_init_registers()
5850 if (rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_init_registers()
5851 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x01); in rt2800_init_registers()
5853 bbp = rt2800_bbp_read(rt2x00dev, 21); in rt2800_init_registers()
5855 rt2800_bbp_write(rt2x00dev, 21, bbp); in rt2800_init_registers()
5856 bbp = rt2800_bbp_read(rt2x00dev, 21); in rt2800_init_registers()
5858 rt2800_bbp_write(rt2x00dev, 21, bbp); in rt2800_init_registers()
5860 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); in rt2800_init_registers()
5863 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); in rt2800_init_registers()
5864 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); in rt2800_init_registers()
5866 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); in rt2800_init_registers()
5868 reg = rt2800_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800_init_registers()
5875 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800_init_registers()
5877 rt2800_config_filter(rt2x00dev, FIF_ALLMULTI); in rt2800_init_registers()
5879 reg = rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG); in rt2800_init_registers()
5882 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); in rt2800_init_registers()
5884 if (rt2x00_rt(rt2x00dev, RT3290)) { in rt2800_init_registers()
5885 reg = rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL); in rt2800_init_registers()
5888 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); in rt2800_init_registers()
5891 reg = rt2800_register_read(rt2x00dev, CMB_CTRL); in rt2800_init_registers()
5895 rt2800_register_write(rt2x00dev, CMB_CTRL, reg); in rt2800_init_registers()
5898 reg = rt2800_register_read(rt2x00dev, OSC_CTRL); in rt2800_init_registers()
5902 rt2800_register_write(rt2x00dev, OSC_CTRL, reg); in rt2800_init_registers()
5904 reg = rt2800_register_read(rt2x00dev, COEX_CFG0); in rt2800_init_registers()
5906 rt2800_register_write(rt2x00dev, COEX_CFG0, reg); in rt2800_init_registers()
5908 reg = rt2800_register_read(rt2x00dev, COEX_CFG2); in rt2800_init_registers()
5913 rt2800_register_write(rt2x00dev, COEX_CFG2, reg); in rt2800_init_registers()
5915 reg = rt2800_register_read(rt2x00dev, PLL_CTRL); in rt2800_init_registers()
5917 rt2800_register_write(rt2x00dev, PLL_CTRL, reg); in rt2800_init_registers()
5920 if (rt2x00_rt(rt2x00dev, RT3071) || in rt2800_init_registers()
5921 rt2x00_rt(rt2x00dev, RT3090) || in rt2800_init_registers()
5922 rt2x00_rt(rt2x00dev, RT3290) || in rt2800_init_registers()
5923 rt2x00_rt(rt2x00dev, RT3390)) { in rt2800_init_registers()
5925 if (rt2x00_rt(rt2x00dev, RT3290)) in rt2800_init_registers()
5926 rt2800_register_write(rt2x00dev, TX_SW_CFG0, in rt2800_init_registers()
5929 rt2800_register_write(rt2x00dev, TX_SW_CFG0, in rt2800_init_registers()
5932 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5933 if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || in rt2800_init_registers()
5934 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || in rt2800_init_registers()
5935 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { in rt2800_init_registers()
5936 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_registers()
5938 rt2800_register_write(rt2x00dev, TX_SW_CFG2, in rt2800_init_registers()
5941 rt2800_register_write(rt2x00dev, TX_SW_CFG2, in rt2800_init_registers()
5944 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
5946 } else if (rt2x00_rt(rt2x00dev, RT3070)) { in rt2800_init_registers()
5947 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); in rt2800_init_registers()
5949 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { in rt2800_init_registers()
5950 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5951 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x0000002c); in rt2800_init_registers()
5953 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); in rt2800_init_registers()
5954 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
5956 } else if (rt2800_is_305x_soc(rt2x00dev)) { in rt2800_init_registers()
5957 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); in rt2800_init_registers()
5958 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5959 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000030); in rt2800_init_registers()
5960 } else if (rt2x00_rt(rt2x00dev, RT3352)) { in rt2800_init_registers()
5961 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); in rt2800_init_registers()
5962 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); in rt2800_init_registers()
5963 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
5964 } else if (rt2x00_rt(rt2x00dev, RT3572)) { in rt2800_init_registers()
5965 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); in rt2800_init_registers()
5966 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); in rt2800_init_registers()
5967 } else if (rt2x00_rt(rt2x00dev, RT3593)) { in rt2800_init_registers()
5968 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); in rt2800_init_registers()
5969 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5970 if (rt2x00_rt_rev_lt(rt2x00dev, RT3593, REV_RT3593E)) { in rt2800_init_registers()
5971 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_registers()
5974 rt2800_register_write(rt2x00dev, TX_SW_CFG2, in rt2800_init_registers()
5977 rt2800_register_write(rt2x00dev, TX_SW_CFG2, in rt2800_init_registers()
5980 rt2800_register_write(rt2x00dev, TX_SW_CFG2, in rt2800_init_registers()
5983 } else if (rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_init_registers()
5984 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); in rt2800_init_registers()
5985 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5986 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000); in rt2800_init_registers()
5987 rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); in rt2800_init_registers()
5988 rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); in rt2800_init_registers()
5989 } else if (rt2x00_rt(rt2x00dev, RT5390) || in rt2800_init_registers()
5990 rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_init_registers()
5991 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); in rt2800_init_registers()
5992 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); in rt2800_init_registers()
5993 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
5994 } else if (rt2x00_rt(rt2x00dev, RT5592)) { in rt2800_init_registers()
5995 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); in rt2800_init_registers()
5996 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); in rt2800_init_registers()
5997 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
5998 } else if (rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_init_registers()
5999 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); in rt2800_init_registers()
6000 } else if (rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_init_registers()
6001 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); in rt2800_init_registers()
6002 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); in rt2800_init_registers()
6003 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); in rt2800_init_registers()
6004 rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); in rt2800_init_registers()
6005 rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); in rt2800_init_registers()
6006 rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); in rt2800_init_registers()
6007 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C); in rt2800_init_registers()
6008 rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C); in rt2800_init_registers()
6009 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, in rt2800_init_registers()
6011 rt2800_register_write(rt2x00dev, TX1_RF_GAIN_CORRECT, in rt2800_init_registers()
6013 reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); in rt2800_init_registers()
6015 rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); in rt2800_init_registers()
6017 rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M1S, 0x77754433); in rt2800_init_registers()
6018 rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M2S, 0x77765543); in rt2800_init_registers()
6019 rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M1S, 0x77765544); in rt2800_init_registers()
6020 rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M2S, 0x77765544); in rt2800_init_registers()
6022 rt2800_register_write(rt2x00dev, HT_FBK_TO_LEGACY, 0x1010); in rt2800_init_registers()
6025 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); in rt2800_init_registers()
6026 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); in rt2800_init_registers()
6029 reg = rt2800_register_read(rt2x00dev, TX_LINK_CFG); in rt2800_init_registers()
6038 rt2800_register_write(rt2x00dev, TX_LINK_CFG, reg); in rt2800_init_registers()
6040 reg = rt2800_register_read(rt2x00dev, TX_TIMEOUT_CFG); in rt2800_init_registers()
6044 rt2800_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg); in rt2800_init_registers()
6046 reg = rt2800_register_read(rt2x00dev, MAX_LEN_CFG); in rt2800_init_registers()
6048 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_init_registers()
6050 } else if (rt2x00_rt_rev_gte(rt2x00dev, RT2872, REV_RT2872E) || in rt2800_init_registers()
6051 rt2x00_rt(rt2x00dev, RT2883) || in rt2800_init_registers()
6052 rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070E)) { in rt2800_init_registers()
6060 rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg); in rt2800_init_registers()
6062 reg = rt2800_register_read(rt2x00dev, LED_CFG); in rt2800_init_registers()
6070 rt2800_register_write(rt2x00dev, LED_CFG, reg); in rt2800_init_registers()
6072 rt2800_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f); in rt2800_init_registers()
6074 reg = rt2800_register_read(rt2x00dev, TX_RTY_CFG); in rt2800_init_registers()
6081 rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg); in rt2800_init_registers()
6083 reg = rt2800_register_read(rt2x00dev, AUTO_RSP_CFG); in rt2800_init_registers()
6091 rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg); in rt2800_init_registers()
6093 reg = rt2800_register_read(rt2x00dev, CCK_PROT_CFG); in rt2800_init_registers()
6104 rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); in rt2800_init_registers()
6106 reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); in rt2800_init_registers()
6117 rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); in rt2800_init_registers()
6119 reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); in rt2800_init_registers()
6130 rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); in rt2800_init_registers()
6132 reg = rt2800_register_read(rt2x00dev, MM40_PROT_CFG); in rt2800_init_registers()
6143 rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); in rt2800_init_registers()
6145 reg = rt2800_register_read(rt2x00dev, GF20_PROT_CFG); in rt2800_init_registers()
6156 rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); in rt2800_init_registers()
6158 reg = rt2800_register_read(rt2x00dev, GF40_PROT_CFG); in rt2800_init_registers()
6169 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); in rt2800_init_registers()
6171 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_init_registers()
6172 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); in rt2800_init_registers()
6174 reg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); in rt2800_init_registers()
6184 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); in rt2800_init_registers()
6191 reg = rt2800_register_read(rt2x00dev, TXOP_CTRL_CFG); in rt2800_init_registers()
6202 rt2800_register_write(rt2x00dev, TXOP_CTRL_CFG, reg); in rt2800_init_registers()
6204 reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; in rt2800_init_registers()
6205 rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); in rt2800_init_registers()
6207 if (rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_init_registers()
6208 rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); in rt2800_init_registers()
6209 rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); in rt2800_init_registers()
6212 reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); in rt2800_init_registers()
6217 rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); in rt2800_init_registers()
6219 rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); in rt2800_init_registers()
6228 reg = rt2800_register_read(rt2x00dev, XIFS_TIME_CFG); in rt2800_init_registers()
6234 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); in rt2800_init_registers()
6236 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); in rt2800_init_registers()
6242 rt2800_register_write(rt2x00dev, SHARED_KEY_MODE_ENTRY(i), 0); in rt2800_init_registers()
6245 rt2800_config_wcid(rt2x00dev, NULL, i); in rt2800_init_registers()
6246 rt2800_delete_wcid_attr(rt2x00dev, i); in rt2800_init_registers()
6254 if (!test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags)) in rt2800_init_registers()
6256 rt2800_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0); in rt2800_init_registers()
6262 rt2800_clear_beacon_register(rt2x00dev, i); in rt2800_init_registers()
6264 if (rt2x00_is_usb(rt2x00dev)) { in rt2800_init_registers()
6265 reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); in rt2800_init_registers()
6267 rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); in rt2800_init_registers()
6268 } else if (rt2x00_is_pcie(rt2x00dev)) { in rt2800_init_registers()
6269 reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); in rt2800_init_registers()
6271 rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); in rt2800_init_registers()
6272 } else if (rt2x00_is_soc(rt2x00dev)) { in rt2800_init_registers()
6290 reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); in rt2800_init_registers()
6292 rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); in rt2800_init_registers()
6295 reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); in rt2800_init_registers()
6304 rt2800_register_write(rt2x00dev, HT_FBK_CFG0, reg); in rt2800_init_registers()
6306 reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG1); in rt2800_init_registers()
6315 rt2800_register_write(rt2x00dev, HT_FBK_CFG1, reg); in rt2800_init_registers()
6317 reg = rt2800_register_read(rt2x00dev, LG_FBK_CFG0); in rt2800_init_registers()
6326 rt2800_register_write(rt2x00dev, LG_FBK_CFG0, reg); in rt2800_init_registers()
6328 reg = rt2800_register_read(rt2x00dev, LG_FBK_CFG1); in rt2800_init_registers()
6333 rt2800_register_write(rt2x00dev, LG_FBK_CFG1, reg); in rt2800_init_registers()
6338 reg = rt2800_register_read(rt2x00dev, AMPDU_BA_WINSIZE); in rt2800_init_registers()
6341 rt2800_register_write(rt2x00dev, AMPDU_BA_WINSIZE, reg); in rt2800_init_registers()
6348 reg = rt2800_register_read(rt2x00dev, RX_STA_CNT0); in rt2800_init_registers()
6349 reg = rt2800_register_read(rt2x00dev, RX_STA_CNT1); in rt2800_init_registers()
6350 reg = rt2800_register_read(rt2x00dev, RX_STA_CNT2); in rt2800_init_registers()
6351 reg = rt2800_register_read(rt2x00dev, TX_STA_CNT0); in rt2800_init_registers()
6352 reg = rt2800_register_read(rt2x00dev, TX_STA_CNT1); in rt2800_init_registers()
6353 reg = rt2800_register_read(rt2x00dev, TX_STA_CNT2); in rt2800_init_registers()
6358 reg = rt2800_register_read(rt2x00dev, INT_TIMER_CFG); in rt2800_init_registers()
6360 rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); in rt2800_init_registers()
6365 reg = rt2800_register_read(rt2x00dev, CH_TIME_CFG); in rt2800_init_registers()
6371 rt2800_register_write(rt2x00dev, CH_TIME_CFG, reg); in rt2800_init_registers()
6377 static void rt2800_bbp4_mac_if_ctrl(struct rt2x00_dev *rt2x00dev) in rt2800_bbp4_mac_if_ctrl() argument
6381 value = rt2800_bbp_read(rt2x00dev, 4); in rt2800_bbp4_mac_if_ctrl()
6383 rt2800_bbp_write(rt2x00dev, 4, value); in rt2800_bbp4_mac_if_ctrl()
6386 static void rt2800_init_freq_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_init_freq_calibration() argument
6388 rt2800_bbp_write(rt2x00dev, 142, 1); in rt2800_init_freq_calibration()
6389 rt2800_bbp_write(rt2x00dev, 143, 57); in rt2800_init_freq_calibration()
6392 static void rt2800_init_bbp_5592_glrt(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_5592_glrt() argument
6408 rt2800_bbp_write(rt2x00dev, 195, 128 + i); in rt2800_init_bbp_5592_glrt()
6409 rt2800_bbp_write(rt2x00dev, 196, glrt_table[i]); in rt2800_init_bbp_5592_glrt()
6413 static void rt2800_init_bbp_early(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_early() argument
6415 rt2800_bbp_write(rt2x00dev, 65, 0x2C); in rt2800_init_bbp_early()
6416 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_early()
6417 rt2800_bbp_write(rt2x00dev, 68, 0x0B); in rt2800_init_bbp_early()
6418 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_early()
6419 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_early()
6420 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_early()
6421 rt2800_bbp_write(rt2x00dev, 81, 0x37); in rt2800_init_bbp_early()
6422 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_early()
6423 rt2800_bbp_write(rt2x00dev, 83, 0x6A); in rt2800_init_bbp_early()
6424 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_early()
6425 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_early()
6426 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_early()
6427 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_early()
6428 rt2800_bbp_write(rt2x00dev, 103, 0x00); in rt2800_init_bbp_early()
6429 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_bbp_early()
6430 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_early()
6433 static void rt2800_disable_unused_dac_adc(struct rt2x00_dev *rt2x00dev) in rt2800_disable_unused_dac_adc() argument
6438 value = rt2800_bbp_read(rt2x00dev, 138); in rt2800_disable_unused_dac_adc()
6439 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); in rt2800_disable_unused_dac_adc()
6444 rt2800_bbp_write(rt2x00dev, 138, value); in rt2800_disable_unused_dac_adc()
6447 static void rt2800_init_bbp_305x_soc(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_305x_soc() argument
6449 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_305x_soc()
6451 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_305x_soc()
6452 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_305x_soc()
6454 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_305x_soc()
6455 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_305x_soc()
6457 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_305x_soc()
6459 rt2800_bbp_write(rt2x00dev, 78, 0x0e); in rt2800_init_bbp_305x_soc()
6460 rt2800_bbp_write(rt2x00dev, 80, 0x08); in rt2800_init_bbp_305x_soc()
6462 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_305x_soc()
6464 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_305x_soc()
6466 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_305x_soc()
6468 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_305x_soc()
6470 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_305x_soc()
6472 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_305x_soc()
6474 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_305x_soc()
6476 rt2800_bbp_write(rt2x00dev, 105, 0x01); in rt2800_init_bbp_305x_soc()
6478 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_305x_soc()
6481 static void rt2800_init_bbp_28xx(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_28xx() argument
6483 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_28xx()
6484 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_28xx()
6486 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { in rt2800_init_bbp_28xx()
6487 rt2800_bbp_write(rt2x00dev, 69, 0x16); in rt2800_init_bbp_28xx()
6488 rt2800_bbp_write(rt2x00dev, 73, 0x12); in rt2800_init_bbp_28xx()
6490 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_28xx()
6491 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_28xx()
6494 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_28xx()
6496 rt2800_bbp_write(rt2x00dev, 81, 0x37); in rt2800_init_bbp_28xx()
6498 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_28xx()
6500 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_28xx()
6502 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) in rt2800_init_bbp_28xx()
6503 rt2800_bbp_write(rt2x00dev, 84, 0x19); in rt2800_init_bbp_28xx()
6505 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_28xx()
6507 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_28xx()
6509 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_28xx()
6511 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_28xx()
6513 rt2800_bbp_write(rt2x00dev, 103, 0x00); in rt2800_init_bbp_28xx()
6515 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_bbp_28xx()
6517 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_28xx()
6520 static void rt2800_init_bbp_30xx(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_30xx() argument
6522 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_30xx()
6523 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_30xx()
6525 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_30xx()
6526 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_30xx()
6528 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_30xx()
6530 rt2800_bbp_write(rt2x00dev, 79, 0x13); in rt2800_init_bbp_30xx()
6531 rt2800_bbp_write(rt2x00dev, 80, 0x05); in rt2800_init_bbp_30xx()
6532 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_30xx()
6534 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_30xx()
6536 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_30xx()
6538 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_30xx()
6540 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_30xx()
6542 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_30xx()
6544 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_30xx()
6546 if (rt2x00_rt_rev_gte(rt2x00dev, RT3070, REV_RT3070F) || in rt2800_init_bbp_30xx()
6547 rt2x00_rt_rev_gte(rt2x00dev, RT3071, REV_RT3071E) || in rt2800_init_bbp_30xx()
6548 rt2x00_rt_rev_gte(rt2x00dev, RT3090, REV_RT3090E)) in rt2800_init_bbp_30xx()
6549 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_30xx()
6551 rt2800_bbp_write(rt2x00dev, 103, 0x00); in rt2800_init_bbp_30xx()
6553 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_bbp_30xx()
6555 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_30xx()
6557 if (rt2x00_rt(rt2x00dev, RT3071) || in rt2800_init_bbp_30xx()
6558 rt2x00_rt(rt2x00dev, RT3090)) in rt2800_init_bbp_30xx()
6559 rt2800_disable_unused_dac_adc(rt2x00dev); in rt2800_init_bbp_30xx()
6562 static void rt2800_init_bbp_3290(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3290() argument
6566 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_3290()
6568 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_3290()
6570 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_3290()
6571 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_3290()
6573 rt2800_bbp_write(rt2x00dev, 68, 0x0b); in rt2800_init_bbp_3290()
6575 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_3290()
6576 rt2800_bbp_write(rt2x00dev, 73, 0x13); in rt2800_init_bbp_3290()
6577 rt2800_bbp_write(rt2x00dev, 75, 0x46); in rt2800_init_bbp_3290()
6578 rt2800_bbp_write(rt2x00dev, 76, 0x28); in rt2800_init_bbp_3290()
6580 rt2800_bbp_write(rt2x00dev, 77, 0x58); in rt2800_init_bbp_3290()
6582 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_3290()
6584 rt2800_bbp_write(rt2x00dev, 74, 0x0b); in rt2800_init_bbp_3290()
6585 rt2800_bbp_write(rt2x00dev, 79, 0x18); in rt2800_init_bbp_3290()
6586 rt2800_bbp_write(rt2x00dev, 80, 0x09); in rt2800_init_bbp_3290()
6587 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_3290()
6589 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_3290()
6591 rt2800_bbp_write(rt2x00dev, 83, 0x7a); in rt2800_init_bbp_3290()
6593 rt2800_bbp_write(rt2x00dev, 84, 0x9a); in rt2800_init_bbp_3290()
6595 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_init_bbp_3290()
6597 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_3290()
6599 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_3290()
6601 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3290()
6603 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_3290()
6605 rt2800_bbp_write(rt2x00dev, 105, 0x1c); in rt2800_init_bbp_3290()
6607 rt2800_bbp_write(rt2x00dev, 106, 0x03); in rt2800_init_bbp_3290()
6609 rt2800_bbp_write(rt2x00dev, 128, 0x12); in rt2800_init_bbp_3290()
6611 rt2800_bbp_write(rt2x00dev, 67, 0x24); in rt2800_init_bbp_3290()
6612 rt2800_bbp_write(rt2x00dev, 143, 0x04); in rt2800_init_bbp_3290()
6613 rt2800_bbp_write(rt2x00dev, 142, 0x99); in rt2800_init_bbp_3290()
6614 rt2800_bbp_write(rt2x00dev, 150, 0x30); in rt2800_init_bbp_3290()
6615 rt2800_bbp_write(rt2x00dev, 151, 0x2e); in rt2800_init_bbp_3290()
6616 rt2800_bbp_write(rt2x00dev, 152, 0x20); in rt2800_init_bbp_3290()
6617 rt2800_bbp_write(rt2x00dev, 153, 0x34); in rt2800_init_bbp_3290()
6618 rt2800_bbp_write(rt2x00dev, 154, 0x40); in rt2800_init_bbp_3290()
6619 rt2800_bbp_write(rt2x00dev, 155, 0x3b); in rt2800_init_bbp_3290()
6620 rt2800_bbp_write(rt2x00dev, 253, 0x04); in rt2800_init_bbp_3290()
6622 value = rt2800_bbp_read(rt2x00dev, 47); in rt2800_init_bbp_3290()
6624 rt2800_bbp_write(rt2x00dev, 47, value); in rt2800_init_bbp_3290()
6627 value = rt2800_bbp_read(rt2x00dev, 3); in rt2800_init_bbp_3290()
6630 rt2800_bbp_write(rt2x00dev, 3, value); in rt2800_init_bbp_3290()
6633 static void rt2800_init_bbp_3352(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3352() argument
6635 rt2800_bbp_write(rt2x00dev, 3, 0x00); in rt2800_init_bbp_3352()
6636 rt2800_bbp_write(rt2x00dev, 4, 0x50); in rt2800_init_bbp_3352()
6638 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_3352()
6640 rt2800_bbp_write(rt2x00dev, 47, 0x48); in rt2800_init_bbp_3352()
6642 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_3352()
6643 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_3352()
6645 rt2800_bbp_write(rt2x00dev, 68, 0x0b); in rt2800_init_bbp_3352()
6647 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_3352()
6648 rt2800_bbp_write(rt2x00dev, 73, 0x13); in rt2800_init_bbp_3352()
6649 rt2800_bbp_write(rt2x00dev, 75, 0x46); in rt2800_init_bbp_3352()
6650 rt2800_bbp_write(rt2x00dev, 76, 0x28); in rt2800_init_bbp_3352()
6652 rt2800_bbp_write(rt2x00dev, 77, 0x59); in rt2800_init_bbp_3352()
6654 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_3352()
6656 rt2800_bbp_write(rt2x00dev, 78, 0x0e); in rt2800_init_bbp_3352()
6657 rt2800_bbp_write(rt2x00dev, 80, 0x08); in rt2800_init_bbp_3352()
6658 rt2800_bbp_write(rt2x00dev, 81, 0x37); in rt2800_init_bbp_3352()
6660 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_3352()
6662 if (rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_init_bbp_3352()
6663 rt2800_bbp_write(rt2x00dev, 83, 0x7a); in rt2800_init_bbp_3352()
6664 rt2800_bbp_write(rt2x00dev, 84, 0x9a); in rt2800_init_bbp_3352()
6666 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_3352()
6667 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_3352()
6670 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_init_bbp_3352()
6672 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt2800_init_bbp_3352()
6674 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_3352()
6676 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_3352()
6678 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3352()
6680 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_3352()
6682 if (rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_init_bbp_3352()
6683 rt2800_bbp_write(rt2x00dev, 105, 0x3c); in rt2800_init_bbp_3352()
6684 rt2800_bbp_write(rt2x00dev, 106, 0x03); in rt2800_init_bbp_3352()
6686 rt2800_bbp_write(rt2x00dev, 105, 0x34); in rt2800_init_bbp_3352()
6687 rt2800_bbp_write(rt2x00dev, 106, 0x05); in rt2800_init_bbp_3352()
6690 rt2800_bbp_write(rt2x00dev, 120, 0x50); in rt2800_init_bbp_3352()
6692 rt2800_bbp_write(rt2x00dev, 137, 0x0f); in rt2800_init_bbp_3352()
6694 rt2800_bbp_write(rt2x00dev, 163, 0xbd); in rt2800_init_bbp_3352()
6696 rt2800_bbp_write(rt2x00dev, 179, 0x02); in rt2800_init_bbp_3352()
6697 rt2800_bbp_write(rt2x00dev, 180, 0x00); in rt2800_init_bbp_3352()
6698 rt2800_bbp_write(rt2x00dev, 182, 0x40); in rt2800_init_bbp_3352()
6699 rt2800_bbp_write(rt2x00dev, 180, 0x01); in rt2800_init_bbp_3352()
6700 rt2800_bbp_write(rt2x00dev, 182, 0x9c); in rt2800_init_bbp_3352()
6701 rt2800_bbp_write(rt2x00dev, 179, 0x00); in rt2800_init_bbp_3352()
6703 rt2800_bbp_write(rt2x00dev, 142, 0x04); in rt2800_init_bbp_3352()
6704 rt2800_bbp_write(rt2x00dev, 143, 0x3b); in rt2800_init_bbp_3352()
6705 rt2800_bbp_write(rt2x00dev, 142, 0x06); in rt2800_init_bbp_3352()
6706 rt2800_bbp_write(rt2x00dev, 143, 0xa0); in rt2800_init_bbp_3352()
6707 rt2800_bbp_write(rt2x00dev, 142, 0x07); in rt2800_init_bbp_3352()
6708 rt2800_bbp_write(rt2x00dev, 143, 0xa1); in rt2800_init_bbp_3352()
6709 rt2800_bbp_write(rt2x00dev, 142, 0x08); in rt2800_init_bbp_3352()
6710 rt2800_bbp_write(rt2x00dev, 143, 0xa2); in rt2800_init_bbp_3352()
6712 rt2800_bbp_write(rt2x00dev, 148, 0xc8); in rt2800_init_bbp_3352()
6714 if (rt2x00_rt(rt2x00dev, RT5350)) { in rt2800_init_bbp_3352()
6716 rt2800_bbp_write(rt2x00dev, 150, 0x40); in rt2800_init_bbp_3352()
6718 rt2800_bbp_write(rt2x00dev, 151, 0x30); in rt2800_init_bbp_3352()
6719 rt2800_bbp_write(rt2x00dev, 152, 0xa3); in rt2800_init_bbp_3352()
6721 rt2800_bbp_write(rt2x00dev, 154, 0); in rt2800_init_bbp_3352()
6725 static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3390() argument
6727 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_3390()
6728 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_3390()
6730 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_3390()
6731 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_3390()
6733 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_3390()
6735 rt2800_bbp_write(rt2x00dev, 79, 0x13); in rt2800_init_bbp_3390()
6736 rt2800_bbp_write(rt2x00dev, 80, 0x05); in rt2800_init_bbp_3390()
6737 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_3390()
6739 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_3390()
6741 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_3390()
6743 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_3390()
6745 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_3390()
6747 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_3390()
6749 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_3390()
6751 if (rt2x00_rt_rev_gte(rt2x00dev, RT3390, REV_RT3390E)) in rt2800_init_bbp_3390()
6752 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3390()
6754 rt2800_bbp_write(rt2x00dev, 103, 0x00); in rt2800_init_bbp_3390()
6756 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_bbp_3390()
6758 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_3390()
6760 rt2800_disable_unused_dac_adc(rt2x00dev); in rt2800_init_bbp_3390()
6763 static void rt2800_init_bbp_3572(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3572() argument
6765 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_3572()
6767 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_3572()
6768 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_3572()
6770 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_3572()
6771 rt2800_bbp_write(rt2x00dev, 73, 0x10); in rt2800_init_bbp_3572()
6773 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_3572()
6775 rt2800_bbp_write(rt2x00dev, 79, 0x13); in rt2800_init_bbp_3572()
6776 rt2800_bbp_write(rt2x00dev, 80, 0x05); in rt2800_init_bbp_3572()
6777 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_3572()
6779 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_3572()
6781 rt2800_bbp_write(rt2x00dev, 83, 0x6a); in rt2800_init_bbp_3572()
6783 rt2800_bbp_write(rt2x00dev, 84, 0x99); in rt2800_init_bbp_3572()
6785 rt2800_bbp_write(rt2x00dev, 86, 0x00); in rt2800_init_bbp_3572()
6787 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_3572()
6789 rt2800_bbp_write(rt2x00dev, 92, 0x00); in rt2800_init_bbp_3572()
6791 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3572()
6793 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_bbp_3572()
6795 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_3572()
6797 rt2800_disable_unused_dac_adc(rt2x00dev); in rt2800_init_bbp_3572()
6800 static void rt2800_init_bbp_3593(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3593() argument
6802 rt2800_init_bbp_early(rt2x00dev); in rt2800_init_bbp_3593()
6804 rt2800_bbp_write(rt2x00dev, 79, 0x13); in rt2800_init_bbp_3593()
6805 rt2800_bbp_write(rt2x00dev, 80, 0x05); in rt2800_init_bbp_3593()
6806 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_3593()
6807 rt2800_bbp_write(rt2x00dev, 137, 0x0f); in rt2800_init_bbp_3593()
6809 rt2800_bbp_write(rt2x00dev, 84, 0x19); in rt2800_init_bbp_3593()
6812 if (rt2x00_rt_rev_gte(rt2x00dev, RT3593, REV_RT3593E)) in rt2800_init_bbp_3593()
6813 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3593()
6816 static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_3883() argument
6818 rt2800_init_bbp_early(rt2x00dev); in rt2800_init_bbp_3883()
6820 rt2800_bbp_write(rt2x00dev, 4, 0x50); in rt2800_init_bbp_3883()
6821 rt2800_bbp_write(rt2x00dev, 47, 0x48); in rt2800_init_bbp_3883()
6823 rt2800_bbp_write(rt2x00dev, 86, 0x46); in rt2800_init_bbp_3883()
6824 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt2800_init_bbp_3883()
6826 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_3883()
6828 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_3883()
6829 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_3883()
6830 rt2800_bbp_write(rt2x00dev, 105, 0x34); in rt2800_init_bbp_3883()
6831 rt2800_bbp_write(rt2x00dev, 106, 0x12); in rt2800_init_bbp_3883()
6832 rt2800_bbp_write(rt2x00dev, 120, 0x50); in rt2800_init_bbp_3883()
6833 rt2800_bbp_write(rt2x00dev, 137, 0x0f); in rt2800_init_bbp_3883()
6834 rt2800_bbp_write(rt2x00dev, 163, 0x9d); in rt2800_init_bbp_3883()
6837 rt2800_bbp_write(rt2x00dev, 179, 0x02); in rt2800_init_bbp_3883()
6838 rt2800_bbp_write(rt2x00dev, 180, 0x00); in rt2800_init_bbp_3883()
6839 rt2800_bbp_write(rt2x00dev, 182, 0x40); in rt2800_init_bbp_3883()
6840 rt2800_bbp_write(rt2x00dev, 180, 0x01); in rt2800_init_bbp_3883()
6841 rt2800_bbp_write(rt2x00dev, 182, 0x9c); in rt2800_init_bbp_3883()
6843 rt2800_bbp_write(rt2x00dev, 179, 0x00); in rt2800_init_bbp_3883()
6846 rt2800_bbp_write(rt2x00dev, 142, 0x04); in rt2800_init_bbp_3883()
6847 rt2800_bbp_write(rt2x00dev, 143, 0x3b); in rt2800_init_bbp_3883()
6848 rt2800_bbp_write(rt2x00dev, 142, 0x06); in rt2800_init_bbp_3883()
6849 rt2800_bbp_write(rt2x00dev, 143, 0xa0); in rt2800_init_bbp_3883()
6850 rt2800_bbp_write(rt2x00dev, 142, 0x07); in rt2800_init_bbp_3883()
6851 rt2800_bbp_write(rt2x00dev, 143, 0xa1); in rt2800_init_bbp_3883()
6852 rt2800_bbp_write(rt2x00dev, 142, 0x08); in rt2800_init_bbp_3883()
6853 rt2800_bbp_write(rt2x00dev, 143, 0xa2); in rt2800_init_bbp_3883()
6854 rt2800_bbp_write(rt2x00dev, 148, 0xc8); in rt2800_init_bbp_3883()
6857 static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_53xx() argument
6863 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_53xx()
6865 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_53xx()
6867 rt2800_bbp_write(rt2x00dev, 65, 0x2c); in rt2800_init_bbp_53xx()
6868 rt2800_bbp_write(rt2x00dev, 66, 0x38); in rt2800_init_bbp_53xx()
6870 rt2800_bbp_write(rt2x00dev, 68, 0x0b); in rt2800_init_bbp_53xx()
6872 rt2800_bbp_write(rt2x00dev, 69, 0x12); in rt2800_init_bbp_53xx()
6873 rt2800_bbp_write(rt2x00dev, 73, 0x13); in rt2800_init_bbp_53xx()
6874 rt2800_bbp_write(rt2x00dev, 75, 0x46); in rt2800_init_bbp_53xx()
6875 rt2800_bbp_write(rt2x00dev, 76, 0x28); in rt2800_init_bbp_53xx()
6877 rt2800_bbp_write(rt2x00dev, 77, 0x59); in rt2800_init_bbp_53xx()
6879 rt2800_bbp_write(rt2x00dev, 70, 0x0a); in rt2800_init_bbp_53xx()
6881 rt2800_bbp_write(rt2x00dev, 79, 0x13); in rt2800_init_bbp_53xx()
6882 rt2800_bbp_write(rt2x00dev, 80, 0x05); in rt2800_init_bbp_53xx()
6883 rt2800_bbp_write(rt2x00dev, 81, 0x33); in rt2800_init_bbp_53xx()
6885 rt2800_bbp_write(rt2x00dev, 82, 0x62); in rt2800_init_bbp_53xx()
6887 rt2800_bbp_write(rt2x00dev, 83, 0x7a); in rt2800_init_bbp_53xx()
6889 rt2800_bbp_write(rt2x00dev, 84, 0x9a); in rt2800_init_bbp_53xx()
6891 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_init_bbp_53xx()
6893 if (rt2x00_rt(rt2x00dev, RT5392)) in rt2800_init_bbp_53xx()
6894 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt2800_init_bbp_53xx()
6896 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_53xx()
6898 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_53xx()
6900 if (rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_init_bbp_53xx()
6901 rt2800_bbp_write(rt2x00dev, 95, 0x9a); in rt2800_init_bbp_53xx()
6902 rt2800_bbp_write(rt2x00dev, 98, 0x12); in rt2800_init_bbp_53xx()
6905 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_53xx()
6907 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_53xx()
6909 rt2800_bbp_write(rt2x00dev, 105, 0x3c); in rt2800_init_bbp_53xx()
6911 if (rt2x00_rt(rt2x00dev, RT5390)) in rt2800_init_bbp_53xx()
6912 rt2800_bbp_write(rt2x00dev, 106, 0x03); in rt2800_init_bbp_53xx()
6913 else if (rt2x00_rt(rt2x00dev, RT5392)) in rt2800_init_bbp_53xx()
6914 rt2800_bbp_write(rt2x00dev, 106, 0x12); in rt2800_init_bbp_53xx()
6918 rt2800_bbp_write(rt2x00dev, 128, 0x12); in rt2800_init_bbp_53xx()
6920 if (rt2x00_rt(rt2x00dev, RT5392)) { in rt2800_init_bbp_53xx()
6921 rt2800_bbp_write(rt2x00dev, 134, 0xd0); in rt2800_init_bbp_53xx()
6922 rt2800_bbp_write(rt2x00dev, 135, 0xf6); in rt2800_init_bbp_53xx()
6925 rt2800_disable_unused_dac_adc(rt2x00dev); in rt2800_init_bbp_53xx()
6927 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_bbp_53xx()
6933 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { in rt2800_init_bbp_53xx()
6936 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_init_bbp_53xx()
6945 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); in rt2800_init_bbp_53xx()
6949 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R) || in rt2800_init_bbp_53xx()
6950 rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5370G)) { in rt2800_init_bbp_53xx()
6951 rt2800_bbp_write(rt2x00dev, 150, 0); /* Disable Antenna Software OFDM */ in rt2800_init_bbp_53xx()
6952 rt2800_bbp_write(rt2x00dev, 151, 0); /* Disable Antenna Software CCK */ in rt2800_init_bbp_53xx()
6953 rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */ in rt2800_init_bbp_53xx()
6956 value = rt2800_bbp_read(rt2x00dev, 152); in rt2800_init_bbp_53xx()
6961 rt2800_bbp_write(rt2x00dev, 152, value); in rt2800_init_bbp_53xx()
6963 rt2800_init_freq_calibration(rt2x00dev); in rt2800_init_bbp_53xx()
6966 static void rt2800_init_bbp_5592(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_5592() argument
6972 rt2800_init_bbp_early(rt2x00dev); in rt2800_init_bbp_5592()
6974 value = rt2800_bbp_read(rt2x00dev, 105); in rt2800_init_bbp_5592()
6976 rt2x00dev->default_ant.rx_chain_num == 2); in rt2800_init_bbp_5592()
6977 rt2800_bbp_write(rt2x00dev, 105, value); in rt2800_init_bbp_5592()
6979 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_5592()
6981 rt2800_bbp_write(rt2x00dev, 20, 0x06); in rt2800_init_bbp_5592()
6982 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt2800_init_bbp_5592()
6983 rt2800_bbp_write(rt2x00dev, 65, 0x2C); in rt2800_init_bbp_5592()
6984 rt2800_bbp_write(rt2x00dev, 68, 0xDD); in rt2800_init_bbp_5592()
6985 rt2800_bbp_write(rt2x00dev, 69, 0x1A); in rt2800_init_bbp_5592()
6986 rt2800_bbp_write(rt2x00dev, 70, 0x05); in rt2800_init_bbp_5592()
6987 rt2800_bbp_write(rt2x00dev, 73, 0x13); in rt2800_init_bbp_5592()
6988 rt2800_bbp_write(rt2x00dev, 74, 0x0F); in rt2800_init_bbp_5592()
6989 rt2800_bbp_write(rt2x00dev, 75, 0x4F); in rt2800_init_bbp_5592()
6990 rt2800_bbp_write(rt2x00dev, 76, 0x28); in rt2800_init_bbp_5592()
6991 rt2800_bbp_write(rt2x00dev, 77, 0x59); in rt2800_init_bbp_5592()
6992 rt2800_bbp_write(rt2x00dev, 84, 0x9A); in rt2800_init_bbp_5592()
6993 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_init_bbp_5592()
6994 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt2800_init_bbp_5592()
6995 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_5592()
6996 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_5592()
6997 rt2800_bbp_write(rt2x00dev, 95, 0x9a); in rt2800_init_bbp_5592()
6998 rt2800_bbp_write(rt2x00dev, 98, 0x12); in rt2800_init_bbp_5592()
6999 rt2800_bbp_write(rt2x00dev, 103, 0xC0); in rt2800_init_bbp_5592()
7000 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_5592()
7002 rt2800_bbp_write(rt2x00dev, 105, 0x3C); in rt2800_init_bbp_5592()
7003 rt2800_bbp_write(rt2x00dev, 106, 0x35); in rt2800_init_bbp_5592()
7004 rt2800_bbp_write(rt2x00dev, 128, 0x12); in rt2800_init_bbp_5592()
7005 rt2800_bbp_write(rt2x00dev, 134, 0xD0); in rt2800_init_bbp_5592()
7006 rt2800_bbp_write(rt2x00dev, 135, 0xF6); in rt2800_init_bbp_5592()
7007 rt2800_bbp_write(rt2x00dev, 137, 0x0F); in rt2800_init_bbp_5592()
7010 rt2800_init_bbp_5592_glrt(rt2x00dev); in rt2800_init_bbp_5592()
7012 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_5592()
7014 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_bbp_5592()
7017 value = rt2800_bbp_read(rt2x00dev, 152); in rt2800_init_bbp_5592()
7025 rt2800_bbp_write(rt2x00dev, 152, value); in rt2800_init_bbp_5592()
7027 if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) { in rt2800_init_bbp_5592()
7028 value = rt2800_bbp_read(rt2x00dev, 254); in rt2800_init_bbp_5592()
7030 rt2800_bbp_write(rt2x00dev, 254, value); in rt2800_init_bbp_5592()
7033 rt2800_init_freq_calibration(rt2x00dev); in rt2800_init_bbp_5592()
7035 rt2800_bbp_write(rt2x00dev, 84, 0x19); in rt2800_init_bbp_5592()
7036 if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) in rt2800_init_bbp_5592()
7037 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_bbp_5592()
7040 static void rt2800_init_bbp_6352(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp_6352() argument
7045 bbp = rt2800_bbp_read(rt2x00dev, 105); in rt2800_init_bbp_6352()
7047 rt2x00dev->default_ant.rx_chain_num == 2); in rt2800_init_bbp_6352()
7048 rt2800_bbp_write(rt2x00dev, 105, bbp); in rt2800_init_bbp_6352()
7051 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_6352()
7054 bbp = rt2800_bbp_read(rt2x00dev, 1); in rt2800_init_bbp_6352()
7056 rt2800_bbp_write(rt2x00dev, 1, bbp); in rt2800_init_bbp_6352()
7059 rt2800_bbp_write(rt2x00dev, 3, 0x08); in rt2800_init_bbp_6352()
7060 rt2800_bbp_write(rt2x00dev, 4, 0x00); /* rt2800_bbp4_mac_if_ctrl? */ in rt2800_init_bbp_6352()
7061 rt2800_bbp_write(rt2x00dev, 6, 0x08); in rt2800_init_bbp_6352()
7062 rt2800_bbp_write(rt2x00dev, 14, 0x09); in rt2800_init_bbp_6352()
7063 rt2800_bbp_write(rt2x00dev, 15, 0xFF); in rt2800_init_bbp_6352()
7064 rt2800_bbp_write(rt2x00dev, 16, 0x01); in rt2800_init_bbp_6352()
7065 rt2800_bbp_write(rt2x00dev, 20, 0x06); in rt2800_init_bbp_6352()
7066 rt2800_bbp_write(rt2x00dev, 21, 0x00); in rt2800_init_bbp_6352()
7067 rt2800_bbp_write(rt2x00dev, 22, 0x00); in rt2800_init_bbp_6352()
7068 rt2800_bbp_write(rt2x00dev, 27, 0x00); in rt2800_init_bbp_6352()
7069 rt2800_bbp_write(rt2x00dev, 28, 0x00); in rt2800_init_bbp_6352()
7070 rt2800_bbp_write(rt2x00dev, 30, 0x00); in rt2800_init_bbp_6352()
7071 rt2800_bbp_write(rt2x00dev, 31, 0x48); in rt2800_init_bbp_6352()
7072 rt2800_bbp_write(rt2x00dev, 47, 0x40); in rt2800_init_bbp_6352()
7073 rt2800_bbp_write(rt2x00dev, 62, 0x00); in rt2800_init_bbp_6352()
7074 rt2800_bbp_write(rt2x00dev, 63, 0x00); in rt2800_init_bbp_6352()
7075 rt2800_bbp_write(rt2x00dev, 64, 0x00); in rt2800_init_bbp_6352()
7076 rt2800_bbp_write(rt2x00dev, 65, 0x2C); in rt2800_init_bbp_6352()
7077 rt2800_bbp_write(rt2x00dev, 66, 0x1C); in rt2800_init_bbp_6352()
7078 rt2800_bbp_write(rt2x00dev, 67, 0x20); in rt2800_init_bbp_6352()
7079 rt2800_bbp_write(rt2x00dev, 68, 0xDD); in rt2800_init_bbp_6352()
7080 rt2800_bbp_write(rt2x00dev, 69, 0x10); in rt2800_init_bbp_6352()
7081 rt2800_bbp_write(rt2x00dev, 70, 0x05); in rt2800_init_bbp_6352()
7082 rt2800_bbp_write(rt2x00dev, 73, 0x18); in rt2800_init_bbp_6352()
7083 rt2800_bbp_write(rt2x00dev, 74, 0x0F); in rt2800_init_bbp_6352()
7084 rt2800_bbp_write(rt2x00dev, 75, 0x60); in rt2800_init_bbp_6352()
7085 rt2800_bbp_write(rt2x00dev, 76, 0x44); in rt2800_init_bbp_6352()
7086 rt2800_bbp_write(rt2x00dev, 77, 0x59); in rt2800_init_bbp_6352()
7087 rt2800_bbp_write(rt2x00dev, 78, 0x1E); in rt2800_init_bbp_6352()
7088 rt2800_bbp_write(rt2x00dev, 79, 0x1C); in rt2800_init_bbp_6352()
7089 rt2800_bbp_write(rt2x00dev, 80, 0x0C); in rt2800_init_bbp_6352()
7090 rt2800_bbp_write(rt2x00dev, 81, 0x3A); in rt2800_init_bbp_6352()
7091 rt2800_bbp_write(rt2x00dev, 82, 0xB6); in rt2800_init_bbp_6352()
7092 rt2800_bbp_write(rt2x00dev, 83, 0x9A); in rt2800_init_bbp_6352()
7093 rt2800_bbp_write(rt2x00dev, 84, 0x9A); in rt2800_init_bbp_6352()
7094 rt2800_bbp_write(rt2x00dev, 86, 0x38); in rt2800_init_bbp_6352()
7095 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt2800_init_bbp_6352()
7096 rt2800_bbp_write(rt2x00dev, 91, 0x04); in rt2800_init_bbp_6352()
7097 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt2800_init_bbp_6352()
7098 rt2800_bbp_write(rt2x00dev, 95, 0x9A); in rt2800_init_bbp_6352()
7099 rt2800_bbp_write(rt2x00dev, 96, 0x00); in rt2800_init_bbp_6352()
7100 rt2800_bbp_write(rt2x00dev, 103, 0xC0); in rt2800_init_bbp_6352()
7101 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt2800_init_bbp_6352()
7103 rt2800_bbp_write(rt2x00dev, 105, 0x3C); in rt2800_init_bbp_6352()
7104 rt2800_bbp_write(rt2x00dev, 106, 0x12); in rt2800_init_bbp_6352()
7105 rt2800_bbp_write(rt2x00dev, 109, 0x00); in rt2800_init_bbp_6352()
7106 rt2800_bbp_write(rt2x00dev, 134, 0x10); in rt2800_init_bbp_6352()
7107 rt2800_bbp_write(rt2x00dev, 135, 0xA6); in rt2800_init_bbp_6352()
7108 rt2800_bbp_write(rt2x00dev, 137, 0x04); in rt2800_init_bbp_6352()
7109 rt2800_bbp_write(rt2x00dev, 142, 0x30); in rt2800_init_bbp_6352()
7110 rt2800_bbp_write(rt2x00dev, 143, 0xF7); in rt2800_init_bbp_6352()
7111 rt2800_bbp_write(rt2x00dev, 160, 0xEC); in rt2800_init_bbp_6352()
7112 rt2800_bbp_write(rt2x00dev, 161, 0xC4); in rt2800_init_bbp_6352()
7113 rt2800_bbp_write(rt2x00dev, 162, 0x77); in rt2800_init_bbp_6352()
7114 rt2800_bbp_write(rt2x00dev, 163, 0xF9); in rt2800_init_bbp_6352()
7115 rt2800_bbp_write(rt2x00dev, 164, 0x00); in rt2800_init_bbp_6352()
7116 rt2800_bbp_write(rt2x00dev, 165, 0x00); in rt2800_init_bbp_6352()
7117 rt2800_bbp_write(rt2x00dev, 186, 0x00); in rt2800_init_bbp_6352()
7118 rt2800_bbp_write(rt2x00dev, 187, 0x00); in rt2800_init_bbp_6352()
7119 rt2800_bbp_write(rt2x00dev, 188, 0x00); in rt2800_init_bbp_6352()
7120 rt2800_bbp_write(rt2x00dev, 186, 0x00); in rt2800_init_bbp_6352()
7121 rt2800_bbp_write(rt2x00dev, 187, 0x01); in rt2800_init_bbp_6352()
7122 rt2800_bbp_write(rt2x00dev, 188, 0x00); in rt2800_init_bbp_6352()
7123 rt2800_bbp_write(rt2x00dev, 189, 0x00); in rt2800_init_bbp_6352()
7125 rt2800_bbp_write(rt2x00dev, 91, 0x06); in rt2800_init_bbp_6352()
7126 rt2800_bbp_write(rt2x00dev, 92, 0x04); in rt2800_init_bbp_6352()
7127 rt2800_bbp_write(rt2x00dev, 93, 0x54); in rt2800_init_bbp_6352()
7128 rt2800_bbp_write(rt2x00dev, 99, 0x50); in rt2800_init_bbp_6352()
7129 rt2800_bbp_write(rt2x00dev, 148, 0x84); in rt2800_init_bbp_6352()
7130 rt2800_bbp_write(rt2x00dev, 167, 0x80); in rt2800_init_bbp_6352()
7131 rt2800_bbp_write(rt2x00dev, 178, 0xFF); in rt2800_init_bbp_6352()
7132 rt2800_bbp_write(rt2x00dev, 106, 0x13); in rt2800_init_bbp_6352()
7135 rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); in rt2800_init_bbp_6352()
7136 rt2800_bbp_glrt_write(rt2x00dev, 1, 0x14); in rt2800_init_bbp_6352()
7137 rt2800_bbp_glrt_write(rt2x00dev, 2, 0x20); in rt2800_init_bbp_6352()
7138 rt2800_bbp_glrt_write(rt2x00dev, 3, 0x0A); in rt2800_init_bbp_6352()
7139 rt2800_bbp_glrt_write(rt2x00dev, 10, 0x16); in rt2800_init_bbp_6352()
7140 rt2800_bbp_glrt_write(rt2x00dev, 11, 0x06); in rt2800_init_bbp_6352()
7141 rt2800_bbp_glrt_write(rt2x00dev, 12, 0x02); in rt2800_init_bbp_6352()
7142 rt2800_bbp_glrt_write(rt2x00dev, 13, 0x07); in rt2800_init_bbp_6352()
7143 rt2800_bbp_glrt_write(rt2x00dev, 14, 0x05); in rt2800_init_bbp_6352()
7144 rt2800_bbp_glrt_write(rt2x00dev, 15, 0x09); in rt2800_init_bbp_6352()
7145 rt2800_bbp_glrt_write(rt2x00dev, 16, 0x20); in rt2800_init_bbp_6352()
7146 rt2800_bbp_glrt_write(rt2x00dev, 17, 0x08); in rt2800_init_bbp_6352()
7147 rt2800_bbp_glrt_write(rt2x00dev, 18, 0x4A); in rt2800_init_bbp_6352()
7148 rt2800_bbp_glrt_write(rt2x00dev, 19, 0x00); in rt2800_init_bbp_6352()
7149 rt2800_bbp_glrt_write(rt2x00dev, 20, 0x00); in rt2800_init_bbp_6352()
7150 rt2800_bbp_glrt_write(rt2x00dev, 128, 0xE0); in rt2800_init_bbp_6352()
7151 rt2800_bbp_glrt_write(rt2x00dev, 129, 0x1F); in rt2800_init_bbp_6352()
7152 rt2800_bbp_glrt_write(rt2x00dev, 130, 0x4F); in rt2800_init_bbp_6352()
7153 rt2800_bbp_glrt_write(rt2x00dev, 131, 0x32); in rt2800_init_bbp_6352()
7154 rt2800_bbp_glrt_write(rt2x00dev, 132, 0x08); in rt2800_init_bbp_6352()
7155 rt2800_bbp_glrt_write(rt2x00dev, 133, 0x28); in rt2800_init_bbp_6352()
7156 rt2800_bbp_glrt_write(rt2x00dev, 134, 0x19); in rt2800_init_bbp_6352()
7157 rt2800_bbp_glrt_write(rt2x00dev, 135, 0x0A); in rt2800_init_bbp_6352()
7158 rt2800_bbp_glrt_write(rt2x00dev, 138, 0x16); in rt2800_init_bbp_6352()
7159 rt2800_bbp_glrt_write(rt2x00dev, 139, 0x10); in rt2800_init_bbp_6352()
7160 rt2800_bbp_glrt_write(rt2x00dev, 140, 0x10); in rt2800_init_bbp_6352()
7161 rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1A); in rt2800_init_bbp_6352()
7162 rt2800_bbp_glrt_write(rt2x00dev, 142, 0x36); in rt2800_init_bbp_6352()
7163 rt2800_bbp_glrt_write(rt2x00dev, 143, 0x2C); in rt2800_init_bbp_6352()
7164 rt2800_bbp_glrt_write(rt2x00dev, 144, 0x26); in rt2800_init_bbp_6352()
7165 rt2800_bbp_glrt_write(rt2x00dev, 145, 0x24); in rt2800_init_bbp_6352()
7166 rt2800_bbp_glrt_write(rt2x00dev, 146, 0x42); in rt2800_init_bbp_6352()
7167 rt2800_bbp_glrt_write(rt2x00dev, 147, 0x40); in rt2800_init_bbp_6352()
7168 rt2800_bbp_glrt_write(rt2x00dev, 148, 0x30); in rt2800_init_bbp_6352()
7169 rt2800_bbp_glrt_write(rt2x00dev, 149, 0x29); in rt2800_init_bbp_6352()
7170 rt2800_bbp_glrt_write(rt2x00dev, 150, 0x4C); in rt2800_init_bbp_6352()
7171 rt2800_bbp_glrt_write(rt2x00dev, 151, 0x46); in rt2800_init_bbp_6352()
7172 rt2800_bbp_glrt_write(rt2x00dev, 152, 0x3D); in rt2800_init_bbp_6352()
7173 rt2800_bbp_glrt_write(rt2x00dev, 153, 0x40); in rt2800_init_bbp_6352()
7174 rt2800_bbp_glrt_write(rt2x00dev, 154, 0x3E); in rt2800_init_bbp_6352()
7175 rt2800_bbp_glrt_write(rt2x00dev, 155, 0x38); in rt2800_init_bbp_6352()
7176 rt2800_bbp_glrt_write(rt2x00dev, 156, 0x3D); in rt2800_init_bbp_6352()
7177 rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2F); in rt2800_init_bbp_6352()
7178 rt2800_bbp_glrt_write(rt2x00dev, 158, 0x3C); in rt2800_init_bbp_6352()
7179 rt2800_bbp_glrt_write(rt2x00dev, 159, 0x34); in rt2800_init_bbp_6352()
7180 rt2800_bbp_glrt_write(rt2x00dev, 160, 0x2C); in rt2800_init_bbp_6352()
7181 rt2800_bbp_glrt_write(rt2x00dev, 161, 0x2F); in rt2800_init_bbp_6352()
7182 rt2800_bbp_glrt_write(rt2x00dev, 162, 0x3C); in rt2800_init_bbp_6352()
7183 rt2800_bbp_glrt_write(rt2x00dev, 163, 0x35); in rt2800_init_bbp_6352()
7184 rt2800_bbp_glrt_write(rt2x00dev, 164, 0x2E); in rt2800_init_bbp_6352()
7185 rt2800_bbp_glrt_write(rt2x00dev, 165, 0x2F); in rt2800_init_bbp_6352()
7186 rt2800_bbp_glrt_write(rt2x00dev, 166, 0x49); in rt2800_init_bbp_6352()
7187 rt2800_bbp_glrt_write(rt2x00dev, 167, 0x41); in rt2800_init_bbp_6352()
7188 rt2800_bbp_glrt_write(rt2x00dev, 168, 0x36); in rt2800_init_bbp_6352()
7189 rt2800_bbp_glrt_write(rt2x00dev, 169, 0x39); in rt2800_init_bbp_6352()
7190 rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30); in rt2800_init_bbp_6352()
7191 rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30); in rt2800_init_bbp_6352()
7192 rt2800_bbp_glrt_write(rt2x00dev, 172, 0x0E); in rt2800_init_bbp_6352()
7193 rt2800_bbp_glrt_write(rt2x00dev, 173, 0x0D); in rt2800_init_bbp_6352()
7194 rt2800_bbp_glrt_write(rt2x00dev, 174, 0x28); in rt2800_init_bbp_6352()
7195 rt2800_bbp_glrt_write(rt2x00dev, 175, 0x21); in rt2800_init_bbp_6352()
7196 rt2800_bbp_glrt_write(rt2x00dev, 176, 0x1C); in rt2800_init_bbp_6352()
7197 rt2800_bbp_glrt_write(rt2x00dev, 177, 0x16); in rt2800_init_bbp_6352()
7198 rt2800_bbp_glrt_write(rt2x00dev, 178, 0x50); in rt2800_init_bbp_6352()
7199 rt2800_bbp_glrt_write(rt2x00dev, 179, 0x4A); in rt2800_init_bbp_6352()
7200 rt2800_bbp_glrt_write(rt2x00dev, 180, 0x43); in rt2800_init_bbp_6352()
7201 rt2800_bbp_glrt_write(rt2x00dev, 181, 0x50); in rt2800_init_bbp_6352()
7202 rt2800_bbp_glrt_write(rt2x00dev, 182, 0x10); in rt2800_init_bbp_6352()
7203 rt2800_bbp_glrt_write(rt2x00dev, 183, 0x10); in rt2800_init_bbp_6352()
7204 rt2800_bbp_glrt_write(rt2x00dev, 184, 0x10); in rt2800_init_bbp_6352()
7205 rt2800_bbp_glrt_write(rt2x00dev, 185, 0x10); in rt2800_init_bbp_6352()
7206 rt2800_bbp_glrt_write(rt2x00dev, 200, 0x7D); in rt2800_init_bbp_6352()
7207 rt2800_bbp_glrt_write(rt2x00dev, 201, 0x14); in rt2800_init_bbp_6352()
7208 rt2800_bbp_glrt_write(rt2x00dev, 202, 0x32); in rt2800_init_bbp_6352()
7209 rt2800_bbp_glrt_write(rt2x00dev, 203, 0x2C); in rt2800_init_bbp_6352()
7210 rt2800_bbp_glrt_write(rt2x00dev, 204, 0x36); in rt2800_init_bbp_6352()
7211 rt2800_bbp_glrt_write(rt2x00dev, 205, 0x4C); in rt2800_init_bbp_6352()
7212 rt2800_bbp_glrt_write(rt2x00dev, 206, 0x43); in rt2800_init_bbp_6352()
7213 rt2800_bbp_glrt_write(rt2x00dev, 207, 0x2C); in rt2800_init_bbp_6352()
7214 rt2800_bbp_glrt_write(rt2x00dev, 208, 0x2E); in rt2800_init_bbp_6352()
7215 rt2800_bbp_glrt_write(rt2x00dev, 209, 0x36); in rt2800_init_bbp_6352()
7216 rt2800_bbp_glrt_write(rt2x00dev, 210, 0x30); in rt2800_init_bbp_6352()
7217 rt2800_bbp_glrt_write(rt2x00dev, 211, 0x6E); in rt2800_init_bbp_6352()
7220 rt2800_bbp_dcoc_write(rt2x00dev, 140, 0x0C); in rt2800_init_bbp_6352()
7221 rt2800_bbp_dcoc_write(rt2x00dev, 141, 0x00); in rt2800_init_bbp_6352()
7222 rt2800_bbp_dcoc_write(rt2x00dev, 142, 0x10); in rt2800_init_bbp_6352()
7223 rt2800_bbp_dcoc_write(rt2x00dev, 143, 0x10); in rt2800_init_bbp_6352()
7224 rt2800_bbp_dcoc_write(rt2x00dev, 144, 0x10); in rt2800_init_bbp_6352()
7225 rt2800_bbp_dcoc_write(rt2x00dev, 145, 0x10); in rt2800_init_bbp_6352()
7226 rt2800_bbp_dcoc_write(rt2x00dev, 146, 0x08); in rt2800_init_bbp_6352()
7227 rt2800_bbp_dcoc_write(rt2x00dev, 147, 0x40); in rt2800_init_bbp_6352()
7228 rt2800_bbp_dcoc_write(rt2x00dev, 148, 0x04); in rt2800_init_bbp_6352()
7229 rt2800_bbp_dcoc_write(rt2x00dev, 149, 0x04); in rt2800_init_bbp_6352()
7230 rt2800_bbp_dcoc_write(rt2x00dev, 150, 0x08); in rt2800_init_bbp_6352()
7231 rt2800_bbp_dcoc_write(rt2x00dev, 151, 0x08); in rt2800_init_bbp_6352()
7232 rt2800_bbp_dcoc_write(rt2x00dev, 152, 0x03); in rt2800_init_bbp_6352()
7233 rt2800_bbp_dcoc_write(rt2x00dev, 153, 0x03); in rt2800_init_bbp_6352()
7234 rt2800_bbp_dcoc_write(rt2x00dev, 154, 0x03); in rt2800_init_bbp_6352()
7235 rt2800_bbp_dcoc_write(rt2x00dev, 155, 0x02); in rt2800_init_bbp_6352()
7236 rt2800_bbp_dcoc_write(rt2x00dev, 156, 0x40); in rt2800_init_bbp_6352()
7237 rt2800_bbp_dcoc_write(rt2x00dev, 157, 0x40); in rt2800_init_bbp_6352()
7238 rt2800_bbp_dcoc_write(rt2x00dev, 158, 0x64); in rt2800_init_bbp_6352()
7239 rt2800_bbp_dcoc_write(rt2x00dev, 159, 0x64); in rt2800_init_bbp_6352()
7241 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_init_bbp_6352()
7243 rt2800_bbp_write(rt2x00dev, 84, 0x19); in rt2800_init_bbp_6352()
7246 static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) in rt2800_init_bbp() argument
7253 if (rt2800_is_305x_soc(rt2x00dev)) in rt2800_init_bbp()
7254 rt2800_init_bbp_305x_soc(rt2x00dev); in rt2800_init_bbp()
7256 switch (rt2x00dev->chip.rt) { in rt2800_init_bbp()
7260 rt2800_init_bbp_28xx(rt2x00dev); in rt2800_init_bbp()
7265 rt2800_init_bbp_30xx(rt2x00dev); in rt2800_init_bbp()
7268 rt2800_init_bbp_3290(rt2x00dev); in rt2800_init_bbp()
7272 rt2800_init_bbp_3352(rt2x00dev); in rt2800_init_bbp()
7275 rt2800_init_bbp_3390(rt2x00dev); in rt2800_init_bbp()
7278 rt2800_init_bbp_3572(rt2x00dev); in rt2800_init_bbp()
7281 rt2800_init_bbp_3593(rt2x00dev); in rt2800_init_bbp()
7284 rt2800_init_bbp_3883(rt2x00dev); in rt2800_init_bbp()
7288 rt2800_init_bbp_53xx(rt2x00dev); in rt2800_init_bbp()
7291 rt2800_init_bbp_5592(rt2x00dev); in rt2800_init_bbp()
7294 rt2800_init_bbp_6352(rt2x00dev); in rt2800_init_bbp()
7299 eeprom = rt2800_eeprom_read_from_array(rt2x00dev, in rt2800_init_bbp()
7305 rt2800_bbp_write(rt2x00dev, reg_id, value); in rt2800_init_bbp()
7310 static void rt2800_led_open_drain_enable(struct rt2x00_dev *rt2x00dev) in rt2800_led_open_drain_enable() argument
7314 reg = rt2800_register_read(rt2x00dev, OPT_14_CSR); in rt2800_led_open_drain_enable()
7316 rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); in rt2800_led_open_drain_enable()
7319 static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40, in rt2800_init_rx_filter() argument
7330 rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); in rt2800_init_rx_filter()
7332 bbp = rt2800_bbp_read(rt2x00dev, 4); in rt2800_init_rx_filter()
7334 rt2800_bbp_write(rt2x00dev, 4, bbp); in rt2800_init_rx_filter()
7336 rfcsr = rt2800_rfcsr_read(rt2x00dev, 31); in rt2800_init_rx_filter()
7338 rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); in rt2800_init_rx_filter()
7340 rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); in rt2800_init_rx_filter()
7342 rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); in rt2800_init_rx_filter()
7347 rt2800_bbp_write(rt2x00dev, 24, 0); in rt2800_init_rx_filter()
7350 rt2800_bbp_write(rt2x00dev, 25, 0x90); in rt2800_init_rx_filter()
7353 passband = rt2800_bbp_read(rt2x00dev, 55); in rt2800_init_rx_filter()
7361 rt2800_bbp_write(rt2x00dev, 24, 0x06); in rt2800_init_rx_filter()
7364 rt2800_bbp_write(rt2x00dev, 25, 0x90); in rt2800_init_rx_filter()
7367 stopband = rt2800_bbp_read(rt2x00dev, 55); in rt2800_init_rx_filter()
7375 rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); in rt2800_init_rx_filter()
7380 rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); in rt2800_init_rx_filter()
7384 static void rt2800_rf_init_calibration(struct rt2x00_dev *rt2x00dev, in rt2800_rf_init_calibration() argument
7389 rfcsr = rt2800_rfcsr_read(rt2x00dev, rf_reg); in rt2800_rf_init_calibration()
7391 rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); in rt2800_rf_init_calibration()
7394 rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); in rt2800_rf_init_calibration()
7397 static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_rx_filter_calibration() argument
7399 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_rx_filter_calibration()
7407 if (rt2x00_rt(rt2x00dev, RT3070)) { in rt2800_rx_filter_calibration()
7416 rt2800_init_rx_filter(rt2x00dev, false, filter_tgt_bw20); in rt2800_rx_filter_calibration()
7418 rt2800_init_rx_filter(rt2x00dev, true, filter_tgt_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()
7429 rt2800_bbp_write(rt2x00dev, 24, 0); in rt2800_rx_filter_calibration()
7431 rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); in rt2800_rx_filter_calibration()
7433 rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); in rt2800_rx_filter_calibration()
7438 bbp = rt2800_bbp_read(rt2x00dev, 4); in rt2800_rx_filter_calibration()
7440 rt2800_bbp_write(rt2x00dev, 4, bbp); in rt2800_rx_filter_calibration()
7443 static void rt2800_normal_mode_setup_3xxx(struct rt2x00_dev *rt2x00dev) in rt2800_normal_mode_setup_3xxx() argument
7445 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_normal_mode_setup_3xxx()
7449 rfcsr = rt2800_rfcsr_read(rt2x00dev, 17); in rt2800_normal_mode_setup_3xxx()
7452 if (rt2x00_rt(rt2x00dev, RT3070) || in rt2800_normal_mode_setup_3xxx()
7453 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || in rt2800_normal_mode_setup_3xxx()
7454 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || in rt2800_normal_mode_setup_3xxx()
7455 rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { in rt2800_normal_mode_setup_3xxx()
7456 if (!rt2x00_has_cap_external_lna_bg(rt2x00dev)) in rt2800_normal_mode_setup_3xxx()
7460 min_gain = rt2x00_rt(rt2x00dev, RT3070) ? 1 : 2; in rt2800_normal_mode_setup_3xxx()
7466 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); in rt2800_normal_mode_setup_3xxx()
7468 if (rt2x00_rt(rt2x00dev, RT3090)) { in rt2800_normal_mode_setup_3xxx()
7470 bbp = rt2800_bbp_read(rt2x00dev, 138); in rt2800_normal_mode_setup_3xxx()
7471 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); in rt2800_normal_mode_setup_3xxx()
7476 rt2800_bbp_write(rt2x00dev, 138, bbp); in rt2800_normal_mode_setup_3xxx()
7479 if (rt2x00_rt(rt2x00dev, RT3070)) { in rt2800_normal_mode_setup_3xxx()
7480 rfcsr = rt2800_rfcsr_read(rt2x00dev, 27); in rt2800_normal_mode_setup_3xxx()
7481 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) in rt2800_normal_mode_setup_3xxx()
7488 rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); in rt2800_normal_mode_setup_3xxx()
7489 } else if (rt2x00_rt(rt2x00dev, RT3071) || in rt2800_normal_mode_setup_3xxx()
7490 rt2x00_rt(rt2x00dev, RT3090) || in rt2800_normal_mode_setup_3xxx()
7491 rt2x00_rt(rt2x00dev, RT3390)) { in rt2800_normal_mode_setup_3xxx()
7492 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_normal_mode_setup_3xxx()
7498 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_normal_mode_setup_3xxx()
7500 rfcsr = rt2800_rfcsr_read(rt2x00dev, 15); in rt2800_normal_mode_setup_3xxx()
7502 rt2800_rfcsr_write(rt2x00dev, 15, rfcsr); in rt2800_normal_mode_setup_3xxx()
7504 rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); in rt2800_normal_mode_setup_3xxx()
7506 rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); in rt2800_normal_mode_setup_3xxx()
7508 rfcsr = rt2800_rfcsr_read(rt2x00dev, 21); in rt2800_normal_mode_setup_3xxx()
7510 rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); in rt2800_normal_mode_setup_3xxx()
7514 static void rt2800_normal_mode_setup_3593(struct rt2x00_dev *rt2x00dev) in rt2800_normal_mode_setup_3593() argument
7516 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_normal_mode_setup_3593()
7520 rfcsr = rt2800_rfcsr_read(rt2x00dev, 50); in rt2800_normal_mode_setup_3593()
7522 rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); in rt2800_normal_mode_setup_3593()
7524 rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); in rt2800_normal_mode_setup_3593()
7528 rt2800_rfcsr_write(rt2x00dev, 51, rfcsr); in rt2800_normal_mode_setup_3593()
7530 rfcsr = rt2800_rfcsr_read(rt2x00dev, 38); in rt2800_normal_mode_setup_3593()
7532 rt2800_rfcsr_write(rt2x00dev, 38, rfcsr); in rt2800_normal_mode_setup_3593()
7534 rfcsr = rt2800_rfcsr_read(rt2x00dev, 39); in rt2800_normal_mode_setup_3593()
7536 rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); in rt2800_normal_mode_setup_3593()
7538 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_normal_mode_setup_3593()
7541 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_normal_mode_setup_3593()
7543 rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_normal_mode_setup_3593()
7545 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); in rt2800_normal_mode_setup_3593()
7550 static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev) in rt2800_normal_mode_setup_5xxx() argument
7556 reg = rt2800_bbp_read(rt2x00dev, 138); in rt2800_normal_mode_setup_5xxx()
7557 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); in rt2800_normal_mode_setup_5xxx()
7562 rt2800_bbp_write(rt2x00dev, 138, reg); in rt2800_normal_mode_setup_5xxx()
7564 reg = rt2800_rfcsr_read(rt2x00dev, 38); in rt2800_normal_mode_setup_5xxx()
7566 rt2800_rfcsr_write(rt2x00dev, 38, reg); in rt2800_normal_mode_setup_5xxx()
7568 reg = rt2800_rfcsr_read(rt2x00dev, 39); in rt2800_normal_mode_setup_5xxx()
7570 rt2800_rfcsr_write(rt2x00dev, 39, reg); in rt2800_normal_mode_setup_5xxx()
7572 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt2800_normal_mode_setup_5xxx()
7574 reg = rt2800_rfcsr_read(rt2x00dev, 30); in rt2800_normal_mode_setup_5xxx()
7576 rt2800_rfcsr_write(rt2x00dev, 30, reg); in rt2800_normal_mode_setup_5xxx()
7579 static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_305x_soc() argument
7581 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_305x_soc()
7583 rt2800_rfcsr_write(rt2x00dev, 0, 0x50); in rt2800_init_rfcsr_305x_soc()
7584 rt2800_rfcsr_write(rt2x00dev, 1, 0x01); in rt2800_init_rfcsr_305x_soc()
7585 rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); in rt2800_init_rfcsr_305x_soc()
7586 rt2800_rfcsr_write(rt2x00dev, 3, 0x75); in rt2800_init_rfcsr_305x_soc()
7587 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); in rt2800_init_rfcsr_305x_soc()
7588 rt2800_rfcsr_write(rt2x00dev, 5, 0x03); in rt2800_init_rfcsr_305x_soc()
7589 rt2800_rfcsr_write(rt2x00dev, 6, 0x02); in rt2800_init_rfcsr_305x_soc()
7590 rt2800_rfcsr_write(rt2x00dev, 7, 0x50); in rt2800_init_rfcsr_305x_soc()
7591 rt2800_rfcsr_write(rt2x00dev, 8, 0x39); in rt2800_init_rfcsr_305x_soc()
7592 rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); in rt2800_init_rfcsr_305x_soc()
7593 rt2800_rfcsr_write(rt2x00dev, 10, 0x60); in rt2800_init_rfcsr_305x_soc()
7594 rt2800_rfcsr_write(rt2x00dev, 11, 0x21); in rt2800_init_rfcsr_305x_soc()
7595 rt2800_rfcsr_write(rt2x00dev, 12, 0x75); in rt2800_init_rfcsr_305x_soc()
7596 rt2800_rfcsr_write(rt2x00dev, 13, 0x75); in rt2800_init_rfcsr_305x_soc()
7597 rt2800_rfcsr_write(rt2x00dev, 14, 0x90); in rt2800_init_rfcsr_305x_soc()
7598 rt2800_rfcsr_write(rt2x00dev, 15, 0x58); in rt2800_init_rfcsr_305x_soc()
7599 rt2800_rfcsr_write(rt2x00dev, 16, 0xb3); in rt2800_init_rfcsr_305x_soc()
7600 rt2800_rfcsr_write(rt2x00dev, 17, 0x92); in rt2800_init_rfcsr_305x_soc()
7601 rt2800_rfcsr_write(rt2x00dev, 18, 0x2c); in rt2800_init_rfcsr_305x_soc()
7602 rt2800_rfcsr_write(rt2x00dev, 19, 0x02); in rt2800_init_rfcsr_305x_soc()
7603 rt2800_rfcsr_write(rt2x00dev, 20, 0xba); in rt2800_init_rfcsr_305x_soc()
7604 rt2800_rfcsr_write(rt2x00dev, 21, 0xdb); in rt2800_init_rfcsr_305x_soc()
7605 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); in rt2800_init_rfcsr_305x_soc()
7606 rt2800_rfcsr_write(rt2x00dev, 23, 0x31); in rt2800_init_rfcsr_305x_soc()
7607 rt2800_rfcsr_write(rt2x00dev, 24, 0x08); in rt2800_init_rfcsr_305x_soc()
7608 rt2800_rfcsr_write(rt2x00dev, 25, 0x01); in rt2800_init_rfcsr_305x_soc()
7609 rt2800_rfcsr_write(rt2x00dev, 26, 0x25); in rt2800_init_rfcsr_305x_soc()
7610 rt2800_rfcsr_write(rt2x00dev, 27, 0x23); in rt2800_init_rfcsr_305x_soc()
7611 rt2800_rfcsr_write(rt2x00dev, 28, 0x13); in rt2800_init_rfcsr_305x_soc()
7612 rt2800_rfcsr_write(rt2x00dev, 29, 0x83); in rt2800_init_rfcsr_305x_soc()
7613 rt2800_rfcsr_write(rt2x00dev, 30, 0x00); in rt2800_init_rfcsr_305x_soc()
7614 rt2800_rfcsr_write(rt2x00dev, 31, 0x00); in rt2800_init_rfcsr_305x_soc()
7617 static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_30xx() argument
7624 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_30xx()
7626 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); in rt2800_init_rfcsr_30xx()
7627 rt2800_rfcsr_write(rt2x00dev, 5, 0x03); in rt2800_init_rfcsr_30xx()
7628 rt2800_rfcsr_write(rt2x00dev, 6, 0x02); in rt2800_init_rfcsr_30xx()
7629 rt2800_rfcsr_write(rt2x00dev, 7, 0x60); in rt2800_init_rfcsr_30xx()
7630 rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); in rt2800_init_rfcsr_30xx()
7631 rt2800_rfcsr_write(rt2x00dev, 10, 0x41); in rt2800_init_rfcsr_30xx()
7632 rt2800_rfcsr_write(rt2x00dev, 11, 0x21); in rt2800_init_rfcsr_30xx()
7633 rt2800_rfcsr_write(rt2x00dev, 12, 0x7b); in rt2800_init_rfcsr_30xx()
7634 rt2800_rfcsr_write(rt2x00dev, 14, 0x90); in rt2800_init_rfcsr_30xx()
7635 rt2800_rfcsr_write(rt2x00dev, 15, 0x58); in rt2800_init_rfcsr_30xx()
7636 rt2800_rfcsr_write(rt2x00dev, 16, 0xb3); in rt2800_init_rfcsr_30xx()
7637 rt2800_rfcsr_write(rt2x00dev, 17, 0x92); in rt2800_init_rfcsr_30xx()
7638 rt2800_rfcsr_write(rt2x00dev, 18, 0x2c); in rt2800_init_rfcsr_30xx()
7639 rt2800_rfcsr_write(rt2x00dev, 19, 0x02); in rt2800_init_rfcsr_30xx()
7640 rt2800_rfcsr_write(rt2x00dev, 20, 0xba); in rt2800_init_rfcsr_30xx()
7641 rt2800_rfcsr_write(rt2x00dev, 21, 0xdb); in rt2800_init_rfcsr_30xx()
7642 rt2800_rfcsr_write(rt2x00dev, 24, 0x16); in rt2800_init_rfcsr_30xx()
7643 rt2800_rfcsr_write(rt2x00dev, 25, 0x03); in rt2800_init_rfcsr_30xx()
7644 rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); in rt2800_init_rfcsr_30xx()
7646 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { in rt2800_init_rfcsr_30xx()
7647 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_30xx()
7650 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_init_rfcsr_30xx()
7651 } else if (rt2x00_rt(rt2x00dev, RT3071) || in rt2800_init_rfcsr_30xx()
7652 rt2x00_rt(rt2x00dev, RT3090)) { in rt2800_init_rfcsr_30xx()
7653 rt2800_rfcsr_write(rt2x00dev, 31, 0x14); in rt2800_init_rfcsr_30xx()
7655 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_init_rfcsr_30xx()
7657 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_init_rfcsr_30xx()
7659 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_30xx()
7661 if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || in rt2800_init_rfcsr_30xx()
7662 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { in rt2800_init_rfcsr_30xx()
7663 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_rfcsr_30xx()
7669 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_init_rfcsr_30xx()
7671 reg = rt2800_register_read(rt2x00dev, GPIO_SWITCH); in rt2800_init_rfcsr_30xx()
7673 rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); in rt2800_init_rfcsr_30xx()
7676 rt2800_rx_filter_calibration(rt2x00dev); in rt2800_init_rfcsr_30xx()
7678 if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) || in rt2800_init_rfcsr_30xx()
7679 rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || in rt2800_init_rfcsr_30xx()
7680 rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) in rt2800_init_rfcsr_30xx()
7681 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); in rt2800_init_rfcsr_30xx()
7683 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_30xx()
7684 rt2800_normal_mode_setup_3xxx(rt2x00dev); in rt2800_init_rfcsr_30xx()
7687 static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3290() argument
7691 rt2800_rf_init_calibration(rt2x00dev, 2); in rt2800_init_rfcsr_3290()
7693 rt2800_rfcsr_write(rt2x00dev, 1, 0x0f); in rt2800_init_rfcsr_3290()
7694 rt2800_rfcsr_write(rt2x00dev, 2, 0x80); in rt2800_init_rfcsr_3290()
7695 rt2800_rfcsr_write(rt2x00dev, 3, 0x08); in rt2800_init_rfcsr_3290()
7696 rt2800_rfcsr_write(rt2x00dev, 4, 0x00); in rt2800_init_rfcsr_3290()
7697 rt2800_rfcsr_write(rt2x00dev, 6, 0xa0); in rt2800_init_rfcsr_3290()
7698 rt2800_rfcsr_write(rt2x00dev, 8, 0xf3); in rt2800_init_rfcsr_3290()
7699 rt2800_rfcsr_write(rt2x00dev, 9, 0x02); in rt2800_init_rfcsr_3290()
7700 rt2800_rfcsr_write(rt2x00dev, 10, 0x53); in rt2800_init_rfcsr_3290()
7701 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); in rt2800_init_rfcsr_3290()
7702 rt2800_rfcsr_write(rt2x00dev, 12, 0x46); in rt2800_init_rfcsr_3290()
7703 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); in rt2800_init_rfcsr_3290()
7704 rt2800_rfcsr_write(rt2x00dev, 18, 0x02); in rt2800_init_rfcsr_3290()
7705 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_3290()
7706 rt2800_rfcsr_write(rt2x00dev, 25, 0x83); in rt2800_init_rfcsr_3290()
7707 rt2800_rfcsr_write(rt2x00dev, 26, 0x82); in rt2800_init_rfcsr_3290()
7708 rt2800_rfcsr_write(rt2x00dev, 27, 0x09); in rt2800_init_rfcsr_3290()
7709 rt2800_rfcsr_write(rt2x00dev, 29, 0x10); in rt2800_init_rfcsr_3290()
7710 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_3290()
7711 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_3290()
7712 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_init_rfcsr_3290()
7713 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_3290()
7714 rt2800_rfcsr_write(rt2x00dev, 34, 0x05); in rt2800_init_rfcsr_3290()
7715 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); in rt2800_init_rfcsr_3290()
7716 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_3290()
7717 rt2800_rfcsr_write(rt2x00dev, 38, 0x85); in rt2800_init_rfcsr_3290()
7718 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); in rt2800_init_rfcsr_3290()
7719 rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); in rt2800_init_rfcsr_3290()
7720 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); in rt2800_init_rfcsr_3290()
7721 rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); in rt2800_init_rfcsr_3290()
7722 rt2800_rfcsr_write(rt2x00dev, 43, 0x7b); in rt2800_init_rfcsr_3290()
7723 rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); in rt2800_init_rfcsr_3290()
7724 rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); in rt2800_init_rfcsr_3290()
7725 rt2800_rfcsr_write(rt2x00dev, 46, 0x73); in rt2800_init_rfcsr_3290()
7726 rt2800_rfcsr_write(rt2x00dev, 47, 0x00); in rt2800_init_rfcsr_3290()
7727 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); in rt2800_init_rfcsr_3290()
7728 rt2800_rfcsr_write(rt2x00dev, 49, 0x98); in rt2800_init_rfcsr_3290()
7729 rt2800_rfcsr_write(rt2x00dev, 52, 0x38); in rt2800_init_rfcsr_3290()
7730 rt2800_rfcsr_write(rt2x00dev, 53, 0x00); in rt2800_init_rfcsr_3290()
7731 rt2800_rfcsr_write(rt2x00dev, 54, 0x78); in rt2800_init_rfcsr_3290()
7732 rt2800_rfcsr_write(rt2x00dev, 55, 0x43); in rt2800_init_rfcsr_3290()
7733 rt2800_rfcsr_write(rt2x00dev, 56, 0x02); in rt2800_init_rfcsr_3290()
7734 rt2800_rfcsr_write(rt2x00dev, 57, 0x80); in rt2800_init_rfcsr_3290()
7735 rt2800_rfcsr_write(rt2x00dev, 58, 0x7f); in rt2800_init_rfcsr_3290()
7736 rt2800_rfcsr_write(rt2x00dev, 59, 0x09); in rt2800_init_rfcsr_3290()
7737 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); in rt2800_init_rfcsr_3290()
7738 rt2800_rfcsr_write(rt2x00dev, 61, 0xc1); in rt2800_init_rfcsr_3290()
7740 rfcsr = rt2800_rfcsr_read(rt2x00dev, 29); in rt2800_init_rfcsr_3290()
7742 rt2800_rfcsr_write(rt2x00dev, 29, rfcsr); in rt2800_init_rfcsr_3290()
7744 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_3290()
7745 rt2800_normal_mode_setup_3xxx(rt2x00dev); in rt2800_init_rfcsr_3290()
7748 static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3352() argument
7751 &rt2x00dev->cap_flags); in rt2800_init_rfcsr_3352()
7753 &rt2x00dev->cap_flags); in rt2800_init_rfcsr_3352()
7756 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_3352()
7758 rt2800_rfcsr_write(rt2x00dev, 0, 0xf0); in rt2800_init_rfcsr_3352()
7759 rt2800_rfcsr_write(rt2x00dev, 1, 0x23); in rt2800_init_rfcsr_3352()
7760 rt2800_rfcsr_write(rt2x00dev, 2, 0x50); in rt2800_init_rfcsr_3352()
7761 rt2800_rfcsr_write(rt2x00dev, 3, 0x18); in rt2800_init_rfcsr_3352()
7762 rt2800_rfcsr_write(rt2x00dev, 4, 0x00); in rt2800_init_rfcsr_3352()
7763 rt2800_rfcsr_write(rt2x00dev, 5, 0x00); in rt2800_init_rfcsr_3352()
7764 rt2800_rfcsr_write(rt2x00dev, 6, 0x33); in rt2800_init_rfcsr_3352()
7765 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_3352()
7766 rt2800_rfcsr_write(rt2x00dev, 8, 0xf1); in rt2800_init_rfcsr_3352()
7767 rt2800_rfcsr_write(rt2x00dev, 9, 0x02); in rt2800_init_rfcsr_3352()
7768 rt2800_rfcsr_write(rt2x00dev, 10, 0xd2); in rt2800_init_rfcsr_3352()
7769 rt2800_rfcsr_write(rt2x00dev, 11, 0x42); in rt2800_init_rfcsr_3352()
7770 rt2800_rfcsr_write(rt2x00dev, 12, 0x1c); in rt2800_init_rfcsr_3352()
7771 rt2800_rfcsr_write(rt2x00dev, 13, 0x00); in rt2800_init_rfcsr_3352()
7772 rt2800_rfcsr_write(rt2x00dev, 14, 0x5a); in rt2800_init_rfcsr_3352()
7773 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_3352()
7774 rt2800_rfcsr_write(rt2x00dev, 16, 0x01); in rt2800_init_rfcsr_3352()
7775 rt2800_rfcsr_write(rt2x00dev, 18, 0x45); in rt2800_init_rfcsr_3352()
7776 rt2800_rfcsr_write(rt2x00dev, 19, 0x02); in rt2800_init_rfcsr_3352()
7777 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_3352()
7778 rt2800_rfcsr_write(rt2x00dev, 21, 0x00); in rt2800_init_rfcsr_3352()
7779 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); in rt2800_init_rfcsr_3352()
7780 rt2800_rfcsr_write(rt2x00dev, 23, 0x00); in rt2800_init_rfcsr_3352()
7781 rt2800_rfcsr_write(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_3352()
7782 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); in rt2800_init_rfcsr_3352()
7783 rt2800_rfcsr_write(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_3352()
7784 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); in rt2800_init_rfcsr_3352()
7785 rt2800_rfcsr_write(rt2x00dev, 28, 0x03); in rt2800_init_rfcsr_3352()
7786 rt2800_rfcsr_write(rt2x00dev, 29, 0x00); in rt2800_init_rfcsr_3352()
7787 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_3352()
7788 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_3352()
7789 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_init_rfcsr_3352()
7790 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_3352()
7796 rt2800_rfcsr_write(rt2x00dev, 34, rfcsr); in rt2800_init_rfcsr_3352()
7797 rt2800_rfcsr_write(rt2x00dev, 35, 0x03); in rt2800_init_rfcsr_3352()
7798 rt2800_rfcsr_write(rt2x00dev, 36, 0xbd); in rt2800_init_rfcsr_3352()
7799 rt2800_rfcsr_write(rt2x00dev, 37, 0x3c); in rt2800_init_rfcsr_3352()
7800 rt2800_rfcsr_write(rt2x00dev, 38, 0x5f); in rt2800_init_rfcsr_3352()
7801 rt2800_rfcsr_write(rt2x00dev, 39, 0xc5); in rt2800_init_rfcsr_3352()
7802 rt2800_rfcsr_write(rt2x00dev, 40, 0x33); in rt2800_init_rfcsr_3352()
7808 rt2800_rfcsr_write(rt2x00dev, 41, rfcsr); in rt2800_init_rfcsr_3352()
7814 rt2800_rfcsr_write(rt2x00dev, 42, rfcsr); in rt2800_init_rfcsr_3352()
7815 rt2800_rfcsr_write(rt2x00dev, 43, 0xdb); in rt2800_init_rfcsr_3352()
7816 rt2800_rfcsr_write(rt2x00dev, 44, 0xdb); in rt2800_init_rfcsr_3352()
7817 rt2800_rfcsr_write(rt2x00dev, 45, 0xdb); in rt2800_init_rfcsr_3352()
7818 rt2800_rfcsr_write(rt2x00dev, 46, 0xdd); in rt2800_init_rfcsr_3352()
7819 rt2800_rfcsr_write(rt2x00dev, 47, 0x0d); in rt2800_init_rfcsr_3352()
7820 rt2800_rfcsr_write(rt2x00dev, 48, 0x14); in rt2800_init_rfcsr_3352()
7821 rt2800_rfcsr_write(rt2x00dev, 49, 0x00); in rt2800_init_rfcsr_3352()
7827 rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); in rt2800_init_rfcsr_3352()
7828 rt2800_rfcsr_write(rt2x00dev, 51, (tx0_ext_pa ? 0x52 : 0x7f)); in rt2800_init_rfcsr_3352()
7829 rt2800_rfcsr_write(rt2x00dev, 52, (tx0_ext_pa ? 0xc0 : 0x00)); in rt2800_init_rfcsr_3352()
7830 rt2800_rfcsr_write(rt2x00dev, 53, (tx0_ext_pa ? 0xd2 : 0x52)); in rt2800_init_rfcsr_3352()
7831 rt2800_rfcsr_write(rt2x00dev, 54, (tx0_ext_pa ? 0xc0 : 0x1b)); in rt2800_init_rfcsr_3352()
7832 rt2800_rfcsr_write(rt2x00dev, 55, (tx1_ext_pa ? 0x52 : 0x7f)); in rt2800_init_rfcsr_3352()
7833 rt2800_rfcsr_write(rt2x00dev, 56, (tx1_ext_pa ? 0xc0 : 0x00)); in rt2800_init_rfcsr_3352()
7834 rt2800_rfcsr_write(rt2x00dev, 57, (tx0_ext_pa ? 0x49 : 0x52)); in rt2800_init_rfcsr_3352()
7835 rt2800_rfcsr_write(rt2x00dev, 58, (tx1_ext_pa ? 0xc0 : 0x1b)); in rt2800_init_rfcsr_3352()
7836 rt2800_rfcsr_write(rt2x00dev, 59, 0x00); in rt2800_init_rfcsr_3352()
7837 rt2800_rfcsr_write(rt2x00dev, 60, 0x00); in rt2800_init_rfcsr_3352()
7838 rt2800_rfcsr_write(rt2x00dev, 61, 0x00); in rt2800_init_rfcsr_3352()
7839 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); in rt2800_init_rfcsr_3352()
7840 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_3352()
7842 rt2800_rx_filter_calibration(rt2x00dev); in rt2800_init_rfcsr_3352()
7843 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_3352()
7844 rt2800_normal_mode_setup_3xxx(rt2x00dev); in rt2800_init_rfcsr_3352()
7847 static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3390() argument
7851 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_3390()
7853 rt2800_rfcsr_write(rt2x00dev, 0, 0xa0); in rt2800_init_rfcsr_3390()
7854 rt2800_rfcsr_write(rt2x00dev, 1, 0xe1); in rt2800_init_rfcsr_3390()
7855 rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); in rt2800_init_rfcsr_3390()
7856 rt2800_rfcsr_write(rt2x00dev, 3, 0x62); in rt2800_init_rfcsr_3390()
7857 rt2800_rfcsr_write(rt2x00dev, 4, 0x40); in rt2800_init_rfcsr_3390()
7858 rt2800_rfcsr_write(rt2x00dev, 5, 0x8b); in rt2800_init_rfcsr_3390()
7859 rt2800_rfcsr_write(rt2x00dev, 6, 0x42); in rt2800_init_rfcsr_3390()
7860 rt2800_rfcsr_write(rt2x00dev, 7, 0x34); in rt2800_init_rfcsr_3390()
7861 rt2800_rfcsr_write(rt2x00dev, 8, 0x00); in rt2800_init_rfcsr_3390()
7862 rt2800_rfcsr_write(rt2x00dev, 9, 0xc0); in rt2800_init_rfcsr_3390()
7863 rt2800_rfcsr_write(rt2x00dev, 10, 0x61); in rt2800_init_rfcsr_3390()
7864 rt2800_rfcsr_write(rt2x00dev, 11, 0x21); in rt2800_init_rfcsr_3390()
7865 rt2800_rfcsr_write(rt2x00dev, 12, 0x3b); in rt2800_init_rfcsr_3390()
7866 rt2800_rfcsr_write(rt2x00dev, 13, 0xe0); in rt2800_init_rfcsr_3390()
7867 rt2800_rfcsr_write(rt2x00dev, 14, 0x90); in rt2800_init_rfcsr_3390()
7868 rt2800_rfcsr_write(rt2x00dev, 15, 0x53); in rt2800_init_rfcsr_3390()
7869 rt2800_rfcsr_write(rt2x00dev, 16, 0xe0); in rt2800_init_rfcsr_3390()
7870 rt2800_rfcsr_write(rt2x00dev, 17, 0x94); in rt2800_init_rfcsr_3390()
7871 rt2800_rfcsr_write(rt2x00dev, 18, 0x5c); in rt2800_init_rfcsr_3390()
7872 rt2800_rfcsr_write(rt2x00dev, 19, 0x4a); in rt2800_init_rfcsr_3390()
7873 rt2800_rfcsr_write(rt2x00dev, 20, 0xb2); in rt2800_init_rfcsr_3390()
7874 rt2800_rfcsr_write(rt2x00dev, 21, 0xf6); in rt2800_init_rfcsr_3390()
7875 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); in rt2800_init_rfcsr_3390()
7876 rt2800_rfcsr_write(rt2x00dev, 23, 0x14); in rt2800_init_rfcsr_3390()
7877 rt2800_rfcsr_write(rt2x00dev, 24, 0x08); in rt2800_init_rfcsr_3390()
7878 rt2800_rfcsr_write(rt2x00dev, 25, 0x3d); in rt2800_init_rfcsr_3390()
7879 rt2800_rfcsr_write(rt2x00dev, 26, 0x85); in rt2800_init_rfcsr_3390()
7880 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_3390()
7881 rt2800_rfcsr_write(rt2x00dev, 28, 0x41); in rt2800_init_rfcsr_3390()
7882 rt2800_rfcsr_write(rt2x00dev, 29, 0x8f); in rt2800_init_rfcsr_3390()
7883 rt2800_rfcsr_write(rt2x00dev, 30, 0x20); in rt2800_init_rfcsr_3390()
7884 rt2800_rfcsr_write(rt2x00dev, 31, 0x0f); in rt2800_init_rfcsr_3390()
7886 reg = rt2800_register_read(rt2x00dev, GPIO_SWITCH); in rt2800_init_rfcsr_3390()
7888 rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); in rt2800_init_rfcsr_3390()
7890 rt2800_rx_filter_calibration(rt2x00dev); in rt2800_init_rfcsr_3390()
7892 if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) in rt2800_init_rfcsr_3390()
7893 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); in rt2800_init_rfcsr_3390()
7895 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_3390()
7896 rt2800_normal_mode_setup_3xxx(rt2x00dev); in rt2800_init_rfcsr_3390()
7899 static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3572() argument
7904 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_3572()
7906 rt2800_rfcsr_write(rt2x00dev, 0, 0x70); in rt2800_init_rfcsr_3572()
7907 rt2800_rfcsr_write(rt2x00dev, 1, 0x81); in rt2800_init_rfcsr_3572()
7908 rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); in rt2800_init_rfcsr_3572()
7909 rt2800_rfcsr_write(rt2x00dev, 3, 0x02); in rt2800_init_rfcsr_3572()
7910 rt2800_rfcsr_write(rt2x00dev, 4, 0x4c); in rt2800_init_rfcsr_3572()
7911 rt2800_rfcsr_write(rt2x00dev, 5, 0x05); in rt2800_init_rfcsr_3572()
7912 rt2800_rfcsr_write(rt2x00dev, 6, 0x4a); in rt2800_init_rfcsr_3572()
7913 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); in rt2800_init_rfcsr_3572()
7914 rt2800_rfcsr_write(rt2x00dev, 9, 0xc3); in rt2800_init_rfcsr_3572()
7915 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); in rt2800_init_rfcsr_3572()
7916 rt2800_rfcsr_write(rt2x00dev, 11, 0xb9); in rt2800_init_rfcsr_3572()
7917 rt2800_rfcsr_write(rt2x00dev, 12, 0x70); in rt2800_init_rfcsr_3572()
7918 rt2800_rfcsr_write(rt2x00dev, 13, 0x65); in rt2800_init_rfcsr_3572()
7919 rt2800_rfcsr_write(rt2x00dev, 14, 0xa0); in rt2800_init_rfcsr_3572()
7920 rt2800_rfcsr_write(rt2x00dev, 15, 0x53); in rt2800_init_rfcsr_3572()
7921 rt2800_rfcsr_write(rt2x00dev, 16, 0x4c); in rt2800_init_rfcsr_3572()
7922 rt2800_rfcsr_write(rt2x00dev, 17, 0x23); in rt2800_init_rfcsr_3572()
7923 rt2800_rfcsr_write(rt2x00dev, 18, 0xac); in rt2800_init_rfcsr_3572()
7924 rt2800_rfcsr_write(rt2x00dev, 19, 0x93); in rt2800_init_rfcsr_3572()
7925 rt2800_rfcsr_write(rt2x00dev, 20, 0xb3); in rt2800_init_rfcsr_3572()
7926 rt2800_rfcsr_write(rt2x00dev, 21, 0xd0); in rt2800_init_rfcsr_3572()
7927 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); in rt2800_init_rfcsr_3572()
7928 rt2800_rfcsr_write(rt2x00dev, 23, 0x3c); in rt2800_init_rfcsr_3572()
7929 rt2800_rfcsr_write(rt2x00dev, 24, 0x16); in rt2800_init_rfcsr_3572()
7930 rt2800_rfcsr_write(rt2x00dev, 25, 0x15); in rt2800_init_rfcsr_3572()
7931 rt2800_rfcsr_write(rt2x00dev, 26, 0x85); in rt2800_init_rfcsr_3572()
7932 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_3572()
7933 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_3572()
7934 rt2800_rfcsr_write(rt2x00dev, 29, 0x9b); in rt2800_init_rfcsr_3572()
7935 rt2800_rfcsr_write(rt2x00dev, 30, 0x09); in rt2800_init_rfcsr_3572()
7936 rt2800_rfcsr_write(rt2x00dev, 31, 0x10); in rt2800_init_rfcsr_3572()
7938 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_init_rfcsr_3572()
7940 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_init_rfcsr_3572()
7942 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_3572()
7945 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_init_rfcsr_3572()
7947 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_3572()
7950 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_init_rfcsr_3572()
7952 rt2800_rx_filter_calibration(rt2x00dev); in rt2800_init_rfcsr_3572()
7953 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_3572()
7954 rt2800_normal_mode_setup_3xxx(rt2x00dev); in rt2800_init_rfcsr_3572()
7957 static void rt3593_post_bbp_init(struct rt2x00_dev *rt2x00dev) in rt3593_post_bbp_init() argument
7962 bbp = rt2800_bbp_read(rt2x00dev, 105); in rt3593_post_bbp_init()
7963 if (rt2x00dev->default_ant.rx_chain_num == 1) in rt3593_post_bbp_init()
7967 rt2800_bbp_write(rt2x00dev, 105, bbp); in rt3593_post_bbp_init()
7969 rt2800_bbp4_mac_if_ctrl(rt2x00dev); in rt3593_post_bbp_init()
7971 rt2800_bbp_write(rt2x00dev, 92, 0x02); in rt3593_post_bbp_init()
7972 rt2800_bbp_write(rt2x00dev, 82, 0x82); in rt3593_post_bbp_init()
7973 rt2800_bbp_write(rt2x00dev, 106, 0x05); in rt3593_post_bbp_init()
7974 rt2800_bbp_write(rt2x00dev, 104, 0x92); in rt3593_post_bbp_init()
7975 rt2800_bbp_write(rt2x00dev, 88, 0x90); in rt3593_post_bbp_init()
7976 rt2800_bbp_write(rt2x00dev, 148, 0xc8); in rt3593_post_bbp_init()
7977 rt2800_bbp_write(rt2x00dev, 47, 0x48); in rt3593_post_bbp_init()
7978 rt2800_bbp_write(rt2x00dev, 120, 0x50); in rt3593_post_bbp_init()
7981 rt2800_bbp_write(rt2x00dev, 163, 0xbd); in rt3593_post_bbp_init()
7983 rt2800_bbp_write(rt2x00dev, 163, 0x9d); in rt3593_post_bbp_init()
7986 rt2800_bbp_write(rt2x00dev, 142, 6); in rt3593_post_bbp_init()
7987 rt2800_bbp_write(rt2x00dev, 143, 160); in rt3593_post_bbp_init()
7988 rt2800_bbp_write(rt2x00dev, 142, 7); in rt3593_post_bbp_init()
7989 rt2800_bbp_write(rt2x00dev, 143, 161); in rt3593_post_bbp_init()
7990 rt2800_bbp_write(rt2x00dev, 142, 8); in rt3593_post_bbp_init()
7991 rt2800_bbp_write(rt2x00dev, 143, 162); in rt3593_post_bbp_init()
7994 rt2800_bbp_write(rt2x00dev, 31, 0x08); in rt3593_post_bbp_init()
7997 rt2800_bbp_write(rt2x00dev, 68, 0x0b); in rt3593_post_bbp_init()
8000 rt2800_bbp_write(rt2x00dev, 105, 0x04); in rt3593_post_bbp_init()
8004 static void rt2800_init_rfcsr_3593(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3593() argument
8006 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_init_rfcsr_3593()
8011 reg = rt2800_register_read(rt2x00dev, GPIO_SWITCH); in rt2800_init_rfcsr_3593()
8014 rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); in rt2800_init_rfcsr_3593()
8017 rt2800_rfcsr_write(rt2x00dev, 1, 0x03); in rt2800_init_rfcsr_3593()
8018 rt2800_rfcsr_write(rt2x00dev, 3, 0x80); in rt2800_init_rfcsr_3593()
8019 rt2800_rfcsr_write(rt2x00dev, 5, 0x00); in rt2800_init_rfcsr_3593()
8020 rt2800_rfcsr_write(rt2x00dev, 6, 0x40); in rt2800_init_rfcsr_3593()
8021 rt2800_rfcsr_write(rt2x00dev, 8, 0xf1); in rt2800_init_rfcsr_3593()
8022 rt2800_rfcsr_write(rt2x00dev, 9, 0x02); in rt2800_init_rfcsr_3593()
8023 rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); in rt2800_init_rfcsr_3593()
8024 rt2800_rfcsr_write(rt2x00dev, 11, 0x40); in rt2800_init_rfcsr_3593()
8025 rt2800_rfcsr_write(rt2x00dev, 12, 0x4e); in rt2800_init_rfcsr_3593()
8026 rt2800_rfcsr_write(rt2x00dev, 13, 0x12); in rt2800_init_rfcsr_3593()
8027 rt2800_rfcsr_write(rt2x00dev, 18, 0x40); in rt2800_init_rfcsr_3593()
8028 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_3593()
8029 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_3593()
8030 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_3593()
8031 rt2800_rfcsr_write(rt2x00dev, 32, 0x78); in rt2800_init_rfcsr_3593()
8032 rt2800_rfcsr_write(rt2x00dev, 33, 0x3b); in rt2800_init_rfcsr_3593()
8033 rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); in rt2800_init_rfcsr_3593()
8034 rt2800_rfcsr_write(rt2x00dev, 35, 0xe0); in rt2800_init_rfcsr_3593()
8035 rt2800_rfcsr_write(rt2x00dev, 38, 0x86); in rt2800_init_rfcsr_3593()
8036 rt2800_rfcsr_write(rt2x00dev, 39, 0x23); in rt2800_init_rfcsr_3593()
8037 rt2800_rfcsr_write(rt2x00dev, 44, 0xd3); in rt2800_init_rfcsr_3593()
8038 rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); in rt2800_init_rfcsr_3593()
8039 rt2800_rfcsr_write(rt2x00dev, 46, 0x60); in rt2800_init_rfcsr_3593()
8040 rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); in rt2800_init_rfcsr_3593()
8041 rt2800_rfcsr_write(rt2x00dev, 50, 0x86); in rt2800_init_rfcsr_3593()
8042 rt2800_rfcsr_write(rt2x00dev, 51, 0x75); in rt2800_init_rfcsr_3593()
8043 rt2800_rfcsr_write(rt2x00dev, 52, 0x45); in rt2800_init_rfcsr_3593()
8044 rt2800_rfcsr_write(rt2x00dev, 53, 0x18); in rt2800_init_rfcsr_3593()
8045 rt2800_rfcsr_write(rt2x00dev, 54, 0x18); in rt2800_init_rfcsr_3593()
8046 rt2800_rfcsr_write(rt2x00dev, 55, 0x18); in rt2800_init_rfcsr_3593()
8047 rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); in rt2800_init_rfcsr_3593()
8048 rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); in rt2800_init_rfcsr_3593()
8052 rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); in rt2800_init_rfcsr_3593()
8054 rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); in rt2800_init_rfcsr_3593()
8056 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_init_rfcsr_3593()
8058 rfcsr = rt2800_rfcsr_read(rt2x00dev, 18); in rt2800_init_rfcsr_3593()
8060 rt2800_rfcsr_write(rt2x00dev, 18, rfcsr); in rt2800_init_rfcsr_3593()
8062 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_3593()
8065 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); in rt2800_init_rfcsr_3593()
8067 reg = rt2800_register_read(rt2x00dev, LDO_CFG0); in rt2800_init_rfcsr_3593()
8069 rt2800_register_write(rt2x00dev, LDO_CFG0, reg); 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()
8079 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_3593()
8080 rt2800_normal_mode_setup_3593(rt2x00dev); in rt2800_init_rfcsr_3593()
8082 rt3593_post_bbp_init(rt2x00dev); in rt2800_init_rfcsr_3593()
8087 static void rt2800_init_rfcsr_5350(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_5350() argument
8089 rt2800_rfcsr_write(rt2x00dev, 0, 0xf0); in rt2800_init_rfcsr_5350()
8090 rt2800_rfcsr_write(rt2x00dev, 1, 0x23); in rt2800_init_rfcsr_5350()
8091 rt2800_rfcsr_write(rt2x00dev, 2, 0x50); in rt2800_init_rfcsr_5350()
8092 rt2800_rfcsr_write(rt2x00dev, 3, 0x08); in rt2800_init_rfcsr_5350()
8093 rt2800_rfcsr_write(rt2x00dev, 4, 0x49); in rt2800_init_rfcsr_5350()
8094 rt2800_rfcsr_write(rt2x00dev, 5, 0x10); in rt2800_init_rfcsr_5350()
8095 rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); in rt2800_init_rfcsr_5350()
8096 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_5350()
8097 rt2800_rfcsr_write(rt2x00dev, 8, 0xf1); in rt2800_init_rfcsr_5350()
8098 rt2800_rfcsr_write(rt2x00dev, 9, 0x02); in rt2800_init_rfcsr_5350()
8099 rt2800_rfcsr_write(rt2x00dev, 10, 0x53); in rt2800_init_rfcsr_5350()
8100 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); in rt2800_init_rfcsr_5350()
8101 rt2800_rfcsr_write(rt2x00dev, 12, 0x46); in rt2800_init_rfcsr_5350()
8102 if (rt2800_clk_is_20mhz(rt2x00dev)) in rt2800_init_rfcsr_5350()
8103 rt2800_rfcsr_write(rt2x00dev, 13, 0x1f); in rt2800_init_rfcsr_5350()
8105 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); in rt2800_init_rfcsr_5350()
8106 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); in rt2800_init_rfcsr_5350()
8107 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_5350()
8108 rt2800_rfcsr_write(rt2x00dev, 16, 0xc0); in rt2800_init_rfcsr_5350()
8109 rt2800_rfcsr_write(rt2x00dev, 18, 0x03); in rt2800_init_rfcsr_5350()
8110 rt2800_rfcsr_write(rt2x00dev, 19, 0x00); in rt2800_init_rfcsr_5350()
8111 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_5350()
8112 rt2800_rfcsr_write(rt2x00dev, 21, 0x00); in rt2800_init_rfcsr_5350()
8113 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_5350()
8114 rt2800_rfcsr_write(rt2x00dev, 23, 0x00); in rt2800_init_rfcsr_5350()
8115 rt2800_rfcsr_write(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_5350()
8116 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); in rt2800_init_rfcsr_5350()
8117 rt2800_rfcsr_write(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_5350()
8118 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); in rt2800_init_rfcsr_5350()
8119 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_5350()
8120 rt2800_rfcsr_write(rt2x00dev, 29, 0xd0); in rt2800_init_rfcsr_5350()
8121 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_5350()
8122 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_5350()
8123 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_init_rfcsr_5350()
8124 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_5350()
8125 rt2800_rfcsr_write(rt2x00dev, 34, 0x07); in rt2800_init_rfcsr_5350()
8126 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); in rt2800_init_rfcsr_5350()
8127 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_5350()
8128 rt2800_rfcsr_write(rt2x00dev, 37, 0x08); in rt2800_init_rfcsr_5350()
8129 rt2800_rfcsr_write(rt2x00dev, 38, 0x85); in rt2800_init_rfcsr_5350()
8130 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); in rt2800_init_rfcsr_5350()
8131 rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); in rt2800_init_rfcsr_5350()
8132 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); in rt2800_init_rfcsr_5350()
8133 rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); in rt2800_init_rfcsr_5350()
8134 rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); in rt2800_init_rfcsr_5350()
8135 rt2800_rfcsr_write(rt2x00dev, 44, 0x0c); in rt2800_init_rfcsr_5350()
8136 rt2800_rfcsr_write(rt2x00dev, 45, 0xa6); in rt2800_init_rfcsr_5350()
8137 rt2800_rfcsr_write(rt2x00dev, 46, 0x73); in rt2800_init_rfcsr_5350()
8138 rt2800_rfcsr_write(rt2x00dev, 47, 0x00); in rt2800_init_rfcsr_5350()
8139 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); in rt2800_init_rfcsr_5350()
8140 rt2800_rfcsr_write(rt2x00dev, 49, 0x80); in rt2800_init_rfcsr_5350()
8141 rt2800_rfcsr_write(rt2x00dev, 50, 0x00); in rt2800_init_rfcsr_5350()
8142 rt2800_rfcsr_write(rt2x00dev, 51, 0x00); in rt2800_init_rfcsr_5350()
8143 rt2800_rfcsr_write(rt2x00dev, 52, 0x38); in rt2800_init_rfcsr_5350()
8144 rt2800_rfcsr_write(rt2x00dev, 53, 0x00); in rt2800_init_rfcsr_5350()
8145 rt2800_rfcsr_write(rt2x00dev, 54, 0x38); in rt2800_init_rfcsr_5350()
8146 rt2800_rfcsr_write(rt2x00dev, 55, 0x43); in rt2800_init_rfcsr_5350()
8147 rt2800_rfcsr_write(rt2x00dev, 56, 0x82); in rt2800_init_rfcsr_5350()
8148 rt2800_rfcsr_write(rt2x00dev, 57, 0x00); in rt2800_init_rfcsr_5350()
8149 rt2800_rfcsr_write(rt2x00dev, 58, 0x39); in rt2800_init_rfcsr_5350()
8150 rt2800_rfcsr_write(rt2x00dev, 59, 0x0b); in rt2800_init_rfcsr_5350()
8151 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); in rt2800_init_rfcsr_5350()
8152 rt2800_rfcsr_write(rt2x00dev, 61, 0xd1); in rt2800_init_rfcsr_5350()
8153 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); in rt2800_init_rfcsr_5350()
8154 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_5350()
8157 static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_3883() argument
8164 rt2800_rf_init_calibration(rt2x00dev, 2); in rt2800_init_rfcsr_3883()
8166 rt2800_rfcsr_write(rt2x00dev, 0, 0xe0); in rt2800_init_rfcsr_3883()
8167 rt2800_rfcsr_write(rt2x00dev, 1, 0x03); in rt2800_init_rfcsr_3883()
8168 rt2800_rfcsr_write(rt2x00dev, 2, 0x50); in rt2800_init_rfcsr_3883()
8169 rt2800_rfcsr_write(rt2x00dev, 3, 0x20); in rt2800_init_rfcsr_3883()
8170 rt2800_rfcsr_write(rt2x00dev, 4, 0x00); in rt2800_init_rfcsr_3883()
8171 rt2800_rfcsr_write(rt2x00dev, 5, 0x00); in rt2800_init_rfcsr_3883()
8172 rt2800_rfcsr_write(rt2x00dev, 6, 0x40); in rt2800_init_rfcsr_3883()
8173 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_3883()
8174 rt2800_rfcsr_write(rt2x00dev, 8, 0x5b); in rt2800_init_rfcsr_3883()
8175 rt2800_rfcsr_write(rt2x00dev, 9, 0x08); in rt2800_init_rfcsr_3883()
8176 rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); in rt2800_init_rfcsr_3883()
8177 rt2800_rfcsr_write(rt2x00dev, 11, 0x48); in rt2800_init_rfcsr_3883()
8178 rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); in rt2800_init_rfcsr_3883()
8179 rt2800_rfcsr_write(rt2x00dev, 13, 0x12); in rt2800_init_rfcsr_3883()
8180 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); in rt2800_init_rfcsr_3883()
8181 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_3883()
8182 rt2800_rfcsr_write(rt2x00dev, 16, 0x00); in rt2800_init_rfcsr_3883()
8188 rt2800_rfcsr_write(rt2x00dev, 18, 0x40); in rt2800_init_rfcsr_3883()
8189 rt2800_rfcsr_write(rt2x00dev, 19, 0x00); in rt2800_init_rfcsr_3883()
8190 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_3883()
8191 rt2800_rfcsr_write(rt2x00dev, 21, 0x00); in rt2800_init_rfcsr_3883()
8192 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_3883()
8193 rt2800_rfcsr_write(rt2x00dev, 23, 0xc0); in rt2800_init_rfcsr_3883()
8194 rt2800_rfcsr_write(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_3883()
8195 rt2800_rfcsr_write(rt2x00dev, 25, 0x00); in rt2800_init_rfcsr_3883()
8196 rt2800_rfcsr_write(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_3883()
8197 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_3883()
8198 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_3883()
8199 rt2800_rfcsr_write(rt2x00dev, 29, 0x00); in rt2800_init_rfcsr_3883()
8200 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_3883()
8201 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_3883()
8202 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_init_rfcsr_3883()
8203 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_3883()
8204 rt2800_rfcsr_write(rt2x00dev, 34, 0x20); in rt2800_init_rfcsr_3883()
8205 rt2800_rfcsr_write(rt2x00dev, 35, 0x00); in rt2800_init_rfcsr_3883()
8206 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_3883()
8207 rt2800_rfcsr_write(rt2x00dev, 37, 0x00); in rt2800_init_rfcsr_3883()
8208 rt2800_rfcsr_write(rt2x00dev, 38, 0x86); in rt2800_init_rfcsr_3883()
8209 rt2800_rfcsr_write(rt2x00dev, 39, 0x23); in rt2800_init_rfcsr_3883()
8210 rt2800_rfcsr_write(rt2x00dev, 40, 0x00); in rt2800_init_rfcsr_3883()
8211 rt2800_rfcsr_write(rt2x00dev, 41, 0x00); in rt2800_init_rfcsr_3883()
8212 rt2800_rfcsr_write(rt2x00dev, 42, 0x00); in rt2800_init_rfcsr_3883()
8213 rt2800_rfcsr_write(rt2x00dev, 43, 0x00); in rt2800_init_rfcsr_3883()
8214 rt2800_rfcsr_write(rt2x00dev, 44, 0x93); in rt2800_init_rfcsr_3883()
8215 rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); in rt2800_init_rfcsr_3883()
8216 rt2800_rfcsr_write(rt2x00dev, 46, 0x60); in rt2800_init_rfcsr_3883()
8217 rt2800_rfcsr_write(rt2x00dev, 47, 0x00); in rt2800_init_rfcsr_3883()
8218 rt2800_rfcsr_write(rt2x00dev, 48, 0x00); in rt2800_init_rfcsr_3883()
8219 rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); in rt2800_init_rfcsr_3883()
8220 rt2800_rfcsr_write(rt2x00dev, 50, 0x86); in rt2800_init_rfcsr_3883()
8221 rt2800_rfcsr_write(rt2x00dev, 51, 0x51); in rt2800_init_rfcsr_3883()
8222 rt2800_rfcsr_write(rt2x00dev, 52, 0x05); in rt2800_init_rfcsr_3883()
8223 rt2800_rfcsr_write(rt2x00dev, 53, 0x76); in rt2800_init_rfcsr_3883()
8224 rt2800_rfcsr_write(rt2x00dev, 54, 0x76); in rt2800_init_rfcsr_3883()
8225 rt2800_rfcsr_write(rt2x00dev, 55, 0x76); in rt2800_init_rfcsr_3883()
8226 rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); in rt2800_init_rfcsr_3883()
8227 rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); in rt2800_init_rfcsr_3883()
8228 rt2800_rfcsr_write(rt2x00dev, 58, 0x00); in rt2800_init_rfcsr_3883()
8229 rt2800_rfcsr_write(rt2x00dev, 59, 0x00); in rt2800_init_rfcsr_3883()
8230 rt2800_rfcsr_write(rt2x00dev, 60, 0x00); in rt2800_init_rfcsr_3883()
8231 rt2800_rfcsr_write(rt2x00dev, 61, 0x00); in rt2800_init_rfcsr_3883()
8232 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); in rt2800_init_rfcsr_3883()
8233 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_3883()
8237 rt2800_bbp_write(rt2x00dev, 137, 0x0f); in rt2800_init_rfcsr_3883()
8239 rt2800_bbp_write(rt2x00dev, 163, 0x9d); in rt2800_init_rfcsr_3883()
8241 rt2800_bbp_write(rt2x00dev, 105, 0x05); in rt2800_init_rfcsr_3883()
8243 rt2800_bbp_write(rt2x00dev, 179, 0x02); in rt2800_init_rfcsr_3883()
8244 rt2800_bbp_write(rt2x00dev, 180, 0x00); in rt2800_init_rfcsr_3883()
8245 rt2800_bbp_write(rt2x00dev, 182, 0x40); in rt2800_init_rfcsr_3883()
8246 rt2800_bbp_write(rt2x00dev, 180, 0x01); in rt2800_init_rfcsr_3883()
8247 rt2800_bbp_write(rt2x00dev, 182, 0x9c); in rt2800_init_rfcsr_3883()
8249 rt2800_bbp_write(rt2x00dev, 179, 0x00); in rt2800_init_rfcsr_3883()
8251 rt2800_bbp_write(rt2x00dev, 142, 0x04); in rt2800_init_rfcsr_3883()
8252 rt2800_bbp_write(rt2x00dev, 143, 0x3b); in rt2800_init_rfcsr_3883()
8253 rt2800_bbp_write(rt2x00dev, 142, 0x06); in rt2800_init_rfcsr_3883()
8254 rt2800_bbp_write(rt2x00dev, 143, 0xa0); in rt2800_init_rfcsr_3883()
8255 rt2800_bbp_write(rt2x00dev, 142, 0x07); in rt2800_init_rfcsr_3883()
8256 rt2800_bbp_write(rt2x00dev, 143, 0xa1); in rt2800_init_rfcsr_3883()
8257 rt2800_bbp_write(rt2x00dev, 142, 0x08); in rt2800_init_rfcsr_3883()
8258 rt2800_bbp_write(rt2x00dev, 143, 0xa2); in rt2800_init_rfcsr_3883()
8259 rt2800_bbp_write(rt2x00dev, 148, 0xc8); in rt2800_init_rfcsr_3883()
8262 rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); in rt2800_init_rfcsr_3883()
8263 rt2800_rfcsr_write(rt2x00dev, 33, 0x32); in rt2800_init_rfcsr_3883()
8266 rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); in rt2800_init_rfcsr_3883()
8269 rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); in rt2800_init_rfcsr_3883()
8272 rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); in rt2800_init_rfcsr_3883()
8274 rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); in rt2800_init_rfcsr_3883()
8276 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); in rt2800_init_rfcsr_3883()
8278 rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); in rt2800_init_rfcsr_3883()
8280 rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); in rt2800_init_rfcsr_3883()
8282 rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); in rt2800_init_rfcsr_3883()
8284 rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); in rt2800_init_rfcsr_3883()
8286 rfcsr = rt2800_rfcsr_read(rt2x00dev, 46); in rt2800_init_rfcsr_3883()
8288 rt2800_rfcsr_write(rt2x00dev, 46, rfcsr); in rt2800_init_rfcsr_3883()
8290 rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); in rt2800_init_rfcsr_3883()
8292 rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); in rt2800_init_rfcsr_3883()
8295 static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_5390() argument
8297 rt2800_rf_init_calibration(rt2x00dev, 2); in rt2800_init_rfcsr_5390()
8299 rt2800_rfcsr_write(rt2x00dev, 1, 0x0f); in rt2800_init_rfcsr_5390()
8300 rt2800_rfcsr_write(rt2x00dev, 2, 0x80); in rt2800_init_rfcsr_5390()
8301 rt2800_rfcsr_write(rt2x00dev, 3, 0x88); in rt2800_init_rfcsr_5390()
8302 rt2800_rfcsr_write(rt2x00dev, 5, 0x10); in rt2800_init_rfcsr_5390()
8303 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) in rt2800_init_rfcsr_5390()
8304 rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); in rt2800_init_rfcsr_5390()
8306 rt2800_rfcsr_write(rt2x00dev, 6, 0xa0); in rt2800_init_rfcsr_5390()
8307 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_5390()
8308 rt2800_rfcsr_write(rt2x00dev, 10, 0x53); in rt2800_init_rfcsr_5390()
8309 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); in rt2800_init_rfcsr_5390()
8310 rt2800_rfcsr_write(rt2x00dev, 12, 0x46); in rt2800_init_rfcsr_5390()
8311 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); in rt2800_init_rfcsr_5390()
8312 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); in rt2800_init_rfcsr_5390()
8313 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_5390()
8314 rt2800_rfcsr_write(rt2x00dev, 16, 0x00); in rt2800_init_rfcsr_5390()
8315 rt2800_rfcsr_write(rt2x00dev, 18, 0x03); in rt2800_init_rfcsr_5390()
8316 rt2800_rfcsr_write(rt2x00dev, 19, 0x00); in rt2800_init_rfcsr_5390()
8318 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_5390()
8319 rt2800_rfcsr_write(rt2x00dev, 21, 0x00); in rt2800_init_rfcsr_5390()
8320 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_5390()
8321 rt2800_rfcsr_write(rt2x00dev, 23, 0x00); in rt2800_init_rfcsr_5390()
8322 rt2800_rfcsr_write(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_5390()
8323 if (rt2x00_is_usb(rt2x00dev) && in rt2800_init_rfcsr_5390()
8324 rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) in rt2800_init_rfcsr_5390()
8325 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); in rt2800_init_rfcsr_5390()
8327 rt2800_rfcsr_write(rt2x00dev, 25, 0xc0); in rt2800_init_rfcsr_5390()
8328 rt2800_rfcsr_write(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_5390()
8329 rt2800_rfcsr_write(rt2x00dev, 27, 0x09); in rt2800_init_rfcsr_5390()
8330 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_5390()
8331 rt2800_rfcsr_write(rt2x00dev, 29, 0x10); in rt2800_init_rfcsr_5390()
8333 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_5390()
8334 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_5390()
8335 rt2800_rfcsr_write(rt2x00dev, 32, 0x80); in rt2800_init_rfcsr_5390()
8336 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_5390()
8337 rt2800_rfcsr_write(rt2x00dev, 34, 0x07); in rt2800_init_rfcsr_5390()
8338 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); in rt2800_init_rfcsr_5390()
8339 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_5390()
8340 rt2800_rfcsr_write(rt2x00dev, 37, 0x08); in rt2800_init_rfcsr_5390()
8341 rt2800_rfcsr_write(rt2x00dev, 38, 0x85); in rt2800_init_rfcsr_5390()
8342 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); in rt2800_init_rfcsr_5390()
8344 rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); in rt2800_init_rfcsr_5390()
8345 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); in rt2800_init_rfcsr_5390()
8346 rt2800_rfcsr_write(rt2x00dev, 42, 0xd2); in rt2800_init_rfcsr_5390()
8347 rt2800_rfcsr_write(rt2x00dev, 43, 0x9a); in rt2800_init_rfcsr_5390()
8348 rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); in rt2800_init_rfcsr_5390()
8349 rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); in rt2800_init_rfcsr_5390()
8350 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) in rt2800_init_rfcsr_5390()
8351 rt2800_rfcsr_write(rt2x00dev, 46, 0x73); in rt2800_init_rfcsr_5390()
8353 rt2800_rfcsr_write(rt2x00dev, 46, 0x7b); in rt2800_init_rfcsr_5390()
8354 rt2800_rfcsr_write(rt2x00dev, 47, 0x00); in rt2800_init_rfcsr_5390()
8355 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); in rt2800_init_rfcsr_5390()
8356 rt2800_rfcsr_write(rt2x00dev, 49, 0x94); in rt2800_init_rfcsr_5390()
8358 rt2800_rfcsr_write(rt2x00dev, 52, 0x38); in rt2800_init_rfcsr_5390()
8359 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) in rt2800_init_rfcsr_5390()
8360 rt2800_rfcsr_write(rt2x00dev, 53, 0x00); in rt2800_init_rfcsr_5390()
8362 rt2800_rfcsr_write(rt2x00dev, 53, 0x84); in rt2800_init_rfcsr_5390()
8363 rt2800_rfcsr_write(rt2x00dev, 54, 0x78); in rt2800_init_rfcsr_5390()
8364 rt2800_rfcsr_write(rt2x00dev, 55, 0x44); in rt2800_init_rfcsr_5390()
8365 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) in rt2800_init_rfcsr_5390()
8366 rt2800_rfcsr_write(rt2x00dev, 56, 0x42); in rt2800_init_rfcsr_5390()
8368 rt2800_rfcsr_write(rt2x00dev, 56, 0x22); in rt2800_init_rfcsr_5390()
8369 rt2800_rfcsr_write(rt2x00dev, 57, 0x80); in rt2800_init_rfcsr_5390()
8370 rt2800_rfcsr_write(rt2x00dev, 58, 0x7f); in rt2800_init_rfcsr_5390()
8371 rt2800_rfcsr_write(rt2x00dev, 59, 0x8f); in rt2800_init_rfcsr_5390()
8373 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); in rt2800_init_rfcsr_5390()
8374 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { in rt2800_init_rfcsr_5390()
8375 if (rt2x00_is_usb(rt2x00dev)) in rt2800_init_rfcsr_5390()
8376 rt2800_rfcsr_write(rt2x00dev, 61, 0xd1); in rt2800_init_rfcsr_5390()
8378 rt2800_rfcsr_write(rt2x00dev, 61, 0xd5); in rt2800_init_rfcsr_5390()
8380 if (rt2x00_is_usb(rt2x00dev)) in rt2800_init_rfcsr_5390()
8381 rt2800_rfcsr_write(rt2x00dev, 61, 0xdd); in rt2800_init_rfcsr_5390()
8383 rt2800_rfcsr_write(rt2x00dev, 61, 0xb5); in rt2800_init_rfcsr_5390()
8385 rt2800_rfcsr_write(rt2x00dev, 62, 0x00); in rt2800_init_rfcsr_5390()
8386 rt2800_rfcsr_write(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_5390()
8388 rt2800_normal_mode_setup_5xxx(rt2x00dev); in rt2800_init_rfcsr_5390()
8390 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_5390()
8393 static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_5392() argument
8395 rt2800_rf_init_calibration(rt2x00dev, 2); in rt2800_init_rfcsr_5392()
8397 rt2800_rfcsr_write(rt2x00dev, 1, 0x17); in rt2800_init_rfcsr_5392()
8398 rt2800_rfcsr_write(rt2x00dev, 3, 0x88); in rt2800_init_rfcsr_5392()
8399 rt2800_rfcsr_write(rt2x00dev, 5, 0x10); in rt2800_init_rfcsr_5392()
8400 rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); in rt2800_init_rfcsr_5392()
8401 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_5392()
8402 rt2800_rfcsr_write(rt2x00dev, 10, 0x53); in rt2800_init_rfcsr_5392()
8403 rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); in rt2800_init_rfcsr_5392()
8404 rt2800_rfcsr_write(rt2x00dev, 12, 0x46); in rt2800_init_rfcsr_5392()
8405 rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); in rt2800_init_rfcsr_5392()
8406 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); in rt2800_init_rfcsr_5392()
8407 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_5392()
8408 rt2800_rfcsr_write(rt2x00dev, 16, 0x00); in rt2800_init_rfcsr_5392()
8409 rt2800_rfcsr_write(rt2x00dev, 18, 0x03); in rt2800_init_rfcsr_5392()
8410 rt2800_rfcsr_write(rt2x00dev, 19, 0x4d); in rt2800_init_rfcsr_5392()
8411 rt2800_rfcsr_write(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_5392()
8412 rt2800_rfcsr_write(rt2x00dev, 21, 0x8d); in rt2800_init_rfcsr_5392()
8413 rt2800_rfcsr_write(rt2x00dev, 22, 0x20); in rt2800_init_rfcsr_5392()
8414 rt2800_rfcsr_write(rt2x00dev, 23, 0x0b); in rt2800_init_rfcsr_5392()
8415 rt2800_rfcsr_write(rt2x00dev, 24, 0x44); in rt2800_init_rfcsr_5392()
8416 rt2800_rfcsr_write(rt2x00dev, 25, 0x80); in rt2800_init_rfcsr_5392()
8417 rt2800_rfcsr_write(rt2x00dev, 26, 0x82); in rt2800_init_rfcsr_5392()
8418 rt2800_rfcsr_write(rt2x00dev, 27, 0x09); in rt2800_init_rfcsr_5392()
8419 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_5392()
8420 rt2800_rfcsr_write(rt2x00dev, 29, 0x10); in rt2800_init_rfcsr_5392()
8421 rt2800_rfcsr_write(rt2x00dev, 30, 0x10); in rt2800_init_rfcsr_5392()
8422 rt2800_rfcsr_write(rt2x00dev, 31, 0x80); in rt2800_init_rfcsr_5392()
8423 rt2800_rfcsr_write(rt2x00dev, 32, 0x20); in rt2800_init_rfcsr_5392()
8424 rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); in rt2800_init_rfcsr_5392()
8425 rt2800_rfcsr_write(rt2x00dev, 34, 0x07); in rt2800_init_rfcsr_5392()
8426 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); in rt2800_init_rfcsr_5392()
8427 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_5392()
8428 rt2800_rfcsr_write(rt2x00dev, 37, 0x08); in rt2800_init_rfcsr_5392()
8429 rt2800_rfcsr_write(rt2x00dev, 38, 0x89); in rt2800_init_rfcsr_5392()
8430 rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); in rt2800_init_rfcsr_5392()
8431 rt2800_rfcsr_write(rt2x00dev, 40, 0x0f); in rt2800_init_rfcsr_5392()
8432 rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); in rt2800_init_rfcsr_5392()
8433 rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); in rt2800_init_rfcsr_5392()
8434 rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); in rt2800_init_rfcsr_5392()
8435 rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); in rt2800_init_rfcsr_5392()
8436 rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); in rt2800_init_rfcsr_5392()
8437 rt2800_rfcsr_write(rt2x00dev, 46, 0x73); in rt2800_init_rfcsr_5392()
8438 rt2800_rfcsr_write(rt2x00dev, 47, 0x0c); in rt2800_init_rfcsr_5392()
8439 rt2800_rfcsr_write(rt2x00dev, 48, 0x10); in rt2800_init_rfcsr_5392()
8440 rt2800_rfcsr_write(rt2x00dev, 49, 0x94); in rt2800_init_rfcsr_5392()
8441 rt2800_rfcsr_write(rt2x00dev, 50, 0x94); in rt2800_init_rfcsr_5392()
8442 rt2800_rfcsr_write(rt2x00dev, 51, 0x3a); in rt2800_init_rfcsr_5392()
8443 rt2800_rfcsr_write(rt2x00dev, 52, 0x48); in rt2800_init_rfcsr_5392()
8444 rt2800_rfcsr_write(rt2x00dev, 53, 0x44); in rt2800_init_rfcsr_5392()
8445 rt2800_rfcsr_write(rt2x00dev, 54, 0x38); in rt2800_init_rfcsr_5392()
8446 rt2800_rfcsr_write(rt2x00dev, 55, 0x43); in rt2800_init_rfcsr_5392()
8447 rt2800_rfcsr_write(rt2x00dev, 56, 0xa1); in rt2800_init_rfcsr_5392()
8448 rt2800_rfcsr_write(rt2x00dev, 57, 0x00); in rt2800_init_rfcsr_5392()
8449 rt2800_rfcsr_write(rt2x00dev, 58, 0x39); in rt2800_init_rfcsr_5392()
8450 rt2800_rfcsr_write(rt2x00dev, 59, 0x07); in rt2800_init_rfcsr_5392()
8451 rt2800_rfcsr_write(rt2x00dev, 60, 0x45); in rt2800_init_rfcsr_5392()
8452 rt2800_rfcsr_write(rt2x00dev, 61, 0x91); in rt2800_init_rfcsr_5392()
8453 rt2800_rfcsr_write(rt2x00dev, 62, 0x39); in rt2800_init_rfcsr_5392()
8454 rt2800_rfcsr_write(rt2x00dev, 63, 0x07); in rt2800_init_rfcsr_5392()
8456 rt2800_normal_mode_setup_5xxx(rt2x00dev); in rt2800_init_rfcsr_5392()
8458 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_5392()
8461 static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_5592() argument
8463 rt2800_rf_init_calibration(rt2x00dev, 30); in rt2800_init_rfcsr_5592()
8465 rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); in rt2800_init_rfcsr_5592()
8466 rt2800_rfcsr_write(rt2x00dev, 3, 0x08); in rt2800_init_rfcsr_5592()
8467 rt2800_rfcsr_write(rt2x00dev, 5, 0x10); in rt2800_init_rfcsr_5592()
8468 rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); in rt2800_init_rfcsr_5592()
8469 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_5592()
8470 rt2800_rfcsr_write(rt2x00dev, 14, 0x00); in rt2800_init_rfcsr_5592()
8471 rt2800_rfcsr_write(rt2x00dev, 15, 0x00); in rt2800_init_rfcsr_5592()
8472 rt2800_rfcsr_write(rt2x00dev, 16, 0x00); in rt2800_init_rfcsr_5592()
8473 rt2800_rfcsr_write(rt2x00dev, 18, 0x03); in rt2800_init_rfcsr_5592()
8474 rt2800_rfcsr_write(rt2x00dev, 19, 0x4D); in rt2800_init_rfcsr_5592()
8475 rt2800_rfcsr_write(rt2x00dev, 20, 0x10); in rt2800_init_rfcsr_5592()
8476 rt2800_rfcsr_write(rt2x00dev, 21, 0x8D); in rt2800_init_rfcsr_5592()
8477 rt2800_rfcsr_write(rt2x00dev, 26, 0x82); in rt2800_init_rfcsr_5592()
8478 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_5592()
8479 rt2800_rfcsr_write(rt2x00dev, 29, 0x10); in rt2800_init_rfcsr_5592()
8480 rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); in rt2800_init_rfcsr_5592()
8481 rt2800_rfcsr_write(rt2x00dev, 34, 0x07); in rt2800_init_rfcsr_5592()
8482 rt2800_rfcsr_write(rt2x00dev, 35, 0x12); in rt2800_init_rfcsr_5592()
8483 rt2800_rfcsr_write(rt2x00dev, 47, 0x0C); in rt2800_init_rfcsr_5592()
8484 rt2800_rfcsr_write(rt2x00dev, 53, 0x22); in rt2800_init_rfcsr_5592()
8485 rt2800_rfcsr_write(rt2x00dev, 63, 0x07); in rt2800_init_rfcsr_5592()
8487 rt2800_rfcsr_write(rt2x00dev, 2, 0x80); in rt2800_init_rfcsr_5592()
8490 rt2800_freq_cal_mode1(rt2x00dev); in rt2800_init_rfcsr_5592()
8493 if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) in rt2800_init_rfcsr_5592()
8494 rt2800_bbp_write(rt2x00dev, 103, 0xc0); in rt2800_init_rfcsr_5592()
8496 rt2800_normal_mode_setup_5xxx(rt2x00dev); in rt2800_init_rfcsr_5592()
8498 if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C)) in rt2800_init_rfcsr_5592()
8499 rt2800_rfcsr_write(rt2x00dev, 27, 0x03); in rt2800_init_rfcsr_5592()
8501 rt2800_led_open_drain_enable(rt2x00dev); in rt2800_init_rfcsr_5592()
8504 static void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) in rt2800_rf_self_txdc_cal() argument
8510 mac0518 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_rf_self_txdc_cal()
8511 mac051c = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_rf_self_txdc_cal()
8512 mac0528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); in rt2800_rf_self_txdc_cal()
8513 mac052c = rt2800_register_read(rt2x00dev, RF_BYPASS2); in rt2800_rf_self_txdc_cal()
8515 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); in rt2800_rf_self_txdc_cal()
8516 rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); in rt2800_rf_self_txdc_cal()
8518 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0xC); in rt2800_rf_self_txdc_cal()
8519 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x3306); in rt2800_rf_self_txdc_cal()
8520 rt2800_register_write(rt2x00dev, RF_CONTROL2, 0x3330); in rt2800_rf_self_txdc_cal()
8521 rt2800_register_write(rt2x00dev, RF_BYPASS2, 0xfffff); in rt2800_rf_self_txdc_cal()
8522 rfb5r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); in rt2800_rf_self_txdc_cal()
8523 rfb7r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); in rt2800_rf_self_txdc_cal()
8525 rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, 0x4); in rt2800_rf_self_txdc_cal()
8528 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); in rt2800_rf_self_txdc_cal()
8532 rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, rfb5r1_org); in rt2800_rf_self_txdc_cal()
8534 rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, 0x4); in rt2800_rf_self_txdc_cal()
8537 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); in rt2800_rf_self_txdc_cal()
8541 rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, rfb7r1_org); in rt2800_rf_self_txdc_cal()
8543 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); in rt2800_rf_self_txdc_cal()
8544 rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); in rt2800_rf_self_txdc_cal()
8545 rt2800_register_write(rt2x00dev, RF_CONTROL0, mac0518); in rt2800_rf_self_txdc_cal()
8546 rt2800_register_write(rt2x00dev, RF_BYPASS0, mac051c); in rt2800_rf_self_txdc_cal()
8547 rt2800_register_write(rt2x00dev, RF_CONTROL2, mac0528); in rt2800_rf_self_txdc_cal()
8548 rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); in rt2800_rf_self_txdc_cal()
8551 static int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) in rt2800_calcrcalibrationcode() argument
8562 static void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_r_calibration() argument
8577 saverfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); in rt2800_r_calibration()
8578 saverfb0r34 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 34); in rt2800_r_calibration()
8579 saverfb0r35 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); in rt2800_r_calibration()
8580 saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_r_calibration()
8581 saverfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); in rt2800_r_calibration()
8582 saverfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); in rt2800_r_calibration()
8583 saverfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); in rt2800_r_calibration()
8584 saverfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); in rt2800_r_calibration()
8586 savebbpr22 = rt2800_bbp_read(rt2x00dev, 22); in rt2800_r_calibration()
8587 savebbpr47 = rt2800_bbp_read(rt2x00dev, 47); in rt2800_r_calibration()
8588 savebbpr49 = rt2800_bbp_read(rt2x00dev, 49); in rt2800_r_calibration()
8590 savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_r_calibration()
8591 MAC_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_r_calibration()
8592 MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_r_calibration()
8593 MAC_PWR_PIN_CFG = rt2800_register_read(rt2x00dev, PWR_PIN_CFG); in rt2800_r_calibration()
8595 maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_r_calibration()
8597 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); in rt2800_r_calibration()
8599 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) in rt2800_r_calibration()
8600 rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); in rt2800_r_calibration()
8602 maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_r_calibration()
8604 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); in rt2800_r_calibration()
8606 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) in rt2800_r_calibration()
8607 rt2x00_warn(rt2x00dev, "Wait MAC Rx Status to MAX !!!\n"); in rt2800_r_calibration()
8610 rt2800_register_write(rt2x00dev, RF_BYPASS0, rfvalue); in rt2800_r_calibration()
8612 rt2800_register_write(rt2x00dev, RF_CONTROL0, rfvalue); in rt2800_r_calibration()
8614 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x27); in rt2800_r_calibration()
8615 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); in rt2800_r_calibration()
8616 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0x83); in rt2800_r_calibration()
8617 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x00); in rt2800_r_calibration()
8618 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); in rt2800_r_calibration()
8620 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x00); in rt2800_r_calibration()
8621 rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, 0x13); in rt2800_r_calibration()
8622 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); in rt2800_r_calibration()
8624 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x1); in rt2800_r_calibration()
8626 rt2800_bbp_write(rt2x00dev, 47, 0x04); in rt2800_r_calibration()
8627 rt2800_bbp_write(rt2x00dev, 22, 0x80); in rt2800_r_calibration()
8629 bytevalue = rt2800_bbp_read(rt2x00dev, 49); in rt2800_r_calibration()
8634 rt2800_bbp_write(rt2x00dev, 22, 0x0); in rt2800_r_calibration()
8635 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x01); in rt2800_r_calibration()
8637 rt2800_bbp_write(rt2x00dev, 22, 0x80); in rt2800_r_calibration()
8639 bytevalue = rt2800_bbp_read(rt2x00dev, 49); in rt2800_r_calibration()
8644 rt2800_bbp_write(rt2x00dev, 22, 0x0); in rt2800_r_calibration()
8646 rcalcode = rt2800_calcrcalibrationcode(rt2x00dev, d1, d2); in rt2800_r_calibration()
8652 rt2800_rfcsr_write_bank(rt2x00dev, 0, 7, r_cal_code); in rt2800_r_calibration()
8654 rt2800_bbp_write(rt2x00dev, 22, 0x0); in rt2800_r_calibration()
8656 bytevalue = rt2800_bbp_read(rt2x00dev, 21); in rt2800_r_calibration()
8658 rt2800_bbp_write(rt2x00dev, 21, bytevalue); in rt2800_r_calibration()
8659 bytevalue = rt2800_bbp_read(rt2x00dev, 21); in rt2800_r_calibration()
8661 rt2800_bbp_write(rt2x00dev, 21, bytevalue); in rt2800_r_calibration()
8663 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, saverfb0r1); in rt2800_r_calibration()
8664 rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, saverfb0r34); in rt2800_r_calibration()
8665 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, saverfb0r35); in rt2800_r_calibration()
8666 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); in rt2800_r_calibration()
8667 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, saverfb5r17); in rt2800_r_calibration()
8668 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, saverfb5r18); in rt2800_r_calibration()
8669 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, saverfb5r19); in rt2800_r_calibration()
8670 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, saverfb5r20); in rt2800_r_calibration()
8672 rt2800_bbp_write(rt2x00dev, 22, savebbpr22); in rt2800_r_calibration()
8673 rt2800_bbp_write(rt2x00dev, 47, savebbpr47); in rt2800_r_calibration()
8674 rt2800_bbp_write(rt2x00dev, 49, savebbpr49); in rt2800_r_calibration()
8676 rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); in rt2800_r_calibration()
8677 rt2800_register_write(rt2x00dev, RF_CONTROL0, MAC_RF_CONTROL0); in rt2800_r_calibration()
8679 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); in rt2800_r_calibration()
8680 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); in rt2800_r_calibration()
8683 static void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_rxdcoc_calibration() argument
8690 saverfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); in rt2800_rxdcoc_calibration()
8693 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfvalue); in rt2800_rxdcoc_calibration()
8695 rt2800_bbp_write(rt2x00dev, 158, 141); in rt2800_rxdcoc_calibration()
8696 bbpreg = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxdcoc_calibration()
8698 rt2800_bbp_write(rt2x00dev, 159, bbpreg); in rt2800_rxdcoc_calibration()
8700 macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_rxdcoc_calibration()
8701 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x8); in rt2800_rxdcoc_calibration()
8703 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) in rt2800_rxdcoc_calibration()
8704 rt2x00_warn(rt2x00dev, "RF TX busy in RX RXDCOC calibration\n"); in rt2800_rxdcoc_calibration()
8706 saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_rxdcoc_calibration()
8707 saverfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); in rt2800_rxdcoc_calibration()
8710 rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x64); in rt2800_rxdcoc_calibration()
8711 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); in rt2800_rxdcoc_calibration()
8712 rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); in rt2800_rxdcoc_calibration()
8714 rt2800_bbp_write(rt2x00dev, 158, 140); in rt2800_rxdcoc_calibration()
8715 bbpreg = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxdcoc_calibration()
8717 rt2800_bbp_write(rt2x00dev, 159, bbpreg); in rt2800_rxdcoc_calibration()
8719 rt2800_bbp_write(rt2x00dev, 159, bbpreg); in rt2800_rxdcoc_calibration()
8722 bbpreg = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxdcoc_calibration()
8728 bbpreg = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxdcoc_calibration()
8730 rt2800_bbp_write(rt2x00dev, 159, bbpreg); in rt2800_rxdcoc_calibration()
8732 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); in rt2800_rxdcoc_calibration()
8734 rt2800_bbp_write(rt2x00dev, 158, 141); in rt2800_rxdcoc_calibration()
8735 bbpreg = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxdcoc_calibration()
8737 rt2800_bbp_write(rt2x00dev, 159, bbpreg); in rt2800_rxdcoc_calibration()
8739 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); in rt2800_rxdcoc_calibration()
8759 static void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_rxiq_calibration() argument
8787 savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_rxiq_calibration()
8788 orig_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_rxiq_calibration()
8789 orig_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_rxiq_calibration()
8790 orig_RF_CONTROL1 = rt2800_register_read(rt2x00dev, RF_CONTROL1); in rt2800_rxiq_calibration()
8791 orig_RF_BYPASS1 = rt2800_register_read(rt2x00dev, RF_BYPASS1); in rt2800_rxiq_calibration()
8792 orig_RF_CONTROL3 = rt2800_register_read(rt2x00dev, RF_CONTROL3); in rt2800_rxiq_calibration()
8793 orig_RF_BYPASS3 = rt2800_register_read(rt2x00dev, RF_BYPASS3); in rt2800_rxiq_calibration()
8795 bbp1 = rt2800_bbp_read(rt2x00dev, 1); in rt2800_rxiq_calibration()
8796 bbp4 = rt2800_bbp_read(rt2x00dev, 4); in rt2800_rxiq_calibration()
8798 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x0); in rt2800_rxiq_calibration()
8800 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) in rt2800_rxiq_calibration()
8801 rt2x00_warn(rt2x00dev, "Timeout waiting for MAC status in RXIQ calibration\n"); in rt2800_rxiq_calibration()
8805 rt2800_bbp_write(rt2x00dev, 4, bbpval); in rt2800_rxiq_calibration()
8807 bbpval = rt2800_bbp_read(rt2x00dev, 21); in rt2800_rxiq_calibration()
8809 rt2800_bbp_write(rt2x00dev, 21, bbpval); in rt2800_rxiq_calibration()
8811 rt2800_bbp_write(rt2x00dev, 21, bbpval); in rt2800_rxiq_calibration()
8813 rt2800_register_write(rt2x00dev, RF_CONTROL1, 0x00000202); in rt2800_rxiq_calibration()
8814 rt2800_register_write(rt2x00dev, RF_BYPASS1, 0x00000303); in rt2800_rxiq_calibration()
8815 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_rxiq_calibration()
8816 rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0101); in rt2800_rxiq_calibration()
8818 rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0000); in rt2800_rxiq_calibration()
8820 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0xf1f1); in rt2800_rxiq_calibration()
8822 rfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); in rt2800_rxiq_calibration()
8823 rfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); in rt2800_rxiq_calibration()
8824 rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); in rt2800_rxiq_calibration()
8825 rfb4r0 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); in rt2800_rxiq_calibration()
8826 rfb4r19 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 19); in rt2800_rxiq_calibration()
8827 rfb5r3 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); in rt2800_rxiq_calibration()
8828 rfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_rxiq_calibration()
8829 rfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); in rt2800_rxiq_calibration()
8830 rfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); in rt2800_rxiq_calibration()
8831 rfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); in rt2800_rxiq_calibration()
8832 rfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); in rt2800_rxiq_calibration()
8834 rfb6r0 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); in rt2800_rxiq_calibration()
8835 rfb6r19 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 19); in rt2800_rxiq_calibration()
8836 rfb7r3 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); in rt2800_rxiq_calibration()
8837 rfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); in rt2800_rxiq_calibration()
8838 rfb7r17 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); in rt2800_rxiq_calibration()
8839 rfb7r18 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); in rt2800_rxiq_calibration()
8840 rfb7r19 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); in rt2800_rxiq_calibration()
8841 rfb7r20 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); in rt2800_rxiq_calibration()
8843 rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x87); in rt2800_rxiq_calibration()
8844 rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0x27); in rt2800_rxiq_calibration()
8845 rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x38); in rt2800_rxiq_calibration()
8846 rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x38); in rt2800_rxiq_calibration()
8847 rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x80); in rt2800_rxiq_calibration()
8848 rt2800_rfcsr_write_dccal(rt2x00dev, 18, 0xC1); in rt2800_rxiq_calibration()
8849 rt2800_rfcsr_write_dccal(rt2x00dev, 19, 0x60); in rt2800_rxiq_calibration()
8850 rt2800_rfcsr_write_dccal(rt2x00dev, 20, 0x00); in rt2800_rxiq_calibration()
8852 rt2800_bbp_write(rt2x00dev, 23, 0x0); in rt2800_rxiq_calibration()
8853 rt2800_bbp_write(rt2x00dev, 24, 0x0); in rt2800_rxiq_calibration()
8855 rt2800_bbp_dcoc_write(rt2x00dev, 5, 0x0); in rt2800_rxiq_calibration()
8857 bbpr241 = rt2800_bbp_read(rt2x00dev, 241); in rt2800_rxiq_calibration()
8858 bbpr242 = rt2800_bbp_read(rt2x00dev, 242); in rt2800_rxiq_calibration()
8860 rt2800_bbp_write(rt2x00dev, 241, 0x10); in rt2800_rxiq_calibration()
8861 rt2800_bbp_write(rt2x00dev, 242, 0x84); in rt2800_rxiq_calibration()
8862 rt2800_bbp_write(rt2x00dev, 244, 0x31); in rt2800_rxiq_calibration()
8864 bbpval = rt2800_bbp_dcoc_read(rt2x00dev, 3); in rt2800_rxiq_calibration()
8866 rt2800_bbp_dcoc_write(rt2x00dev, 3, bbpval); in rt2800_rxiq_calibration()
8868 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); in rt2800_rxiq_calibration()
8870 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); in rt2800_rxiq_calibration()
8872 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003376); in rt2800_rxiq_calibration()
8873 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); in rt2800_rxiq_calibration()
8875 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_rxiq_calibration()
8876 rt2800_bbp_write(rt2x00dev, 23, 0x06); in rt2800_rxiq_calibration()
8877 rt2800_bbp_write(rt2x00dev, 24, 0x06); in rt2800_rxiq_calibration()
8879 rt2800_bbp_write(rt2x00dev, 23, 0x02); in rt2800_rxiq_calibration()
8880 rt2800_bbp_write(rt2x00dev, 24, 0x02); in rt2800_rxiq_calibration()
8887 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); in rt2800_rxiq_calibration()
8890 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); in rt2800_rxiq_calibration()
8893 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); in rt2800_rxiq_calibration()
8895 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); in rt2800_rxiq_calibration()
8900 rt2800_bbp_write(rt2x00dev, 1, bbpval); in rt2800_rxiq_calibration()
8902 rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x00); in rt2800_rxiq_calibration()
8906 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); in rt2800_rxiq_calibration()
8909 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); in rt2800_rxiq_calibration()
8912 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); in rt2800_rxiq_calibration()
8914 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002006); in rt2800_rxiq_calibration()
8919 rt2800_bbp_write(rt2x00dev, 1, bbpval); in rt2800_rxiq_calibration()
8921 rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x01); in rt2800_rxiq_calibration()
8927 rt2800_rfcsr_write_dccal(rt2x00dev, 3, rf_vga_table[vga_idx]); in rt2800_rxiq_calibration()
8928 rt2800_rfcsr_write_dccal(rt2x00dev, 4, rf_vga_table[vga_idx]); in rt2800_rxiq_calibration()
8930 rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x93); in rt2800_rxiq_calibration()
8933 bbpval = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
8941 rt2x00_warn(rt2x00dev, "Fatal Error: Calibration doesn't finish"); in rt2800_rxiq_calibration()
8949 rt2800_bbp_write(rt2x00dev, 158, 0x1e); in rt2800_rxiq_calibration()
8950 rt2800_bbp_write(rt2x00dev, 159, i); in rt2800_rxiq_calibration()
8951 rt2800_bbp_write(rt2x00dev, 158, 0x22); in rt2800_rxiq_calibration()
8952 value = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
8954 rt2800_bbp_write(rt2x00dev, 158, 0x21); in rt2800_rxiq_calibration()
8955 value = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
8957 rt2800_bbp_write(rt2x00dev, 158, 0x20); in rt2800_rxiq_calibration()
8958 value = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
8960 rt2800_bbp_write(rt2x00dev, 158, 0x1f); in rt2800_rxiq_calibration()
8961 value = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
8982 rt2x00_dbg(rt2x00dev, in rt2800_rxiq_calibration()
9013 rt2x00_dbg(rt2x00dev, "Sigma_i=%d, Sigma_q=%d, R_iq=%d", sigma_i, sigma_q, r_iq); in rt2800_rxiq_calibration()
9021 rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", in rt2800_rxiq_calibration()
9030 rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); in rt2800_rxiq_calibration()
9035 rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); in rt2800_rxiq_calibration()
9040 rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", in rt2800_rxiq_calibration()
9042 rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); in rt2800_rxiq_calibration()
9046 rt2800_bbp_write(rt2x00dev, 158, 0x37); in rt2800_rxiq_calibration()
9047 rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); in rt2800_rxiq_calibration()
9048 rt2800_bbp_write(rt2x00dev, 158, 0x35); in rt2800_rxiq_calibration()
9049 rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); in rt2800_rxiq_calibration()
9051 rt2800_bbp_write(rt2x00dev, 158, 0x55); in rt2800_rxiq_calibration()
9052 rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); in rt2800_rxiq_calibration()
9053 rt2800_bbp_write(rt2x00dev, 158, 0x53); in rt2800_rxiq_calibration()
9054 rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); in rt2800_rxiq_calibration()
9059 rt2800_bbp_write(rt2x00dev, 158, 0x3); in rt2800_rxiq_calibration()
9060 bbpval = rt2800_bbp_read(rt2x00dev, 159); in rt2800_rxiq_calibration()
9061 rt2800_bbp_write(rt2x00dev, 159, (bbpval | 0x07)); in rt2800_rxiq_calibration()
9063 rt2800_bbp_write(rt2x00dev, 158, 0x00); in rt2800_rxiq_calibration()
9064 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_rxiq_calibration()
9065 rt2800_bbp_write(rt2x00dev, 1, bbp1); in rt2800_rxiq_calibration()
9066 rt2800_bbp_write(rt2x00dev, 4, bbp4); in rt2800_rxiq_calibration()
9067 rt2800_bbp_write(rt2x00dev, 241, bbpr241); in rt2800_rxiq_calibration()
9068 rt2800_bbp_write(rt2x00dev, 242, bbpr242); in rt2800_rxiq_calibration()
9070 rt2800_bbp_write(rt2x00dev, 244, 0x00); in rt2800_rxiq_calibration()
9071 bbpval = rt2800_bbp_read(rt2x00dev, 21); in rt2800_rxiq_calibration()
9073 rt2800_bbp_write(rt2x00dev, 21, bbpval); in rt2800_rxiq_calibration()
9076 rt2800_bbp_write(rt2x00dev, 21, bbpval); in rt2800_rxiq_calibration()
9078 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfb0r1); in rt2800_rxiq_calibration()
9079 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfb0r2); in rt2800_rxiq_calibration()
9080 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); in rt2800_rxiq_calibration()
9082 rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, rfb4r0); in rt2800_rxiq_calibration()
9083 rt2800_rfcsr_write_bank(rt2x00dev, 4, 19, rfb4r19); in rt2800_rxiq_calibration()
9084 rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rfb5r3); in rt2800_rxiq_calibration()
9085 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rfb5r4); in rt2800_rxiq_calibration()
9086 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, rfb5r17); in rt2800_rxiq_calibration()
9087 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, rfb5r18); in rt2800_rxiq_calibration()
9088 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, rfb5r19); in rt2800_rxiq_calibration()
9089 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, rfb5r20); in rt2800_rxiq_calibration()
9091 rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, rfb6r0); in rt2800_rxiq_calibration()
9092 rt2800_rfcsr_write_bank(rt2x00dev, 6, 19, rfb6r19); in rt2800_rxiq_calibration()
9093 rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, rfb7r3); in rt2800_rxiq_calibration()
9094 rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, rfb7r4); in rt2800_rxiq_calibration()
9095 rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, rfb7r17); in rt2800_rxiq_calibration()
9096 rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, rfb7r18); in rt2800_rxiq_calibration()
9097 rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, rfb7r19); in rt2800_rxiq_calibration()
9098 rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, rfb7r20); in rt2800_rxiq_calibration()
9100 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); in rt2800_rxiq_calibration()
9102 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); in rt2800_rxiq_calibration()
9104 rt2800_register_write(rt2x00dev, RF_CONTROL0, orig_RF_CONTROL0); in rt2800_rxiq_calibration()
9106 rt2800_register_write(rt2x00dev, RF_BYPASS0, orig_RF_BYPASS0); in rt2800_rxiq_calibration()
9107 rt2800_register_write(rt2x00dev, RF_CONTROL1, orig_RF_CONTROL1); in rt2800_rxiq_calibration()
9108 rt2800_register_write(rt2x00dev, RF_BYPASS1, orig_RF_BYPASS1); in rt2800_rxiq_calibration()
9109 rt2800_register_write(rt2x00dev, RF_CONTROL3, orig_RF_CONTROL3); in rt2800_rxiq_calibration()
9110 rt2800_register_write(rt2x00dev, RF_BYPASS3, orig_RF_BYPASS3); in rt2800_rxiq_calibration()
9111 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); in rt2800_rxiq_calibration()
9114 static void rt2800_rf_configstore(struct rt2x00_dev *rt2x00dev, in rt2800_rf_configstore() argument
9120 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); in rt2800_rf_configstore()
9124 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); in rt2800_rf_configstore()
9128 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); in rt2800_rf_configstore()
9132 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); in rt2800_rf_configstore()
9136 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); in rt2800_rf_configstore()
9140 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 2); in rt2800_rf_configstore()
9144 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 34); in rt2800_rf_configstore()
9148 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); in rt2800_rf_configstore()
9152 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_rf_configstore()
9156 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); in rt2800_rf_configstore()
9160 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); in rt2800_rf_configstore()
9164 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); in rt2800_rf_configstore()
9168 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); in rt2800_rf_configstore()
9173 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); in rt2800_rf_configstore()
9177 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); in rt2800_rf_configstore()
9181 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); in rt2800_rf_configstore()
9185 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); in rt2800_rf_configstore()
9189 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); in rt2800_rf_configstore()
9193 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 2); in rt2800_rf_configstore()
9197 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 34); in rt2800_rf_configstore()
9201 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); in rt2800_rf_configstore()
9205 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); in rt2800_rf_configstore()
9209 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); in rt2800_rf_configstore()
9213 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); in rt2800_rf_configstore()
9217 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); in rt2800_rf_configstore()
9221 rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); in rt2800_rf_configstore()
9226 rt2x00_warn(rt2x00dev, "Unknown chain = %u\n", chain); in rt2800_rf_configstore()
9230 static void rt2800_rf_configrecover(struct rt2x00_dev *rt2x00dev, in rt2800_rf_configrecover() argument
9241 rt2800_rfcsr_write_bank(rt2x00dev, bank, rf_register, value); in rt2800_rf_configrecover()
9242 rt2x00_dbg(rt2x00dev, "bank: %d, rf_register: %d, value: %x\n", in rt2800_rf_configrecover()
9248 static void rt2800_setbbptonegenerator(struct rt2x00_dev *rt2x00dev) in rt2800_setbbptonegenerator() argument
9250 rt2800_bbp_write(rt2x00dev, 158, 0xAA); in rt2800_setbbptonegenerator()
9251 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_setbbptonegenerator()
9253 rt2800_bbp_write(rt2x00dev, 158, 0xAB); in rt2800_setbbptonegenerator()
9254 rt2800_bbp_write(rt2x00dev, 159, 0x0A); in rt2800_setbbptonegenerator()
9256 rt2800_bbp_write(rt2x00dev, 158, 0xAC); in rt2800_setbbptonegenerator()
9257 rt2800_bbp_write(rt2x00dev, 159, 0x3F); in rt2800_setbbptonegenerator()
9259 rt2800_bbp_write(rt2x00dev, 158, 0xAD); in rt2800_setbbptonegenerator()
9260 rt2800_bbp_write(rt2x00dev, 159, 0x3F); in rt2800_setbbptonegenerator()
9262 rt2800_bbp_write(rt2x00dev, 244, 0x40); in rt2800_setbbptonegenerator()
9265 static u32 rt2800_do_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx, u8 read_neg) in rt2800_do_fft_accumulation() argument
9273 rt2800_bbp_write(rt2x00dev, 158, 0x00); in rt2800_do_fft_accumulation()
9274 rt2800_bbp_write(rt2x00dev, 159, 0x9b); in rt2800_do_fft_accumulation()
9280 bbp = rt2800_bbp_read(rt2x00dev, 159); in rt2800_do_fft_accumulation()
9284 rt2800_bbp_write(rt2x00dev, 158, 0xba); in rt2800_do_fft_accumulation()
9285 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_do_fft_accumulation()
9286 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_do_fft_accumulation()
9287 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_do_fft_accumulation()
9289 macvalue = rt2800_register_read(rt2x00dev, 0x057C); in rt2800_do_fft_accumulation()
9298 rt2x00_dbg(rt2x00dev, "I = %d, Q = %d, power = %x\n", fftout_i, fftout_q, pint); in rt2800_do_fft_accumulation()
9304 rt2800_bbp_write(rt2x00dev, 158, 0xba); in rt2800_do_fft_accumulation()
9305 rt2800_bbp_write(rt2x00dev, 159, tidxi); in rt2800_do_fft_accumulation()
9306 rt2800_bbp_write(rt2x00dev, 159, tidxi); in rt2800_do_fft_accumulation()
9307 rt2800_bbp_write(rt2x00dev, 159, tidxi); in rt2800_do_fft_accumulation()
9309 macvalue = rt2800_register_read(rt2x00dev, 0x057C); in rt2800_do_fft_accumulation()
9324 static u32 rt2800_read_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx) in rt2800_read_fft_accumulation() argument
9330 rt2800_bbp_write(rt2x00dev, 158, 0xBA); in rt2800_read_fft_accumulation()
9331 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_read_fft_accumulation()
9332 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_read_fft_accumulation()
9333 rt2800_bbp_write(rt2x00dev, 159, tidx); in rt2800_read_fft_accumulation()
9335 macvalue = rt2800_register_read(rt2x00dev, 0x057C); 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
9352 rt2800_bbp_write(rt2x00dev, 158, 0xb0); in rt2800_write_dc()
9354 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_write_dc()
9361 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_write_dc()
9363 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_write_dc()
9366 static void rt2800_loft_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, in rt2800_loft_search() argument
9376 rt2800_bbp_write(rt2x00dev, 158, 0xb0); in rt2800_loft_search()
9377 rt2800_bbp_write(rt2x00dev, 159, 0x80); in rt2800_loft_search()
9387 rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx0); in rt2800_loft_search()
9388 p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); in rt2800_loft_search()
9393 rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx1); in rt2800_loft_search()
9394 p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); in rt2800_loft_search()
9396 rt2x00_dbg(rt2x00dev, "alc=%u, IorQ=%u, idx_final=%2x\n", in rt2800_loft_search()
9398 rt2x00_dbg(rt2x00dev, "p0=%x, p1=%x, pf=%x, idx_0=%x, idx_1=%x, ibit=%x\n", in rt2800_loft_search()
9410 rt2x00_dbg(rt2x00dev, "IorQ=%u, idx_final[%u]:%x, pf:%8x\n", in rt2800_loft_search()
9413 rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idxf[iorq]); in rt2800_loft_search()
9421 static void rt2800_iq_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 *ges, u8 *pes) in rt2800_iq_search() argument
9456 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_iq_search()
9457 rt2800_bbp_write(rt2x00dev, 159, idx0); in rt2800_iq_search()
9459 p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); in rt2800_iq_search()
9468 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_iq_search()
9469 rt2800_bbp_write(rt2x00dev, 159, idx1); in rt2800_iq_search()
9471 p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); in rt2800_iq_search()
9473 rt2x00_dbg(rt2x00dev, in rt2800_iq_search()
9490 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_iq_search()
9491 rt2800_bbp_write(rt2x00dev, 159, iq_err); in rt2800_iq_search()
9498 rt2x00_dbg(rt2x00dev, "IQCalibration pf=%8x (%2x, %2x) !\n", in rt2800_iq_search()
9520 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_iq_search()
9521 rt2800_bbp_write(rt2x00dev, 159, gef & 0x0F); in rt2800_iq_search()
9524 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_iq_search()
9525 rt2800_bbp_write(rt2x00dev, 159, pef & 0x3F); in rt2800_iq_search()
9527 p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); in rt2800_iq_search()
9537 rt2x00_dbg(rt2x00dev, "Fine IQCalibration p1=%8x pf=%8x (%2x, %2x) !\n", in rt2800_iq_search()
9545 static void rt2800_rf_aux_tx0_loopback(struct rt2x00_dev *rt2x00dev) in rt2800_rf_aux_tx0_loopback() argument
9547 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x21); in rt2800_rf_aux_tx0_loopback()
9548 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x10); in rt2800_rf_aux_tx0_loopback()
9549 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); in rt2800_rf_aux_tx0_loopback()
9550 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x1b); in rt2800_rf_aux_tx0_loopback()
9551 rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, 0x81); in rt2800_rf_aux_tx0_loopback()
9552 rt2800_rfcsr_write_bank(rt2x00dev, 4, 2, 0x81); in rt2800_rf_aux_tx0_loopback()
9553 rt2800_rfcsr_write_bank(rt2x00dev, 4, 34, 0xee); in rt2800_rf_aux_tx0_loopback()
9554 rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, 0x2d); in rt2800_rf_aux_tx0_loopback()
9555 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x2d); in rt2800_rf_aux_tx0_loopback()
9556 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); in rt2800_rf_aux_tx0_loopback()
9557 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xd7); in rt2800_rf_aux_tx0_loopback()
9558 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0xa2); in rt2800_rf_aux_tx0_loopback()
9559 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); in rt2800_rf_aux_tx0_loopback()
9562 static void rt2800_rf_aux_tx1_loopback(struct rt2x00_dev *rt2x00dev) in rt2800_rf_aux_tx1_loopback() argument
9564 rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x22); in rt2800_rf_aux_tx1_loopback()
9565 rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x20); in rt2800_rf_aux_tx1_loopback()
9566 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); in rt2800_rf_aux_tx1_loopback()
9567 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x4b); in rt2800_rf_aux_tx1_loopback()
9568 rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, 0x81); in rt2800_rf_aux_tx1_loopback()
9569 rt2800_rfcsr_write_bank(rt2x00dev, 6, 2, 0x81); in rt2800_rf_aux_tx1_loopback()
9570 rt2800_rfcsr_write_bank(rt2x00dev, 6, 34, 0xee); in rt2800_rf_aux_tx1_loopback()
9571 rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, 0x2d); in rt2800_rf_aux_tx1_loopback()
9572 rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, 0x2d); in rt2800_rf_aux_tx1_loopback()
9573 rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, 0x80); in rt2800_rf_aux_tx1_loopback()
9574 rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, 0xd7); in rt2800_rf_aux_tx1_loopback()
9575 rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, 0xa2); in rt2800_rf_aux_tx1_loopback()
9576 rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, 0x20); in rt2800_rf_aux_tx1_loopback()
9579 static void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev) in rt2800_loft_iq_calibration() argument
9613 savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9614 macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); in rt2800_loft_iq_calibration()
9615 macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_loft_iq_calibration()
9616 macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_loft_iq_calibration()
9617 macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); in rt2800_loft_iq_calibration()
9618 macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); in rt2800_loft_iq_calibration()
9619 mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); in rt2800_loft_iq_calibration()
9620 orig528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); in rt2800_loft_iq_calibration()
9621 orig52c = rt2800_register_read(rt2x00dev, RF_BYPASS2); in rt2800_loft_iq_calibration()
9623 macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9625 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); in rt2800_loft_iq_calibration()
9627 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) in rt2800_loft_iq_calibration()
9628 rt2x00_warn(rt2x00dev, "RF TX busy in LOFT IQ calibration\n"); in rt2800_loft_iq_calibration()
9630 macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9632 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); in rt2800_loft_iq_calibration()
9634 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) in rt2800_loft_iq_calibration()
9635 rt2x00_warn(rt2x00dev, "RF RX busy in LOFT IQ calibration\n"); in rt2800_loft_iq_calibration()
9638 rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); in rt2800_loft_iq_calibration()
9640 bbpr30 = rt2800_bbp_read(rt2x00dev, 30); in rt2800_loft_iq_calibration()
9641 rfb0r39 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 39); in rt2800_loft_iq_calibration()
9642 rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); in rt2800_loft_iq_calibration()
9644 rt2800_bbp_write(rt2x00dev, 30, 0x1F); in rt2800_loft_iq_calibration()
9645 rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, 0x80); in rt2800_loft_iq_calibration()
9646 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x5B); in rt2800_loft_iq_calibration()
9648 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9649 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9651 rt2800_setbbptonegenerator(rt2x00dev); in rt2800_loft_iq_calibration()
9654 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9655 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9656 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); in rt2800_loft_iq_calibration()
9657 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); in rt2800_loft_iq_calibration()
9658 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); in rt2800_loft_iq_calibration()
9659 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); in rt2800_loft_iq_calibration()
9660 rt2800_register_write(rt2x00dev, 0x13b8, 0x10); in rt2800_loft_iq_calibration()
9664 rt2800_rf_aux_tx0_loopback(rt2x00dev); in rt2800_loft_iq_calibration()
9666 rt2800_rf_aux_tx1_loopback(rt2x00dev); in rt2800_loft_iq_calibration()
9671 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); in rt2800_loft_iq_calibration()
9673 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); in rt2800_loft_iq_calibration()
9675 rt2800_bbp_write(rt2x00dev, 158, 0x05); in rt2800_loft_iq_calibration()
9676 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9678 rt2800_bbp_write(rt2x00dev, 158, 0x01); in rt2800_loft_iq_calibration()
9680 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9682 rt2800_bbp_write(rt2x00dev, 159, 0x01); in rt2800_loft_iq_calibration()
9686 rt2800_bbp_write(rt2x00dev, 23, bbp_2324gain[rf_alc_idx]); in rt2800_loft_iq_calibration()
9687 rt2800_bbp_write(rt2x00dev, 24, bbp_2324gain[rf_alc_idx]); in rt2800_loft_iq_calibration()
9689 macvalue = rt2800_register_read(rt2x00dev, RF_CONTROL3); in rt2800_loft_iq_calibration()
9693 rt2800_register_write(rt2x00dev, RF_CONTROL3, macvalue); in rt2800_loft_iq_calibration()
9695 rt2800_register_write(rt2x00dev, RF_BYPASS3, macvalue); in rt2800_loft_iq_calibration()
9698 rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x21); in rt2800_loft_iq_calibration()
9702 rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); in rt2800_loft_iq_calibration()
9703 rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); in rt2800_loft_iq_calibration()
9704 rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); in rt2800_loft_iq_calibration()
9705 rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); in rt2800_loft_iq_calibration()
9706 p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); in rt2800_loft_iq_calibration()
9707 rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x21); in rt2800_loft_iq_calibration()
9708 p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); in rt2800_loft_iq_calibration()
9709 rt2x00_dbg(rt2x00dev, "LOFT AGC %d %d\n", p0, p1); in rt2800_loft_iq_calibration()
9714 rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); in rt2800_loft_iq_calibration()
9715 rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); in rt2800_loft_iq_calibration()
9717 rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n", vga_gain[ch_idx], in rt2800_loft_iq_calibration()
9723 rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); in rt2800_loft_iq_calibration()
9724 rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); in rt2800_loft_iq_calibration()
9726 rt2800_loft_search(rt2x00dev, ch_idx, rf_alc_idx, loft_dc_search_result); in rt2800_loft_iq_calibration()
9732 rt2800_bbp_write(rt2x00dev, 158, 0xB0); in rt2800_loft_iq_calibration()
9734 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9735 rt2x00_dbg(rt2x00dev, " ALC %2x,", bbp); in rt2800_loft_iq_calibration()
9737 rt2800_bbp_write(rt2x00dev, 158, 0xb1); in rt2800_loft_iq_calibration()
9740 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9741 rt2x00_dbg(rt2x00dev, " I0 %2x,", bbp); in rt2800_loft_iq_calibration()
9743 rt2800_bbp_write(rt2x00dev, 158, 0xb2); in rt2800_loft_iq_calibration()
9746 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9747 rt2x00_dbg(rt2x00dev, " Q0 %2x,", bbp); in rt2800_loft_iq_calibration()
9749 rt2800_bbp_write(rt2x00dev, 158, 0xb8); in rt2800_loft_iq_calibration()
9752 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9753 rt2x00_dbg(rt2x00dev, " I1 %2x,", bbp); in rt2800_loft_iq_calibration()
9755 rt2800_bbp_write(rt2x00dev, 158, 0xb9); in rt2800_loft_iq_calibration()
9758 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9759 rt2x00_dbg(rt2x00dev, " Q1 %2x\n", bbp); in rt2800_loft_iq_calibration()
9763 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9764 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9766 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); in rt2800_loft_iq_calibration()
9768 rt2800_bbp_write(rt2x00dev, 158, 0x00); in rt2800_loft_iq_calibration()
9769 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9772 rt2800_bbp_write(rt2x00dev, 244, 0x00); in rt2800_loft_iq_calibration()
9774 rt2800_bbp_write(rt2x00dev, 21, 0x01); in rt2800_loft_iq_calibration()
9776 rt2800_bbp_write(rt2x00dev, 21, 0x00); in rt2800_loft_iq_calibration()
9778 rt2800_rf_configrecover(rt2x00dev, rf_store); in rt2800_loft_iq_calibration()
9780 rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); in rt2800_loft_iq_calibration()
9781 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); in rt2800_loft_iq_calibration()
9782 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); in rt2800_loft_iq_calibration()
9783 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); in rt2800_loft_iq_calibration()
9784 rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); in rt2800_loft_iq_calibration()
9786 rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); in rt2800_loft_iq_calibration()
9787 rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); in rt2800_loft_iq_calibration()
9788 rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); in rt2800_loft_iq_calibration()
9789 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); in rt2800_loft_iq_calibration()
9790 rt2800_register_write(rt2x00dev, RF_CONTROL2, orig528); in rt2800_loft_iq_calibration()
9791 rt2800_register_write(rt2x00dev, RF_BYPASS2, orig52c); in rt2800_loft_iq_calibration()
9792 rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); in rt2800_loft_iq_calibration()
9794 savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9795 macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); in rt2800_loft_iq_calibration()
9796 macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_loft_iq_calibration()
9797 macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_loft_iq_calibration()
9798 macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); in rt2800_loft_iq_calibration()
9799 macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); in rt2800_loft_iq_calibration()
9801 bbpr1 = rt2800_bbp_read(rt2x00dev, 1); in rt2800_loft_iq_calibration()
9802 bbpr4 = rt2800_bbp_read(rt2x00dev, 4); in rt2800_loft_iq_calibration()
9803 bbpr241 = rt2800_bbp_read(rt2x00dev, 241); in rt2800_loft_iq_calibration()
9804 bbpr242 = rt2800_bbp_read(rt2x00dev, 242); in rt2800_loft_iq_calibration()
9805 mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); in rt2800_loft_iq_calibration()
9807 macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9809 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); in rt2800_loft_iq_calibration()
9811 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_TX))) in rt2800_loft_iq_calibration()
9812 rt2x00_warn(rt2x00dev, "RF TX busy in LOFT IQ calibration\n"); in rt2800_loft_iq_calibration()
9814 macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_loft_iq_calibration()
9816 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); in rt2800_loft_iq_calibration()
9818 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) in rt2800_loft_iq_calibration()
9819 rt2x00_warn(rt2x00dev, "RF RX busy in LOFT IQ calibration\n"); in rt2800_loft_iq_calibration()
9821 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9822 rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000101); in rt2800_loft_iq_calibration()
9823 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); in rt2800_loft_iq_calibration()
9826 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9827 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9829 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9830 rt2800_bbp_write(rt2x00dev, 4, bbpr4 & (~0x18)); in rt2800_loft_iq_calibration()
9831 rt2800_bbp_write(rt2x00dev, 21, 0x01); in rt2800_loft_iq_calibration()
9833 rt2800_bbp_write(rt2x00dev, 21, 0x00); in rt2800_loft_iq_calibration()
9835 rt2800_bbp_write(rt2x00dev, 241, 0x14); in rt2800_loft_iq_calibration()
9836 rt2800_bbp_write(rt2x00dev, 242, 0x80); in rt2800_loft_iq_calibration()
9837 rt2800_bbp_write(rt2x00dev, 244, 0x31); in rt2800_loft_iq_calibration()
9839 rt2800_setbbptonegenerator(rt2x00dev); in rt2800_loft_iq_calibration()
9842 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); in rt2800_loft_iq_calibration()
9843 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); in rt2800_loft_iq_calibration()
9846 rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); in rt2800_loft_iq_calibration()
9848 if (!test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9849 rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000000); in rt2800_loft_iq_calibration()
9850 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); in rt2800_loft_iq_calibration()
9853 rt2800_register_write(rt2x00dev, 0x13b8, 0x00000010); in rt2800_loft_iq_calibration()
9856 rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); in rt2800_loft_iq_calibration()
9858 rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x3B); in rt2800_loft_iq_calibration()
9859 rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x3B); in rt2800_loft_iq_calibration()
9861 rt2800_bbp_write(rt2x00dev, 158, 0x03); in rt2800_loft_iq_calibration()
9862 rt2800_bbp_write(rt2x00dev, 159, 0x60); in rt2800_loft_iq_calibration()
9863 rt2800_bbp_write(rt2x00dev, 158, 0xB0); in rt2800_loft_iq_calibration()
9864 rt2800_bbp_write(rt2x00dev, 159, 0x80); in rt2800_loft_iq_calibration()
9867 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9868 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9871 rt2800_bbp_write(rt2x00dev, 158, 0x01); in rt2800_loft_iq_calibration()
9872 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9873 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9876 rt2800_bbp_write(rt2x00dev, 1, bbp); in rt2800_loft_iq_calibration()
9878 rt2800_rf_aux_tx0_loopback(rt2x00dev); in rt2800_loft_iq_calibration()
9879 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); in rt2800_loft_iq_calibration()
9881 rt2800_bbp_write(rt2x00dev, 158, 0x01); in rt2800_loft_iq_calibration()
9882 rt2800_bbp_write(rt2x00dev, 159, 0x01); in rt2800_loft_iq_calibration()
9883 if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9886 rt2800_bbp_write(rt2x00dev, 1, bbp); in rt2800_loft_iq_calibration()
9888 rt2800_rf_aux_tx1_loopback(rt2x00dev); in rt2800_loft_iq_calibration()
9889 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); in rt2800_loft_iq_calibration()
9892 rt2800_bbp_write(rt2x00dev, 158, 0x05); in rt2800_loft_iq_calibration()
9893 rt2800_bbp_write(rt2x00dev, 159, 0x04); in rt2800_loft_iq_calibration()
9896 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_loft_iq_calibration()
9897 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9899 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9900 rt2800_bbp_write(rt2x00dev, 23, 0x06); in rt2800_loft_iq_calibration()
9901 rt2800_bbp_write(rt2x00dev, 24, 0x06); in rt2800_loft_iq_calibration()
9904 rt2800_bbp_write(rt2x00dev, 23, 0x1F); in rt2800_loft_iq_calibration()
9905 rt2800_bbp_write(rt2x00dev, 24, 0x1F); in rt2800_loft_iq_calibration()
9911 rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); in rt2800_loft_iq_calibration()
9912 rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); in rt2800_loft_iq_calibration()
9915 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_loft_iq_calibration()
9916 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9917 p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); in rt2800_loft_iq_calibration()
9918 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
9919 p0_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); in rt2800_loft_iq_calibration()
9922 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_loft_iq_calibration()
9923 rt2800_bbp_write(rt2x00dev, 159, 0x21); in rt2800_loft_iq_calibration()
9924 p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); in rt2800_loft_iq_calibration()
9925 if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
9926 p1_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); in rt2800_loft_iq_calibration()
9928 rt2x00_dbg(rt2x00dev, "IQ AGC %d %d\n", p0, p1); in rt2800_loft_iq_calibration()
9930 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9931 rt2x00_dbg(rt2x00dev, "IQ AGC IDX 10 %d %d\n", p0_idx10, p1_idx10); in rt2800_loft_iq_calibration()
9945 rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n", vga_gain[ch_idx], in rt2800_loft_iq_calibration()
9949 rt2800_bbp_write(rt2x00dev, 158, bbp); in rt2800_loft_iq_calibration()
9950 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9952 rt2800_iq_search(rt2x00dev, ch_idx, ger, per); in rt2800_loft_iq_calibration()
9955 rt2800_bbp_write(rt2x00dev, 23, 0x00); in rt2800_loft_iq_calibration()
9956 rt2800_bbp_write(rt2x00dev, 24, 0x00); in rt2800_loft_iq_calibration()
9957 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); in rt2800_loft_iq_calibration()
9959 rt2800_bbp_write(rt2x00dev, 158, 0x28); in rt2800_loft_iq_calibration()
9961 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9963 rt2800_bbp_write(rt2x00dev, 158, 0x29); in rt2800_loft_iq_calibration()
9965 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9967 rt2800_bbp_write(rt2x00dev, 158, 0x46); in rt2800_loft_iq_calibration()
9969 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9971 rt2800_bbp_write(rt2x00dev, 158, 0x47); in rt2800_loft_iq_calibration()
9973 rt2800_bbp_write(rt2x00dev, 159, bbp); in rt2800_loft_iq_calibration()
9975 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { in rt2800_loft_iq_calibration()
9976 rt2800_bbp_write(rt2x00dev, 1, bbpr1); in rt2800_loft_iq_calibration()
9977 rt2800_bbp_write(rt2x00dev, 241, bbpr241); in rt2800_loft_iq_calibration()
9978 rt2800_bbp_write(rt2x00dev, 242, bbpr242); in rt2800_loft_iq_calibration()
9980 rt2800_bbp_write(rt2x00dev, 244, 0x00); in rt2800_loft_iq_calibration()
9982 rt2800_bbp_write(rt2x00dev, 158, 0x00); in rt2800_loft_iq_calibration()
9983 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9984 rt2800_bbp_write(rt2x00dev, 158, 0xB0); in rt2800_loft_iq_calibration()
9985 rt2800_bbp_write(rt2x00dev, 159, 0x00); in rt2800_loft_iq_calibration()
9987 rt2800_bbp_write(rt2x00dev, 30, bbpr30); in rt2800_loft_iq_calibration()
9988 rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, rfb0r39); in rt2800_loft_iq_calibration()
9989 rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); in rt2800_loft_iq_calibration()
9991 if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) in rt2800_loft_iq_calibration()
9992 rt2800_bbp_write(rt2x00dev, 4, bbpr4); in rt2800_loft_iq_calibration()
9994 rt2800_bbp_write(rt2x00dev, 21, 0x01); in rt2800_loft_iq_calibration()
9996 rt2800_bbp_write(rt2x00dev, 21, 0x00); in rt2800_loft_iq_calibration()
9998 rt2800_rf_configrecover(rt2x00dev, rf_store); in rt2800_loft_iq_calibration()
10000 rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); in rt2800_loft_iq_calibration()
10001 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); in rt2800_loft_iq_calibration()
10002 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); in rt2800_loft_iq_calibration()
10003 rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); in rt2800_loft_iq_calibration()
10005 rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); in rt2800_loft_iq_calibration()
10006 rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); in rt2800_loft_iq_calibration()
10007 rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); in rt2800_loft_iq_calibration()
10008 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); in rt2800_loft_iq_calibration()
10009 rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); in rt2800_loft_iq_calibration()
10012 static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, in rt2800_bbp_core_soft_reset() argument
10017 bbp_val = rt2800_bbp_read(rt2x00dev, 21); in rt2800_bbp_core_soft_reset()
10019 rt2800_bbp_write(rt2x00dev, 21, bbp_val); in rt2800_bbp_core_soft_reset()
10023 bbp_val = rt2800_bbp_read(rt2x00dev, 4); in rt2800_bbp_core_soft_reset()
10025 rt2800_bbp_write(rt2x00dev, 4, bbp_val); in rt2800_bbp_core_soft_reset()
10029 bbp_val = rt2800_bbp_read(rt2x00dev, 21); in rt2800_bbp_core_soft_reset()
10031 rt2800_bbp_write(rt2x00dev, 21, bbp_val); in rt2800_bbp_core_soft_reset()
10035 static int rt2800_rf_lp_config(struct rt2x00_dev *rt2x00dev, bool btxcal) in rt2800_rf_lp_config() argument
10040 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); in rt2800_rf_lp_config()
10042 rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x02); in rt2800_rf_lp_config()
10044 rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x06); in rt2800_rf_lp_config()
10046 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); in rt2800_rf_lp_config()
10048 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, rf_val); in rt2800_rf_lp_config()
10051 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xC1); in rt2800_rf_lp_config()
10052 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x20); in rt2800_rf_lp_config()
10053 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x02); in rt2800_rf_lp_config()
10054 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); in rt2800_rf_lp_config()
10057 rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rf_val); in rt2800_rf_lp_config()
10058 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_rf_lp_config()
10061 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rf_val); in rt2800_rf_lp_config()
10062 rt2800_rfcsr_write_bank(rt2x00dev, 5, 5, 0x31); in rt2800_rf_lp_config()
10064 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xF1); in rt2800_rf_lp_config()
10065 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x18); in rt2800_rf_lp_config()
10066 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x02); in rt2800_rf_lp_config()
10067 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); in rt2800_rf_lp_config()
10070 rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rf_val); in rt2800_rf_lp_config()
10071 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_rf_lp_config()
10074 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rf_val); in rt2800_rf_lp_config()
10080 static s8 rt2800_lp_tx_filter_bw_cal(struct rt2x00_dev *rt2x00dev) in rt2800_lp_tx_filter_bw_cal() argument
10086 rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x82); in rt2800_lp_tx_filter_bw_cal()
10091 bbp_val = rt2800_bbp_read(rt2x00dev, 159); in rt2800_lp_tx_filter_bw_cal()
10098 bbp_val = rt2800_bbp_dcoc_read(rt2x00dev, 0x39); in rt2800_lp_tx_filter_bw_cal()
10106 static void rt2800_bw_filter_calibration(struct rt2x00_dev *rt2x00dev, in rt2800_bw_filter_calibration() argument
10109 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_bw_filter_calibration()
10127 MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); in rt2800_bw_filter_calibration()
10128 MAC_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); in rt2800_bw_filter_calibration()
10131 savebbpr23 = rt2800_bbp_read(rt2x00dev, 23); in rt2800_bw_filter_calibration()
10133 savebbp159r0 = rt2800_bbp_dcoc_read(rt2x00dev, 0); in rt2800_bw_filter_calibration()
10134 savebbp159r2 = rt2800_bbp_dcoc_read(rt2x00dev, 2); in rt2800_bw_filter_calibration()
10137 saverfb5r00 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 0); in rt2800_bw_filter_calibration()
10138 saverfb5r01 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); in rt2800_bw_filter_calibration()
10139 saverfb5r03 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); in rt2800_bw_filter_calibration()
10140 saverfb5r04 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); in rt2800_bw_filter_calibration()
10141 saverfb5r05 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 5); in rt2800_bw_filter_calibration()
10142 saverfb5r06 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 6); in rt2800_bw_filter_calibration()
10143 saverfb5r07 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 7); in rt2800_bw_filter_calibration()
10144 saverfb5r08 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 8); in rt2800_bw_filter_calibration()
10145 saverfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); in rt2800_bw_filter_calibration()
10146 saverfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); in rt2800_bw_filter_calibration()
10147 saverfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); in rt2800_bw_filter_calibration()
10148 saverfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); in rt2800_bw_filter_calibration()
10150 saverfb5r37 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 37); in rt2800_bw_filter_calibration()
10151 saverfb5r38 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 38); in rt2800_bw_filter_calibration()
10152 saverfb5r39 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 39); in rt2800_bw_filter_calibration()
10153 saverfb5r40 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 40); in rt2800_bw_filter_calibration()
10154 saverfb5r41 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 41); in rt2800_bw_filter_calibration()
10155 saverfb5r42 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 42); in rt2800_bw_filter_calibration()
10156 saverfb5r43 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 43); in rt2800_bw_filter_calibration()
10157 saverfb5r44 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 44); in rt2800_bw_filter_calibration()
10158 saverfb5r45 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 45); in rt2800_bw_filter_calibration()
10159 saverfb5r46 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 46); in rt2800_bw_filter_calibration()
10161 saverfb5r58 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 58); in rt2800_bw_filter_calibration()
10162 saverfb5r59 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 59); in rt2800_bw_filter_calibration()
10164 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 0); in rt2800_bw_filter_calibration()
10166 rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, rf_val); in rt2800_bw_filter_calibration()
10168 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); in rt2800_bw_filter_calibration()
10170 rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, rf_val); in rt2800_bw_filter_calibration()
10175 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); in rt2800_bw_filter_calibration()
10181 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 0); in rt2800_bw_filter_calibration()
10184 rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, rf_val); in rt2800_bw_filter_calibration()
10187 bbp_val = rt2800_bbp_read(rt2x00dev, 23); in rt2800_bw_filter_calibration()
10190 rt2800_bbp_write(rt2x00dev, 23, bbp_val); in rt2800_bw_filter_calibration()
10210 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 8); in rt2800_bw_filter_calibration()
10215 rt2800_rfcsr_write_bank(rt2x00dev, 5, 8, rf_val); in rt2800_bw_filter_calibration()
10217 rt2800_bbp_core_soft_reset(rt2x00dev, true, is_ht40); in rt2800_bw_filter_calibration()
10219 rt2800_rf_lp_config(rt2x00dev, btxcal); in rt2800_bw_filter_calibration()
10222 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 58); in rt2800_bw_filter_calibration()
10224 rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rf_val); in rt2800_bw_filter_calibration()
10225 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 59); in rt2800_bw_filter_calibration()
10227 rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rf_val); in rt2800_bw_filter_calibration()
10230 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 6); in rt2800_bw_filter_calibration()
10232 rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rf_val); in rt2800_bw_filter_calibration()
10233 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 7); in rt2800_bw_filter_calibration()
10235 rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rf_val); in rt2800_bw_filter_calibration()
10240 bbp_val = rt2800_bbp_dcoc_read(rt2x00dev, 2); in rt2800_bw_filter_calibration()
10242 rt2800_bbp_dcoc_write(rt2x00dev, 2, bbp_val); in rt2800_bw_filter_calibration()
10244 rt2800_bbp_core_soft_reset(rt2x00dev, false, is_ht40); in rt2800_bw_filter_calibration()
10246 cal_r32_init = rt2800_lp_tx_filter_bw_cal(rt2x00dev); in rt2800_bw_filter_calibration()
10248 bbp_val = rt2800_bbp_dcoc_read(rt2x00dev, 2); in rt2800_bw_filter_calibration()
10250 rt2800_bbp_dcoc_write(rt2x00dev, 2, bbp_val); in rt2800_bw_filter_calibration()
10253 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 58); in rt2800_bw_filter_calibration()
10256 rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, rf_val); in rt2800_bw_filter_calibration()
10257 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 59); in rt2800_bw_filter_calibration()
10260 rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, rf_val); in rt2800_bw_filter_calibration()
10262 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 6); in rt2800_bw_filter_calibration()
10265 rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, rf_val); in rt2800_bw_filter_calibration()
10266 rf_val = rt2800_rfcsr_read_bank(rt2x00dev, 5, 7); in rt2800_bw_filter_calibration()
10269 rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, rf_val); in rt2800_bw_filter_calibration()
10274 rt2800_bbp_core_soft_reset(rt2x00dev, false, is_ht40); in rt2800_bw_filter_calibration()
10276 cal_r32_val = rt2800_lp_tx_filter_bw_cal(rt2x00dev); in rt2800_bw_filter_calibration()
10314 rt2800_rfcsr_write_bank(rt2x00dev, 5, 0, saverfb5r00); in rt2800_bw_filter_calibration()
10315 rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, saverfb5r01); in rt2800_bw_filter_calibration()
10316 rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, saverfb5r03); in rt2800_bw_filter_calibration()
10317 rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r04); in rt2800_bw_filter_calibration()
10318 rt2800_rfcsr_write_bank(rt2x00dev, 5, 5, saverfb5r05); in rt2800_bw_filter_calibration()
10319 rt2800_rfcsr_write_bank(rt2x00dev, 5, 6, saverfb5r06); in rt2800_bw_filter_calibration()
10320 rt2800_rfcsr_write_bank(rt2x00dev, 5, 7, saverfb5r07); in rt2800_bw_filter_calibration()
10321 rt2800_rfcsr_write_bank(rt2x00dev, 5, 8, saverfb5r08); in rt2800_bw_filter_calibration()
10322 rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, saverfb5r17); in rt2800_bw_filter_calibration()
10323 rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, saverfb5r18); in rt2800_bw_filter_calibration()
10324 rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, saverfb5r19); in rt2800_bw_filter_calibration()
10325 rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, saverfb5r20); in rt2800_bw_filter_calibration()
10327 rt2800_rfcsr_write_bank(rt2x00dev, 5, 37, saverfb5r37); in rt2800_bw_filter_calibration()
10328 rt2800_rfcsr_write_bank(rt2x00dev, 5, 38, saverfb5r38); in rt2800_bw_filter_calibration()
10329 rt2800_rfcsr_write_bank(rt2x00dev, 5, 39, saverfb5r39); in rt2800_bw_filter_calibration()
10330 rt2800_rfcsr_write_bank(rt2x00dev, 5, 40, saverfb5r40); in rt2800_bw_filter_calibration()
10331 rt2800_rfcsr_write_bank(rt2x00dev, 5, 41, saverfb5r41); in rt2800_bw_filter_calibration()
10332 rt2800_rfcsr_write_bank(rt2x00dev, 5, 42, saverfb5r42); in rt2800_bw_filter_calibration()
10333 rt2800_rfcsr_write_bank(rt2x00dev, 5, 43, saverfb5r43); in rt2800_bw_filter_calibration()
10334 rt2800_rfcsr_write_bank(rt2x00dev, 5, 44, saverfb5r44); in rt2800_bw_filter_calibration()
10335 rt2800_rfcsr_write_bank(rt2x00dev, 5, 45, saverfb5r45); in rt2800_bw_filter_calibration()
10336 rt2800_rfcsr_write_bank(rt2x00dev, 5, 46, saverfb5r46); in rt2800_bw_filter_calibration()
10338 rt2800_rfcsr_write_bank(rt2x00dev, 5, 58, saverfb5r58); in rt2800_bw_filter_calibration()
10339 rt2800_rfcsr_write_bank(rt2x00dev, 5, 59, saverfb5r59); in rt2800_bw_filter_calibration()
10341 rt2800_bbp_write(rt2x00dev, 23, savebbpr23); in rt2800_bw_filter_calibration()
10343 rt2800_bbp_dcoc_write(rt2x00dev, 0, savebbp159r0); in rt2800_bw_filter_calibration()
10344 rt2800_bbp_dcoc_write(rt2x00dev, 2, savebbp159r2); in rt2800_bw_filter_calibration()
10346 bbp_val = rt2800_bbp_read(rt2x00dev, 4); in rt2800_bw_filter_calibration()
10348 2 * test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)); in rt2800_bw_filter_calibration()
10349 rt2800_bbp_write(rt2x00dev, 4, bbp_val); in rt2800_bw_filter_calibration()
10351 rt2800_register_write(rt2x00dev, RF_CONTROL0, MAC_RF_CONTROL0); in rt2800_bw_filter_calibration()
10352 rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); in rt2800_bw_filter_calibration()
10355 static void rt2800_restore_rf_bbp_rt6352(struct rt2x00_dev *rt2x00dev) in rt2800_restore_rf_bbp_rt6352() argument
10357 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_restore_rf_bbp_rt6352()
10358 rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); in rt2800_restore_rf_bbp_rt6352()
10359 rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); in rt2800_restore_rf_bbp_rt6352()
10362 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { in rt2800_restore_rf_bbp_rt6352()
10363 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); in rt2800_restore_rf_bbp_rt6352()
10364 rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); in rt2800_restore_rf_bbp_rt6352()
10365 rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); in rt2800_restore_rf_bbp_rt6352()
10368 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_restore_rf_bbp_rt6352()
10369 rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xd3); in rt2800_restore_rf_bbp_rt6352()
10370 rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xb3); in rt2800_restore_rf_bbp_rt6352()
10371 rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xd5); in rt2800_restore_rf_bbp_rt6352()
10372 rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); in rt2800_restore_rf_bbp_rt6352()
10373 rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6c); in rt2800_restore_rf_bbp_rt6352()
10374 rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xfc); in rt2800_restore_rf_bbp_rt6352()
10375 rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1f); in rt2800_restore_rf_bbp_rt6352()
10376 rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); in rt2800_restore_rf_bbp_rt6352()
10377 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); in rt2800_restore_rf_bbp_rt6352()
10378 rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xff); in rt2800_restore_rf_bbp_rt6352()
10379 rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1c); in rt2800_restore_rf_bbp_rt6352()
10380 rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); in rt2800_restore_rf_bbp_rt6352()
10381 rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6b); in rt2800_restore_rf_bbp_rt6352()
10382 rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xf7); in rt2800_restore_rf_bbp_rt6352()
10383 rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); in rt2800_restore_rf_bbp_rt6352()
10386 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { in rt2800_restore_rf_bbp_rt6352()
10387 rt2800_bbp_write(rt2x00dev, 75, 0x60); in rt2800_restore_rf_bbp_rt6352()
10388 rt2800_bbp_write(rt2x00dev, 76, 0x44); in rt2800_restore_rf_bbp_rt6352()
10389 rt2800_bbp_write(rt2x00dev, 79, 0x1c); in rt2800_restore_rf_bbp_rt6352()
10390 rt2800_bbp_write(rt2x00dev, 80, 0x0c); in rt2800_restore_rf_bbp_rt6352()
10391 rt2800_bbp_write(rt2x00dev, 82, 0xB6); in rt2800_restore_rf_bbp_rt6352()
10394 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_restore_rf_bbp_rt6352()
10395 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363a); in rt2800_restore_rf_bbp_rt6352()
10396 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c666c); in rt2800_restore_rf_bbp_rt6352()
10397 rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c666c); in rt2800_restore_rf_bbp_rt6352()
10401 static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) in rt2800_calibration_rt6352() argument
10405 if (rt2x00_has_cap_external_pa(rt2x00dev) || in rt2800_calibration_rt6352()
10406 rt2x00_has_cap_external_lna_bg(rt2x00dev)) in rt2800_calibration_rt6352()
10407 rt2800_restore_rf_bbp_rt6352(rt2x00dev); in rt2800_calibration_rt6352()
10409 rt2800_r_calibration(rt2x00dev); in rt2800_calibration_rt6352()
10410 rt2800_rf_self_txdc_cal(rt2x00dev); in rt2800_calibration_rt6352()
10411 rt2800_rxdcoc_calibration(rt2x00dev); in rt2800_calibration_rt6352()
10412 rt2800_bw_filter_calibration(rt2x00dev, true); in rt2800_calibration_rt6352()
10413 rt2800_bw_filter_calibration(rt2x00dev, false); in rt2800_calibration_rt6352()
10414 rt2800_loft_iq_calibration(rt2x00dev); in rt2800_calibration_rt6352()
10418 rt2800_rxdcoc_calibration(rt2x00dev); in rt2800_calibration_rt6352()
10419 rt2800_rxiq_calibration(rt2x00dev); in rt2800_calibration_rt6352()
10421 if (!rt2x00_has_cap_external_pa(rt2x00dev) && in rt2800_calibration_rt6352()
10422 !rt2x00_has_cap_external_lna_bg(rt2x00dev)) in rt2800_calibration_rt6352()
10425 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_calibration_rt6352()
10426 reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); in rt2800_calibration_rt6352()
10428 rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); in rt2800_calibration_rt6352()
10430 reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); in rt2800_calibration_rt6352()
10432 rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); in rt2800_calibration_rt6352()
10435 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { in rt2800_calibration_rt6352()
10436 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); in rt2800_calibration_rt6352()
10437 rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); in rt2800_calibration_rt6352()
10438 rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); in rt2800_calibration_rt6352()
10441 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_calibration_rt6352()
10442 rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); in rt2800_calibration_rt6352()
10443 rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); in rt2800_calibration_rt6352()
10444 rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); in rt2800_calibration_rt6352()
10445 rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); in rt2800_calibration_rt6352()
10446 rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xc8); in rt2800_calibration_rt6352()
10447 rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xa4); in rt2800_calibration_rt6352()
10448 rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); in rt2800_calibration_rt6352()
10449 rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); in rt2800_calibration_rt6352()
10450 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xc8); in rt2800_calibration_rt6352()
10451 rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xa4); in rt2800_calibration_rt6352()
10452 rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); in rt2800_calibration_rt6352()
10453 rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); in rt2800_calibration_rt6352()
10454 rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xc8); in rt2800_calibration_rt6352()
10455 rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xa4); in rt2800_calibration_rt6352()
10456 rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); in rt2800_calibration_rt6352()
10459 if (rt2x00_has_cap_external_pa(rt2x00dev)) in rt2800_calibration_rt6352()
10460 rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); in rt2800_calibration_rt6352()
10462 if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { in rt2800_calibration_rt6352()
10463 rt2800_bbp_write(rt2x00dev, 75, 0x68); in rt2800_calibration_rt6352()
10464 rt2800_bbp_write(rt2x00dev, 76, 0x4c); in rt2800_calibration_rt6352()
10465 rt2800_bbp_write(rt2x00dev, 79, 0x1c); in rt2800_calibration_rt6352()
10466 rt2800_bbp_write(rt2x00dev, 80, 0x0c); in rt2800_calibration_rt6352()
10467 rt2800_bbp_write(rt2x00dev, 82, 0xb6); in rt2800_calibration_rt6352()
10470 if (rt2x00_has_cap_external_pa(rt2x00dev)) { in rt2800_calibration_rt6352()
10471 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); in rt2800_calibration_rt6352()
10472 rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c6b6c); in rt2800_calibration_rt6352()
10473 rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c6b6c); in rt2800_calibration_rt6352()
10477 static void rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr_6352() argument
10480 rt2800_rfcsr_write(rt2x00dev, 0, 0x02); in rt2800_init_rfcsr_6352()
10481 rt2800_rfcsr_write(rt2x00dev, 1, 0x03); in rt2800_init_rfcsr_6352()
10482 rt2800_rfcsr_write(rt2x00dev, 2, 0x33); in rt2800_init_rfcsr_6352()
10483 rt2800_rfcsr_write(rt2x00dev, 3, 0xFF); in rt2800_init_rfcsr_6352()
10484 rt2800_rfcsr_write(rt2x00dev, 4, 0x0C); in rt2800_init_rfcsr_6352()
10485 rt2800_rfcsr_write(rt2x00dev, 5, 0x40); in rt2800_init_rfcsr_6352()
10486 rt2800_rfcsr_write(rt2x00dev, 6, 0x00); in rt2800_init_rfcsr_6352()
10487 rt2800_rfcsr_write(rt2x00dev, 7, 0x00); in rt2800_init_rfcsr_6352()
10488 rt2800_rfcsr_write(rt2x00dev, 8, 0x00); in rt2800_init_rfcsr_6352()
10489 rt2800_rfcsr_write(rt2x00dev, 9, 0x00); in rt2800_init_rfcsr_6352()
10490 rt2800_rfcsr_write(rt2x00dev, 10, 0x00); in rt2800_init_rfcsr_6352()
10491 rt2800_rfcsr_write(rt2x00dev, 11, 0x00); in rt2800_init_rfcsr_6352()
10492 rt2800_rfcsr_write(rt2x00dev, 12, rt2x00dev->freq_offset); in rt2800_init_rfcsr_6352()
10493 rt2800_rfcsr_write(rt2x00dev, 13, 0x00); in rt2800_init_rfcsr_6352()
10494 rt2800_rfcsr_write(rt2x00dev, 14, 0x40); in rt2800_init_rfcsr_6352()
10495 rt2800_rfcsr_write(rt2x00dev, 15, 0x22); in rt2800_init_rfcsr_6352()
10496 rt2800_rfcsr_write(rt2x00dev, 16, 0x4C); in rt2800_init_rfcsr_6352()
10497 rt2800_rfcsr_write(rt2x00dev, 17, 0x00); in rt2800_init_rfcsr_6352()
10498 rt2800_rfcsr_write(rt2x00dev, 18, 0x00); in rt2800_init_rfcsr_6352()
10499 rt2800_rfcsr_write(rt2x00dev, 19, 0x00); in rt2800_init_rfcsr_6352()
10500 rt2800_rfcsr_write(rt2x00dev, 20, 0xA0); in rt2800_init_rfcsr_6352()
10501 rt2800_rfcsr_write(rt2x00dev, 21, 0x12); in rt2800_init_rfcsr_6352()
10502 rt2800_rfcsr_write(rt2x00dev, 22, 0x07); in rt2800_init_rfcsr_6352()
10503 rt2800_rfcsr_write(rt2x00dev, 23, 0x13); in rt2800_init_rfcsr_6352()
10504 rt2800_rfcsr_write(rt2x00dev, 24, 0xFE); in rt2800_init_rfcsr_6352()
10505 rt2800_rfcsr_write(rt2x00dev, 25, 0x24); in rt2800_init_rfcsr_6352()
10506 rt2800_rfcsr_write(rt2x00dev, 26, 0x7A); in rt2800_init_rfcsr_6352()
10507 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_6352()
10508 rt2800_rfcsr_write(rt2x00dev, 28, 0x00); in rt2800_init_rfcsr_6352()
10509 rt2800_rfcsr_write(rt2x00dev, 29, 0x05); in rt2800_init_rfcsr_6352()
10510 rt2800_rfcsr_write(rt2x00dev, 30, 0x00); in rt2800_init_rfcsr_6352()
10511 rt2800_rfcsr_write(rt2x00dev, 31, 0x00); in rt2800_init_rfcsr_6352()
10512 rt2800_rfcsr_write(rt2x00dev, 32, 0x00); in rt2800_init_rfcsr_6352()
10513 rt2800_rfcsr_write(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_6352()
10514 rt2800_rfcsr_write(rt2x00dev, 34, 0x00); in rt2800_init_rfcsr_6352()
10515 rt2800_rfcsr_write(rt2x00dev, 35, 0x00); in rt2800_init_rfcsr_6352()
10516 rt2800_rfcsr_write(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_6352()
10517 rt2800_rfcsr_write(rt2x00dev, 37, 0x00); in rt2800_init_rfcsr_6352()
10518 rt2800_rfcsr_write(rt2x00dev, 38, 0x00); in rt2800_init_rfcsr_6352()
10519 rt2800_rfcsr_write(rt2x00dev, 39, 0x00); in rt2800_init_rfcsr_6352()
10520 rt2800_rfcsr_write(rt2x00dev, 40, 0x00); in rt2800_init_rfcsr_6352()
10521 rt2800_rfcsr_write(rt2x00dev, 41, 0xD0); in rt2800_init_rfcsr_6352()
10522 rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); in rt2800_init_rfcsr_6352()
10523 rt2800_rfcsr_write(rt2x00dev, 43, 0x00); in rt2800_init_rfcsr_6352()
10525 rt2800_rfcsr_write(rt2x00dev, 11, 0x21); in rt2800_init_rfcsr_6352()
10526 if (rt2800_clk_is_20mhz(rt2x00dev)) in rt2800_init_rfcsr_6352()
10527 rt2800_rfcsr_write(rt2x00dev, 13, 0x03); in rt2800_init_rfcsr_6352()
10529 rt2800_rfcsr_write(rt2x00dev, 13, 0x00); in rt2800_init_rfcsr_6352()
10530 rt2800_rfcsr_write(rt2x00dev, 14, 0x7C); in rt2800_init_rfcsr_6352()
10531 rt2800_rfcsr_write(rt2x00dev, 16, 0x80); in rt2800_init_rfcsr_6352()
10532 rt2800_rfcsr_write(rt2x00dev, 17, 0x99); in rt2800_init_rfcsr_6352()
10533 rt2800_rfcsr_write(rt2x00dev, 18, 0x99); in rt2800_init_rfcsr_6352()
10534 rt2800_rfcsr_write(rt2x00dev, 19, 0x09); in rt2800_init_rfcsr_6352()
10535 rt2800_rfcsr_write(rt2x00dev, 20, 0x50); in rt2800_init_rfcsr_6352()
10536 rt2800_rfcsr_write(rt2x00dev, 21, 0xB0); in rt2800_init_rfcsr_6352()
10537 rt2800_rfcsr_write(rt2x00dev, 22, 0x00); in rt2800_init_rfcsr_6352()
10538 rt2800_rfcsr_write(rt2x00dev, 23, 0x06); in rt2800_init_rfcsr_6352()
10539 rt2800_rfcsr_write(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_6352()
10540 rt2800_rfcsr_write(rt2x00dev, 25, 0x00); in rt2800_init_rfcsr_6352()
10541 rt2800_rfcsr_write(rt2x00dev, 26, 0x5D); in rt2800_init_rfcsr_6352()
10542 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_6352()
10543 rt2800_rfcsr_write(rt2x00dev, 28, 0x61); in rt2800_init_rfcsr_6352()
10544 rt2800_rfcsr_write(rt2x00dev, 29, 0xB5); in rt2800_init_rfcsr_6352()
10545 rt2800_rfcsr_write(rt2x00dev, 43, 0x02); in rt2800_init_rfcsr_6352()
10547 rt2800_rfcsr_write(rt2x00dev, 28, 0x62); in rt2800_init_rfcsr_6352()
10548 rt2800_rfcsr_write(rt2x00dev, 29, 0xAD); in rt2800_init_rfcsr_6352()
10549 rt2800_rfcsr_write(rt2x00dev, 39, 0x80); in rt2800_init_rfcsr_6352()
10552 rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); in rt2800_init_rfcsr_6352()
10553 rt2800_rfcsr_write_chanreg(rt2x00dev, 1, 0x00); in rt2800_init_rfcsr_6352()
10554 rt2800_rfcsr_write_chanreg(rt2x00dev, 2, 0x00); in rt2800_init_rfcsr_6352()
10555 rt2800_rfcsr_write_chanreg(rt2x00dev, 3, 0x00); in rt2800_init_rfcsr_6352()
10556 rt2800_rfcsr_write_chanreg(rt2x00dev, 4, 0x00); in rt2800_init_rfcsr_6352()
10557 rt2800_rfcsr_write_chanreg(rt2x00dev, 5, 0x08); in rt2800_init_rfcsr_6352()
10558 rt2800_rfcsr_write_chanreg(rt2x00dev, 6, 0x00); in rt2800_init_rfcsr_6352()
10559 rt2800_rfcsr_write_chanreg(rt2x00dev, 7, 0x51); in rt2800_init_rfcsr_6352()
10560 rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x53); in rt2800_init_rfcsr_6352()
10561 rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x16); in rt2800_init_rfcsr_6352()
10562 rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x61); in rt2800_init_rfcsr_6352()
10563 rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); in rt2800_init_rfcsr_6352()
10564 rt2800_rfcsr_write_chanreg(rt2x00dev, 12, 0x22); in rt2800_init_rfcsr_6352()
10565 rt2800_rfcsr_write_chanreg(rt2x00dev, 13, 0x3D); in rt2800_init_rfcsr_6352()
10566 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); in rt2800_init_rfcsr_6352()
10567 rt2800_rfcsr_write_chanreg(rt2x00dev, 15, 0x13); in rt2800_init_rfcsr_6352()
10568 rt2800_rfcsr_write_chanreg(rt2x00dev, 16, 0x22); in rt2800_init_rfcsr_6352()
10569 rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x27); in rt2800_init_rfcsr_6352()
10570 rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); in rt2800_init_rfcsr_6352()
10571 rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); in rt2800_init_rfcsr_6352()
10572 rt2800_rfcsr_write_chanreg(rt2x00dev, 20, 0x01); in rt2800_init_rfcsr_6352()
10573 rt2800_rfcsr_write_chanreg(rt2x00dev, 21, 0x52); in rt2800_init_rfcsr_6352()
10574 rt2800_rfcsr_write_chanreg(rt2x00dev, 22, 0x80); in rt2800_init_rfcsr_6352()
10575 rt2800_rfcsr_write_chanreg(rt2x00dev, 23, 0xB3); in rt2800_init_rfcsr_6352()
10576 rt2800_rfcsr_write_chanreg(rt2x00dev, 24, 0x00); in rt2800_init_rfcsr_6352()
10577 rt2800_rfcsr_write_chanreg(rt2x00dev, 25, 0x00); in rt2800_init_rfcsr_6352()
10578 rt2800_rfcsr_write_chanreg(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_6352()
10579 rt2800_rfcsr_write_chanreg(rt2x00dev, 27, 0x00); in rt2800_init_rfcsr_6352()
10580 rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x5C); in rt2800_init_rfcsr_6352()
10581 rt2800_rfcsr_write_chanreg(rt2x00dev, 29, 0x6B); in rt2800_init_rfcsr_6352()
10582 rt2800_rfcsr_write_chanreg(rt2x00dev, 30, 0x6B); in rt2800_init_rfcsr_6352()
10583 rt2800_rfcsr_write_chanreg(rt2x00dev, 31, 0x31); in rt2800_init_rfcsr_6352()
10584 rt2800_rfcsr_write_chanreg(rt2x00dev, 32, 0x5D); in rt2800_init_rfcsr_6352()
10585 rt2800_rfcsr_write_chanreg(rt2x00dev, 33, 0x00); in rt2800_init_rfcsr_6352()
10586 rt2800_rfcsr_write_chanreg(rt2x00dev, 34, 0xE6); in rt2800_init_rfcsr_6352()
10587 rt2800_rfcsr_write_chanreg(rt2x00dev, 35, 0x55); in rt2800_init_rfcsr_6352()
10588 rt2800_rfcsr_write_chanreg(rt2x00dev, 36, 0x00); in rt2800_init_rfcsr_6352()
10589 rt2800_rfcsr_write_chanreg(rt2x00dev, 37, 0xBB); in rt2800_init_rfcsr_6352()
10590 rt2800_rfcsr_write_chanreg(rt2x00dev, 38, 0xB3); in rt2800_init_rfcsr_6352()
10591 rt2800_rfcsr_write_chanreg(rt2x00dev, 39, 0xB3); in rt2800_init_rfcsr_6352()
10592 rt2800_rfcsr_write_chanreg(rt2x00dev, 40, 0x03); in rt2800_init_rfcsr_6352()
10593 rt2800_rfcsr_write_chanreg(rt2x00dev, 41, 0x00); in rt2800_init_rfcsr_6352()
10594 rt2800_rfcsr_write_chanreg(rt2x00dev, 42, 0x00); in rt2800_init_rfcsr_6352()
10595 rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xB3); in rt2800_init_rfcsr_6352()
10596 rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xD3); in rt2800_init_rfcsr_6352()
10597 rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5); in rt2800_init_rfcsr_6352()
10598 rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x07); in rt2800_init_rfcsr_6352()
10599 rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x68); in rt2800_init_rfcsr_6352()
10600 rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xEF); in rt2800_init_rfcsr_6352()
10601 rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1C); in rt2800_init_rfcsr_6352()
10602 rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x07); in rt2800_init_rfcsr_6352()
10603 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xA8); in rt2800_init_rfcsr_6352()
10604 rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0x85); in rt2800_init_rfcsr_6352()
10605 rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x10); in rt2800_init_rfcsr_6352()
10606 rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x07); in rt2800_init_rfcsr_6352()
10607 rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6A); in rt2800_init_rfcsr_6352()
10608 rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0x85); in rt2800_init_rfcsr_6352()
10609 rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x10); in rt2800_init_rfcsr_6352()
10610 rt2800_rfcsr_write_chanreg(rt2x00dev, 62, 0x1C); in rt2800_init_rfcsr_6352()
10611 rt2800_rfcsr_write_chanreg(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_6352()
10613 rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); in rt2800_init_rfcsr_6352()
10615 rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47); in rt2800_init_rfcsr_6352()
10616 rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71); in rt2800_init_rfcsr_6352()
10617 rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x33); in rt2800_init_rfcsr_6352()
10618 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x0E); in rt2800_init_rfcsr_6352()
10619 rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); in rt2800_init_rfcsr_6352()
10620 rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA4); in rt2800_init_rfcsr_6352()
10621 rt2800_rfcsr_write_chanreg(rt2x00dev, 20, 0x02); in rt2800_init_rfcsr_6352()
10622 rt2800_rfcsr_write_chanreg(rt2x00dev, 21, 0x12); in rt2800_init_rfcsr_6352()
10623 rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x1C); in rt2800_init_rfcsr_6352()
10624 rt2800_rfcsr_write_chanreg(rt2x00dev, 29, 0xEB); in rt2800_init_rfcsr_6352()
10625 rt2800_rfcsr_write_chanreg(rt2x00dev, 32, 0x7D); in rt2800_init_rfcsr_6352()
10626 rt2800_rfcsr_write_chanreg(rt2x00dev, 34, 0xD6); in rt2800_init_rfcsr_6352()
10627 rt2800_rfcsr_write_chanreg(rt2x00dev, 36, 0x08); in rt2800_init_rfcsr_6352()
10628 rt2800_rfcsr_write_chanreg(rt2x00dev, 38, 0xB4); in rt2800_init_rfcsr_6352()
10629 rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); in rt2800_init_rfcsr_6352()
10630 rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3); in rt2800_init_rfcsr_6352()
10631 rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5); in rt2800_init_rfcsr_6352()
10632 rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); in rt2800_init_rfcsr_6352()
10633 rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0x67); in rt2800_init_rfcsr_6352()
10634 rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0x69); in rt2800_init_rfcsr_6352()
10635 rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFF); in rt2800_init_rfcsr_6352()
10636 rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27); in rt2800_init_rfcsr_6352()
10637 rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x20); in rt2800_init_rfcsr_6352()
10638 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); in rt2800_init_rfcsr_6352()
10639 rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF); in rt2800_init_rfcsr_6352()
10640 rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C); in rt2800_init_rfcsr_6352()
10641 rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); in rt2800_init_rfcsr_6352()
10642 rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); in rt2800_init_rfcsr_6352()
10643 rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); in rt2800_init_rfcsr_6352()
10644 rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); in rt2800_init_rfcsr_6352()
10646 rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); in rt2800_init_rfcsr_6352()
10647 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); in rt2800_init_rfcsr_6352()
10648 rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); in rt2800_init_rfcsr_6352()
10649 rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); in rt2800_init_rfcsr_6352()
10650 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); in rt2800_init_rfcsr_6352()
10651 rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); in rt2800_init_rfcsr_6352()
10652 rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); in rt2800_init_rfcsr_6352()
10653 rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); in rt2800_init_rfcsr_6352()
10654 rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); in rt2800_init_rfcsr_6352()
10656 rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); in rt2800_init_rfcsr_6352()
10657 rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); in rt2800_init_rfcsr_6352()
10658 rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); in rt2800_init_rfcsr_6352()
10659 rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); in rt2800_init_rfcsr_6352()
10660 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); in rt2800_init_rfcsr_6352()
10661 rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); in rt2800_init_rfcsr_6352()
10664 rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); in rt2800_init_rfcsr_6352()
10665 rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); in rt2800_init_rfcsr_6352()
10666 rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); in rt2800_init_rfcsr_6352()
10667 rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); in rt2800_init_rfcsr_6352()
10668 rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); in rt2800_init_rfcsr_6352()
10669 rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); in rt2800_init_rfcsr_6352()
10670 rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); in rt2800_init_rfcsr_6352()
10671 rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); in rt2800_init_rfcsr_6352()
10674 rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); in rt2800_init_rfcsr_6352()
10675 rt2800_rfcsr_write_dccal(rt2x00dev, 1, 0x00); in rt2800_init_rfcsr_6352()
10676 rt2800_rfcsr_write_dccal(rt2x00dev, 2, 0x00); in rt2800_init_rfcsr_6352()
10677 rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x00); in rt2800_init_rfcsr_6352()
10678 rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x00); in rt2800_init_rfcsr_6352()
10679 rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); in rt2800_init_rfcsr_6352()
10680 rt2800_rfcsr_write_dccal(rt2x00dev, 6, 0x10); in rt2800_init_rfcsr_6352()
10681 rt2800_rfcsr_write_dccal(rt2x00dev, 7, 0x10); in rt2800_init_rfcsr_6352()
10682 rt2800_rfcsr_write_dccal(rt2x00dev, 8, 0x04); in rt2800_init_rfcsr_6352()
10683 rt2800_rfcsr_write_dccal(rt2x00dev, 9, 0x00); in rt2800_init_rfcsr_6352()
10684 rt2800_rfcsr_write_dccal(rt2x00dev, 10, 0x07); in rt2800_init_rfcsr_6352()
10685 rt2800_rfcsr_write_dccal(rt2x00dev, 11, 0x01); in rt2800_init_rfcsr_6352()
10686 rt2800_rfcsr_write_dccal(rt2x00dev, 12, 0x07); in rt2800_init_rfcsr_6352()
10687 rt2800_rfcsr_write_dccal(rt2x00dev, 13, 0x07); in rt2800_init_rfcsr_6352()
10688 rt2800_rfcsr_write_dccal(rt2x00dev, 14, 0x07); in rt2800_init_rfcsr_6352()
10689 rt2800_rfcsr_write_dccal(rt2x00dev, 15, 0x20); in rt2800_init_rfcsr_6352()
10690 rt2800_rfcsr_write_dccal(rt2x00dev, 16, 0x22); in rt2800_init_rfcsr_6352()
10691 rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x00); in rt2800_init_rfcsr_6352()
10692 rt2800_rfcsr_write_dccal(rt2x00dev, 18, 0x00); in rt2800_init_rfcsr_6352()
10693 rt2800_rfcsr_write_dccal(rt2x00dev, 19, 0x00); in rt2800_init_rfcsr_6352()
10694 rt2800_rfcsr_write_dccal(rt2x00dev, 20, 0x00); in rt2800_init_rfcsr_6352()
10695 rt2800_rfcsr_write_dccal(rt2x00dev, 21, 0xF1); in rt2800_init_rfcsr_6352()
10696 rt2800_rfcsr_write_dccal(rt2x00dev, 22, 0x11); in rt2800_init_rfcsr_6352()
10697 rt2800_rfcsr_write_dccal(rt2x00dev, 23, 0x02); in rt2800_init_rfcsr_6352()
10698 rt2800_rfcsr_write_dccal(rt2x00dev, 24, 0x41); in rt2800_init_rfcsr_6352()
10699 rt2800_rfcsr_write_dccal(rt2x00dev, 25, 0x20); in rt2800_init_rfcsr_6352()
10700 rt2800_rfcsr_write_dccal(rt2x00dev, 26, 0x00); in rt2800_init_rfcsr_6352()
10701 rt2800_rfcsr_write_dccal(rt2x00dev, 27, 0xD7); in rt2800_init_rfcsr_6352()
10702 rt2800_rfcsr_write_dccal(rt2x00dev, 28, 0xA2); in rt2800_init_rfcsr_6352()
10703 rt2800_rfcsr_write_dccal(rt2x00dev, 29, 0x20); in rt2800_init_rfcsr_6352()
10704 rt2800_rfcsr_write_dccal(rt2x00dev, 30, 0x49); in rt2800_init_rfcsr_6352()
10705 rt2800_rfcsr_write_dccal(rt2x00dev, 31, 0x20); in rt2800_init_rfcsr_6352()
10706 rt2800_rfcsr_write_dccal(rt2x00dev, 32, 0x04); in rt2800_init_rfcsr_6352()
10707 rt2800_rfcsr_write_dccal(rt2x00dev, 33, 0xF1); in rt2800_init_rfcsr_6352()
10708 rt2800_rfcsr_write_dccal(rt2x00dev, 34, 0xA1); in rt2800_init_rfcsr_6352()
10709 rt2800_rfcsr_write_dccal(rt2x00dev, 35, 0x01); in rt2800_init_rfcsr_6352()
10710 rt2800_rfcsr_write_dccal(rt2x00dev, 41, 0x00); in rt2800_init_rfcsr_6352()
10711 rt2800_rfcsr_write_dccal(rt2x00dev, 42, 0x00); in rt2800_init_rfcsr_6352()
10712 rt2800_rfcsr_write_dccal(rt2x00dev, 43, 0x00); in rt2800_init_rfcsr_6352()
10713 rt2800_rfcsr_write_dccal(rt2x00dev, 44, 0x00); in rt2800_init_rfcsr_6352()
10714 rt2800_rfcsr_write_dccal(rt2x00dev, 45, 0x00); in rt2800_init_rfcsr_6352()
10715 rt2800_rfcsr_write_dccal(rt2x00dev, 46, 0x00); in rt2800_init_rfcsr_6352()
10716 rt2800_rfcsr_write_dccal(rt2x00dev, 47, 0x3E); in rt2800_init_rfcsr_6352()
10717 rt2800_rfcsr_write_dccal(rt2x00dev, 48, 0x3D); in rt2800_init_rfcsr_6352()
10718 rt2800_rfcsr_write_dccal(rt2x00dev, 49, 0x3E); in rt2800_init_rfcsr_6352()
10719 rt2800_rfcsr_write_dccal(rt2x00dev, 50, 0x3D); in rt2800_init_rfcsr_6352()
10720 rt2800_rfcsr_write_dccal(rt2x00dev, 51, 0x3E); in rt2800_init_rfcsr_6352()
10721 rt2800_rfcsr_write_dccal(rt2x00dev, 52, 0x3D); in rt2800_init_rfcsr_6352()
10722 rt2800_rfcsr_write_dccal(rt2x00dev, 53, 0x00); in rt2800_init_rfcsr_6352()
10723 rt2800_rfcsr_write_dccal(rt2x00dev, 54, 0x00); in rt2800_init_rfcsr_6352()
10724 rt2800_rfcsr_write_dccal(rt2x00dev, 55, 0x00); in rt2800_init_rfcsr_6352()
10725 rt2800_rfcsr_write_dccal(rt2x00dev, 56, 0x00); in rt2800_init_rfcsr_6352()
10726 rt2800_rfcsr_write_dccal(rt2x00dev, 57, 0x00); in rt2800_init_rfcsr_6352()
10727 rt2800_rfcsr_write_dccal(rt2x00dev, 58, 0x10); in rt2800_init_rfcsr_6352()
10728 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x10); in rt2800_init_rfcsr_6352()
10729 rt2800_rfcsr_write_dccal(rt2x00dev, 60, 0x0A); in rt2800_init_rfcsr_6352()
10730 rt2800_rfcsr_write_dccal(rt2x00dev, 61, 0x00); in rt2800_init_rfcsr_6352()
10731 rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); in rt2800_init_rfcsr_6352()
10732 rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); in rt2800_init_rfcsr_6352()
10734 rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x08); in rt2800_init_rfcsr_6352()
10735 rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x04); in rt2800_init_rfcsr_6352()
10736 rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x20); in rt2800_init_rfcsr_6352()
10738 rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); in rt2800_init_rfcsr_6352()
10739 rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); in rt2800_init_rfcsr_6352()
10742 rt2800_calibration_rt6352(rt2x00dev); in rt2800_init_rfcsr_6352()
10745 static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) in rt2800_init_rfcsr() argument
10747 if (rt2800_is_305x_soc(rt2x00dev)) { in rt2800_init_rfcsr()
10748 rt2800_init_rfcsr_305x_soc(rt2x00dev); in rt2800_init_rfcsr()
10752 switch (rt2x00dev->chip.rt) { in rt2800_init_rfcsr()
10756 rt2800_init_rfcsr_30xx(rt2x00dev); in rt2800_init_rfcsr()
10759 rt2800_init_rfcsr_3290(rt2x00dev); in rt2800_init_rfcsr()
10762 rt2800_init_rfcsr_3352(rt2x00dev); in rt2800_init_rfcsr()
10765 rt2800_init_rfcsr_3390(rt2x00dev); in rt2800_init_rfcsr()
10768 rt2800_init_rfcsr_3883(rt2x00dev); in rt2800_init_rfcsr()
10771 rt2800_init_rfcsr_3572(rt2x00dev); in rt2800_init_rfcsr()
10774 rt2800_init_rfcsr_3593(rt2x00dev); in rt2800_init_rfcsr()
10777 rt2800_init_rfcsr_5350(rt2x00dev); in rt2800_init_rfcsr()
10780 rt2800_init_rfcsr_5390(rt2x00dev); in rt2800_init_rfcsr()
10783 rt2800_init_rfcsr_5392(rt2x00dev); in rt2800_init_rfcsr()
10786 rt2800_init_rfcsr_5592(rt2x00dev); in rt2800_init_rfcsr()
10789 rt2800_init_rfcsr_6352(rt2x00dev); in rt2800_init_rfcsr()
10794 int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) in rt2800_enable_radio() argument
10802 if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || in rt2800_enable_radio()
10803 rt2800_init_registers(rt2x00dev))) in rt2800_enable_radio()
10809 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) in rt2800_enable_radio()
10815 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); in rt2800_enable_radio()
10816 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); in rt2800_enable_radio()
10817 if (rt2x00_is_usb(rt2x00dev)) in rt2800_enable_radio()
10818 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); in rt2800_enable_radio()
10819 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); in rt2800_enable_radio()
10825 if (unlikely(rt2800_wait_bbp_ready(rt2x00dev))) in rt2800_enable_radio()
10831 rt2800_init_bbp(rt2x00dev); in rt2800_enable_radio()
10832 rt2800_init_rfcsr(rt2x00dev); in rt2800_enable_radio()
10834 if (rt2x00_is_usb(rt2x00dev) && in rt2800_enable_radio()
10835 (rt2x00_rt(rt2x00dev, RT3070) || in rt2800_enable_radio()
10836 rt2x00_rt(rt2x00dev, RT3071) || in rt2800_enable_radio()
10837 rt2x00_rt(rt2x00dev, RT3572))) { in rt2800_enable_radio()
10839 rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); in rt2800_enable_radio()
10846 reg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_enable_radio()
10849 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800_enable_radio()
10853 reg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); in rt2800_enable_radio()
10857 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); in rt2800_enable_radio()
10859 reg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_enable_radio()
10862 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800_enable_radio()
10867 word = rt2800_eeprom_read(rt2x00dev, EEPROM_LED_AG_CONF); in rt2800_enable_radio()
10868 rt2800_mcu_request(rt2x00dev, MCU_LED_AG_CONF, 0xff, in rt2800_enable_radio()
10871 word = rt2800_eeprom_read(rt2x00dev, EEPROM_LED_ACT_CONF); in rt2800_enable_radio()
10872 rt2800_mcu_request(rt2x00dev, MCU_LED_ACT_CONF, 0xff, in rt2800_enable_radio()
10875 word = rt2800_eeprom_read(rt2x00dev, EEPROM_LED_POLARITY); in rt2800_enable_radio()
10876 rt2800_mcu_request(rt2x00dev, MCU_LED_LED_POLARITY, 0xff, in rt2800_enable_radio()
10883 void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev) in rt2800_disable_radio() argument
10887 rt2800_disable_wpdma(rt2x00dev); in rt2800_disable_radio()
10890 rt2800_wait_wpdma_ready(rt2x00dev); in rt2800_disable_radio()
10892 reg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800_disable_radio()
10895 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800_disable_radio()
10899 int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) in rt2800_efuse_detect() argument
10904 if (rt2x00_rt(rt2x00dev, RT3290)) in rt2800_efuse_detect()
10909 reg = rt2800_register_read(rt2x00dev, efuse_ctrl_reg); in rt2800_efuse_detect()
10914 static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) in rt2800_efuse_read() argument
10923 if (rt2x00_rt(rt2x00dev, RT3290)) { in rt2800_efuse_read()
10936 mutex_lock(&rt2x00dev->csr_mutex); in rt2800_efuse_read()
10938 reg = rt2800_register_read_lock(rt2x00dev, efuse_ctrl_reg); in rt2800_efuse_read()
10942 rt2800_register_write_lock(rt2x00dev, efuse_ctrl_reg, reg); in rt2800_efuse_read()
10945 rt2800_regbusy_read(rt2x00dev, efuse_ctrl_reg, EFUSE_CTRL_KICK, ®); in rt2800_efuse_read()
10947 reg = rt2800_register_read_lock(rt2x00dev, efuse_data3_reg); in rt2800_efuse_read()
10949 *(__le32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); in rt2800_efuse_read()
10950 reg = rt2800_register_read_lock(rt2x00dev, efuse_data2_reg); in rt2800_efuse_read()
10951 *(__le32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); in rt2800_efuse_read()
10952 reg = rt2800_register_read_lock(rt2x00dev, efuse_data1_reg); in rt2800_efuse_read()
10953 *(__le32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg); in rt2800_efuse_read()
10954 reg = rt2800_register_read_lock(rt2x00dev, efuse_data0_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()
10960 int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) in rt2800_read_eeprom_efuse() argument
10965 rt2800_efuse_read(rt2x00dev, i); in rt2800_read_eeprom_efuse()
10971 static u8 rt2800_get_txmixer_gain_24g(struct rt2x00_dev *rt2x00dev) in rt2800_get_txmixer_gain_24g() argument
10975 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_get_txmixer_gain_24g()
10976 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_get_txmixer_gain_24g()
10979 word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG); in rt2800_get_txmixer_gain_24g()
10986 static u8 rt2800_get_txmixer_gain_5g(struct rt2x00_dev *rt2x00dev) in rt2800_get_txmixer_gain_5g() argument
10990 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_get_txmixer_gain_5g()
10991 rt2x00_rt(rt2x00dev, RT3883)) in rt2800_get_txmixer_gain_5g()
10994 word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A); in rt2800_get_txmixer_gain_5g()
11001 static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) in rt2800_validate_eeprom() argument
11003 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; in rt2800_validate_eeprom()
11012 retval = rt2800_read_eeprom(rt2x00dev); in rt2800_validate_eeprom()
11019 mac = rt2800_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); in rt2800_validate_eeprom()
11020 rt2x00lib_set_mac_address(rt2x00dev, mac); in rt2800_validate_eeprom()
11022 word = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); in rt2800_validate_eeprom()
11027 rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); in rt2800_validate_eeprom()
11028 rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); in rt2800_validate_eeprom()
11029 } else if (rt2x00_rt(rt2x00dev, RT2860) || in rt2800_validate_eeprom()
11030 rt2x00_rt(rt2x00dev, RT2872)) { in rt2800_validate_eeprom()
11036 rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); in rt2800_validate_eeprom()
11039 word = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_validate_eeprom()
11056 rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word); in rt2800_validate_eeprom()
11057 rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); in rt2800_validate_eeprom()
11060 word = rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ); in rt2800_validate_eeprom()
11063 rt2800_eeprom_write(rt2x00dev, EEPROM_FREQ, word); in rt2800_validate_eeprom()
11064 rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word); in rt2800_validate_eeprom()
11070 rt2800_eeprom_write(rt2x00dev, EEPROM_FREQ, word); in rt2800_validate_eeprom()
11071 rt2800_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555); in rt2800_validate_eeprom()
11072 rt2800_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221); in rt2800_validate_eeprom()
11073 rt2800_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8); in rt2800_validate_eeprom()
11074 rt2x00_eeprom_dbg(rt2x00dev, "Led Mode: 0x%04x\n", word); in rt2800_validate_eeprom()
11082 word = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); in rt2800_validate_eeprom()
11085 word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG); in rt2800_validate_eeprom()
11090 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word); in rt2800_validate_eeprom()
11092 drv_data->txmixer_gain_24g = rt2800_get_txmixer_gain_24g(rt2x00dev); in rt2800_validate_eeprom()
11094 word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); in rt2800_validate_eeprom()
11097 if (!rt2x00_rt(rt2x00dev, RT3593) && in rt2800_validate_eeprom()
11098 !rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_validate_eeprom()
11104 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word); in rt2800_validate_eeprom()
11106 drv_data->txmixer_gain_5g = rt2800_get_txmixer_gain_5g(rt2x00dev); in rt2800_validate_eeprom()
11108 word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A); in rt2800_validate_eeprom()
11113 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word); in rt2800_validate_eeprom()
11115 word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); in rt2800_validate_eeprom()
11118 if (!rt2x00_rt(rt2x00dev, RT3593) && in rt2800_validate_eeprom()
11119 !rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_validate_eeprom()
11125 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); in rt2800_validate_eeprom()
11127 if (rt2x00_rt(rt2x00dev, RT3593) || in rt2800_validate_eeprom()
11128 rt2x00_rt(rt2x00dev, RT3883)) { in rt2800_validate_eeprom()
11129 word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); in rt2800_validate_eeprom()
11138 rt2800_eeprom_write(rt2x00dev, EEPROM_EXT_LNA2, word); in rt2800_validate_eeprom()
11144 static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) in rt2800_init_eeprom() argument
11153 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); in rt2800_init_eeprom()
11160 if (rt2x00_rt(rt2x00dev, RT3290) || in rt2800_init_eeprom()
11161 rt2x00_rt(rt2x00dev, RT5390) || in rt2800_init_eeprom()
11162 rt2x00_rt(rt2x00dev, RT5392) || in rt2800_init_eeprom()
11163 rt2x00_rt(rt2x00dev, RT6352)) in rt2800_init_eeprom()
11164 rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID); in rt2800_init_eeprom()
11165 else if (rt2x00_rt(rt2x00dev, RT3352)) in rt2800_init_eeprom()
11167 else if (rt2x00_rt(rt2x00dev, RT3883)) in rt2800_init_eeprom()
11169 else if (rt2x00_rt(rt2x00dev, RT5350)) in rt2800_init_eeprom()
11171 else if (rt2x00_rt(rt2x00dev, RT5592)) in rt2800_init_eeprom()
11203 rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n", in rt2800_init_eeprom()
11208 rt2x00_set_rf(rt2x00dev, rf); 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()
11218 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_eeprom()
11220 if (rt2x00_rt(rt2x00dev, RT3070) || in rt2800_init_eeprom()
11221 rt2x00_rt(rt2x00dev, RT3090) || in rt2800_init_eeprom()
11222 rt2x00_rt(rt2x00dev, RT3352) || in rt2800_init_eeprom()
11223 rt2x00_rt(rt2x00dev, RT3390)) { 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()
11244 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R) || in rt2800_init_eeprom()
11245 rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5370G)) { 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()
11267 if (!rt2x00_rt(rt2x00dev, RT3352) && in rt2800_init_eeprom()
11269 __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11274 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_FREQ); 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()
11291 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER); in rt2800_init_eeprom()
11295 __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11300 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); in rt2800_init_eeprom()
11302 if (rt2x00_rt(rt2x00dev, RT3352) || in rt2800_init_eeprom()
11303 rt2x00_rt(rt2x00dev, RT6352)) { in rt2800_init_eeprom()
11307 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11311 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11314 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); in rt2800_init_eeprom()
11316 if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) { in rt2800_init_eeprom()
11320 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11322 &rt2x00dev->cap_flags); in rt2800_init_eeprom()
11700 static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) in rt2800_probe_hw_mode() argument
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()
11738 if (!rt2x00_is_usb(rt2x00dev)) 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()
11745 rt2800_eeprom_addr(rt2x00dev, 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()
11766 switch (rt2x00dev->chip.rf) { in rt2800_probe_hw_mode()
11795 if (rt2800_clk_is_20mhz(rt2x00dev)) in rt2800_probe_hw_mode()
11818 reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX); in rt2800_probe_hw_mode()
11839 if (!rt2x00_rf(rt2x00dev, RF2020)) 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()
11887 rt2x00dev->chan_survey = in rt2800_probe_hw_mode()
11890 if (!rt2x00dev->chan_survey) { in rt2800_probe_hw_mode()
11897 default_power1 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); in rt2800_probe_hw_mode()
11898 default_power2 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); in rt2800_probe_hw_mode()
11900 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_probe_hw_mode()
11901 default_power3 = rt2800_eeprom_addr(rt2x00dev, in rt2800_probe_hw_mode()
11914 default_power1 = rt2800_eeprom_addr(rt2x00dev, in rt2800_probe_hw_mode()
11916 default_power2 = rt2800_eeprom_addr(rt2x00dev, in rt2800_probe_hw_mode()
11919 if (rt2x00dev->default_ant.tx_chain_num > 2) in rt2800_probe_hw_mode()
11921 rt2800_eeprom_addr(rt2x00dev, 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()
11961 static int rt2800_probe_rt(struct rt2x00_dev *rt2x00dev) in rt2800_probe_rt() argument
11967 if (rt2x00_rt(rt2x00dev, RT3290)) in rt2800_probe_rt()
11968 reg = rt2800_register_read(rt2x00dev, MAC_CSR0_3290); in rt2800_probe_rt()
11970 reg = rt2800_register_read(rt2x00dev, MAC_CSR0); in rt2800_probe_rt()
11994 rt2x00_err(rt2x00dev, "Invalid RT chipset 0x%04x, rev %04x detected\n", in rt2800_probe_rt()
11999 if (rt == RT5390 && rt2x00_is_soc(rt2x00dev)) in rt2800_probe_rt()
12002 rt2x00_set_rt(rt2x00dev, rt, rev); in rt2800_probe_rt()
12007 int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) in rt2800_probe_hw() argument
12012 retval = rt2800_probe_rt(rt2x00dev); in rt2800_probe_hw()
12019 retval = rt2800_validate_eeprom(rt2x00dev); in rt2800_probe_hw()
12023 retval = rt2800_init_eeprom(rt2x00dev); in rt2800_probe_hw()
12031 reg = rt2800_register_read(rt2x00dev, GPIO_CTRL); in rt2800_probe_hw()
12033 rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); in rt2800_probe_hw()
12038 retval = rt2800_probe_hw_mode(rt2x00dev); in rt2800_probe_hw()
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()
12047 if (!rt2x00_is_usb(rt2x00dev)) in rt2800_probe_hw()
12048 __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags); in rt2800_probe_hw()
12053 if (!rt2x00_is_soc(rt2x00dev)) 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()
12057 if (!rt2800_hwcrypt_disabled(rt2x00dev)) 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()
12061 if (rt2x00_is_usb(rt2x00dev)) 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()
12070 if (rt2x00_is_usb(rt2x00dev)) 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() local
12101 rt2800_register_multiread(rt2x00dev, offset, in rt2800_get_key_seq()
12111 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_set_rts_threshold() local
12115 reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); in rt2800_set_rts_threshold()
12117 rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); in rt2800_set_rts_threshold()
12119 reg = rt2800_register_read(rt2x00dev, CCK_PROT_CFG); in rt2800_set_rts_threshold()
12121 rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); in rt2800_set_rts_threshold()
12123 reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); in rt2800_set_rts_threshold()
12125 rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); in rt2800_set_rts_threshold()
12127 reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); in rt2800_set_rts_threshold()
12129 rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); in rt2800_set_rts_threshold()
12131 reg = rt2800_register_read(rt2x00dev, MM40_PROT_CFG); in rt2800_set_rts_threshold()
12133 rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); in rt2800_set_rts_threshold()
12135 reg = rt2800_register_read(rt2x00dev, GF20_PROT_CFG); in rt2800_set_rts_threshold()
12137 rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); in rt2800_set_rts_threshold()
12139 reg = rt2800_register_read(rt2x00dev, GF40_PROT_CFG); in rt2800_set_rts_threshold()
12141 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); in rt2800_set_rts_threshold()
12152 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_conf_tx() local
12176 queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); in rt2800_conf_tx()
12183 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_conf_tx()
12185 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_conf_tx()
12191 reg = rt2800_register_read(rt2x00dev, WMM_AIFSN_CFG); in rt2800_conf_tx()
12193 rt2800_register_write(rt2x00dev, WMM_AIFSN_CFG, reg); in rt2800_conf_tx()
12195 reg = rt2800_register_read(rt2x00dev, WMM_CWMIN_CFG); in rt2800_conf_tx()
12197 rt2800_register_write(rt2x00dev, WMM_CWMIN_CFG, reg); in rt2800_conf_tx()
12199 reg = rt2800_register_read(rt2x00dev, WMM_CWMAX_CFG); in rt2800_conf_tx()
12201 rt2800_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); in rt2800_conf_tx()
12206 reg = rt2800_register_read(rt2x00dev, offset); in rt2800_conf_tx()
12211 rt2800_register_write(rt2x00dev, offset, reg); in rt2800_conf_tx()
12219 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_get_tsf() local
12223 reg = rt2800_register_read(rt2x00dev, TSF_TIMER_DW1); in rt2800_get_tsf()
12225 reg = rt2800_register_read(rt2x00dev, TSF_TIMER_DW0); in rt2800_get_tsf()
12283 struct rt2x00_dev *rt2x00dev = hw->priv; in rt2800_get_survey() local
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()
12297 rt2800_update_survey(rt2x00dev); in rt2800_get_survey()
12299 survey->channel = &rt2x00dev->bands[band].channels[idx]; in rt2800_get_survey()