summaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/310-rt2x00-Fix-MCS-rx_mask-rt2800pci.patch
blob: 31da8534c3e7dbf1d95fa652225156c5223e1ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 4009f1317cb51ac89f37241de48970f2ee6a8ec5 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Sat, 7 Feb 2009 17:18:03 +0100
Subject: [PATCH] rt2x00: Fix MCS rx_mask (rt2800pci)

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2800pci.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -2193,6 +2193,13 @@ static int rt2800pci_validate_eeprom(str
 		rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820);
 		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
 		EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word);
+	} else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) {
+		/*
+		 * There is a max of 2 RX streams for RT2860 series
+		 */
+		if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2)
+			rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2);
+		rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word);
 	}
 
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
@@ -2416,6 +2423,7 @@ static int rt2800pci_probe_hw_mode(struc
 	char *tx_power1;
 	char *tx_power2;
 	unsigned int i;
+	u16 eeprom;
 
 	/*
 	 * Initialize all hw fields.
@@ -2432,6 +2440,8 @@ static int rt2800pci_probe_hw_mode(struc
 				rt2x00_eeprom_addr(rt2x00dev,
 						   EEPROM_MAC_ADDR_0));
 
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom);
+
 	/*
 	 * Initialize hw_mode information.
 	 */
@@ -2463,11 +2473,19 @@ static int rt2800pci_probe_hw_mode(struc
 	    IEEE80211_HT_CAP_PSMP_SUPPORT;
 	spec->ht.ampdu_factor = 3;
 	spec->ht.ampdu_density = 4;
-	spec->ht.mcs.rx_mask[0] = 0xff;
-	spec->ht.mcs.rx_mask[1] = 0xff;
 	spec->ht.mcs.tx_params =
 	    IEEE80211_HT_MCS_TX_DEFINED;
 
+	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) {
+	case 3:
+		spec->ht.mcs.rx_mask[2] = 0xff;
+	case 2:
+		spec->ht.mcs.rx_mask[1] = 0xff;
+	case 1:
+		spec->ht.mcs.rx_mask[0] = 0xff;
+		break;
+	}
+
 	/*
 	 * Create channel information array
 	 */