4bbc7ae44e6c4f13682072fe6b0e5fb02f5dae60
[oweals/openwrt.git] /
1 From 1616650aea676541d4dc8adc6f4219856d193c8b Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Tue, 1 Oct 2013 17:27:57 +0200
4 Subject: [PATCH] rt2x00: rt2800lib: fix EEPROM LNA validation for RT3883
5
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 ---
8  drivers/net/wireless/ralink/rt2x00/rt2800lib.c |    9 ++++++---
9  1 file changed, 6 insertions(+), 3 deletions(-)
10
11 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
12 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
13 @@ -9098,7 +9098,8 @@ static int rt2800_validate_eeprom(struct
14         word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2);
15         if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
16                 rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
17 -       if (!rt2x00_rt(rt2x00dev, RT3593)) {
18 +       if (!rt2x00_rt(rt2x00dev, RT3593) &&
19 +           !rt2x00_rt(rt2x00dev, RT3883)) {
20                 if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
21                     rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
22                         rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
23 @@ -9118,7 +9119,8 @@ static int rt2800_validate_eeprom(struct
24         word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2);
25         if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
26                 rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
27 -       if (!rt2x00_rt(rt2x00dev, RT3593)) {
28 +       if (!rt2x00_rt(rt2x00dev, RT3593) &&
29 +           !rt2x00_rt(rt2x00dev, RT3883)) {
30                 if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
31                     rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
32                         rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
33 @@ -9126,7 +9128,8 @@ static int rt2800_validate_eeprom(struct
34         }
35         rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
36  
37 -       if (rt2x00_rt(rt2x00dev, RT3593)) {
38 +       if (rt2x00_rt(rt2x00dev, RT3593) ||
39 +           rt2x00_rt(rt2x00dev, RT3883)) {
40                 word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2);
41                 if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 ||
42                     rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff)