aboutsummaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/317-rt2x00-Fix-register-initialization-rt2800usb.patch
blob: de54242f384e97ae9e2c29ceb2f41d19047f3f9b (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
From d97bb9291c59852989a86667ba317613fa2b77c5 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Sat, 17 Jan 2009 19:19:16 +0100
Subject: [PATCH] rt2x00: Fix register initialization (rt2800usb)

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

--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -582,9 +582,12 @@ static void rt2800usb_config_ant(struct 
 	 */
 	switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH)) {
 	case 1:
+		rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0);
 		rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0);
 		break;
 	case 2:
+		rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 16);
+		break;
 	case 3:
 		/* Do nothing */
 		break;
@@ -1279,7 +1282,7 @@ static int rt2800usb_init_registers(stru
 	 * ASIC will keep garbage value after boot, clear encryption keys.
 	 */
 	for (i = 0; i < 254; i++) {
-		u32 wcid[2] = { 0xffffffff, 0x0000ffff };
+		u32 wcid[2] = { 0xffffffff, 0x00ffffff };
 		rt2x00usb_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i),
 					      wcid, sizeof(wcid));
 	}
@@ -1421,6 +1424,7 @@ static int rt2800usb_init_bbp(struct rt2
 	rt2800usb_bbp_write(rt2x00dev, 86, 0x00);
 	rt2800usb_bbp_write(rt2x00dev, 91, 0x04);
 	rt2800usb_bbp_write(rt2x00dev, 92, 0x00);
+	rt2800usb_bbp_write(rt2x00dev, 103, 0x00);
 	rt2800usb_bbp_write(rt2x00dev, 105, 0x05);
 
 	if (rt2x00_rev(&rt2x00dev->chip) == RT2870_VERSION_C) {
@@ -1904,9 +1908,17 @@ static int rt2800usb_validate_eeprom(str
 	}
 
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word);
-	if (word != 0) {
-		/* NIC configuration must always be 0. */
-		word = 0;
+	if (word == 0xffff) {
+		rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0);
+		rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0);
 		rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word);
 		EEPROM(rt2x00dev, "NIC: 0x%04x\n", word);
 	}