diff options
author | RA-Jay Hung <jay_hung@ralinktech.com> | 2011-01-10 05:28:10 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-19 11:36:07 -0500 |
commit | 80d184e6cfb1ba7371152c4c91652d770c9caddb (patch) | |
tree | 2bd28dc016b85aaac3218bf317ef225e8aec4608 /drivers/net/wireless/rt2x00 | |
parent | 7f6e144fb99a4a70d3c5ad5f074204c5b89a6f65 (diff) |
rt2x00: Fix and fine-tune rf registers for RT3070/RT3071/RT3090
Basically fix and fine-tune RT3070/RT3071/RT3090 chip RF initial value
when call rt2800_init_rfcsr
Signed-off-by: RA-Jay Hung <jay_hung@ralinktech.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 25 |
2 files changed, 23 insertions, 8 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 4c55e8525cad..c7e615cebac1 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1805,6 +1805,12 @@ struct mac_iveiv_entry { | |||
1805 | #define RFCSR30_RF_CALIBRATION FIELD8(0x80) | 1805 | #define RFCSR30_RF_CALIBRATION FIELD8(0x80) |
1806 | 1806 | ||
1807 | /* | 1807 | /* |
1808 | * RFCSR 31: | ||
1809 | */ | ||
1810 | #define RFCSR31_RX_AGC_FC FIELD8(0x1f) | ||
1811 | #define RFCSR31_RX_H20M FIELD8(0x20) | ||
1812 | |||
1813 | /* | ||
1808 | * RF registers | 1814 | * RF registers |
1809 | */ | 1815 | */ |
1810 | 1816 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index e2a528da3641..a25be625ee90 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2436,6 +2436,10 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, | |||
2436 | rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40); | 2436 | rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40); |
2437 | rt2800_bbp_write(rt2x00dev, 4, bbp); | 2437 | rt2800_bbp_write(rt2x00dev, 4, bbp); |
2438 | 2438 | ||
2439 | rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr); | ||
2440 | rt2x00_set_field8(&rfcsr, RFCSR31_RX_H20M, bw40); | ||
2441 | rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); | ||
2442 | |||
2439 | rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); | 2443 | rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); |
2440 | rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1); | 2444 | rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1); |
2441 | rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); | 2445 | rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); |
@@ -2510,7 +2514,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2510 | rt2800_rfcsr_write(rt2x00dev, 4, 0x40); | 2514 | rt2800_rfcsr_write(rt2x00dev, 4, 0x40); |
2511 | rt2800_rfcsr_write(rt2x00dev, 5, 0x03); | 2515 | rt2800_rfcsr_write(rt2x00dev, 5, 0x03); |
2512 | rt2800_rfcsr_write(rt2x00dev, 6, 0x02); | 2516 | rt2800_rfcsr_write(rt2x00dev, 6, 0x02); |
2513 | rt2800_rfcsr_write(rt2x00dev, 7, 0x70); | 2517 | rt2800_rfcsr_write(rt2x00dev, 7, 0x60); |
2514 | rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); | 2518 | rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); |
2515 | rt2800_rfcsr_write(rt2x00dev, 10, 0x41); | 2519 | rt2800_rfcsr_write(rt2x00dev, 10, 0x41); |
2516 | rt2800_rfcsr_write(rt2x00dev, 11, 0x21); | 2520 | rt2800_rfcsr_write(rt2x00dev, 11, 0x21); |
@@ -2602,12 +2606,12 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2602 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | 2606 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); |
2603 | } else if (rt2x00_rt(rt2x00dev, RT3071) || | 2607 | } else if (rt2x00_rt(rt2x00dev, RT3071) || |
2604 | rt2x00_rt(rt2x00dev, RT3090)) { | 2608 | rt2x00_rt(rt2x00dev, RT3090)) { |
2609 | rt2800_rfcsr_write(rt2x00dev, 31, 0x14); | ||
2610 | |||
2605 | rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); | 2611 | rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); |
2606 | rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); | 2612 | rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); |
2607 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); | 2613 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); |
2608 | 2614 | ||
2609 | rt2800_rfcsr_write(rt2x00dev, 31, 0x14); | ||
2610 | |||
2611 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); | 2615 | rt2800_register_read(rt2x00dev, LDO_CFG0, ®); |
2612 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); | 2616 | rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); |
2613 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | 2617 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || |
@@ -2619,6 +2623,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2619 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); | 2623 | rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); |
2620 | } | 2624 | } |
2621 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); | 2625 | rt2800_register_write(rt2x00dev, LDO_CFG0, reg); |
2626 | |||
2627 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); | ||
2628 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); | ||
2629 | rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); | ||
2622 | } else if (rt2x00_rt(rt2x00dev, RT3390)) { | 2630 | } else if (rt2x00_rt(rt2x00dev, RT3390)) { |
2623 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); | 2631 | rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); |
2624 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); | 2632 | rt2x00_set_field32(®, GPIO_SWITCH_5, 0); |
@@ -2670,10 +2678,11 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2670 | 2678 | ||
2671 | rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); | 2679 | rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); |
2672 | rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); | 2680 | rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); |
2673 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | 2681 | if (rt2x00_rt(rt2x00dev, RT3070) || |
2682 | rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || | ||
2674 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || | 2683 | rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || |
2675 | rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { | 2684 | rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { |
2676 | if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) | 2685 | if (!test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) |
2677 | rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); | 2686 | rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); |
2678 | } | 2687 | } |
2679 | rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom); | 2688 | rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom); |
@@ -2686,6 +2695,7 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2686 | if (rt2x00_rt(rt2x00dev, RT3090)) { | 2695 | if (rt2x00_rt(rt2x00dev, RT3090)) { |
2687 | rt2800_bbp_read(rt2x00dev, 138, &bbp); | 2696 | rt2800_bbp_read(rt2x00dev, 138, &bbp); |
2688 | 2697 | ||
2698 | /* Turn off unused DAC1 and ADC1 to reduce power consumption */ | ||
2689 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); | 2699 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); |
2690 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) | 2700 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) |
2691 | rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); | 2701 | rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); |
@@ -2719,10 +2729,9 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2719 | rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); | 2729 | rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); |
2720 | } | 2730 | } |
2721 | 2731 | ||
2722 | if (rt2x00_rt(rt2x00dev, RT3070) || rt2x00_rt(rt2x00dev, RT3071)) { | 2732 | if (rt2x00_rt(rt2x00dev, RT3070)) { |
2723 | rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr); | 2733 | rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr); |
2724 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) || | 2734 | if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) |
2725 | rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E)) | ||
2726 | rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3); | 2735 | rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3); |
2727 | else | 2736 | else |
2728 | rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0); | 2737 | rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0); |