1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2007 - 2011 Realtek Corporation. */
3
4 #include "../include/rtw_iol.h"
5
6 #define read_next_pair(array, v1, v2, i) \
7 do { \
8 i += 2; \
9 v1 = array[i]; \
10 v2 = array[i + 1]; \
11 } while (0)
12
CheckCondition(const u32 condition,const u32 hex)13 static bool CheckCondition(const u32 condition, const u32 hex)
14 {
15 u32 _interface = (hex & 0x0000FF00) >> 8;
16 u32 _platform = (hex & 0x00FF0000) >> 16;
17 u32 cond = condition;
18
19 if (condition == 0xCDCDCDCD)
20 return true;
21
22 cond = condition & 0x0000FF00;
23 cond = cond >> 8;
24 if ((_interface & cond) == 0 && cond != 0x07)
25 return false;
26
27 cond = condition & 0x00FF0000;
28 cond = cond >> 16;
29 if ((_platform & cond) == 0 && cond != 0x0F)
30 return false;
31 return true;
32 }
33
34 /******************************************************************************
35 * AGC_TAB_1T.TXT
36 ******************************************************************************/
37
38 static u32 array_agc_tab_1t_8188e[] = {
39 0xC78, 0xFB000001,
40 0xC78, 0xFB010001,
41 0xC78, 0xFB020001,
42 0xC78, 0xFB030001,
43 0xC78, 0xFB040001,
44 0xC78, 0xFB050001,
45 0xC78, 0xFA060001,
46 0xC78, 0xF9070001,
47 0xC78, 0xF8080001,
48 0xC78, 0xF7090001,
49 0xC78, 0xF60A0001,
50 0xC78, 0xF50B0001,
51 0xC78, 0xF40C0001,
52 0xC78, 0xF30D0001,
53 0xC78, 0xF20E0001,
54 0xC78, 0xF10F0001,
55 0xC78, 0xF0100001,
56 0xC78, 0xEF110001,
57 0xC78, 0xEE120001,
58 0xC78, 0xED130001,
59 0xC78, 0xEC140001,
60 0xC78, 0xEB150001,
61 0xC78, 0xEA160001,
62 0xC78, 0xE9170001,
63 0xC78, 0xE8180001,
64 0xC78, 0xE7190001,
65 0xC78, 0xE61A0001,
66 0xC78, 0xE51B0001,
67 0xC78, 0xE41C0001,
68 0xC78, 0xE31D0001,
69 0xC78, 0xE21E0001,
70 0xC78, 0xE11F0001,
71 0xC78, 0x8A200001,
72 0xC78, 0x89210001,
73 0xC78, 0x88220001,
74 0xC78, 0x87230001,
75 0xC78, 0x86240001,
76 0xC78, 0x85250001,
77 0xC78, 0x84260001,
78 0xC78, 0x83270001,
79 0xC78, 0x82280001,
80 0xC78, 0x6B290001,
81 0xC78, 0x6A2A0001,
82 0xC78, 0x692B0001,
83 0xC78, 0x682C0001,
84 0xC78, 0x672D0001,
85 0xC78, 0x662E0001,
86 0xC78, 0x652F0001,
87 0xC78, 0x64300001,
88 0xC78, 0x63310001,
89 0xC78, 0x62320001,
90 0xC78, 0x61330001,
91 0xC78, 0x46340001,
92 0xC78, 0x45350001,
93 0xC78, 0x44360001,
94 0xC78, 0x43370001,
95 0xC78, 0x42380001,
96 0xC78, 0x41390001,
97 0xC78, 0x403A0001,
98 0xC78, 0x403B0001,
99 0xC78, 0x403C0001,
100 0xC78, 0x403D0001,
101 0xC78, 0x403E0001,
102 0xC78, 0x403F0001,
103 0xC78, 0xFB400001,
104 0xC78, 0xFB410001,
105 0xC78, 0xFB420001,
106 0xC78, 0xFB430001,
107 0xC78, 0xFB440001,
108 0xC78, 0xFB450001,
109 0xC78, 0xFB460001,
110 0xC78, 0xFB470001,
111 0xC78, 0xFB480001,
112 0xC78, 0xFA490001,
113 0xC78, 0xF94A0001,
114 0xC78, 0xF84B0001,
115 0xC78, 0xF74C0001,
116 0xC78, 0xF64D0001,
117 0xC78, 0xF54E0001,
118 0xC78, 0xF44F0001,
119 0xC78, 0xF3500001,
120 0xC78, 0xF2510001,
121 0xC78, 0xF1520001,
122 0xC78, 0xF0530001,
123 0xC78, 0xEF540001,
124 0xC78, 0xEE550001,
125 0xC78, 0xED560001,
126 0xC78, 0xEC570001,
127 0xC78, 0xEB580001,
128 0xC78, 0xEA590001,
129 0xC78, 0xE95A0001,
130 0xC78, 0xE85B0001,
131 0xC78, 0xE75C0001,
132 0xC78, 0xE65D0001,
133 0xC78, 0xE55E0001,
134 0xC78, 0xE45F0001,
135 0xC78, 0xE3600001,
136 0xC78, 0xE2610001,
137 0xC78, 0xC3620001,
138 0xC78, 0xC2630001,
139 0xC78, 0xC1640001,
140 0xC78, 0x8B650001,
141 0xC78, 0x8A660001,
142 0xC78, 0x89670001,
143 0xC78, 0x88680001,
144 0xC78, 0x87690001,
145 0xC78, 0x866A0001,
146 0xC78, 0x856B0001,
147 0xC78, 0x846C0001,
148 0xC78, 0x676D0001,
149 0xC78, 0x666E0001,
150 0xC78, 0x656F0001,
151 0xC78, 0x64700001,
152 0xC78, 0x63710001,
153 0xC78, 0x62720001,
154 0xC78, 0x61730001,
155 0xC78, 0x60740001,
156 0xC78, 0x46750001,
157 0xC78, 0x45760001,
158 0xC78, 0x44770001,
159 0xC78, 0x43780001,
160 0xC78, 0x42790001,
161 0xC78, 0x417A0001,
162 0xC78, 0x407B0001,
163 0xC78, 0x407C0001,
164 0xC78, 0x407D0001,
165 0xC78, 0x407E0001,
166 0xC78, 0x407F0001,
167 };
168
odm_ConfigBB_AGC_8188E(struct odm_dm_struct * pDM_Odm,u32 Addr,u32 Bitmask,u32 Data)169 static void odm_ConfigBB_AGC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
170 {
171 rtl8188e_PHY_SetBBReg(pDM_Odm->Adapter, Addr, Bitmask, Data);
172 /* Add 1us delay between BB/RF register setting. */
173 udelay(1);
174 }
175
ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct * dm_odm)176 int ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct *dm_odm)
177 {
178 u32 hex = 0;
179 u32 i = 0;
180 u32 arraylen = ARRAY_SIZE(array_agc_tab_1t_8188e);
181 u32 *array = array_agc_tab_1t_8188e;
182 bool biol = false;
183 struct adapter *adapter = dm_odm->Adapter;
184 struct xmit_frame *pxmit_frame = NULL;
185 u8 bndy_cnt = 1;
186
187 hex += ODM_ITRF_USB << 8;
188 hex += ODM_CE << 16;
189 hex += 0xFF000000;
190 biol = rtw_IOL_applied(adapter);
191
192 if (biol) {
193 pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
194 if (!pxmit_frame) {
195 pr_info("rtw_IOL_accquire_xmit_frame failed\n");
196 return -ENOMEM;
197 }
198 }
199
200 for (i = 0; i < arraylen; i += 2) {
201 u32 v1 = array[i];
202 u32 v2 = array[i + 1];
203
204 /* This (offset, data) pair meets the condition. */
205 if (v1 < 0xCDCDCDCD) {
206 if (biol) {
207 if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
208 bndy_cnt++;
209 rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
210 } else {
211 odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
212 }
213 continue;
214 } else {
215 /* This line is the start line of branch. */
216 if (!CheckCondition(array[i], hex)) {
217 /* Discard the following (offset, data) pairs. */
218 read_next_pair(array, v1, v2, i);
219 while (v2 != 0xDEAD &&
220 v2 != 0xCDEF &&
221 v2 != 0xCDCD && i < arraylen - 2)
222 read_next_pair(array, v1, v2, i);
223 i -= 2; /* prevent from for-loop += 2 */
224 } else { /* Configure matched pairs and skip to end of if-else. */
225 read_next_pair(array, v1, v2, i);
226 while (v2 != 0xDEAD &&
227 v2 != 0xCDEF &&
228 v2 != 0xCDCD && i < arraylen - 2) {
229 if (biol) {
230 if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
231 bndy_cnt++;
232 rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
233 } else {
234 odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
235 }
236 read_next_pair(array, v1, v2, i);
237 }
238
239 while (v2 != 0xDEAD && i < arraylen - 2)
240 read_next_pair(array, v1, v2, i);
241 }
242 }
243 }
244 if (biol) {
245 if (!rtl8188e_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
246 printk("~~~ %s IOL_exec_cmds Failed !!!\n", __func__);
247 return -1;
248 }
249 }
250 return 0;
251 }
252
253 /******************************************************************************
254 * PHY_REG_1T.TXT
255 ******************************************************************************/
256
257 static u32 array_phy_reg_1t_8188e[] = {
258 0x800, 0x80040000,
259 0x804, 0x00000003,
260 0x808, 0x0000FC00,
261 0x80C, 0x0000000A,
262 0x810, 0x10001331,
263 0x814, 0x020C3D10,
264 0x818, 0x02200385,
265 0x81C, 0x00000000,
266 0x820, 0x01000100,
267 0x824, 0x00390204,
268 0x828, 0x00000000,
269 0x82C, 0x00000000,
270 0x830, 0x00000000,
271 0x834, 0x00000000,
272 0x838, 0x00000000,
273 0x83C, 0x00000000,
274 0x840, 0x00010000,
275 0x844, 0x00000000,
276 0x848, 0x00000000,
277 0x84C, 0x00000000,
278 0x850, 0x00000000,
279 0x854, 0x00000000,
280 0x858, 0x569A11A9,
281 0x85C, 0x01000014,
282 0x860, 0x66F60110,
283 0x864, 0x061F0649,
284 0x868, 0x00000000,
285 0x86C, 0x27272700,
286 0x870, 0x07000760,
287 0x874, 0x25004000,
288 0x878, 0x00000808,
289 0x87C, 0x00000000,
290 0x880, 0xB0000C1C,
291 0x884, 0x00000001,
292 0x888, 0x00000000,
293 0x88C, 0xCCC000C0,
294 0x890, 0x00000800,
295 0x894, 0xFFFFFFFE,
296 0x898, 0x40302010,
297 0x89C, 0x00706050,
298 0x900, 0x00000000,
299 0x904, 0x00000023,
300 0x908, 0x00000000,
301 0x90C, 0x81121111,
302 0x910, 0x00000002,
303 0x914, 0x00000201,
304 0xA00, 0x00D047C8,
305 0xA04, 0x80FF000C,
306 0xA08, 0x8C838300,
307 0xA0C, 0x2E7F120F,
308 0xA10, 0x9500BB78,
309 0xA14, 0x1114D028,
310 0xA18, 0x00881117,
311 0xA1C, 0x89140F00,
312 0xA20, 0x1A1B0000,
313 0xA24, 0x090E1317,
314 0xA28, 0x00000204,
315 0xA2C, 0x00D30000,
316 0xA70, 0x101FBF00,
317 0xA74, 0x00000007,
318 0xA78, 0x00000900,
319 0xA7C, 0x225B0606,
320 0xA80, 0x218075B1,
321 0xB2C, 0x80000000,
322 0xC00, 0x48071D40,
323 0xC04, 0x03A05611,
324 0xC08, 0x000000E4,
325 0xC0C, 0x6C6C6C6C,
326 0xC10, 0x08800000,
327 0xC14, 0x40000100,
328 0xC18, 0x08800000,
329 0xC1C, 0x40000100,
330 0xC20, 0x00000000,
331 0xC24, 0x00000000,
332 0xC28, 0x00000000,
333 0xC2C, 0x00000000,
334 0xC30, 0x69E9AC47,
335 0xC34, 0x469652AF,
336 0xC38, 0x49795994,
337 0xC3C, 0x0A97971C,
338 0xC40, 0x1F7C403F,
339 0xC44, 0x000100B7,
340 0xC48, 0xEC020107,
341 0xC4C, 0x007F037F,
342 0xC50, 0x69553420,
343 0xC54, 0x43BC0094,
344 0xC58, 0x00013169,
345 0xC5C, 0x00250492,
346 0xC60, 0x00000000,
347 0xC64, 0x7112848B,
348 0xC68, 0x47C00BFF,
349 0xC6C, 0x00000036,
350 0xC70, 0x2C7F000D,
351 0xC74, 0x020610DB,
352 0xC78, 0x0000001F,
353 0xC7C, 0x00B91612,
354 0xC80, 0x390000E4,
355 0xC84, 0x20F60000,
356 0xC88, 0x40000100,
357 0xC8C, 0x20200000,
358 0xC90, 0x00091521,
359 0xC94, 0x00000000,
360 0xC98, 0x00121820,
361 0xC9C, 0x00007F7F,
362 0xCA0, 0x00000000,
363 0xCA4, 0x000300A0,
364 0xCA8, 0x00000000,
365 0xCAC, 0x00000000,
366 0xCB0, 0x00000000,
367 0xCB4, 0x00000000,
368 0xCB8, 0x00000000,
369 0xCBC, 0x28000000,
370 0xCC0, 0x00000000,
371 0xCC4, 0x00000000,
372 0xCC8, 0x00000000,
373 0xCCC, 0x00000000,
374 0xCD0, 0x00000000,
375 0xCD4, 0x00000000,
376 0xCD8, 0x64B22427,
377 0xCDC, 0x00766932,
378 0xCE0, 0x00222222,
379 0xCE4, 0x00000000,
380 0xCE8, 0x37644302,
381 0xCEC, 0x2F97D40C,
382 0xD00, 0x00000740,
383 0xD04, 0x00020401,
384 0xD08, 0x0000907F,
385 0xD0C, 0x20010201,
386 0xD10, 0xA0633333,
387 0xD14, 0x3333BC43,
388 0xD18, 0x7A8F5B6F,
389 0xD2C, 0xCC979975,
390 0xD30, 0x00000000,
391 0xD34, 0x80608000,
392 0xD38, 0x00000000,
393 0xD3C, 0x00127353,
394 0xD40, 0x00000000,
395 0xD44, 0x00000000,
396 0xD48, 0x00000000,
397 0xD4C, 0x00000000,
398 0xD50, 0x6437140A,
399 0xD54, 0x00000000,
400 0xD58, 0x00000282,
401 0xD5C, 0x30032064,
402 0xD60, 0x4653DE68,
403 0xD64, 0x04518A3C,
404 0xD68, 0x00002101,
405 0xD6C, 0x2A201C16,
406 0xD70, 0x1812362E,
407 0xD74, 0x322C2220,
408 0xD78, 0x000E3C24,
409 0xE00, 0x2D2D2D2D,
410 0xE04, 0x2D2D2D2D,
411 0xE08, 0x0390272D,
412 0xE10, 0x2D2D2D2D,
413 0xE14, 0x2D2D2D2D,
414 0xE18, 0x2D2D2D2D,
415 0xE1C, 0x2D2D2D2D,
416 0xE28, 0x00000000,
417 0xE30, 0x1000DC1F,
418 0xE34, 0x10008C1F,
419 0xE38, 0x02140102,
420 0xE3C, 0x681604C2,
421 0xE40, 0x01007C00,
422 0xE44, 0x01004800,
423 0xE48, 0xFB000000,
424 0xE4C, 0x000028D1,
425 0xE50, 0x1000DC1F,
426 0xE54, 0x10008C1F,
427 0xE58, 0x02140102,
428 0xE5C, 0x28160D05,
429 0xE60, 0x00000008,
430 0xE68, 0x001B25A4,
431 0xE6C, 0x00C00014,
432 0xE70, 0x00C00014,
433 0xE74, 0x01000014,
434 0xE78, 0x01000014,
435 0xE7C, 0x01000014,
436 0xE80, 0x01000014,
437 0xE84, 0x00C00014,
438 0xE88, 0x01000014,
439 0xE8C, 0x00C00014,
440 0xED0, 0x00C00014,
441 0xED4, 0x00C00014,
442 0xED8, 0x00C00014,
443 0xEDC, 0x00000014,
444 0xEE0, 0x00000014,
445 0xEEC, 0x01C00014,
446 0xF14, 0x00000003,
447 0xF4C, 0x00000000,
448 0xF00, 0x00000300,
449 };
450
odm_ConfigBB_PHY_8188E(struct odm_dm_struct * pDM_Odm,u32 Addr,u32 Bitmask,u32 Data)451 static void odm_ConfigBB_PHY_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
452 {
453 if (Addr == 0xfe) {
454 msleep(50);
455 } else if (Addr == 0xfd) {
456 mdelay(5);
457 } else if (Addr == 0xfc) {
458 mdelay(1);
459 } else if (Addr == 0xfb) {
460 udelay(50);
461 } else if (Addr == 0xfa) {
462 udelay(5);
463 } else if (Addr == 0xf9) {
464 udelay(1);
465 } else {
466 if (Addr == 0xa24)
467 pDM_Odm->RFCalibrateInfo.RegA24 = Data;
468 rtl8188e_PHY_SetBBReg(pDM_Odm->Adapter, Addr, Bitmask, Data);
469
470 /* Add 1us delay between BB/RF register setting. */
471 udelay(1);
472 }
473 }
474
ODM_ReadAndConfig_PHY_REG_1T_8188E(struct odm_dm_struct * dm_odm)475 int ODM_ReadAndConfig_PHY_REG_1T_8188E(struct odm_dm_struct *dm_odm)
476 {
477 u32 hex = 0;
478 u32 i = 0;
479 u32 arraylen = ARRAY_SIZE(array_phy_reg_1t_8188e);
480 u32 *array = array_phy_reg_1t_8188e;
481 bool biol = false;
482 struct adapter *adapter = dm_odm->Adapter;
483 struct xmit_frame *pxmit_frame = NULL;
484 u8 bndy_cnt = 1;
485 hex += ODM_ITRF_USB << 8;
486 hex += ODM_CE << 16;
487 hex += 0xFF000000;
488 biol = rtw_IOL_applied(adapter);
489
490 if (biol) {
491 pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
492 if (!pxmit_frame) {
493 pr_info("rtw_IOL_accquire_xmit_frame failed\n");
494 return -ENOMEM;
495 }
496 }
497
498 for (i = 0; i < arraylen; i += 2) {
499 u32 v1 = array[i];
500 u32 v2 = array[i + 1];
501
502 /* This (offset, data) pair meets the condition. */
503 if (v1 < 0xCDCDCDCD) {
504 if (biol) {
505 if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
506 bndy_cnt++;
507 if (v1 == 0xfe) {
508 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
509 } else if (v1 == 0xfd) {
510 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
511 } else if (v1 == 0xfc) {
512 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
513 } else if (v1 == 0xfb) {
514 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
515 } else if (v1 == 0xfa) {
516 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
517 } else if (v1 == 0xf9) {
518 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
519 } else {
520 if (v1 == 0xa24)
521 dm_odm->RFCalibrateInfo.RegA24 = v2;
522 rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
523 }
524 } else {
525 odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
526 }
527 continue;
528 } else { /* This line is the start line of branch. */
529 if (!CheckCondition(array[i], hex)) {
530 /* Discard the following (offset, data) pairs. */
531 read_next_pair(array, v1, v2, i);
532 while (v2 != 0xDEAD &&
533 v2 != 0xCDEF &&
534 v2 != 0xCDCD && i < arraylen - 2)
535 read_next_pair(array, v1, v2, i);
536 i -= 2; /* prevent from for-loop += 2 */
537 } else { /* Configure matched pairs and skip to end of if-else. */
538 read_next_pair(array, v1, v2, i);
539 while (v2 != 0xDEAD &&
540 v2 != 0xCDEF &&
541 v2 != 0xCDCD && i < arraylen - 2) {
542 if (biol) {
543 if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
544 bndy_cnt++;
545 if (v1 == 0xfe) {
546 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
547 } else if (v1 == 0xfd) {
548 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
549 } else if (v1 == 0xfc) {
550 rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
551 } else if (v1 == 0xfb) {
552 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
553 } else if (v1 == 0xfa) {
554 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
555 } else if (v1 == 0xf9) {
556 rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
557 } else {
558 if (v1 == 0xa24)
559 dm_odm->RFCalibrateInfo.RegA24 = v2;
560
561 rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
562 }
563 } else {
564 odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
565 }
566 read_next_pair(array, v1, v2, i);
567 }
568
569 while (v2 != 0xDEAD && i < arraylen - 2)
570 read_next_pair(array, v1, v2, i);
571 }
572 }
573 }
574 if (biol) {
575 if (!rtl8188e_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
576 pr_info("~~~ IOL Config %s Failed !!!\n", __func__);
577 return -1;
578 }
579 }
580 return 0;
581 }
582
583 /******************************************************************************
584 * PHY_REG_PG.TXT
585 ******************************************************************************/
586
587 static u32 array_phy_reg_pg_8188e[] = {
588 0xE00, 0xFFFFFFFF, 0x06070809,
589 0xE04, 0xFFFFFFFF, 0x02020405,
590 0xE08, 0x0000FF00, 0x00000006,
591 0x86C, 0xFFFFFF00, 0x00020400,
592 0xE10, 0xFFFFFFFF, 0x08090A0B,
593 0xE14, 0xFFFFFFFF, 0x01030607,
594 0xE18, 0xFFFFFFFF, 0x08090A0B,
595 0xE1C, 0xFFFFFFFF, 0x01030607,
596 0xE00, 0xFFFFFFFF, 0x00000000,
597 0xE04, 0xFFFFFFFF, 0x00000000,
598 0xE08, 0x0000FF00, 0x00000000,
599 0x86C, 0xFFFFFF00, 0x00000000,
600 0xE10, 0xFFFFFFFF, 0x00000000,
601 0xE14, 0xFFFFFFFF, 0x00000000,
602 0xE18, 0xFFFFFFFF, 0x00000000,
603 0xE1C, 0xFFFFFFFF, 0x00000000,
604 0xE00, 0xFFFFFFFF, 0x02020202,
605 0xE04, 0xFFFFFFFF, 0x00020202,
606 0xE08, 0x0000FF00, 0x00000000,
607 0x86C, 0xFFFFFF00, 0x00000000,
608 0xE10, 0xFFFFFFFF, 0x04040404,
609 0xE14, 0xFFFFFFFF, 0x00020404,
610 0xE18, 0xFFFFFFFF, 0x00000000,
611 0xE1C, 0xFFFFFFFF, 0x00000000,
612 0xE00, 0xFFFFFFFF, 0x02020202,
613 0xE04, 0xFFFFFFFF, 0x00020202,
614 0xE08, 0x0000FF00, 0x00000000,
615 0x86C, 0xFFFFFF00, 0x00000000,
616 0xE10, 0xFFFFFFFF, 0x04040404,
617 0xE14, 0xFFFFFFFF, 0x00020404,
618 0xE18, 0xFFFFFFFF, 0x00000000,
619 0xE1C, 0xFFFFFFFF, 0x00000000,
620 0xE00, 0xFFFFFFFF, 0x00000000,
621 0xE04, 0xFFFFFFFF, 0x00000000,
622 0xE08, 0x0000FF00, 0x00000000,
623 0x86C, 0xFFFFFF00, 0x00000000,
624 0xE10, 0xFFFFFFFF, 0x00000000,
625 0xE14, 0xFFFFFFFF, 0x00000000,
626 0xE18, 0xFFFFFFFF, 0x00000000,
627 0xE1C, 0xFFFFFFFF, 0x00000000,
628 0xE00, 0xFFFFFFFF, 0x02020202,
629 0xE04, 0xFFFFFFFF, 0x00020202,
630 0xE08, 0x0000FF00, 0x00000000,
631 0x86C, 0xFFFFFF00, 0x00000000,
632 0xE10, 0xFFFFFFFF, 0x04040404,
633 0xE14, 0xFFFFFFFF, 0x00020404,
634 0xE18, 0xFFFFFFFF, 0x00000000,
635 0xE1C, 0xFFFFFFFF, 0x00000000,
636 0xE00, 0xFFFFFFFF, 0x00000000,
637 0xE04, 0xFFFFFFFF, 0x00000000,
638 0xE08, 0x0000FF00, 0x00000000,
639 0x86C, 0xFFFFFF00, 0x00000000,
640 0xE10, 0xFFFFFFFF, 0x00000000,
641 0xE14, 0xFFFFFFFF, 0x00000000,
642 0xE18, 0xFFFFFFFF, 0x00000000,
643 0xE1C, 0xFFFFFFFF, 0x00000000,
644 0xE00, 0xFFFFFFFF, 0x00000000,
645 0xE04, 0xFFFFFFFF, 0x00000000,
646 0xE08, 0x0000FF00, 0x00000000,
647 0x86C, 0xFFFFFF00, 0x00000000,
648 0xE10, 0xFFFFFFFF, 0x00000000,
649 0xE14, 0xFFFFFFFF, 0x00000000,
650 0xE18, 0xFFFFFFFF, 0x00000000,
651 0xE1C, 0xFFFFFFFF, 0x00000000,
652 0xE00, 0xFFFFFFFF, 0x00000000,
653 0xE04, 0xFFFFFFFF, 0x00000000,
654 0xE08, 0x0000FF00, 0x00000000,
655 0x86C, 0xFFFFFF00, 0x00000000,
656 0xE10, 0xFFFFFFFF, 0x00000000,
657 0xE14, 0xFFFFFFFF, 0x00000000,
658 0xE18, 0xFFFFFFFF, 0x00000000,
659 0xE1C, 0xFFFFFFFF, 0x00000000,
660 0xE00, 0xFFFFFFFF, 0x00000000,
661 0xE04, 0xFFFFFFFF, 0x00000000,
662 0xE08, 0x0000FF00, 0x00000000,
663 0x86C, 0xFFFFFF00, 0x00000000,
664 0xE10, 0xFFFFFFFF, 0x00000000,
665 0xE14, 0xFFFFFFFF, 0x00000000,
666 0xE18, 0xFFFFFFFF, 0x00000000,
667 0xE1C, 0xFFFFFFFF, 0x00000000,
668 0xE00, 0xFFFFFFFF, 0x00000000,
669 0xE04, 0xFFFFFFFF, 0x00000000,
670 0xE08, 0x0000FF00, 0x00000000,
671 0x86C, 0xFFFFFF00, 0x00000000,
672 0xE10, 0xFFFFFFFF, 0x00000000,
673 0xE14, 0xFFFFFFFF, 0x00000000,
674 0xE18, 0xFFFFFFFF, 0x00000000,
675 0xE1C, 0xFFFFFFFF, 0x00000000,
676
677 };
678
odm_ConfigBB_PHY_REG_PG_8188E(struct odm_dm_struct * pDM_Odm,u32 Addr,u32 Bitmask,u32 Data)679 static void odm_ConfigBB_PHY_REG_PG_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask,
680 u32 Data)
681 {
682 if (Addr == 0xfe)
683 msleep(50);
684 else if (Addr == 0xfd)
685 mdelay(5);
686 else if (Addr == 0xfc)
687 mdelay(1);
688 else if (Addr == 0xfb)
689 udelay(50);
690 else if (Addr == 0xfa)
691 udelay(5);
692 else if (Addr == 0xf9)
693 udelay(1);
694 else
695 storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data);
696 }
697
ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct * dm_odm)698 void ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct *dm_odm)
699 {
700 u32 hex;
701 u32 i = 0;
702 u32 arraylen = ARRAY_SIZE(array_phy_reg_pg_8188e);
703 u32 *array = array_phy_reg_pg_8188e;
704
705 hex = ODM_ITRF_USB << 8;
706 hex += (ODM_CE << 16) + 0xFF000000;
707
708 for (i = 0; i < arraylen; i += 3) {
709 u32 v1 = array[i];
710 u32 v2 = array[i + 1];
711 u32 v3 = array[i + 2];
712
713 /* this line is a line of pure_body */
714 if (v1 < 0xCDCDCDCD) {
715 odm_ConfigBB_PHY_REG_PG_8188E(dm_odm, v1, v2, v3);
716 continue;
717 } else { /* this line is the start of branch */
718 if (!CheckCondition(array[i], hex)) {
719 /* don't need the hw_body */
720 i += 2; /* skip the pair of expression */
721 v1 = array[i];
722 v2 = array[i + 1];
723 v3 = array[i + 2];
724 while (v2 != 0xDEAD) {
725 i += 3;
726 v1 = array[i];
727 v2 = array[i + 1];
728 v3 = array[i + 1];
729 }
730 }
731 }
732 }
733 }
734