aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-02-21 17:47:33 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-21 17:47:33 -0500
commit4b0d1a0b1fd7248d0fc341d00ed908c7373c7788 (patch)
tree7ba1dad63482c9a3d4461ec324aef9f909e73f49 /drivers/net/wireless/rt2x00/rt2800lib.c
parent8de65c2aaa1faf8e57e1b29b4265b6a57fae4136 (diff)
parenta9802d43f205faa2fff422502a1336a50b9615c3 (diff)
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c159
1 files changed, 132 insertions, 27 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index dbe7ece862f2..772d4aec303a 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1645,10 +1645,14 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1645 struct rf_channel *rf, 1645 struct rf_channel *rf,
1646 struct channel_info *info) 1646 struct channel_info *info)
1647{ 1647{
1648 u8 rfcsr; 1648 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
1649 u8 rfcsr, calib_tx, calib_rx;
1649 1650
1650 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); 1651 rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1);
1651 rt2800_rfcsr_write(rt2x00dev, 3, rf->rf3); 1652
1653 rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr);
1654 rt2x00_set_field8(&rfcsr, RFCSR3_K, rf->rf3);
1655 rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
1652 1656
1653 rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); 1657 rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr);
1654 rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2); 1658 rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2);
@@ -1662,16 +1666,82 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,
1662 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2); 1666 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2);
1663 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); 1667 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr);
1664 1668
1669 rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
1670 rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
1671 rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
1672 if (rt2x00_rt(rt2x00dev, RT3390)) {
1673 rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD,
1674 rt2x00dev->default_ant.rx_chain_num == 1);
1675 rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD,
1676 rt2x00dev->default_ant.tx_chain_num == 1);
1677 } else {
1678 rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0);
1679 rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0);
1680 rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0);
1681 rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0);
1682
1683 switch (rt2x00dev->default_ant.tx_chain_num) {
1684 case 1:
1685 rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1);
1686 /* fall through */
1687 case 2:
1688 rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1);
1689 break;
1690 }
1691
1692 switch (rt2x00dev->default_ant.rx_chain_num) {
1693 case 1:
1694 rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1);
1695 /* fall through */
1696 case 2:
1697 rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1);
1698 break;
1699 }
1700 }
1701 rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
1702
1703 rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
1704 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
1705 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1706 msleep(1);
1707 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
1708 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1709
1665 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); 1710 rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr);
1666 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); 1711 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
1667 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); 1712 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
1668 1713
1669 rt2800_rfcsr_write(rt2x00dev, 24, 1714 if (rt2x00_rt(rt2x00dev, RT3390)) {
1670 rt2x00dev->calibration[conf_is_ht40(conf)]); 1715 calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f;
1716 calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f;
1717 } else {
1718 if (conf_is_ht40(conf)) {
1719 calib_tx = drv_data->calibration_bw40;
1720 calib_rx = drv_data->calibration_bw40;
1721 } else {
1722 calib_tx = drv_data->calibration_bw20;
1723 calib_rx = drv_data->calibration_bw20;
1724 }
1725 }
1726
1727 rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr);
1728 rt2x00_set_field8(&rfcsr, RFCSR24_TX_CALIB, calib_tx);
1729 rt2800_rfcsr_write(rt2x00dev, 24, rfcsr);
1730
1731 rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr);
1732 rt2x00_set_field8(&rfcsr, RFCSR31_RX_CALIB, calib_rx);
1733 rt2800_rfcsr_write(rt2x00dev, 31, rfcsr);
1671 1734
1672 rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr); 1735 rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr);
1673 rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); 1736 rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1);
1674 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); 1737 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
1738
1739 rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
1740 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1);
1741 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1742 msleep(1);
1743 rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0);
1744 rt2800_rfcsr_write(rt2x00dev, 30, rfcsr);
1675} 1745}
1676 1746
1677static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev, 1747static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
@@ -1679,12 +1749,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1679 struct rf_channel *rf, 1749 struct rf_channel *rf,
1680 struct channel_info *info) 1750 struct channel_info *info)
1681{ 1751{
1752 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
1682 u8 rfcsr; 1753 u8 rfcsr;
1683 u32 reg; 1754 u32 reg;
1684 1755
1685 if (rf->channel <= 14) { 1756 if (rf->channel <= 14) {
1686 rt2800_bbp_write(rt2x00dev, 25, 0x15); 1757 rt2800_bbp_write(rt2x00dev, 25, drv_data->bbp25);
1687 rt2800_bbp_write(rt2x00dev, 26, 0x85); 1758 rt2800_bbp_write(rt2x00dev, 26, drv_data->bbp26);
1688 } else { 1759 } else {
1689 rt2800_bbp_write(rt2x00dev, 25, 0x09); 1760 rt2800_bbp_write(rt2x00dev, 25, 0x09);
1690 rt2800_bbp_write(rt2x00dev, 26, 0xff); 1761 rt2800_bbp_write(rt2x00dev, 26, 0xff);
@@ -1712,8 +1783,7 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1712 if (rf->channel <= 14) { 1783 if (rf->channel <= 14) {
1713 rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 3); 1784 rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 3);
1714 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, 1785 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
1715 (info->default_power1 & 0x3) | 1786 info->default_power1);
1716 ((info->default_power1 & 0xC) << 1));
1717 } else { 1787 } else {
1718 rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 7); 1788 rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 7);
1719 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, 1789 rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER,
@@ -1726,8 +1796,7 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1726 if (rf->channel <= 14) { 1796 if (rf->channel <= 14) {
1727 rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 3); 1797 rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 3);
1728 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, 1798 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER,
1729 (info->default_power2 & 0x3) | 1799 info->default_power2);
1730 ((info->default_power2 & 0xC) << 1));
1731 } else { 1800 } else {
1732 rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 7); 1801 rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 7);
1733 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, 1802 rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER,
@@ -1737,11 +1806,12 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1737 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); 1806 rt2800_rfcsr_write(rt2x00dev, 13, rfcsr);
1738 1807
1739 rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); 1808 rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr);
1740 rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1);
1741 rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); 1809 rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0);
1742 rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); 1810 rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0);
1743 rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); 1811 rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0);
1744 rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); 1812 rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0);
1813 rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0);
1814 rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0);
1745 if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) { 1815 if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) {
1746 if (rf->channel <= 14) { 1816 if (rf->channel <= 14) {
1747 rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); 1817 rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1);
@@ -1772,10 +1842,13 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1772 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); 1842 rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset);
1773 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); 1843 rt2800_rfcsr_write(rt2x00dev, 23, rfcsr);
1774 1844
1775 rt2800_rfcsr_write(rt2x00dev, 24, 1845 if (conf_is_ht40(conf)) {
1776 rt2x00dev->calibration[conf_is_ht40(conf)]); 1846 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw40);
1777 rt2800_rfcsr_write(rt2x00dev, 31, 1847 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw40);
1778 rt2x00dev->calibration[conf_is_ht40(conf)]); 1848 } else {
1849 rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw20);
1850 rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw20);
1851 }
1779 1852
1780 if (rf->channel <= 14) { 1853 if (rf->channel <= 14) {
1781 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); 1854 rt2800_rfcsr_write(rt2x00dev, 7, 0xd8);
@@ -1783,7 +1856,10 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1783 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); 1856 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1);
1784 rt2800_rfcsr_write(rt2x00dev, 11, 0xb9); 1857 rt2800_rfcsr_write(rt2x00dev, 11, 0xb9);
1785 rt2800_rfcsr_write(rt2x00dev, 15, 0x53); 1858 rt2800_rfcsr_write(rt2x00dev, 15, 0x53);
1786 rt2800_rfcsr_write(rt2x00dev, 16, 0x4c); 1859 rfcsr = 0x4c;
1860 rt2x00_set_field8(&rfcsr, RFCSR16_TXMIXER_GAIN,
1861 drv_data->txmixer_gain_24g);
1862 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
1787 rt2800_rfcsr_write(rt2x00dev, 17, 0x23); 1863 rt2800_rfcsr_write(rt2x00dev, 17, 0x23);
1788 rt2800_rfcsr_write(rt2x00dev, 19, 0x93); 1864 rt2800_rfcsr_write(rt2x00dev, 19, 0x93);
1789 rt2800_rfcsr_write(rt2x00dev, 20, 0xb3); 1865 rt2800_rfcsr_write(rt2x00dev, 20, 0xb3);
@@ -1792,12 +1868,20 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
1792 rt2800_rfcsr_write(rt2x00dev, 27, 0x00); 1868 rt2800_rfcsr_write(rt2x00dev, 27, 0x00);
1793 rt2800_rfcsr_write(rt2x00dev, 29, 0x9b); 1869 rt2800_rfcsr_write(rt2x00dev, 29, 0x9b);
1794 } else { 1870 } else {
1795 rt2800_rfcsr_write(rt2x00dev, 7, 0x14); 1871 rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr);
1872 rt2x00_set_field8(&rfcsr, RFCSR7_BIT2, 1);
1873 rt2x00_set_field8(&rfcsr, RFCSR7_BIT3, 0);
1874 rt2x00_set_field8(&rfcsr, RFCSR7_BIT4, 1);
1875 rt2x00_set_field8(&rfcsr, RFCSR7_BITS67, 0);
1876 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
1796 rt2800_rfcsr_write(rt2x00dev, 9, 0xc0); 1877 rt2800_rfcsr_write(rt2x00dev, 9, 0xc0);
1797 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); 1878 rt2800_rfcsr_write(rt2x00dev, 10, 0xf1);
1798 rt2800_rfcsr_write(rt2x00dev, 11, 0x00); 1879 rt2800_rfcsr_write(rt2x00dev, 11, 0x00);
1799 rt2800_rfcsr_write(rt2x00dev, 15, 0x43); 1880 rt2800_rfcsr_write(rt2x00dev, 15, 0x43);
1800 rt2800_rfcsr_write(rt2x00dev, 16, 0x7a); 1881 rfcsr = 0x7a;
1882 rt2x00_set_field8(&rfcsr, RFCSR16_TXMIXER_GAIN,
1883 drv_data->txmixer_gain_5g);
1884 rt2800_rfcsr_write(rt2x00dev, 16, rfcsr);
1801 rt2800_rfcsr_write(rt2x00dev, 17, 0x23); 1885 rt2800_rfcsr_write(rt2x00dev, 17, 0x23);
1802 if (rf->channel <= 64) { 1886 if (rf->channel <= 64) {
1803 rt2800_rfcsr_write(rt2x00dev, 19, 0xb7); 1887 rt2800_rfcsr_write(rt2x00dev, 19, 0xb7);
@@ -3246,6 +3330,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,
3246 3330
3247static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) 3331static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3248{ 3332{
3333 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
3249 u8 rfcsr; 3334 u8 rfcsr;
3250 u8 bbp; 3335 u8 bbp;
3251 u32 reg; 3336 u32 reg;
@@ -3534,20 +3619,26 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3534 * Set RX Filter calibration for 20MHz and 40MHz 3619 * Set RX Filter calibration for 20MHz and 40MHz
3535 */ 3620 */
3536 if (rt2x00_rt(rt2x00dev, RT3070)) { 3621 if (rt2x00_rt(rt2x00dev, RT3070)) {
3537 rt2x00dev->calibration[0] = 3622 drv_data->calibration_bw20 =
3538 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16); 3623 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x16);
3539 rt2x00dev->calibration[1] = 3624 drv_data->calibration_bw40 =
3540 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19); 3625 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x19);
3541 } else if (rt2x00_rt(rt2x00dev, RT3071) || 3626 } else if (rt2x00_rt(rt2x00dev, RT3071) ||
3542 rt2x00_rt(rt2x00dev, RT3090) || 3627 rt2x00_rt(rt2x00dev, RT3090) ||
3543 rt2x00_rt(rt2x00dev, RT3390) || 3628 rt2x00_rt(rt2x00dev, RT3390) ||
3544 rt2x00_rt(rt2x00dev, RT3572)) { 3629 rt2x00_rt(rt2x00dev, RT3572)) {
3545 rt2x00dev->calibration[0] = 3630 drv_data->calibration_bw20 =
3546 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13); 3631 rt2800_init_rx_filter(rt2x00dev, false, 0x07, 0x13);
3547 rt2x00dev->calibration[1] = 3632 drv_data->calibration_bw40 =
3548 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15); 3633 rt2800_init_rx_filter(rt2x00dev, true, 0x27, 0x15);
3549 } 3634 }
3550 3635
3636 /*
3637 * Save BBP 25 & 26 values for later use in channel switching
3638 */
3639 rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25);
3640 rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26);
3641
3551 if (!rt2x00_rt(rt2x00dev, RT5390)) { 3642 if (!rt2x00_rt(rt2x00dev, RT5390)) {
3552 /* 3643 /*
3553 * Set back to initial state 3644 * Set back to initial state
@@ -3587,11 +3678,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
3587 &rt2x00dev->cap_flags)) 3678 &rt2x00dev->cap_flags))
3588 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); 3679 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
3589 } 3680 }
3590 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &eeprom); 3681 rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
3591 if (rt2x00_get_field16(eeprom, EEPROM_TXMIXER_GAIN_BG_VAL) >= 1) 3682 drv_data->txmixer_gain_24g);
3592 rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
3593 rt2x00_get_field16(eeprom,
3594 EEPROM_TXMIXER_GAIN_BG_VAL));
3595 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); 3683 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
3596 } 3684 }
3597 3685
@@ -3799,6 +3887,7 @@ EXPORT_SYMBOL_GPL(rt2800_read_eeprom_efuse);
3799 3887
3800int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) 3888int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
3801{ 3889{
3890 struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
3802 u16 word; 3891 u16 word;
3803 u8 *mac; 3892 u8 *mac;
3804 u8 default_lna_gain; 3893 u8 default_lna_gain;
@@ -3882,6 +3971,14 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
3882 rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0); 3971 rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0);
3883 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word); 3972 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word);
3884 3973
3974 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
3975 if ((word & 0x00ff) != 0x00ff) {
3976 drv_data->txmixer_gain_24g =
3977 rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_BG_VAL);
3978 } else {
3979 drv_data->txmixer_gain_24g = 0;
3980 }
3981
3885 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word); 3982 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
3886 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) 3983 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
3887 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); 3984 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
@@ -3891,6 +3988,14 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
3891 default_lna_gain); 3988 default_lna_gain);
3892 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word); 3989 rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
3893 3990
3991 rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A, &word);
3992 if ((word & 0x00ff) != 0x00ff) {
3993 drv_data->txmixer_gain_5g =
3994 rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_A_VAL);
3995 } else {
3996 drv_data->txmixer_gain_5g = 0;
3997 }
3998
3894 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word); 3999 rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word);
3895 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10) 4000 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10)
3896 rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0); 4001 rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0);