1 --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
2 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
11 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
12 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
13 @@ -3014,6 +3014,13 @@ static void rt2800_config_channel_rf53xx
15 rt2800_rfcsr_write(rt2x00dev, 59,
17 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
18 + static const char r59_non_bt[] = {0x0b, 0x0b,
19 + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
20 + 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
22 + rt2800_rfcsr_write(rt2x00dev, 59,
27 @@ -3492,6 +3499,7 @@ static void rt2800_config_channel(struct
28 rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
35 @@ -3510,6 +3518,7 @@ static void rt2800_config_channel(struct
36 if (rt2x00_rf(rt2x00dev, RF3070) ||
37 rt2x00_rf(rt2x00dev, RF3290) ||
38 rt2x00_rf(rt2x00dev, RF3322) ||
39 + rt2x00_rf(rt2x00dev, RF5350) ||
40 rt2x00_rf(rt2x00dev, RF5360) ||
41 rt2x00_rf(rt2x00dev, RF5362) ||
42 rt2x00_rf(rt2x00dev, RF5370) ||
43 @@ -3788,7 +3797,8 @@ static void rt2800_config_channel(struct
47 - if (rt2x00_rt(rt2x00dev, RT3352)) {
48 + if (rt2x00_rt(rt2x00dev, RT3352) ||
49 + rt2x00_rt(rt2x00dev, RT5350)) {
50 rt2800_bbp_read(rt2x00dev, 49, &bbp);
51 rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
52 rt2800_bbp_write(rt2x00dev, 49, bbp);
53 @@ -4674,6 +4684,7 @@ void rt2800_vco_calibration(struct rt2x0
61 @@ -5087,6 +5098,8 @@ static int rt2800_init_registers(struct
62 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
63 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
64 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
65 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
66 + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
68 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
69 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
70 @@ -5742,9 +5755,13 @@ static void rt2800_init_bbp_3352(struct
72 rt2800_bbp_write(rt2x00dev, 82, 0x62);
74 - rt2800_bbp_write(rt2x00dev, 83, 0x6a);
76 - rt2800_bbp_write(rt2x00dev, 84, 0x99);
77 + if (rt2x00_rt(rt2x00dev, RT5350)) {
78 + rt2800_bbp_write(rt2x00dev, 83, 0x7a);
79 + rt2800_bbp_write(rt2x00dev, 84, 0x9a);
81 + rt2800_bbp_write(rt2x00dev, 83, 0x6a);
82 + rt2800_bbp_write(rt2x00dev, 84, 0x99);
85 rt2800_bbp_write(rt2x00dev, 86, 0x38);
87 @@ -5758,9 +5775,13 @@ static void rt2800_init_bbp_3352(struct
89 rt2800_bbp_write(rt2x00dev, 104, 0x92);
91 - rt2800_bbp_write(rt2x00dev, 105, 0x34);
93 - rt2800_bbp_write(rt2x00dev, 106, 0x05);
94 + if (rt2x00_rt(rt2x00dev, RT5350)) {
95 + rt2800_bbp_write(rt2x00dev, 105, 0x3c);
96 + rt2800_bbp_write(rt2x00dev, 106, 0x03);
98 + rt2800_bbp_write(rt2x00dev, 105, 0x34);
99 + rt2800_bbp_write(rt2x00dev, 106, 0x05);
102 rt2800_bbp_write(rt2x00dev, 120, 0x50);
104 @@ -5785,6 +5806,13 @@ static void rt2800_init_bbp_3352(struct
105 rt2800_bbp_write(rt2x00dev, 143, 0xa2);
107 rt2800_bbp_write(rt2x00dev, 148, 0xc8);
109 + if (rt2x00_rt(rt2x00dev, RT5350)) {
110 + rt2800_bbp_write(rt2x00dev, 150, 0x40); /* Antenna Software OFDM */
111 + rt2800_bbp_write(rt2x00dev, 151, 0x30); /* Antenna Software CCK */
112 + rt2800_bbp_write(rt2x00dev, 152, 0xa3);
113 + rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */
117 static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
118 @@ -6126,6 +6154,7 @@ static void rt2800_init_bbp(struct rt2x0
119 rt2800_init_bbp_3290(rt2x00dev);
123 rt2800_init_bbp_3352(rt2x00dev);
126 @@ -7077,6 +7106,76 @@ static void rt2800_init_rfcsr_3883(struc
127 rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
130 +static void rt2800_init_rfcsr_5350(struct rt2x00_dev *rt2x00dev)
132 + rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
133 + rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
134 + rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
135 + rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
136 + rt2800_rfcsr_write(rt2x00dev, 4, 0x49);
137 + rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
138 + rt2800_rfcsr_write(rt2x00dev, 6, 0xe0);
139 + rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
140 + rt2800_rfcsr_write(rt2x00dev, 8, 0xf1);
141 + rt2800_rfcsr_write(rt2x00dev, 9, 0x02);
142 + rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
143 + rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
144 + rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
145 + if(rt2x00dev->spec.clk_is_20mhz)
146 + rt2800_rfcsr_write(rt2x00dev, 13, 0x1f);
148 + rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
149 + rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
150 + rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
151 + rt2800_rfcsr_write(rt2x00dev, 16, 0xc0);
152 + rt2800_rfcsr_write(rt2x00dev, 18, 0x03);
153 + rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
154 + rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
155 + rt2800_rfcsr_write(rt2x00dev, 21, 0x00);
156 + rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
157 + rt2800_rfcsr_write(rt2x00dev, 23, 0x00);
158 + rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
159 + rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
160 + rt2800_rfcsr_write(rt2x00dev, 26, 0x00);
161 + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
162 + rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
163 + rt2800_rfcsr_write(rt2x00dev, 29, 0xd0);
164 + rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
165 + rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
166 + rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
167 + rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
168 + rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
169 + rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
170 + rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
171 + rt2800_rfcsr_write(rt2x00dev, 37, 0x08);
172 + rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
173 + rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);
174 + rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
175 + rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
176 + rt2800_rfcsr_write(rt2x00dev, 42, 0xd5);
177 + rt2800_rfcsr_write(rt2x00dev, 43, 0x9b);
178 + rt2800_rfcsr_write(rt2x00dev, 44, 0x0c);
179 + rt2800_rfcsr_write(rt2x00dev, 45, 0xa6);
180 + rt2800_rfcsr_write(rt2x00dev, 46, 0x73);
181 + rt2800_rfcsr_write(rt2x00dev, 47, 0x00);
182 + rt2800_rfcsr_write(rt2x00dev, 48, 0x10);
183 + rt2800_rfcsr_write(rt2x00dev, 49, 0x80);
184 + rt2800_rfcsr_write(rt2x00dev, 50, 0x00);
185 + rt2800_rfcsr_write(rt2x00dev, 51, 0x00);
186 + rt2800_rfcsr_write(rt2x00dev, 52, 0x38);
187 + rt2800_rfcsr_write(rt2x00dev, 53, 0x00);
188 + rt2800_rfcsr_write(rt2x00dev, 54, 0x38);
189 + rt2800_rfcsr_write(rt2x00dev, 55, 0x43);
190 + rt2800_rfcsr_write(rt2x00dev, 56, 0x82);
191 + rt2800_rfcsr_write(rt2x00dev, 57, 0x00);
192 + rt2800_rfcsr_write(rt2x00dev, 58, 0x39);
193 + rt2800_rfcsr_write(rt2x00dev, 59, 0x0b);
194 + rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
195 + rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
196 + rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
197 + rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
200 static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
202 rt2800_rf_init_calibration(rt2x00dev, 2);
203 @@ -7317,6 +7416,9 @@ static void rt2800_init_rfcsr(struct rt2
205 rt2800_init_rfcsr_3593(rt2x00dev);
208 + rt2800_init_rfcsr_5350(rt2x00dev);
211 rt2800_init_rfcsr_5390(rt2x00dev);
213 @@ -7576,6 +7678,12 @@ static int rt2800_validate_eeprom(struct
214 rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
215 rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
216 rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
217 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
218 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 1);
219 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1);
220 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF3320);
221 + rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
222 + rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
223 } else if (rt2x00_rt(rt2x00dev, RT2860) ||
224 rt2x00_rt(rt2x00dev, RT2872)) {
226 @@ -7714,6 +7822,8 @@ static int rt2800_init_eeprom(struct rt2
227 rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
228 else if (rt2x00_rt(rt2x00dev, RT3883))
230 + else if (rt2x00_rt(rt2x00dev, RT5350))
233 rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
235 @@ -7733,6 +7843,7 @@ static int rt2800_init_eeprom(struct rt2
243 @@ -8286,6 +8397,7 @@ static int rt2800_probe_hw_mode(struct r
251 @@ -8425,6 +8537,7 @@ static int rt2800_probe_hw_mode(struct r
259 @@ -8465,6 +8578,7 @@ static int rt2800_probe_rt(struct rt2x00
267 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
268 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
269 @@ -169,6 +169,7 @@ struct rt2x00_chip {
270 #define RT3572 0x3572
271 #define RT3593 0x3593
272 #define RT3883 0x3883 /* WSOC */
273 +#define RT5350 0x5350 /* WSOC 2.4GHz */
274 #define RT5390 0x5390 /* 2.4GHz */
275 #define RT5392 0x5392 /* 2.4GHz */
276 #define RT5592 0x5592