aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index c990ab8b1d24..e96ea3298c7c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -527,8 +527,10 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
527 */ 527 */
528 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); 528 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
529 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); 529 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
530 if (rt2x00_is_usb(rt2x00dev)) 530 if (rt2x00_is_usb(rt2x00dev)) {
531 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); 531 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0);
532 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0);
533 }
532 msleep(1); 534 msleep(1);
533 535
534 return 0; 536 return 0;
@@ -2456,6 +2458,41 @@ static void rt2800_config_channel_rf55xx(struct rt2x00_dev *rt2x00dev,
2456 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); 2458 rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
2457} 2459}
2458 2460
2461static void rt2800_iq_calibrate(struct rt2x00_dev *rt2x00dev, int channel)
2462{
2463 u8 cal;
2464
2465 /* TODO */
2466 if (WARN_ON_ONCE(channel > 14))
2467 return;
2468
2469 rt2800_bbp_write(rt2x00dev, 158, 0x2c);
2470 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX0_2G);
2471 rt2800_bbp_write(rt2x00dev, 159, cal);
2472
2473 rt2800_bbp_write(rt2x00dev, 158, 0x2d);
2474 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX0_2G);
2475 rt2800_bbp_write(rt2x00dev, 159, cal);
2476
2477 rt2800_bbp_write(rt2x00dev, 158, 0x4a);
2478 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX1_2G);
2479 rt2800_bbp_write(rt2x00dev, 159, cal);
2480
2481 rt2800_bbp_write(rt2x00dev, 158, 0x4b);
2482 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX1_2G);
2483 rt2800_bbp_write(rt2x00dev, 159, cal);
2484
2485 /* RF IQ compensation control */
2486 rt2800_bbp_write(rt2x00dev, 158, 0x04);
2487 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_RF_IQ_COMPENSATION_CONTROL);
2488 rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0);
2489
2490 /* RF IQ imbalance compensation control */
2491 rt2800_bbp_write(rt2x00dev, 158, 0x03);
2492 cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL);
2493 rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0);
2494}
2495
2459static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, 2496static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2460 struct ieee80211_conf *conf, 2497 struct ieee80211_conf *conf,
2461 struct rf_channel *rf, 2498 struct rf_channel *rf,
@@ -2606,7 +2643,7 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2606 rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a); 2643 rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a);
2607 2644
2608 /* TODO AGC adjust */ 2645 /* TODO AGC adjust */
2609 /* TODO IQ calibration */ 2646 rt2800_iq_calibrate(rt2x00dev, rf->channel);
2610 } 2647 }
2611 2648
2612 rt2800_bbp_read(rt2x00dev, 4, &bbp); 2649 rt2800_bbp_read(rt2x00dev, 4, &bbp);