aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-07-08 10:08:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-07-22 16:54:33 -0400
commitf36bb0ca1be5bcb7148ad32263626f8609dfc0d7 (patch)
treea6c84a0d91b9d0b508cc50bbcac246fbb3d104ec /drivers/net/wireless/rt2x00/rt2800lib.c
parent6316c786cc8aff762530ea740233bf2da10fea33 (diff)
rt2x00: rt2800lib: fix LNA_A[12] gain values for RT3593
The LNA_A[12] gain values are stored at a different offset in the EEPROM on RT3593 based devices. However the current code unconditionally reads those values from the location used by other chipsets. Fix the code to use the correct EEPROM offset. Based on the DPO_RT5572_LinuxSTA_2.6.0.1_20120629 driver. References: RT3593_EEPROM_RSSI2_OFFSET_ALNAGAIN1_24G_READ in include/chip/rt3593.h RT3593_EEPROM_RSSI2_OFFSET_ALNAGAIN2_5G_READ in include/chip/rt3593.h Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 65045e0236fc..419ea05f13a3 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1826,11 +1826,25 @@ static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev,
1826 rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom); 1826 rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
1827 lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); 1827 lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
1828 } else if (libconf->rf.channel <= 128) { 1828 } else if (libconf->rf.channel <= 128) {
1829 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom); 1829 if (rt2x00_rt(rt2x00dev, RT3593)) {
1830 lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_LNA_A1); 1830 rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
1831 lna_gain = rt2x00_get_field16(eeprom,
1832 EEPROM_EXT_LNA2_A1);
1833 } else {
1834 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom);
1835 lna_gain = rt2x00_get_field16(eeprom,
1836 EEPROM_RSSI_BG2_LNA_A1);
1837 }
1831 } else { 1838 } else {
1832 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom); 1839 if (rt2x00_rt(rt2x00dev, RT3593)) {
1833 lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_LNA_A2); 1840 rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
1841 lna_gain = rt2x00_get_field16(eeprom,
1842 EEPROM_EXT_LNA2_A2);
1843 } else {
1844 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom);
1845 lna_gain = rt2x00_get_field16(eeprom,
1846 EEPROM_RSSI_A2_LNA_A2);
1847 }
1834 } 1848 }
1835 1849
1836 rt2x00dev->lna_gain = lna_gain; 1850 rt2x00dev->lna_gain = lna_gain;
@@ -6488,10 +6502,12 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
6488 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word); 6502 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
6489 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) 6503 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
6490 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); 6504 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
6491 if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || 6505 if (!rt2x00_rt(rt2x00dev, RT3593)) {
6492 rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) 6506 if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
6493 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, 6507 rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
6494 default_lna_gain); 6508 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
6509 default_lna_gain);
6510 }
6495 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word); 6511 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word);
6496 6512
6497 drv_data->txmixer_gain_5g = rt2800_get_txmixer_gain_5g(rt2x00dev); 6513 drv_data->txmixer_gain_5g = rt2800_get_txmixer_gain_5g(rt2x00dev);
@@ -6506,12 +6522,27 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
6506 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word); 6522 rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
6507 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) 6523 if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
6508 rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); 6524 rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
6509 if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || 6525 if (!rt2x00_rt(rt2x00dev, RT3593)) {
6510 rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) 6526 if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
6511 rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, 6527 rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
6512 default_lna_gain); 6528 rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
6529 default_lna_gain);
6530 }
6513 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); 6531 rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
6514 6532
6533 if (rt2x00_rt(rt2x00dev, RT3593)) {
6534 rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &word);
6535 if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 ||
6536 rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff)
6537 rt2x00_set_field16(&word, EEPROM_EXT_LNA2_A1,
6538 default_lna_gain);
6539 if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A2) == 0x00 ||
6540 rt2x00_get_field16(word, EEPROM_EXT_LNA2_A2) == 0xff)
6541 rt2x00_set_field16(&word, EEPROM_EXT_LNA2_A1,
6542 default_lna_gain);
6543 rt2800_eeprom_write(rt2x00dev, EEPROM_EXT_LNA2, word);
6544 }
6545
6515 return 0; 6546 return 0;
6516} 6547}
6517 6548