summaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/326-rt2x00-Update-chipset-ID-handling-rt2800pci.patch
blob: 284ba04ff61ffc66ae1097558ee2625aa349ca7c (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From d2216933a12c38ab23ee1170c1c143002a825046 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Thu, 22 Jan 2009 21:16:08 +0100
Subject: [PATCH] rt2x00: Update chipset ID handling (rt2800pci)

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

--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -984,7 +984,7 @@ static void rt2800pci_reset_tuner(struct
 static void rt2800pci_link_tuner(struct rt2x00_dev *rt2x00dev,
 				 struct link_qual *qual, const u32 count)
 {
-	if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C)
+	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION)
 		return;
 
 	/*
@@ -1272,7 +1272,11 @@ static int rt2800pci_init_registers(stru
 
 	rt2x00pci_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
-	rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
+	if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION &&
+	    rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION)
+		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
+	else
+		rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_PSDU, 0);
 	rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
 	rt2x00pci_register_write(rt2x00dev, MAX_LEN_CFG, reg);
@@ -1523,12 +1527,12 @@ static int rt2800pci_init_bbp(struct rt2
 	rt2800pci_bbp_write(rt2x00dev, 103, 0x00);
 	rt2800pci_bbp_write(rt2x00dev, 105, 0x05);
 
-	if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_C) {
+	if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) {
 		rt2800pci_bbp_write(rt2x00dev, 69, 0x16);
 		rt2800pci_bbp_write(rt2x00dev, 73, 0x12);
 	}
 
-	if (rt2x00_rev(&rt2x00dev->chip) == RT2860_VERSION_D)
+	if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION)
 		rt2800pci_bbp_write(rt2x00dev, 84, 0x19);
 
 	for (i = 0; i < EEPROM_BBP_SIZE; i++) {
@@ -1637,6 +1641,11 @@ static int rt2800pci_enable_radio(struct
 	/*
 	 * Enable RX.
 	 */
+	rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
+	rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_TX, 1);
+	rt2x00_set_field32(&reg, MAC_SYS_CTRL_ENABLE_RX, 0);
+	rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
+
 	rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
 	rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1);
 	rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1);
@@ -2253,13 +2262,14 @@ static int rt2800pci_init_eeprom(struct 
 			     PCI_CONFIG_HEADER_DEVICE, &device);
 	value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE);
 	rt2x00pci_register_read(rt2x00dev, MAC_CSR0, &reg);
-	reg = rt2x00_get_field32(reg, MAC_CSR0_ASIC_REV);
 	rt2x00_set_chip(rt2x00dev, device, value, reg);
 
 	if (!rt2x00_rf(&rt2x00dev->chip, RF2820) &&
 	    !rt2x00_rf(&rt2x00dev->chip, RF2850) &&
 	    !rt2x00_rf(&rt2x00dev->chip, RF2720) &&
-	    !rt2x00_rf(&rt2x00dev->chip, RF2750)) {
+	    !rt2x00_rf(&rt2x00dev->chip, RF2750) &&
+	    !rt2x00_rf(&rt2x00dev->chip, RF3020) &&
+	    !rt2x00_rf(&rt2x00dev->chip, RF2020)) {
 		ERROR(rt2x00dev, "Invalid RF chipset detected.\n");
 		return -ENODEV;
 	}
--- a/drivers/net/wireless/rt2x00/rt2800pci.h
+++ b/drivers/net/wireless/rt2x00/rt2800pci.h
@@ -47,9 +47,11 @@
 /*
  * RT2860 version
  */
-#define RT2860_VERSION_C		0x0100
-#define RT2860_VERSION_D		0x0101
-#define RT2860_VERSION_E		0x0200
+#define RT2860C_VERSION			0x28600100
+#define RT2860D_VERSION			0x28600101
+#define RT2880E_VERSION			0x28720200
+#define RT2883_VERSION			0x28830300
+#define RT3070_VERSION			0x30700200
 
 /*
  * Signal information.