mac80211: refresh a patch that was using the wrong patch style
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 616-rt2x00-support-rt5350.patch
1 --- a/drivers/net/wireless/rt2x00/rt2800.h
2 +++ b/drivers/net/wireless/rt2x00/rt2800.h
3 @@ -71,6 +71,7 @@
4 #define RF3053 0x000d
5 #define RF5592 0x000f
6 #define RF3290 0x3290
7 +#define RF5350 0x5350
8 #define RF5360 0x5360
9 #define RF5370 0x5370
10 #define RF5372 0x5372
11 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
12 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
13 @@ -2141,6 +2141,15 @@ static void rt2800_config_channel_rf53xx
14 if (rf->channel <= 14) {
15 int idx = rf->channel-1;
16
17 + 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};
21 +
22 + rt2800_rfcsr_write(rt2x00dev, 59,
23 + r59_non_bt[idx]);
24 + }
25 +
26 if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) {
27 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
28 /* r55/r59 value array of channel 1~14 */
29 @@ -2598,6 +2607,7 @@ static void rt2800_config_channel(struct
30 case RF3322:
31 rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
32 break;
33 + case RF5350:
34 case RF5360:
35 case RF5370:
36 case RF5372:
37 @@ -2614,6 +2624,7 @@ static void rt2800_config_channel(struct
38
39 if (rt2x00_rf(rt2x00dev, RF3290) ||
40 rt2x00_rf(rt2x00dev, RF3322) ||
41 + rt2x00_rf(rt2x00dev, RF5350) ||
42 rt2x00_rf(rt2x00dev, RF5360) ||
43 rt2x00_rf(rt2x00dev, RF5370) ||
44 rt2x00_rf(rt2x00dev, RF5372) ||
45 @@ -2778,7 +2789,8 @@ static void rt2800_config_channel(struct
46 /*
47 * Clear update flag
48 */
49 - if (rt2x00_rt(rt2x00dev, RT3352)) {
50 + if (rt2x00_rt(rt2x00dev, RT3352) ||
51 + rt2x00_rt(rt2x00dev, RT5350)) {
52 rt2800_bbp_read(rt2x00dev, 49, &bbp);
53 rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
54 rt2800_bbp_write(rt2x00dev, 49, bbp);
55 @@ -3224,6 +3236,7 @@ void rt2800_vco_calibration(struct rt2x0
56 rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
57 break;
58 case RF3290:
59 + case RF5350:
60 case RF5360:
61 case RF5370:
62 case RF5372:
63 @@ -3569,6 +3582,8 @@ static int rt2800_init_registers(struct
64 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
65 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
66 rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
67 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
68 + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
69 } else {
70 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
71 rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
72 @@ -4216,9 +4231,13 @@ static void rt2800_init_bbp_3352(struct
73
74 rt2800_bbp_write(rt2x00dev, 82, 0x62);
75
76 - rt2800_bbp_write(rt2x00dev, 83, 0x6a);
77 -
78 - rt2800_bbp_write(rt2x00dev, 84, 0x99);
79 + if (rt2x00_rt(rt2x00dev, RT5350)) {
80 + rt2800_bbp_write(rt2x00dev, 83, 0x7a);
81 + rt2800_bbp_write(rt2x00dev, 84, 0x9a);
82 + } else {
83 + rt2800_bbp_write(rt2x00dev, 83, 0x6a);
84 + rt2800_bbp_write(rt2x00dev, 84, 0x99);
85 + }
86
87 rt2800_bbp_write(rt2x00dev, 86, 0x38);
88
89 @@ -4232,9 +4251,13 @@ static void rt2800_init_bbp_3352(struct
90
91 rt2800_bbp_write(rt2x00dev, 104, 0x92);
92
93 - rt2800_bbp_write(rt2x00dev, 105, 0x34);
94 -
95 - rt2800_bbp_write(rt2x00dev, 106, 0x05);
96 + if (rt2x00_rt(rt2x00dev, RT5350)) {
97 + rt2800_bbp_write(rt2x00dev, 105, 0x3c);
98 + rt2800_bbp_write(rt2x00dev, 106, 0x03);
99 + } else {
100 + rt2800_bbp_write(rt2x00dev, 105, 0x34);
101 + rt2800_bbp_write(rt2x00dev, 106, 0x05);
102 + }
103
104 rt2800_bbp_write(rt2x00dev, 120, 0x50);
105
106 @@ -4259,6 +4282,13 @@ static void rt2800_init_bbp_3352(struct
107 rt2800_bbp_write(rt2x00dev, 143, 0xa2);
108
109 rt2800_bbp_write(rt2x00dev, 148, 0xc8);
110 +
111 + if (rt2x00_rt(rt2x00dev, RT5350)) {
112 + rt2800_bbp_write(rt2x00dev, 150, 0x40); /* Antenna Software OFDM */
113 + rt2800_bbp_write(rt2x00dev, 151, 0x30); /* Antenna Software CCK */
114 + rt2800_bbp_write(rt2x00dev, 152, 0xa3);
115 + rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */
116 + }
117 }
118
119 static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
120 @@ -4543,6 +4573,7 @@ static void rt2800_init_bbp(struct rt2x0
121 rt2800_init_bbp_3290(rt2x00dev);
122 break;
123 case RT3352:
124 + case RT5350:
125 rt2800_init_bbp_3352(rt2x00dev);
126 break;
127 case RT3390:
128 @@ -5182,6 +5213,76 @@ static void rt2800_init_rfcsr_3572(struc
129 rt2800_normal_mode_setup_3xxx(rt2x00dev);
130 }
131
132 +static void rt2800_init_rfcsr_5350(struct rt2x00_dev *rt2x00dev)
133 +{
134 + rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
135 + rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
136 + rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
137 + rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
138 + rt2800_rfcsr_write(rt2x00dev, 4, 0x49);
139 + rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
140 + rt2800_rfcsr_write(rt2x00dev, 6, 0xe0);
141 + rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
142 + rt2800_rfcsr_write(rt2x00dev, 8, 0xf1);
143 + rt2800_rfcsr_write(rt2x00dev, 9, 0x02);
144 + rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
145 + rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
146 + rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
147 + if(rt2x00dev->spec.clk_is_20mhz)
148 + rt2800_rfcsr_write(rt2x00dev, 13, 0x1f);
149 + else
150 + rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
151 + rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
152 + rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
153 + rt2800_rfcsr_write(rt2x00dev, 16, 0xc0);
154 + rt2800_rfcsr_write(rt2x00dev, 18, 0x03);
155 + rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
156 + rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
157 + rt2800_rfcsr_write(rt2x00dev, 21, 0x00);
158 + rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
159 + rt2800_rfcsr_write(rt2x00dev, 23, 0x00);
160 + rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
161 + rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
162 + rt2800_rfcsr_write(rt2x00dev, 26, 0x00);
163 + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
164 + rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
165 + rt2800_rfcsr_write(rt2x00dev, 29, 0xd0);
166 + rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
167 + rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
168 + rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
169 + rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
170 + rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
171 + rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
172 + rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
173 + rt2800_rfcsr_write(rt2x00dev, 37, 0x08);
174 + rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
175 + rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);
176 + rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
177 + rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
178 + rt2800_rfcsr_write(rt2x00dev, 42, 0xd5);
179 + rt2800_rfcsr_write(rt2x00dev, 43, 0x9b);
180 + rt2800_rfcsr_write(rt2x00dev, 44, 0x0c);
181 + rt2800_rfcsr_write(rt2x00dev, 45, 0xa6);
182 + rt2800_rfcsr_write(rt2x00dev, 46, 0x73);
183 + rt2800_rfcsr_write(rt2x00dev, 47, 0x00);
184 + rt2800_rfcsr_write(rt2x00dev, 48, 0x10);
185 + rt2800_rfcsr_write(rt2x00dev, 49, 0x80);
186 + rt2800_rfcsr_write(rt2x00dev, 50, 0x00);
187 + rt2800_rfcsr_write(rt2x00dev, 51, 0x00);
188 + rt2800_rfcsr_write(rt2x00dev, 52, 0x38);
189 + rt2800_rfcsr_write(rt2x00dev, 53, 0x00);
190 + rt2800_rfcsr_write(rt2x00dev, 54, 0x38);
191 + rt2800_rfcsr_write(rt2x00dev, 55, 0x43);
192 + rt2800_rfcsr_write(rt2x00dev, 56, 0x82);
193 + rt2800_rfcsr_write(rt2x00dev, 57, 0x00);
194 + rt2800_rfcsr_write(rt2x00dev, 58, 0x39);
195 + rt2800_rfcsr_write(rt2x00dev, 59, 0x0b);
196 + rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
197 + rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
198 + rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
199 + rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
200 +}
201 +
202 static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
203 {
204 rt2800_rf_init_calibration(rt2x00dev, 2);
205 @@ -5410,6 +5511,9 @@ static void rt2800_init_rfcsr(struct rt2
206 case RT3572:
207 rt2800_init_rfcsr_3572(rt2x00dev);
208 break;
209 + case RT5350:
210 + rt2800_init_rfcsr_5350(rt2x00dev);
211 + break;
212 case RT5390:
213 rt2800_init_rfcsr_5390(rt2x00dev);
214 break;
215 @@ -5621,6 +5725,12 @@ static int rt2800_validate_eeprom(struct
216 rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
217 rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
218 rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
219 + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
220 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 1);
221 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1);
222 + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF3320);
223 + rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
224 + rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
225 } else if (rt2x00_rt(rt2x00dev, RT2860) ||
226 rt2x00_rt(rt2x00dev, RT2872)) {
227 /*
228 @@ -5749,6 +5859,8 @@ static int rt2800_init_eeprom(struct rt2
229 rt2x00_rt(rt2x00dev, RT5390) ||
230 rt2x00_rt(rt2x00dev, RT5392))
231 rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
232 + else if (rt2x00_rt(rt2x00dev, RT5350))
233 + rf = RF5350;
234 else
235 rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
236
237 @@ -5765,6 +5877,7 @@ static int rt2800_init_eeprom(struct rt2
238 case RF3290:
239 case RF3320:
240 case RF3322:
241 + case RF5350:
242 case RF5360:
243 case RF5370:
244 case RF5372:
245 @@ -6263,7 +6376,8 @@ static int rt2800_probe_hw_mode(struct r
246 rt2x00_rf(rt2x00dev, RF5392)) {
247 spec->num_channels = 14;
248 spec->channels = rf_vals_3x;
249 - } else if (rt2x00_rf(rt2x00dev, RF3322)) {
250 + } else if (rt2x00_rf(rt2x00dev, RF3322) ||
251 + rt2x00_rf(rt2x00dev, RF5350)) {
252 spec->num_channels = 14;
253 if (spec->clk_is_20mhz)
254 spec->channels = rf_vals_xtal20mhz_3x;
255 @@ -6364,6 +6478,7 @@ static int rt2800_probe_hw_mode(struct r
256 case RF3320:
257 case RF3052:
258 case RF3290:
259 + case RF5350:
260 case RF5360:
261 case RF5370:
262 case RF5372:
263 @@ -6401,6 +6516,7 @@ static int rt2800_probe_rt(struct rt2x00
264 case RT3352:
265 case RT3390:
266 case RT3572:
267 + case RT5350:
268 case RT5390:
269 case RT5392:
270 case RT5592:
271 --- a/drivers/net/wireless/rt2x00/rt2x00.h
272 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
273 @@ -181,6 +181,7 @@ struct rt2x00_chip {
274 #define RT3572 0x3572
275 #define RT3593 0x3593
276 #define RT3883 0x3883 /* WSOC */
277 +#define RT5350 0x5350 /* WSOC 2.4GHz */
278 #define RT5390 0x5390 /* 2.4GHz */
279 #define RT5392 0x5392 /* 2.4GHz */
280 #define RT5592 0x5592