qlge: Remove spinlock from asic init path.
[linux-2.6] / drivers / staging / rtl8187se / r8180_rtl8255.c
1 /*
2   This is part of the rtl8180-sa2400 driver
3   released under the GPL (See file COPYING for details).
4   Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
5
6   This files contains programming code for the rtl8255
7   radio frontend.
8
9   *Many* thanks to Realtek Corp. for their great support!
10
11 */
12
13 #define BAND_A 1
14 #define BAND_BG 2
15
16 #include "r8180.h"
17 #include "r8180_hw.h"
18 #include "r8180_rtl8255.h"
19
20 u32 rtl8255_chan[] = {
21         0,      //dummy channel 0
22         0x13, //1
23         0x115, //2
24         0x217, //3
25         0x219, //4
26         0x31b, //5
27         0x41d, //6
28         0x41f, //7
29         0x621, //8
30         0x623, //9
31         0x625, //10
32         0x627, //11
33         0x829, //12
34         0x82b, //13
35         0x92f, // 14
36 };
37
38 static short rtl8255_gain_2G[]={
39         0x33, 0x17, 0x7c, 0xc5,//-78
40         0x43, 0x17, 0x7a, 0xc5,//-74
41         0x53, 0x17, 0x78, 0xc5,//-70
42         0x63, 0x17, 0x76, 0xc5,//-66
43 };
44
45
46 static short rtl8255_agc[]={
47         0x1, 0x1, 0x1, 0x1, 0x1,         0x1, 0x1, 0x1, 0x1, 0x1,
48
49         0x1, 0x1, 0x2, 0x2, 0x3,         0x3, 0x4, 0x4, 0x5, 0x5,
50         0x6, 0x6, 0x7, 0x7, 0x8,         0x8, 0x9, 0x9, 0xa, 0xa,
51         0xb, 0xb, 0xc, 0xc, 0xd,         0xd, 0xe, 0xe, 0xf, 0xf,
52
53         0x10, 0x10, 0x11, 0x11, 0x12,    0x12, 0x13, 0x13, 0x14, 0x14,
54         0x15, 0x15, 0x16, 0x16, 0x17,    0x17, 0x18, 0x18, 0x19, 0x19,
55         0x1a, 0x1a, 0x1b, 0x1b, 0x1c,    0x1c, 0x1d, 0x1d, 0x1e, 0x1e,
56         0x1f, 0x1f,
57
58         0x20, 0x20, 0x21, 0x21, 0x22,    0x22, 0x23, 0x23, 0x24, 0x24,
59         0x25, 0x25, 0x26, 0x26, 0x27,    0x27, 0x28, 0x28, 0x29, 0x29,
60         0x2a, 0x2a,
61
62         0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
63         0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
64         0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
65         0x2a, 0x2a, 0x2a, 0x2a
66
67 };
68
69 void rtl8255_set_gain(struct net_device *dev, short gain)
70 {
71
72 //      struct r8180_priv *priv = ieee80211_priv(dev);
73
74         write_phy_ofdm(dev, 0x0d, rtl8255_gain_2G[gain * 4]);
75         write_phy_ofdm(dev, 0x23, rtl8255_gain_2G[gain * 4 + 1]);
76         write_phy_ofdm(dev, 0x1b, rtl8255_gain_2G[gain * 4 + 2]);
77         write_phy_ofdm(dev, 0x1d, rtl8255_gain_2G[gain * 4 + 3]);
78         //rtl8225_set_gain_usb(dev, gain);
79 }
80
81 void write_rtl8255_reg0c(struct net_device *dev, u32 d1, u32 d2, u32 d3, u32 d4,
82 u32 d5, u32 d6, u32 d7, u32 d8, u32 d9, u32 d10)
83 {
84         int i,j;
85         u16 out,select;
86         u8 bit;
87         u32 bangdata;
88 //      struct r8180_priv *priv = ieee80211_priv(dev);
89
90         write_nic_word(dev,RFPinsEnable,
91                 (read_nic_word(dev,RFPinsEnable) | 0x7));
92
93         select = read_nic_word(dev, RFPinsSelect);
94
95         write_nic_word(dev, RFPinsSelect, select | 0x7 | SW_CONTROL_GPIO);
96
97         out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
98
99         write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
100
101         force_pci_posting(dev);
102         udelay(2);
103
104         write_nic_word(dev, RFPinsOutput, out);
105
106         force_pci_posting(dev);
107         udelay(2);
108
109         for(j=0;j<10;j++)
110         {
111                 switch(j)
112                 {
113                         case 9:
114                         bangdata = d10 | 0x0c;
115                         break;
116                         case 8:
117                         bangdata = d9;
118                         break;
119                         case 7:
120                         bangdata = d8;
121                         break;
122                         case 6:
123                         bangdata = d7;
124                         break;
125                         case 5:
126                         bangdata = d6;
127                         break;
128                         case 4:
129                         bangdata = d5;
130                         break;
131                         case 3:
132                         bangdata = d4;
133                         break;
134                         case 2:
135                         bangdata = d3;
136                         break;
137                         case 1:
138                         bangdata = d2;
139                         break;
140                         case 0:
141                         bangdata = d1;
142                         break;
143                         default:
144                         bangdata=0xbadc0de; /* avoid gcc complaints */
145                         break;
146                 }
147
148                 for(i=31; i>=0;i--){
149
150                         bit = (bangdata & (1<<i)) >> i;
151
152                         write_nic_word(dev, RFPinsOutput, bit | out);
153                         force_pci_posting(dev);
154                         udelay(1);
155                         write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
156                         force_pci_posting(dev);
157                         udelay(1);
158                 //      write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
159                         i--;
160                         bit = (bangdata & (1<<i)) >> i;
161
162                         write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
163                         force_pci_posting(dev);
164                         udelay(1);
165                 //      write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
166                         write_nic_word(dev, RFPinsOutput, bit | out);
167                         force_pci_posting(dev);
168                         udelay(1);
169                 }
170         }
171
172         write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
173         force_pci_posting(dev);
174         udelay(10);
175
176 //      write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
177         write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO);
178 //      rtl8185_rf_pins_enable(dev);
179
180 }
181
182 void write_rtl8255(struct net_device *dev, u8 adr, u16 data)
183 {
184         int i;
185         u16 out,select;
186         u8 bit;
187         u32 bangdata = (data << 4) | (adr & 0xf);
188 //      struct r8180_priv *priv = ieee80211_priv(dev);
189
190         out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
191
192         write_nic_word(dev,RFPinsEnable,
193                 (read_nic_word(dev,RFPinsEnable) | 0x7));
194
195         select = read_nic_word(dev, RFPinsSelect);
196
197         write_nic_word(dev, RFPinsSelect, select | 0x7 | SW_CONTROL_GPIO);
198
199         force_pci_posting(dev);
200         udelay(10);
201
202         write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
203
204         force_pci_posting(dev);
205         udelay(2);
206
207         write_nic_word(dev, RFPinsOutput, out);
208
209         force_pci_posting(dev);
210         udelay(10);
211
212
213         for(i=15; i>=0;i--){
214
215                 bit = (bangdata & (1<<i)) >> i;
216
217                 write_nic_word(dev, RFPinsOutput, bit | out);
218                 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
219                 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
220                 i--;
221                 bit = (bangdata & (1<<i)) >> i;
222
223                 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
224                 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
225                 write_nic_word(dev, RFPinsOutput, bit | out);
226         }
227
228
229         write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
230
231         force_pci_posting(dev);
232         udelay(10);
233
234         write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
235         write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO);
236
237         rtl8185_rf_pins_enable(dev);
238 }
239
240 void rtl8255_rf_close(struct net_device *dev)
241 {
242
243 //      rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
244 //      rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
245 }
246
247 void rtl8255_SetTXPowerLevel(struct net_device *dev, short ch)
248 {
249         struct r8180_priv *priv = ieee80211_priv(dev);
250
251         u8 cck_power_level = 0xff & priv->chtxpwr[ch];
252         u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
253         write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
254         write_nic_byte(dev, TX_GAIN_CCK, cck_power_level);
255         force_pci_posting(dev);
256         mdelay(1);
257         //write_nic_byte(dev, TX_AGC_CONTROL,4);
258 }
259 #if 0
260 /* switch between mode B and G */
261 void rtl8255_set_mode(struct net_device *dev, short modeb)
262 {
263         write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
264         write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
265 }
266 #endif
267
268 void rtl8255_rf_set_chan(struct net_device *dev, short ch)
269 {
270         //write_rtl8225(dev, 0x7, rtl8225_chan[1]);
271         write_rtl8255(dev, 0x5, 0x65);
272         write_rtl8255(dev, 0x6, rtl8255_chan[ch]);
273         write_rtl8255(dev, 0x7, 0x7c);
274         write_rtl8255(dev, 0x8, 0x6);
275
276
277         force_pci_posting(dev);
278         set_current_state(TASK_INTERRUPTIBLE);
279         schedule_timeout(HZ);
280 //      rtl8225_set_mode_B(dev);
281
282         rtl8255_SetTXPowerLevel(dev, ch);
283         /* FIXME FIXME FIXME */
284
285         #if 0
286         write_nic_byte(dev,DIFS,0xe); //DIFS
287         write_nic_byte(dev,SLOT,0x14); //SLOT
288         write_nic_byte(dev,EIFS,0x5b); // EIFS
289         //write_nic_byte(dev,0xbc,0); //CW CONFIG
290         write_nic_byte(dev,0xbd,0xa4); //CW VALUE
291         //write_nic_byte(dev,TX_AGC_CONTROL,4);
292         //write_nic_byte(dev, 0x9d,7);
293 //Apr 20 13:25:03 localhost kernel: w8. 409d<-7  // CCK AGC
294         /*write_nic_word(dev,0x84,0x488);
295         write_nic_byte(dev,0x91,0x3e);
296         write_nic_byte(dev,0x90,0x30);
297         write_nic_word(dev,0x84,0x488);
298         write_nic_byte(dev,0x91,0x3e);
299         write_nic_byte(dev,0x90,0x20);
300         */
301         //mdelay(100);
302         #endif
303 }
304
305 void rtl8255_init_BGband(struct net_device *dev)
306 {
307         write_rtl8255(dev, 0x3, 0x0);
308         write_rtl8255(dev, 0x1, 0x807);
309         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804187cf, 0x40000027,
310                 0x92402ac0, 0xf0009, 0x28000, 0xc00, 0x0);
311         write_rtl8255(dev, 0x1, 0x807);
312         write_rtl8255(dev, 0x4, 0xc00);
313         write_rtl8255(dev, 0x4, 0xe00);
314         write_rtl8255(dev, 0x4, 0xc00);
315         write_rtl8255(dev, 0x1, 0x0);
316         write_rtl8255(dev, 0x4, 0x800);
317         write_rtl8255(dev, 0x3, 0x0);
318         write_rtl8255(dev, 0x2, 0x0);
319         write_rtl8255(dev, 0x4, 0xa00);
320         write_rtl8255(dev, 0x4, 0x800);
321         write_rtl8255(dev, 0x4, 0x400);
322         write_rtl8255(dev, 0x3, 0x26);
323         write_rtl8255(dev, 0x2, 0x27);
324         write_rtl8255(dev, 0x4, 0x600);
325         write_rtl8255(dev, 0x4, 0x400);
326         write_rtl8255(dev, 0x4, 0x400);
327         write_rtl8255(dev, 0x3, 0x100);
328         write_rtl8255(dev, 0x4, 0x600);
329         write_rtl8255(dev, 0x4, 0x400);
330         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804187ce, 0x80000027,
331                 0x92402ac0, 0xf0009, 0x28000, 0xc00, 0x0);
332         write_rtl8255(dev, 0x1, 0x807);
333         write_rtl8255(dev, 0x4, 0xc01);
334         write_rtl8255(dev, 0x4, 0xe01);
335         write_rtl8255(dev, 0x4, 0xc01);
336         write_rtl8255(dev, 0x1, 0x0);
337         write_rtl8255(dev, 0x4, 0x801);
338         write_rtl8255(dev, 0x3, 0x0);
339         write_rtl8255(dev, 0x2, 0x0);
340         write_rtl8255(dev, 0x4, 0xa01);
341         write_rtl8255(dev, 0x4, 0x801);
342         write_rtl8255(dev, 0x4, 0x401);
343         write_rtl8255(dev, 0x3, 0x26);
344         write_rtl8255(dev, 0x2, 0x27);
345         write_rtl8255(dev, 0x4, 0x601);
346         write_rtl8255(dev, 0x4, 0x401);
347         write_rtl8255(dev, 0x4, 0x401);
348         write_rtl8255(dev, 0x3, 0x100);
349         write_rtl8255(dev, 0x4, 0x601);
350         write_rtl8255(dev, 0x4, 0x401);
351         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418bdf, 0x40000027,
352                 0x92402ac4, 0xf0009, 0x28000, 0xc00, 0x0);
353         write_rtl8255(dev, 0x1, 0x807);
354         write_rtl8255(dev, 0x4, 0xc02);
355         write_rtl8255(dev, 0x4, 0xe02);
356         write_rtl8255(dev, 0x4, 0xc02);
357         write_rtl8255(dev, 0x1, 0x0);
358         write_rtl8255(dev, 0x4, 0x802);
359         write_rtl8255(dev, 0x3, 0x0);
360         write_rtl8255(dev, 0x2, 0x0);
361         write_rtl8255(dev, 0x4, 0xa02);
362         write_rtl8255(dev, 0x4, 0x802);
363         write_rtl8255(dev, 0x4, 0x402);
364         write_rtl8255(dev, 0x3, 0x26);
365         write_rtl8255(dev, 0x2, 0x26);
366         write_rtl8255(dev, 0x4, 0x602);
367         write_rtl8255(dev, 0x4, 0x402);
368         write_rtl8255(dev, 0x4, 0x402);
369         write_rtl8255(dev, 0x3, 0x100);
370         write_rtl8255(dev, 0x4, 0x602);
371         write_rtl8255(dev, 0x4, 0x402);
372         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418bbf, 0x40000027,
373                 0x92402ac4, 0xf0009, 0x28000, 0xc00, 0x0);
374         write_rtl8255(dev, 0x1, 0x807);
375         write_rtl8255(dev, 0x4, 0xc03);
376         write_rtl8255(dev, 0x4, 0xe03);
377         write_rtl8255(dev, 0x4, 0xc03);
378         write_rtl8255(dev, 0x1, 0x0);
379         write_rtl8255(dev, 0x4, 0x803);
380         write_rtl8255(dev, 0x3, 0x0);
381         write_rtl8255(dev, 0x2, 0x0);
382         write_rtl8255(dev, 0x4, 0xa03);
383         write_rtl8255(dev, 0x4, 0x803);
384         write_rtl8255(dev, 0x4, 0x403);
385         write_rtl8255(dev, 0x3, 0x26);
386         write_rtl8255(dev, 0x2, 0x26);
387         write_rtl8255(dev, 0x4, 0x603);
388         write_rtl8255(dev, 0x4, 0x403);
389         write_rtl8255(dev, 0x4, 0x403);
390         write_rtl8255(dev, 0x3, 0x100);
391         write_rtl8255(dev, 0x4, 0x603);
392         write_rtl8255(dev, 0x4, 0x403);
393         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418b9f, 0x40000027,
394                 0x92402ac8, 0xf0009, 0x28000, 0xc00, 0x0);
395         write_rtl8255(dev, 0x1, 0x807);
396         write_rtl8255(dev, 0x4, 0xc04);
397         write_rtl8255(dev, 0x4, 0xe04);
398         write_rtl8255(dev, 0x4, 0xc04);
399         write_rtl8255(dev, 0x1, 0x0);
400         write_rtl8255(dev, 0x4, 0x804);
401         write_rtl8255(dev, 0x3, 0x0);
402         write_rtl8255(dev, 0x2, 0x0);
403         write_rtl8255(dev, 0x4, 0xa04);
404         write_rtl8255(dev, 0x4, 0x804);
405         write_rtl8255(dev, 0x4, 0x404);
406         write_rtl8255(dev, 0x3, 0x26);
407         write_rtl8255(dev, 0x2, 0x26);
408         write_rtl8255(dev, 0x4, 0x604);
409         write_rtl8255(dev, 0x4, 0x404);
410         write_rtl8255(dev, 0x4, 0x404);
411         write_rtl8255(dev, 0x3, 0x100);
412         write_rtl8255(dev, 0x4, 0x604);
413         write_rtl8255(dev, 0x4, 0x404);
414         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183df, 0x40000027,
415                 0x92402ac8, 0xf0009, 0x28000, 0xc00, 0x0);
416         write_rtl8255(dev, 0x1, 0x807);
417         write_rtl8255(dev, 0x4, 0xc05);
418         write_rtl8255(dev, 0x4, 0xe05);
419         write_rtl8255(dev, 0x4, 0xc05);
420         write_rtl8255(dev, 0x1, 0x0);
421         write_rtl8255(dev, 0x4, 0x805);
422         write_rtl8255(dev, 0x3, 0x0);
423         write_rtl8255(dev, 0x2, 0x0);
424         write_rtl8255(dev, 0x4, 0xa05);
425         write_rtl8255(dev, 0x4, 0x805);
426         write_rtl8255(dev, 0x4, 0x405);
427         write_rtl8255(dev, 0x3, 0x26);
428         write_rtl8255(dev, 0x2, 0x26);
429         write_rtl8255(dev, 0x4, 0x605);
430         write_rtl8255(dev, 0x4, 0x405);
431         write_rtl8255(dev, 0x4, 0x405);
432         write_rtl8255(dev, 0x3, 0x100);
433         write_rtl8255(dev, 0x4, 0x605);
434         write_rtl8255(dev, 0x4, 0x405);
435         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183cf, 0x27,
436                 0x92402acc, 0xf0009, 0x28000, 0xc00, 0x0);
437         write_rtl8255(dev, 0x1, 0x807);
438         write_rtl8255(dev, 0x4, 0xc06);
439         write_rtl8255(dev, 0x4, 0xe06);
440         write_rtl8255(dev, 0x4, 0xc06);
441         write_rtl8255(dev, 0x1, 0x0);
442         write_rtl8255(dev, 0x4, 0x806);
443         write_rtl8255(dev, 0x3, 0x0);
444         write_rtl8255(dev, 0x2, 0x0);
445         write_rtl8255(dev, 0x4, 0xa06);
446         write_rtl8255(dev, 0x4, 0x806);
447         write_rtl8255(dev, 0x4, 0x406);
448         write_rtl8255(dev, 0x3, 0x25);
449         write_rtl8255(dev, 0x2, 0x26);
450         write_rtl8255(dev, 0x4, 0x606);
451         write_rtl8255(dev, 0x4, 0x406);
452         write_rtl8255(dev, 0x4, 0x406);
453         write_rtl8255(dev, 0x3, 0x100);
454         write_rtl8255(dev, 0x4, 0x606);
455         write_rtl8255(dev, 0x4, 0x406);
456         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183af, 0x27,
457                 0x92402acc, 0xf0009, 0x28000, 0xc00, 0x0);
458         write_rtl8255(dev, 0x1, 0x807);
459         write_rtl8255(dev, 0x4, 0xc07);
460         write_rtl8255(dev, 0x4, 0xe07);
461         write_rtl8255(dev, 0x4, 0xc07);
462         write_rtl8255(dev, 0x1, 0x0);
463         write_rtl8255(dev, 0x4, 0x807);
464         write_rtl8255(dev, 0x3, 0x0);
465         write_rtl8255(dev, 0x2, 0x0);
466         write_rtl8255(dev, 0x4, 0xa07);
467         write_rtl8255(dev, 0x4, 0x807);
468         write_rtl8255(dev, 0x4, 0x407);
469         write_rtl8255(dev, 0x3, 0x25);
470         write_rtl8255(dev, 0x2, 0x26);
471         write_rtl8255(dev, 0x4, 0x607);
472         write_rtl8255(dev, 0x4, 0x407);
473         write_rtl8255(dev, 0x4, 0x407);
474         write_rtl8255(dev, 0x3, 0x100);
475         write_rtl8255(dev, 0x4, 0x607);
476         write_rtl8255(dev, 0x4, 0x407);
477         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804083d7, 0x40000027,
478                 0x92402ad0, 0xf0009, 0x28000, 0xc00, 0x0);
479         write_rtl8255(dev, 0x1, 0x807);
480         write_rtl8255(dev, 0x4, 0xc08);
481         write_rtl8255(dev, 0x4, 0xe08);
482         write_rtl8255(dev, 0x4, 0xc08);
483         write_rtl8255(dev, 0x1, 0x0);
484         write_rtl8255(dev, 0x4, 0x808);
485         write_rtl8255(dev, 0x3, 0x0);
486         write_rtl8255(dev, 0x2, 0x0);
487         write_rtl8255(dev, 0x4, 0xa08);
488         write_rtl8255(dev, 0x4, 0x808);
489         write_rtl8255(dev, 0x4, 0x408);
490         write_rtl8255(dev, 0x3, 0x25);
491         write_rtl8255(dev, 0x2, 0x26);
492         write_rtl8255(dev, 0x4, 0x608);
493         write_rtl8255(dev, 0x4, 0x408);
494         write_rtl8255(dev, 0x4, 0x408);
495         write_rtl8255(dev, 0x3, 0x100);
496         write_rtl8255(dev, 0x4, 0x608);
497         write_rtl8255(dev, 0x4, 0x408);
498         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804083c7, 0x27,
499                 0x92402ad0, 0xf0009, 0x28000, 0xc00, 0x0);
500         write_rtl8255(dev, 0x1, 0x807);
501         write_rtl8255(dev, 0x4, 0xc09);
502         write_rtl8255(dev, 0x4, 0xe09);
503         write_rtl8255(dev, 0x4, 0xc09);
504         write_rtl8255(dev, 0x1, 0x0);
505         write_rtl8255(dev, 0x4, 0x809);
506         write_rtl8255(dev, 0x3, 0x0);
507         write_rtl8255(dev, 0x2, 0x0);
508         write_rtl8255(dev, 0x4, 0xa09);
509         write_rtl8255(dev, 0x4, 0x809);
510         write_rtl8255(dev, 0x4, 0x409);
511         write_rtl8255(dev, 0x3, 0x25);
512         write_rtl8255(dev, 0x2, 0x26);
513         write_rtl8255(dev, 0x4, 0x609);
514         write_rtl8255(dev, 0x4, 0x409);
515         write_rtl8255(dev, 0x4, 0x409);
516         write_rtl8255(dev, 0x3, 0x100);
517         write_rtl8255(dev, 0x4, 0x609);
518         write_rtl8255(dev, 0x4, 0x409);
519         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043d7, 0x40000027,
520                 0x92402ad4, 0xf0009, 0x28000, 0xc00, 0x0);
521         write_rtl8255(dev, 0x1, 0x807);
522         write_rtl8255(dev, 0x4, 0xc0a);
523         write_rtl8255(dev, 0x4, 0xe0a);
524         write_rtl8255(dev, 0x4, 0xc0a);
525         write_rtl8255(dev, 0x1, 0x0);
526         write_rtl8255(dev, 0x4, 0x80a);
527         write_rtl8255(dev, 0x3, 0x0);
528         write_rtl8255(dev, 0x2, 0x0);
529         write_rtl8255(dev, 0x4, 0xa0a);
530         write_rtl8255(dev, 0x4, 0x80a);
531         write_rtl8255(dev, 0x4, 0x40a);
532         write_rtl8255(dev, 0x3, 0x25);
533         write_rtl8255(dev, 0x2, 0x26);
534         write_rtl8255(dev, 0x4, 0x60a);
535         write_rtl8255(dev, 0x4, 0x40a);
536         write_rtl8255(dev, 0x4, 0x40a);
537         write_rtl8255(dev, 0x3, 0x100);
538         write_rtl8255(dev, 0x4, 0x60a);
539         write_rtl8255(dev, 0x4, 0x40a);
540         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043d7, 0x40000027,
541                 0x92402ad4, 0xf0009, 0x28000, 0xc00, 0x0);
542         write_rtl8255(dev, 0x1, 0x807);
543         write_rtl8255(dev, 0x4, 0xc0b);
544         write_rtl8255(dev, 0x4, 0xe0b);
545         write_rtl8255(dev, 0x4, 0xc0b);
546         write_rtl8255(dev, 0x1, 0x0);
547         write_rtl8255(dev, 0x4, 0x80b);
548         write_rtl8255(dev, 0x3, 0x0);
549         write_rtl8255(dev, 0x2, 0x0);
550         write_rtl8255(dev, 0x4, 0xa0b);
551         write_rtl8255(dev, 0x4, 0x80b);
552         write_rtl8255(dev, 0x4, 0x40b);
553         write_rtl8255(dev, 0x3, 0x25);
554         write_rtl8255(dev, 0x2, 0x26);
555         write_rtl8255(dev, 0x4, 0x60b);
556         write_rtl8255(dev, 0x4, 0x40b);
557         write_rtl8255(dev, 0x4, 0x40b);
558         write_rtl8255(dev, 0x3, 0x100);
559         write_rtl8255(dev, 0x4, 0x60b);
560         write_rtl8255(dev, 0x4, 0x40b);
561         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043c7, 0x27,
562                 0x92402ad8, 0xf0009, 0x28000, 0xc00, 0x0);
563         write_rtl8255(dev, 0x1, 0x807);
564         write_rtl8255(dev, 0x4, 0xc0c);
565         write_rtl8255(dev, 0x4, 0xe0c);
566         write_rtl8255(dev, 0x4, 0xc0c);
567         write_rtl8255(dev, 0x1, 0x0);
568         write_rtl8255(dev, 0x4, 0x80c);
569         write_rtl8255(dev, 0x3, 0x0);
570         write_rtl8255(dev, 0x2, 0x0);
571         write_rtl8255(dev, 0x4, 0xa0c);
572         write_rtl8255(dev, 0x4, 0x80c);
573         write_rtl8255(dev, 0x4, 0x40c);
574         write_rtl8255(dev, 0x3, 0x25);
575         write_rtl8255(dev, 0x2, 0x26);
576         write_rtl8255(dev, 0x4, 0x60c);
577         write_rtl8255(dev, 0x4, 0x40c);
578         write_rtl8255(dev, 0x4, 0x40c);
579         write_rtl8255(dev, 0x3, 0x100);
580         write_rtl8255(dev, 0x4, 0x60c);
581         write_rtl8255(dev, 0x4, 0x40c);
582         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043a7, 0x27,
583                 0x92402ad8, 0xf0009, 0x28000, 0xc00, 0x0);
584         write_rtl8255(dev, 0x1, 0x807);
585         write_rtl8255(dev, 0x4, 0xc0d);
586         write_rtl8255(dev, 0x4, 0xe0d);
587         write_rtl8255(dev, 0x4, 0xc0d);
588         write_rtl8255(dev, 0x1, 0x0);
589         write_rtl8255(dev, 0x4, 0x80d);
590         write_rtl8255(dev, 0x3, 0x0);
591         write_rtl8255(dev, 0x2, 0x0);
592         write_rtl8255(dev, 0x4, 0xa0d);
593         write_rtl8255(dev, 0x4, 0x80d);
594         write_rtl8255(dev, 0x4, 0x40d);
595         write_rtl8255(dev, 0x3, 0x25);
596         write_rtl8255(dev, 0x2, 0x26);
597         write_rtl8255(dev, 0x4, 0x60d);
598         write_rtl8255(dev, 0x4, 0x40d);
599         write_rtl8255(dev, 0x4, 0x40d);
600         write_rtl8255(dev, 0x3, 0x100);
601         write_rtl8255(dev, 0x4, 0x60d);
602         write_rtl8255(dev, 0x4, 0x40d);
603         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404387, 0x27,
604                 0x92402aa8, 0xf0009, 0x28000, 0xc00, 0x0);
605         write_rtl8255(dev, 0x1, 0x807);
606         write_rtl8255(dev, 0x4, 0xc0e);
607         write_rtl8255(dev, 0x4, 0xe0e);
608         write_rtl8255(dev, 0x4, 0xc0e);
609         write_rtl8255(dev, 0x1, 0x0);
610         write_rtl8255(dev, 0x4, 0x80e);
611         write_rtl8255(dev, 0x3, 0x0);
612         write_rtl8255(dev, 0x2, 0x0);
613         write_rtl8255(dev, 0x4, 0xa0e);
614         write_rtl8255(dev, 0x4, 0x80e);
615         write_rtl8255(dev, 0x4, 0x40e);
616         write_rtl8255(dev, 0x3, 0x25);
617         write_rtl8255(dev, 0x2, 0x26);
618         write_rtl8255(dev, 0x4, 0x60e);
619         write_rtl8255(dev, 0x4, 0x40e);
620         write_rtl8255(dev, 0x4, 0x40e);
621         write_rtl8255(dev, 0x3, 0x100);
622         write_rtl8255(dev, 0x4, 0x60e);
623         write_rtl8255(dev, 0x4, 0x40e);
624         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804041c7, 0x27,
625                 0x92402aa8, 0xf0009, 0x28000, 0xc00, 0x0);
626         write_rtl8255(dev, 0x1, 0x807);
627         write_rtl8255(dev, 0x4, 0xc0f);
628         write_rtl8255(dev, 0x4, 0xe0f);
629         write_rtl8255(dev, 0x4, 0xc0f);
630         write_rtl8255(dev, 0x1, 0x0);
631         write_rtl8255(dev, 0x4, 0x80f);
632         write_rtl8255(dev, 0x3, 0x0);
633         write_rtl8255(dev, 0x2, 0x0);
634         write_rtl8255(dev, 0x4, 0xa0f);
635         write_rtl8255(dev, 0x4, 0x80f);
636         write_rtl8255(dev, 0x4, 0x40f);
637         write_rtl8255(dev, 0x3, 0x25);
638         write_rtl8255(dev, 0x2, 0x26);
639         write_rtl8255(dev, 0x4, 0x60f);
640         write_rtl8255(dev, 0x4, 0x40f);
641         write_rtl8255(dev, 0x4, 0x40f);
642         write_rtl8255(dev, 0x3, 0x100);
643         write_rtl8255(dev, 0x4, 0x60f);
644         write_rtl8255(dev, 0x4, 0x40f);
645         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804041a7, 0x27,
646                 0x92402aac, 0xf0009, 0x28000, 0xc00, 0x0);
647         write_rtl8255(dev, 0x1, 0x807);
648         write_rtl8255(dev, 0x4, 0xc10);
649         write_rtl8255(dev, 0x4, 0xe10);
650         write_rtl8255(dev, 0x4, 0xc10);
651         write_rtl8255(dev, 0x1, 0x0);
652         write_rtl8255(dev, 0x4, 0x810);
653         write_rtl8255(dev, 0x3, 0x0);
654         write_rtl8255(dev, 0x2, 0x0);
655         write_rtl8255(dev, 0x4, 0xa10);
656         write_rtl8255(dev, 0x4, 0x810);
657         write_rtl8255(dev, 0x4, 0x410);
658         write_rtl8255(dev, 0x3, 0x25);
659         write_rtl8255(dev, 0x2, 0x26);
660         write_rtl8255(dev, 0x4, 0x610);
661         write_rtl8255(dev, 0x4, 0x410);
662         write_rtl8255(dev, 0x4, 0x410);
663         write_rtl8255(dev, 0x3, 0x100);
664         write_rtl8255(dev, 0x4, 0x610);
665         write_rtl8255(dev, 0x4, 0x410);
666         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404187, 0x27,
667                 0x92402aac, 0xf0009, 0x28000, 0xc00, 0x0);
668         write_rtl8255(dev, 0x1, 0x807);
669         write_rtl8255(dev, 0x4, 0xc11);
670         write_rtl8255(dev, 0x4, 0xe11);
671         write_rtl8255(dev, 0x4, 0xc11);
672         write_rtl8255(dev, 0x1, 0x0);
673         write_rtl8255(dev, 0x4, 0x811);
674         write_rtl8255(dev, 0x3, 0x0);
675         write_rtl8255(dev, 0x2, 0x0);
676         write_rtl8255(dev, 0x4, 0xa11);
677         write_rtl8255(dev, 0x4, 0x811);
678         write_rtl8255(dev, 0x4, 0x411);
679         write_rtl8255(dev, 0x3, 0x25);
680         write_rtl8255(dev, 0x2, 0x26);
681         write_rtl8255(dev, 0x4, 0x611);
682         write_rtl8255(dev, 0x4, 0x411);
683         write_rtl8255(dev, 0x4, 0x411);
684         write_rtl8255(dev, 0x3, 0x100);
685         write_rtl8255(dev, 0x4, 0x611);
686         write_rtl8255(dev, 0x4, 0x411);
687         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404186, 0x80000027,
688                 0x92402ab0, 0xf0009, 0x28000, 0xc00, 0x0);
689         write_rtl8255(dev, 0x1, 0x807);
690         write_rtl8255(dev, 0x4, 0xc12);
691         write_rtl8255(dev, 0x4, 0xe12);
692         write_rtl8255(dev, 0x4, 0xc12);
693         write_rtl8255(dev, 0x1, 0x0);
694         write_rtl8255(dev, 0x4, 0x812);
695         write_rtl8255(dev, 0x3, 0x0);
696         write_rtl8255(dev, 0x2, 0x0);
697         write_rtl8255(dev, 0x4, 0xa12);
698         write_rtl8255(dev, 0x4, 0x812);
699         write_rtl8255(dev, 0x4, 0x412);
700         write_rtl8255(dev, 0x3, 0x25);
701         write_rtl8255(dev, 0x2, 0x26);
702         write_rtl8255(dev, 0x4, 0x612);
703         write_rtl8255(dev, 0x4, 0x412);
704         write_rtl8255(dev, 0x4, 0x412);
705         write_rtl8255(dev, 0x3, 0x100);
706         write_rtl8255(dev, 0x4, 0x612);
707         write_rtl8255(dev, 0x4, 0x412);
708         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404186, 0x27,
709                 0x92402ab0, 0xf0009, 0x28000, 0xc00, 0x0);
710         write_rtl8255(dev, 0x1, 0x807);
711         write_rtl8255(dev, 0x4, 0xc13);
712         write_rtl8255(dev, 0x4, 0xe13);
713         write_rtl8255(dev, 0x4, 0xc13);
714         write_rtl8255(dev, 0x1, 0x0);
715         write_rtl8255(dev, 0x4, 0x813);
716         write_rtl8255(dev, 0x3, 0x0);
717         write_rtl8255(dev, 0x2, 0x0);
718         write_rtl8255(dev, 0x4, 0xa13);
719         write_rtl8255(dev, 0x4, 0x813);
720         write_rtl8255(dev, 0x4, 0x413);
721         write_rtl8255(dev, 0x3, 0x25);
722         write_rtl8255(dev, 0x2, 0x26);
723         write_rtl8255(dev, 0x4, 0x613);
724         write_rtl8255(dev, 0x4, 0x413);
725         write_rtl8255(dev, 0x4, 0x413);
726         write_rtl8255(dev, 0x3, 0x100);
727         write_rtl8255(dev, 0x4, 0x613);
728         write_rtl8255(dev, 0x4, 0x413);
729         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404146, 0x27,
730                 0x92402ab4, 0xf0009, 0x28000, 0xc00, 0x0);
731         write_rtl8255(dev, 0x1, 0x807);
732         write_rtl8255(dev, 0x4, 0xc14);
733         write_rtl8255(dev, 0x4, 0xe14);
734         write_rtl8255(dev, 0x4, 0xc14);
735         write_rtl8255(dev, 0x1, 0x0);
736         write_rtl8255(dev, 0x4, 0x814);
737         write_rtl8255(dev, 0x3, 0x0);
738         write_rtl8255(dev, 0x2, 0x0);
739         write_rtl8255(dev, 0x4, 0xa14);
740         write_rtl8255(dev, 0x4, 0x814);
741         write_rtl8255(dev, 0x4, 0x414);
742         write_rtl8255(dev, 0x3, 0x25);
743         write_rtl8255(dev, 0x2, 0x26);
744         write_rtl8255(dev, 0x4, 0x614);
745         write_rtl8255(dev, 0x4, 0x414);
746         write_rtl8255(dev, 0x4, 0x414);
747         write_rtl8255(dev, 0x3, 0x100);
748         write_rtl8255(dev, 0x4, 0x614);
749         write_rtl8255(dev, 0x4, 0x414);
750         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404126, 0x27,
751                 0x92402ab4, 0xf0009, 0x28000, 0xc00, 0x0);
752         write_rtl8255(dev, 0x1, 0x807);
753         write_rtl8255(dev, 0x4, 0xc15);
754         write_rtl8255(dev, 0x4, 0xe15);
755         write_rtl8255(dev, 0x4, 0xc15);
756         write_rtl8255(dev, 0x1, 0x0);
757         write_rtl8255(dev, 0x4, 0x815);
758         write_rtl8255(dev, 0x3, 0x0);
759         write_rtl8255(dev, 0x2, 0x0);
760         write_rtl8255(dev, 0x4, 0xa15);
761         write_rtl8255(dev, 0x4, 0x815);
762         write_rtl8255(dev, 0x4, 0x415);
763         write_rtl8255(dev, 0x3, 0x25);
764         write_rtl8255(dev, 0x2, 0x26);
765         write_rtl8255(dev, 0x4, 0x615);
766         write_rtl8255(dev, 0x4, 0x415);
767         write_rtl8255(dev, 0x4, 0x415);
768         write_rtl8255(dev, 0x3, 0x100);
769         write_rtl8255(dev, 0x4, 0x615);
770         write_rtl8255(dev, 0x4, 0x415);
771         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404106, 0x27,
772                 0x92402ab8, 0xf0009, 0x28000, 0xc00, 0x0);
773         write_rtl8255(dev, 0x1, 0x807);
774         write_rtl8255(dev, 0x4, 0xc16);
775         write_rtl8255(dev, 0x4, 0xe16);
776         write_rtl8255(dev, 0x4, 0xc16);
777         write_rtl8255(dev, 0x1, 0x0);
778         write_rtl8255(dev, 0x4, 0x816);
779         write_rtl8255(dev, 0x3, 0x0);
780         write_rtl8255(dev, 0x2, 0x0);
781         write_rtl8255(dev, 0x4, 0xa16);
782         write_rtl8255(dev, 0x4, 0x816);
783         write_rtl8255(dev, 0x4, 0x416);
784         write_rtl8255(dev, 0x3, 0x25);
785         write_rtl8255(dev, 0x2, 0x26);
786         write_rtl8255(dev, 0x4, 0x616);
787         write_rtl8255(dev, 0x4, 0x416);
788         write_rtl8255(dev, 0x4, 0x416);
789         write_rtl8255(dev, 0x3, 0x100);
790         write_rtl8255(dev, 0x4, 0x616);
791         write_rtl8255(dev, 0x4, 0x416);
792         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404105, 0x27,
793                 0x92402ab8, 0xf0009, 0x28000, 0xc00, 0x0);
794         write_rtl8255(dev, 0x1, 0x807);
795         write_rtl8255(dev, 0x4, 0xc17);
796         write_rtl8255(dev, 0x4, 0xe17);
797         write_rtl8255(dev, 0x4, 0xc17);
798         write_rtl8255(dev, 0x1, 0x0);
799         write_rtl8255(dev, 0x4, 0x817);
800         write_rtl8255(dev, 0x3, 0x0);
801         write_rtl8255(dev, 0x2, 0x0);
802         write_rtl8255(dev, 0x4, 0xa17);
803         write_rtl8255(dev, 0x4, 0x817);
804         write_rtl8255(dev, 0x4, 0x417);
805         write_rtl8255(dev, 0x3, 0x25);
806         write_rtl8255(dev, 0x2, 0x26);
807         write_rtl8255(dev, 0x4, 0x617);
808         write_rtl8255(dev, 0x4, 0x417);
809         write_rtl8255(dev, 0x4, 0x417);
810         write_rtl8255(dev, 0x3, 0x100);
811         write_rtl8255(dev, 0x4, 0x617);
812         write_rtl8255(dev, 0x4, 0x417);
813         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404104, 0x80000027,
814                 0x92402a88, 0xf0009, 0x28000, 0xc00, 0x0);
815         write_rtl8255(dev, 0x1, 0x807);
816         write_rtl8255(dev, 0x4, 0xc18);
817         write_rtl8255(dev, 0x4, 0xe18);
818         write_rtl8255(dev, 0x4, 0xc18);
819         write_rtl8255(dev, 0x1, 0x0);
820         write_rtl8255(dev, 0x4, 0x818);
821         write_rtl8255(dev, 0x3, 0x0);
822         write_rtl8255(dev, 0x2, 0x0);
823         write_rtl8255(dev, 0x4, 0xa18);
824         write_rtl8255(dev, 0x4, 0x818);
825         write_rtl8255(dev, 0x4, 0x418);
826         write_rtl8255(dev, 0x3, 0x25);
827         write_rtl8255(dev, 0x2, 0x26);
828         write_rtl8255(dev, 0x4, 0x618);
829         write_rtl8255(dev, 0x4, 0x418);
830         write_rtl8255(dev, 0x4, 0x418);
831         write_rtl8255(dev, 0x3, 0x100);
832         write_rtl8255(dev, 0x4, 0x618);
833         write_rtl8255(dev, 0x4, 0x418);
834         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404104, 0x27,
835                 0x92402a88, 0xf0009, 0x28000, 0xc00, 0x0);
836         write_rtl8255(dev, 0x1, 0x807);
837         write_rtl8255(dev, 0x4, 0xc19);
838         write_rtl8255(dev, 0x4, 0xe19);
839         write_rtl8255(dev, 0x4, 0xc19);
840         write_rtl8255(dev, 0x1, 0x0);
841         write_rtl8255(dev, 0x4, 0x819);
842         write_rtl8255(dev, 0x3, 0x0);
843         write_rtl8255(dev, 0x2, 0x0);
844         write_rtl8255(dev, 0x4, 0xa19);
845         write_rtl8255(dev, 0x4, 0x819);
846         write_rtl8255(dev, 0x4, 0x419);
847         write_rtl8255(dev, 0x3, 0x25);
848         write_rtl8255(dev, 0x2, 0x26);
849         write_rtl8255(dev, 0x4, 0x619);
850         write_rtl8255(dev, 0x4, 0x419);
851         write_rtl8255(dev, 0x4, 0x419);
852         write_rtl8255(dev, 0x3, 0x100);
853         write_rtl8255(dev, 0x4, 0x619);
854         write_rtl8255(dev, 0x4, 0x419);
855         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404044, 0x27,
856                 0x92402a8c, 0xf0009, 0x28000, 0xc00, 0x0);
857         write_rtl8255(dev, 0x1, 0x807);
858         write_rtl8255(dev, 0x4, 0xc1a);
859         write_rtl8255(dev, 0x4, 0xe1a);
860         write_rtl8255(dev, 0x4, 0xc1a);
861         write_rtl8255(dev, 0x1, 0x0);
862         write_rtl8255(dev, 0x4, 0x81a);
863         write_rtl8255(dev, 0x3, 0x0);
864         write_rtl8255(dev, 0x2, 0x0);
865         write_rtl8255(dev, 0x4, 0xa1a);
866         write_rtl8255(dev, 0x4, 0x81a);
867         write_rtl8255(dev, 0x4, 0x41a);
868         write_rtl8255(dev, 0x3, 0x25);
869         write_rtl8255(dev, 0x2, 0x26);
870         write_rtl8255(dev, 0x4, 0x61a);
871         write_rtl8255(dev, 0x4, 0x41a);
872         write_rtl8255(dev, 0x4, 0x41a);
873         write_rtl8255(dev, 0x3, 0x100);
874         write_rtl8255(dev, 0x4, 0x61a);
875         write_rtl8255(dev, 0x4, 0x41a);
876         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404024, 0x27,
877                 0x92402a8c, 0xf0009, 0x28000, 0xc00, 0x0);
878         write_rtl8255(dev, 0x1, 0x807);
879         write_rtl8255(dev, 0x4, 0xc1b);
880         write_rtl8255(dev, 0x4, 0xe1b);
881         write_rtl8255(dev, 0x4, 0xc1b);
882         write_rtl8255(dev, 0x1, 0x0);
883         write_rtl8255(dev, 0x4, 0x81b);
884         write_rtl8255(dev, 0x3, 0x0);
885         write_rtl8255(dev, 0x2, 0x0);
886         write_rtl8255(dev, 0x4, 0xa1b);
887         write_rtl8255(dev, 0x4, 0x81b);
888         write_rtl8255(dev, 0x4, 0x41b);
889         write_rtl8255(dev, 0x3, 0x25);
890         write_rtl8255(dev, 0x2, 0x26);
891         write_rtl8255(dev, 0x4, 0x61b);
892         write_rtl8255(dev, 0x4, 0x41b);
893         write_rtl8255(dev, 0x4, 0x41b);
894         write_rtl8255(dev, 0x3, 0x100);
895         write_rtl8255(dev, 0x4, 0x61b);
896         write_rtl8255(dev, 0x4, 0x41b);
897         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404004, 0x27,
898                 0x92402a90, 0xf0009, 0x28000, 0xc00, 0x0);
899         write_rtl8255(dev, 0x1, 0x807);
900         write_rtl8255(dev, 0x4, 0xc1c);
901         write_rtl8255(dev, 0x4, 0xe1c);
902         write_rtl8255(dev, 0x4, 0xc1c);
903         write_rtl8255(dev, 0x1, 0x0);
904         write_rtl8255(dev, 0x4, 0x81c);
905         write_rtl8255(dev, 0x3, 0x0);
906         write_rtl8255(dev, 0x2, 0x0);
907         write_rtl8255(dev, 0x4, 0xa1c);
908         write_rtl8255(dev, 0x4, 0x81c);
909         write_rtl8255(dev, 0x4, 0x41c);
910         write_rtl8255(dev, 0x3, 0x25);
911         write_rtl8255(dev, 0x2, 0x26);
912         write_rtl8255(dev, 0x4, 0x61c);
913         write_rtl8255(dev, 0x4, 0x41c);
914         write_rtl8255(dev, 0x4, 0x41c);
915         write_rtl8255(dev, 0x3, 0x100);
916         write_rtl8255(dev, 0x4, 0x61c);
917         write_rtl8255(dev, 0x4, 0x41c);
918         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404001, 0x27,
919                 0x92402a90, 0xf0009, 0x28000, 0xc00, 0x0);
920         write_rtl8255(dev, 0x1, 0x807);
921         write_rtl8255(dev, 0x4, 0xc1d);
922         write_rtl8255(dev, 0x4, 0xe1d);
923         write_rtl8255(dev, 0x4, 0xc1d);
924         write_rtl8255(dev, 0x1, 0x0);
925         write_rtl8255(dev, 0x4, 0x81d);
926         write_rtl8255(dev, 0x3, 0x0);
927         write_rtl8255(dev, 0x2, 0x0);
928         write_rtl8255(dev, 0x4, 0xa1d);
929         write_rtl8255(dev, 0x4, 0x81d);
930         write_rtl8255(dev, 0x4, 0x41d);
931         write_rtl8255(dev, 0x3, 0x25);
932         write_rtl8255(dev, 0x2, 0x26);
933         write_rtl8255(dev, 0x4, 0x61d);
934         write_rtl8255(dev, 0x4, 0x41d);
935         write_rtl8255(dev, 0x4, 0x41d);
936         write_rtl8255(dev, 0x3, 0x100);
937         write_rtl8255(dev, 0x4, 0x61d);
938         write_rtl8255(dev, 0x4, 0x41d);
939         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
940                 0x92402a94, 0xf0009, 0x28000, 0xc00, 0x0);
941         write_rtl8255(dev, 0x1, 0x807);
942         write_rtl8255(dev, 0x4, 0xc1e);
943         write_rtl8255(dev, 0x4, 0xe1e);
944         write_rtl8255(dev, 0x4, 0xc1e);
945         write_rtl8255(dev, 0x1, 0x0);
946         write_rtl8255(dev, 0x4, 0x81e);
947         write_rtl8255(dev, 0x3, 0x0);
948         write_rtl8255(dev, 0x2, 0x0);
949         write_rtl8255(dev, 0x4, 0xa1e);
950         write_rtl8255(dev, 0x4, 0x81e);
951         write_rtl8255(dev, 0x4, 0x41e);
952         write_rtl8255(dev, 0x3, 0x25);
953         write_rtl8255(dev, 0x2, 0x26);
954         write_rtl8255(dev, 0x4, 0x61e);
955         write_rtl8255(dev, 0x4, 0x41e);
956         write_rtl8255(dev, 0x4, 0x41e);
957         write_rtl8255(dev, 0x3, 0x100);
958         write_rtl8255(dev, 0x4, 0x61e);
959         write_rtl8255(dev, 0x4, 0x41e);
960         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x27,
961                 0x92402a94, 0xf0009, 0x28000, 0xc00, 0x0);
962         write_rtl8255(dev, 0x1, 0x807);
963         write_rtl8255(dev, 0x4, 0xc1f);
964         write_rtl8255(dev, 0x4, 0xe1f);
965         write_rtl8255(dev, 0x4, 0xc1f);
966         write_rtl8255(dev, 0x1, 0x0);
967         write_rtl8255(dev, 0x4, 0x81f);
968         write_rtl8255(dev, 0x3, 0x0);
969         write_rtl8255(dev, 0x2, 0x0);
970         write_rtl8255(dev, 0x4, 0xa1f);
971         write_rtl8255(dev, 0x4, 0x81f);
972         write_rtl8255(dev, 0x4, 0x41f);
973         write_rtl8255(dev, 0x3, 0x25);
974         write_rtl8255(dev, 0x2, 0x26);
975         write_rtl8255(dev, 0x4, 0x61f);
976         write_rtl8255(dev, 0x4, 0x41f);
977         write_rtl8255(dev, 0x4, 0x41f);
978         write_rtl8255(dev, 0x3, 0x100);
979         write_rtl8255(dev, 0x4, 0x61f);
980         write_rtl8255(dev, 0x4, 0x41f);
981         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404020, 0x80000027,
982                 0x92402a98, 0xf8009, 0x28000, 0xc00, 0x0);
983         write_rtl8255(dev, 0x1, 0x807);
984         write_rtl8255(dev, 0x4, 0xc20);
985         write_rtl8255(dev, 0x4, 0xe20);
986         write_rtl8255(dev, 0x4, 0xc20);
987         write_rtl8255(dev, 0x1, 0x0);
988         write_rtl8255(dev, 0x4, 0x820);
989         write_rtl8255(dev, 0x3, 0x0);
990         write_rtl8255(dev, 0x2, 0x0);
991         write_rtl8255(dev, 0x4, 0xa20);
992         write_rtl8255(dev, 0x4, 0x820);
993         write_rtl8255(dev, 0x4, 0x420);
994         write_rtl8255(dev, 0x3, 0x25);
995         write_rtl8255(dev, 0x2, 0x26);
996         write_rtl8255(dev, 0x4, 0x620);
997         write_rtl8255(dev, 0x4, 0x420);
998         write_rtl8255(dev, 0x4, 0x420);
999         write_rtl8255(dev, 0x3, 0x100);
1000         write_rtl8255(dev, 0x4, 0x620);
1001         write_rtl8255(dev, 0x4, 0x420);
1002         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404020, 0x27,
1003                 0x92402a98, 0xf8009, 0x28000, 0xc00, 0x0);
1004         write_rtl8255(dev, 0x1, 0x807);
1005         write_rtl8255(dev, 0x4, 0xc21);
1006         write_rtl8255(dev, 0x4, 0xe21);
1007         write_rtl8255(dev, 0x4, 0xc21);
1008         write_rtl8255(dev, 0x1, 0x0);
1009         write_rtl8255(dev, 0x4, 0x821);
1010         write_rtl8255(dev, 0x3, 0x0);
1011         write_rtl8255(dev, 0x2, 0x0);
1012         write_rtl8255(dev, 0x4, 0xa21);
1013         write_rtl8255(dev, 0x4, 0x821);
1014         write_rtl8255(dev, 0x4, 0x421);
1015         write_rtl8255(dev, 0x3, 0x25);
1016         write_rtl8255(dev, 0x2, 0x26);
1017         write_rtl8255(dev, 0x4, 0x621);
1018         write_rtl8255(dev, 0x4, 0x421);
1019         write_rtl8255(dev, 0x4, 0x421);
1020         write_rtl8255(dev, 0x3, 0x100);
1021         write_rtl8255(dev, 0x4, 0x621);
1022         write_rtl8255(dev, 0x4, 0x421);
1023         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1024                 0x92402a68, 0xf0009, 0x10028000, 0xc00, 0x0);
1025         write_rtl8255(dev, 0x1, 0x807);
1026         write_rtl8255(dev, 0x4, 0xc22);
1027         write_rtl8255(dev, 0x4, 0xe22);
1028         write_rtl8255(dev, 0x4, 0xc22);
1029         write_rtl8255(dev, 0x1, 0x0);
1030         write_rtl8255(dev, 0x4, 0x822);
1031         write_rtl8255(dev, 0x3, 0x0);
1032         write_rtl8255(dev, 0x2, 0x0);
1033         write_rtl8255(dev, 0x4, 0xa22);
1034         write_rtl8255(dev, 0x4, 0x822);
1035         write_rtl8255(dev, 0x4, 0x422);
1036         write_rtl8255(dev, 0x3, 0x25);
1037         write_rtl8255(dev, 0x2, 0x26);
1038         write_rtl8255(dev, 0x4, 0x622);
1039         write_rtl8255(dev, 0x4, 0x422);
1040         write_rtl8255(dev, 0x4, 0x422);
1041         write_rtl8255(dev, 0x3, 0x100);
1042         write_rtl8255(dev, 0x4, 0x622);
1043         write_rtl8255(dev, 0x4, 0x422);
1044         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
1045                 0x92402a68, 0xf0009, 0x20028000, 0xc00, 0x0);
1046         write_rtl8255(dev, 0x1, 0x807);
1047         write_rtl8255(dev, 0x4, 0xc23);
1048         write_rtl8255(dev, 0x4, 0xe23);
1049         write_rtl8255(dev, 0x4, 0xc23);
1050         write_rtl8255(dev, 0x1, 0x0);
1051         write_rtl8255(dev, 0x4, 0x823);
1052         write_rtl8255(dev, 0x3, 0x0);
1053         write_rtl8255(dev, 0x2, 0x0);
1054         write_rtl8255(dev, 0x4, 0xa23);
1055         write_rtl8255(dev, 0x4, 0x823);
1056         write_rtl8255(dev, 0x4, 0x423);
1057         write_rtl8255(dev, 0x3, 0x25);
1058         write_rtl8255(dev, 0x2, 0x26);
1059         write_rtl8255(dev, 0x4, 0x623);
1060         write_rtl8255(dev, 0x4, 0x423);
1061         write_rtl8255(dev, 0x4, 0x423);
1062         write_rtl8255(dev, 0x3, 0x100);
1063         write_rtl8255(dev, 0x4, 0x623);
1064         write_rtl8255(dev, 0x4, 0x423);
1065         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
1066                 0x92402a6c, 0xf0009, 0x30028000, 0xc00, 0x0);
1067         write_rtl8255(dev, 0x1, 0x807);
1068         write_rtl8255(dev, 0x4, 0xc24);
1069         write_rtl8255(dev, 0x4, 0xe24);
1070         write_rtl8255(dev, 0x4, 0xc24);
1071         write_rtl8255(dev, 0x1, 0x0);
1072         write_rtl8255(dev, 0x4, 0x824);
1073         write_rtl8255(dev, 0x3, 0x0);
1074         write_rtl8255(dev, 0x2, 0x0);
1075         write_rtl8255(dev, 0x4, 0xa24);
1076         write_rtl8255(dev, 0x4, 0x824);
1077         write_rtl8255(dev, 0x4, 0x424);
1078         write_rtl8255(dev, 0x3, 0x25);
1079         write_rtl8255(dev, 0x2, 0x26);
1080         write_rtl8255(dev, 0x4, 0x624);
1081         write_rtl8255(dev, 0x4, 0x424);
1082         write_rtl8255(dev, 0x4, 0x424);
1083         write_rtl8255(dev, 0x3, 0x100);
1084         write_rtl8255(dev, 0x4, 0x624);
1085         write_rtl8255(dev, 0x4, 0x424);
1086         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
1087                 0x92402a6c, 0xf0009, 0x40028000, 0xc00, 0x0);
1088         write_rtl8255(dev, 0x1, 0x807);
1089         write_rtl8255(dev, 0x4, 0xc25);
1090         write_rtl8255(dev, 0x4, 0xe25);
1091         write_rtl8255(dev, 0x4, 0xc25);
1092         write_rtl8255(dev, 0x1, 0x0);
1093         write_rtl8255(dev, 0x4, 0x825);
1094         write_rtl8255(dev, 0x3, 0x0);
1095         write_rtl8255(dev, 0x2, 0x0);
1096         write_rtl8255(dev, 0x4, 0xa25);
1097         write_rtl8255(dev, 0x4, 0x825);
1098         write_rtl8255(dev, 0x4, 0x425);
1099         write_rtl8255(dev, 0x3, 0x25);
1100         write_rtl8255(dev, 0x2, 0x26);
1101         write_rtl8255(dev, 0x4, 0x625);
1102         write_rtl8255(dev, 0x4, 0x425);
1103         write_rtl8255(dev, 0x4, 0x425);
1104         write_rtl8255(dev, 0x3, 0x100);
1105         write_rtl8255(dev, 0x4, 0x625);
1106         write_rtl8255(dev, 0x4, 0x425);
1107         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1108                 0x92402a70, 0xf0009, 0x60028000, 0xc00, 0x0);
1109         write_rtl8255(dev, 0x1, 0x807);
1110         write_rtl8255(dev, 0x4, 0xc26);
1111         write_rtl8255(dev, 0x4, 0xe26);
1112         write_rtl8255(dev, 0x4, 0xc26);
1113         write_rtl8255(dev, 0x1, 0x0);
1114         write_rtl8255(dev, 0x4, 0x826);
1115         write_rtl8255(dev, 0x3, 0x0);
1116         write_rtl8255(dev, 0x2, 0x0);
1117         write_rtl8255(dev, 0x4, 0xa26);
1118         write_rtl8255(dev, 0x4, 0x826);
1119         write_rtl8255(dev, 0x4, 0x426);
1120         write_rtl8255(dev, 0x3, 0x25);
1121         write_rtl8255(dev, 0x2, 0x26);
1122         write_rtl8255(dev, 0x4, 0x626);
1123         write_rtl8255(dev, 0x4, 0x426);
1124         write_rtl8255(dev, 0x4, 0x426);
1125         write_rtl8255(dev, 0x3, 0x100);
1126         write_rtl8255(dev, 0x4, 0x626);
1127         write_rtl8255(dev, 0x4, 0x426);
1128         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404031, 0x40000027,
1129                 0x92402a70, 0xf0011, 0x60028000, 0xc00, 0x0);
1130         write_rtl8255(dev, 0x1, 0x807);
1131         write_rtl8255(dev, 0x4, 0xc27);
1132         write_rtl8255(dev, 0x4, 0xe27);
1133         write_rtl8255(dev, 0x4, 0xc27);
1134         write_rtl8255(dev, 0x1, 0x0);
1135         write_rtl8255(dev, 0x4, 0x827);
1136         write_rtl8255(dev, 0x3, 0x0);
1137         write_rtl8255(dev, 0x2, 0x0);
1138         write_rtl8255(dev, 0x4, 0xa27);
1139         write_rtl8255(dev, 0x4, 0x827);
1140         write_rtl8255(dev, 0x4, 0x427);
1141         write_rtl8255(dev, 0x3, 0x25);
1142         write_rtl8255(dev, 0x2, 0x26);
1143         write_rtl8255(dev, 0x4, 0x627);
1144         write_rtl8255(dev, 0x4, 0x427);
1145         write_rtl8255(dev, 0x4, 0x427);
1146         write_rtl8255(dev, 0x3, 0x100);
1147         write_rtl8255(dev, 0x4, 0x627);
1148         write_rtl8255(dev, 0x4, 0x427);
1149         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404011, 0x40000027,
1150                 0x92402a74, 0xf0011, 0x60028000, 0xc00, 0x0);
1151         write_rtl8255(dev, 0x1, 0x807);
1152         write_rtl8255(dev, 0x4, 0xc28);
1153         write_rtl8255(dev, 0x4, 0xe28);
1154         write_rtl8255(dev, 0x4, 0xc28);
1155         write_rtl8255(dev, 0x1, 0x0);
1156         write_rtl8255(dev, 0x4, 0x828);
1157         write_rtl8255(dev, 0x3, 0x0);
1158         write_rtl8255(dev, 0x2, 0x0);
1159         write_rtl8255(dev, 0x4, 0xa28);
1160         write_rtl8255(dev, 0x4, 0x828);
1161         write_rtl8255(dev, 0x4, 0x428);
1162         write_rtl8255(dev, 0x3, 0x25);
1163         write_rtl8255(dev, 0x2, 0x26);
1164         write_rtl8255(dev, 0x4, 0x628);
1165         write_rtl8255(dev, 0x4, 0x428);
1166         write_rtl8255(dev, 0x4, 0x428);
1167         write_rtl8255(dev, 0x3, 0x100);
1168         write_rtl8255(dev, 0x4, 0x628);
1169         write_rtl8255(dev, 0x4, 0x428);
1170         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0xc0000027,
1171                 0x92402a74, 0xf0011, 0x60028000, 0xc00, 0x0);
1172         write_rtl8255(dev, 0x1, 0x807);
1173         write_rtl8255(dev, 0x4, 0xc29);
1174         write_rtl8255(dev, 0x4, 0xe29);
1175         write_rtl8255(dev, 0x4, 0xc29);
1176         write_rtl8255(dev, 0x1, 0x0);
1177         write_rtl8255(dev, 0x4, 0x829);
1178         write_rtl8255(dev, 0x3, 0x0);
1179         write_rtl8255(dev, 0x2, 0x0);
1180         write_rtl8255(dev, 0x4, 0xa29);
1181         write_rtl8255(dev, 0x4, 0x829);
1182         write_rtl8255(dev, 0x4, 0x429);
1183         write_rtl8255(dev, 0x3, 0x25);
1184         write_rtl8255(dev, 0x2, 0x26);
1185         write_rtl8255(dev, 0x4, 0x629);
1186         write_rtl8255(dev, 0x4, 0x429);
1187         write_rtl8255(dev, 0x4, 0x429);
1188         write_rtl8255(dev, 0x3, 0x100);
1189         write_rtl8255(dev, 0x4, 0x629);
1190         write_rtl8255(dev, 0x4, 0x429);
1191         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1192                 0x92402a78, 0xf0011, 0x60028000, 0xc00, 0x0);
1193         write_rtl8255(dev, 0x1, 0x807);
1194         write_rtl8255(dev, 0x4, 0xc2a);
1195         write_rtl8255(dev, 0x4, 0xe2a);
1196         write_rtl8255(dev, 0x4, 0xc2a);
1197         write_rtl8255(dev, 0x1, 0x0);
1198         write_rtl8255(dev, 0x4, 0x82a);
1199         write_rtl8255(dev, 0x3, 0x0);
1200         write_rtl8255(dev, 0x2, 0x0);
1201         write_rtl8255(dev, 0x4, 0xa2a);
1202         write_rtl8255(dev, 0x4, 0x82a);
1203         write_rtl8255(dev, 0x4, 0x42a);
1204         write_rtl8255(dev, 0x3, 0x24);
1205         write_rtl8255(dev, 0x2, 0x26);
1206         write_rtl8255(dev, 0x4, 0x62a);
1207         write_rtl8255(dev, 0x4, 0x42a);
1208         write_rtl8255(dev, 0x4, 0x42a);
1209         write_rtl8255(dev, 0x3, 0x100);
1210         write_rtl8255(dev, 0x4, 0x62a);
1211         write_rtl8255(dev, 0x4, 0x42a);
1212         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1213                 0x92402a78, 0xf0011, 0x70028000, 0xc00, 0x0);
1214         write_rtl8255(dev, 0x1, 0x807);
1215         write_rtl8255(dev, 0x4, 0xc2b);
1216         write_rtl8255(dev, 0x4, 0xe2b);
1217         write_rtl8255(dev, 0x4, 0xc2b);
1218         write_rtl8255(dev, 0x1, 0x0);
1219         write_rtl8255(dev, 0x4, 0x82b);
1220         write_rtl8255(dev, 0x3, 0x0);
1221         write_rtl8255(dev, 0x2, 0x0);
1222         write_rtl8255(dev, 0x4, 0xa2b);
1223         write_rtl8255(dev, 0x4, 0x82b);
1224         write_rtl8255(dev, 0x4, 0x42b);
1225         write_rtl8255(dev, 0x3, 0x24);
1226         write_rtl8255(dev, 0x2, 0x26);
1227         write_rtl8255(dev, 0x4, 0x62b);
1228         write_rtl8255(dev, 0x4, 0x42b);
1229         write_rtl8255(dev, 0x4, 0x42b);
1230         write_rtl8255(dev, 0x3, 0x100);
1231         write_rtl8255(dev, 0x4, 0x62b);
1232         write_rtl8255(dev, 0x4, 0x42b);
1233         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1234                 0x92402a48, 0xf0019, 0x70028000, 0xc00, 0x0);
1235         write_rtl8255(dev, 0x1, 0x807);
1236         write_rtl8255(dev, 0x4, 0xc2c);
1237         write_rtl8255(dev, 0x4, 0xe2c);
1238         write_rtl8255(dev, 0x4, 0xc2c);
1239         write_rtl8255(dev, 0x1, 0x0);
1240         write_rtl8255(dev, 0x4, 0x82c);
1241         write_rtl8255(dev, 0x3, 0x0);
1242         write_rtl8255(dev, 0x2, 0x0);
1243         write_rtl8255(dev, 0x4, 0xa2c);
1244         write_rtl8255(dev, 0x4, 0x82c);
1245         write_rtl8255(dev, 0x4, 0x42c);
1246         write_rtl8255(dev, 0x3, 0x24);
1247         write_rtl8255(dev, 0x2, 0x26);
1248         write_rtl8255(dev, 0x4, 0x62c);
1249         write_rtl8255(dev, 0x4, 0x42c);
1250         write_rtl8255(dev, 0x4, 0x42c);
1251         write_rtl8255(dev, 0x3, 0x100);
1252         write_rtl8255(dev, 0x4, 0x62c);
1253         write_rtl8255(dev, 0x4, 0x42c);
1254         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1255                 0x92402a48, 0xf8019, 0x70028000, 0xc00, 0x0);
1256         write_rtl8255(dev, 0x1, 0x807);
1257         write_rtl8255(dev, 0x4, 0xc2d);
1258         write_rtl8255(dev, 0x4, 0xe2d);
1259         write_rtl8255(dev, 0x4, 0xc2d);
1260         write_rtl8255(dev, 0x1, 0x0);
1261         write_rtl8255(dev, 0x4, 0x82d);
1262         write_rtl8255(dev, 0x3, 0x0);
1263         write_rtl8255(dev, 0x2, 0x0);
1264         write_rtl8255(dev, 0x4, 0xa2d);
1265         write_rtl8255(dev, 0x4, 0x82d);
1266         write_rtl8255(dev, 0x4, 0x42d);
1267         write_rtl8255(dev, 0x3, 0x24);
1268         write_rtl8255(dev, 0x2, 0x26);
1269         write_rtl8255(dev, 0x4, 0x62d);
1270         write_rtl8255(dev, 0x4, 0x42d);
1271         write_rtl8255(dev, 0x4, 0x42d);
1272         write_rtl8255(dev, 0x3, 0x100);
1273         write_rtl8255(dev, 0x4, 0x62d);
1274         write_rtl8255(dev, 0x4, 0x42d);
1275         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1276                 0x92402a4c, 0xf8019, 0x70028000, 0xc00, 0x0);
1277         write_rtl8255(dev, 0x1, 0x807);
1278         write_rtl8255(dev, 0x4, 0xc2e);
1279         write_rtl8255(dev, 0x4, 0xe2e);
1280         write_rtl8255(dev, 0x4, 0xc2e);
1281         write_rtl8255(dev, 0x1, 0x0);
1282         write_rtl8255(dev, 0x4, 0x82e);
1283         write_rtl8255(dev, 0x3, 0x0);
1284         write_rtl8255(dev, 0x2, 0x0);
1285         write_rtl8255(dev, 0x4, 0xa2e);
1286         write_rtl8255(dev, 0x4, 0x82e);
1287         write_rtl8255(dev, 0x4, 0x42e);
1288         write_rtl8255(dev, 0x3, 0x24);
1289         write_rtl8255(dev, 0x2, 0x26);
1290         write_rtl8255(dev, 0x4, 0x62e);
1291         write_rtl8255(dev, 0x4, 0x42e);
1292         write_rtl8255(dev, 0x4, 0x42e);
1293         write_rtl8255(dev, 0x3, 0x100);
1294         write_rtl8255(dev, 0x4, 0x62e);
1295         write_rtl8255(dev, 0x4, 0x42e);
1296         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1297                 0x92402a4c, 0xf8019, 0x70028000, 0xc00, 0x0);
1298         write_rtl8255(dev, 0x1, 0x807);
1299         write_rtl8255(dev, 0x4, 0xc2f);
1300         write_rtl8255(dev, 0x4, 0xe2f);
1301         write_rtl8255(dev, 0x4, 0xc2f);
1302         write_rtl8255(dev, 0x1, 0x0);
1303         write_rtl8255(dev, 0x4, 0x82f);
1304         write_rtl8255(dev, 0x3, 0x0);
1305         write_rtl8255(dev, 0x2, 0x0);
1306         write_rtl8255(dev, 0x4, 0xa2f);
1307         write_rtl8255(dev, 0x4, 0x82f);
1308         write_rtl8255(dev, 0x4, 0x42f);
1309         write_rtl8255(dev, 0x3, 0x24);
1310         write_rtl8255(dev, 0x2, 0x26);
1311         write_rtl8255(dev, 0x4, 0x62f);
1312         write_rtl8255(dev, 0x4, 0x42f);
1313         write_rtl8255(dev, 0x4, 0x42f);
1314         write_rtl8255(dev, 0x3, 0x100);
1315         write_rtl8255(dev, 0x4, 0x62f);
1316         write_rtl8255(dev, 0x4, 0x42f);
1317         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1318                 0x92402a50, 0xf8019, 0x70028000, 0xc00, 0x0);
1319         write_rtl8255(dev, 0x1, 0x807);
1320         write_rtl8255(dev, 0x4, 0xc30);
1321         write_rtl8255(dev, 0x4, 0xe30);
1322         write_rtl8255(dev, 0x4, 0xc30);
1323         write_rtl8255(dev, 0x1, 0x0);
1324         write_rtl8255(dev, 0x4, 0x830);
1325         write_rtl8255(dev, 0x3, 0x0);
1326         write_rtl8255(dev, 0x2, 0x0);
1327         write_rtl8255(dev, 0x4, 0xa30);
1328         write_rtl8255(dev, 0x4, 0x830);
1329         write_rtl8255(dev, 0x4, 0x430);
1330         write_rtl8255(dev, 0x3, 0x24);
1331         write_rtl8255(dev, 0x2, 0x26);
1332         write_rtl8255(dev, 0x4, 0x630);
1333         write_rtl8255(dev, 0x4, 0x430);
1334         write_rtl8255(dev, 0x4, 0x430);
1335         write_rtl8255(dev, 0x3, 0x100);
1336         write_rtl8255(dev, 0x4, 0x630);
1337         write_rtl8255(dev, 0x4, 0x430);
1338         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1339                 0x92402a50, 0xf8019, 0x70028000, 0xc00, 0x0);
1340         write_rtl8255(dev, 0x1, 0x807);
1341         write_rtl8255(dev, 0x4, 0xc31);
1342         write_rtl8255(dev, 0x4, 0xe31);
1343         write_rtl8255(dev, 0x4, 0xc31);
1344         write_rtl8255(dev, 0x1, 0x0);
1345         write_rtl8255(dev, 0x4, 0x831);
1346         write_rtl8255(dev, 0x3, 0x0);
1347         write_rtl8255(dev, 0x2, 0x0);
1348         write_rtl8255(dev, 0x4, 0xa31);
1349         write_rtl8255(dev, 0x4, 0x831);
1350         write_rtl8255(dev, 0x4, 0x431);
1351         write_rtl8255(dev, 0x3, 0x24);
1352         write_rtl8255(dev, 0x2, 0x26);
1353         write_rtl8255(dev, 0x4, 0x631);
1354         write_rtl8255(dev, 0x4, 0x431);
1355         write_rtl8255(dev, 0x4, 0x431);
1356         write_rtl8255(dev, 0x3, 0x100);
1357         write_rtl8255(dev, 0x4, 0x631);
1358         write_rtl8255(dev, 0x4, 0x431);
1359         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1360                 0x92402a54, 0xf8019, 0x70028000, 0xc00, 0x0);
1361         write_rtl8255(dev, 0x1, 0x807);
1362         write_rtl8255(dev, 0x4, 0xc32);
1363         write_rtl8255(dev, 0x4, 0xe32);
1364         write_rtl8255(dev, 0x4, 0xc32);
1365         write_rtl8255(dev, 0x1, 0x0);
1366         write_rtl8255(dev, 0x4, 0x832);
1367         write_rtl8255(dev, 0x3, 0x0);
1368         write_rtl8255(dev, 0x2, 0x0);
1369         write_rtl8255(dev, 0x4, 0xa32);
1370         write_rtl8255(dev, 0x4, 0x832);
1371         write_rtl8255(dev, 0x4, 0x432);
1372         write_rtl8255(dev, 0x3, 0x24);
1373         write_rtl8255(dev, 0x2, 0x26);
1374         write_rtl8255(dev, 0x4, 0x632);
1375         write_rtl8255(dev, 0x4, 0x432);
1376         write_rtl8255(dev, 0x4, 0x432);
1377         write_rtl8255(dev, 0x3, 0x100);
1378         write_rtl8255(dev, 0x4, 0x632);
1379         write_rtl8255(dev, 0x4, 0x432);
1380         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1381                 0x92402a54, 0xf8019, 0x70028000, 0xc00, 0x0);
1382         write_rtl8255(dev, 0x1, 0x807);
1383         write_rtl8255(dev, 0x4, 0xc33);
1384         write_rtl8255(dev, 0x4, 0xe33);
1385         write_rtl8255(dev, 0x4, 0xc33);
1386         write_rtl8255(dev, 0x1, 0x0);
1387         write_rtl8255(dev, 0x4, 0x833);
1388         write_rtl8255(dev, 0x3, 0x0);
1389         write_rtl8255(dev, 0x2, 0x0);
1390         write_rtl8255(dev, 0x4, 0xa33);
1391         write_rtl8255(dev, 0x4, 0x833);
1392         write_rtl8255(dev, 0x4, 0x433);
1393         write_rtl8255(dev, 0x3, 0x24);
1394         write_rtl8255(dev, 0x2, 0x26);
1395         write_rtl8255(dev, 0x4, 0x633);
1396         write_rtl8255(dev, 0x4, 0x433);
1397         write_rtl8255(dev, 0x4, 0x433);
1398         write_rtl8255(dev, 0x3, 0x100);
1399         write_rtl8255(dev, 0x4, 0x633);
1400         write_rtl8255(dev, 0x4, 0x433);
1401         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1402                 0x92402a58, 0xf8019, 0x70028000, 0xc00, 0x0);
1403         write_rtl8255(dev, 0x1, 0x807);
1404         write_rtl8255(dev, 0x4, 0xc34);
1405         write_rtl8255(dev, 0x4, 0xe34);
1406         write_rtl8255(dev, 0x4, 0xc34);
1407         write_rtl8255(dev, 0x1, 0x0);
1408         write_rtl8255(dev, 0x4, 0x834);
1409         write_rtl8255(dev, 0x3, 0x0);
1410         write_rtl8255(dev, 0x2, 0x0);
1411         write_rtl8255(dev, 0x4, 0xa34);
1412         write_rtl8255(dev, 0x4, 0x834);
1413         write_rtl8255(dev, 0x4, 0x434);
1414         write_rtl8255(dev, 0x3, 0x24);
1415         write_rtl8255(dev, 0x2, 0x26);
1416         write_rtl8255(dev, 0x4, 0x634);
1417         write_rtl8255(dev, 0x4, 0x434);
1418         write_rtl8255(dev, 0x4, 0x434);
1419         write_rtl8255(dev, 0x3, 0x100);
1420         write_rtl8255(dev, 0x4, 0x634);
1421         write_rtl8255(dev, 0x4, 0x434);
1422         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1423                 0x92402a58, 0xf8019, 0x70028000, 0xc00, 0x0);
1424         write_rtl8255(dev, 0x1, 0x807);
1425         write_rtl8255(dev, 0x4, 0xc35);
1426         write_rtl8255(dev, 0x4, 0xe35);
1427         write_rtl8255(dev, 0x4, 0xc35);
1428         write_rtl8255(dev, 0x1, 0x0);
1429         write_rtl8255(dev, 0x4, 0x835);
1430         write_rtl8255(dev, 0x3, 0x0);
1431         write_rtl8255(dev, 0x2, 0x0);
1432         write_rtl8255(dev, 0x4, 0xa35);
1433         write_rtl8255(dev, 0x4, 0x835);
1434         write_rtl8255(dev, 0x4, 0x435);
1435         write_rtl8255(dev, 0x3, 0x24);
1436         write_rtl8255(dev, 0x2, 0x26);
1437         write_rtl8255(dev, 0x4, 0x635);
1438         write_rtl8255(dev, 0x4, 0x435);
1439         write_rtl8255(dev, 0x4, 0x435);
1440         write_rtl8255(dev, 0x3, 0x100);
1441         write_rtl8255(dev, 0x4, 0x635);
1442         write_rtl8255(dev, 0x4, 0x435);
1443         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1444                 0x92402a24, 0xf8019, 0x70028000, 0xc00, 0x0);
1445         write_rtl8255(dev, 0x1, 0x807);
1446         write_rtl8255(dev, 0x4, 0xc36);
1447         write_rtl8255(dev, 0x4, 0xe36);
1448         write_rtl8255(dev, 0x4, 0xc36);
1449         write_rtl8255(dev, 0x1, 0x0);
1450         write_rtl8255(dev, 0x4, 0x836);
1451         write_rtl8255(dev, 0x3, 0x0);
1452         write_rtl8255(dev, 0x2, 0x0);
1453         write_rtl8255(dev, 0x4, 0xa36);
1454         write_rtl8255(dev, 0x4, 0x836);
1455         write_rtl8255(dev, 0x4, 0x436);
1456         write_rtl8255(dev, 0x3, 0x24);
1457         write_rtl8255(dev, 0x2, 0x25);
1458         write_rtl8255(dev, 0x4, 0x636);
1459         write_rtl8255(dev, 0x4, 0x436);
1460         write_rtl8255(dev, 0x4, 0x436);
1461         write_rtl8255(dev, 0x3, 0x100);
1462         write_rtl8255(dev, 0x4, 0x636);
1463         write_rtl8255(dev, 0x4, 0x436);
1464         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1465                 0x92402a24, 0xf8019, 0x70028000, 0xc00, 0x0);
1466         write_rtl8255(dev, 0x1, 0x807);
1467         write_rtl8255(dev, 0x4, 0xc37);
1468         write_rtl8255(dev, 0x4, 0xe37);
1469         write_rtl8255(dev, 0x4, 0xc37);
1470         write_rtl8255(dev, 0x1, 0x0);
1471         write_rtl8255(dev, 0x4, 0x837);
1472         write_rtl8255(dev, 0x3, 0x0);
1473         write_rtl8255(dev, 0x2, 0x0);
1474         write_rtl8255(dev, 0x4, 0xa37);
1475         write_rtl8255(dev, 0x4, 0x837);
1476         write_rtl8255(dev, 0x4, 0x437);
1477         write_rtl8255(dev, 0x3, 0x24);
1478         write_rtl8255(dev, 0x2, 0x25);
1479         write_rtl8255(dev, 0x4, 0x637);
1480         write_rtl8255(dev, 0x4, 0x437);
1481         write_rtl8255(dev, 0x4, 0x437);
1482         write_rtl8255(dev, 0x3, 0x100);
1483         write_rtl8255(dev, 0x4, 0x637);
1484         write_rtl8255(dev, 0x4, 0x437);
1485         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1486                 0x92402a28, 0xf8019, 0x70028000, 0xc00, 0x0);
1487         write_rtl8255(dev, 0x1, 0x807);
1488         write_rtl8255(dev, 0x4, 0xc38);
1489         write_rtl8255(dev, 0x4, 0xe38);
1490         write_rtl8255(dev, 0x4, 0xc38);
1491         write_rtl8255(dev, 0x1, 0x0);
1492         write_rtl8255(dev, 0x4, 0x838);
1493         write_rtl8255(dev, 0x3, 0x0);
1494         write_rtl8255(dev, 0x2, 0x0);
1495         write_rtl8255(dev, 0x4, 0xa38);
1496         write_rtl8255(dev, 0x4, 0x838);
1497         write_rtl8255(dev, 0x4, 0x438);
1498         write_rtl8255(dev, 0x3, 0x24);
1499         write_rtl8255(dev, 0x2, 0x25);
1500         write_rtl8255(dev, 0x4, 0x638);
1501         write_rtl8255(dev, 0x4, 0x438);
1502         write_rtl8255(dev, 0x4, 0x438);
1503         write_rtl8255(dev, 0x3, 0x100);
1504         write_rtl8255(dev, 0x4, 0x638);
1505         write_rtl8255(dev, 0x4, 0x438);
1506         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1507                 0x92402a28, 0xf8019, 0x70028000, 0xc00, 0x0);
1508         write_rtl8255(dev, 0x1, 0x807);
1509         write_rtl8255(dev, 0x4, 0xc39);
1510         write_rtl8255(dev, 0x4, 0xe39);
1511         write_rtl8255(dev, 0x4, 0xc39);
1512         write_rtl8255(dev, 0x1, 0x0);
1513         write_rtl8255(dev, 0x4, 0x839);
1514         write_rtl8255(dev, 0x3, 0x0);
1515         write_rtl8255(dev, 0x2, 0x0);
1516         write_rtl8255(dev, 0x4, 0xa39);
1517         write_rtl8255(dev, 0x4, 0x839);
1518         write_rtl8255(dev, 0x4, 0x439);
1519         write_rtl8255(dev, 0x3, 0x24);
1520         write_rtl8255(dev, 0x2, 0x25);
1521         write_rtl8255(dev, 0x4, 0x639);
1522         write_rtl8255(dev, 0x4, 0x439);
1523         write_rtl8255(dev, 0x4, 0x439);
1524         write_rtl8255(dev, 0x3, 0x100);
1525         write_rtl8255(dev, 0x4, 0x639);
1526         write_rtl8255(dev, 0x4, 0x439);
1527         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1528                 0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
1529         write_rtl8255(dev, 0x1, 0x807);
1530         write_rtl8255(dev, 0x4, 0xc3a);
1531         write_rtl8255(dev, 0x4, 0xe3a);
1532         write_rtl8255(dev, 0x4, 0xc3a);
1533         write_rtl8255(dev, 0x1, 0x0);
1534         write_rtl8255(dev, 0x4, 0x83a);
1535         write_rtl8255(dev, 0x3, 0x0);
1536         write_rtl8255(dev, 0x2, 0x0);
1537         write_rtl8255(dev, 0x4, 0xa3a);
1538         write_rtl8255(dev, 0x4, 0x83a);
1539         write_rtl8255(dev, 0x4, 0x43a);
1540         write_rtl8255(dev, 0x3, 0x0);
1541         write_rtl8255(dev, 0x2, 0x0);
1542         write_rtl8255(dev, 0x4, 0x63a);
1543         write_rtl8255(dev, 0x4, 0x43a);
1544         write_rtl8255(dev, 0x4, 0x43a);
1545         write_rtl8255(dev, 0x3, 0x100);
1546         write_rtl8255(dev, 0x4, 0x63a);
1547         write_rtl8255(dev, 0x4, 0x43a);
1548         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1549                 0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
1550         write_rtl8255(dev, 0x1, 0x807);
1551         write_rtl8255(dev, 0x4, 0xc3b);
1552         write_rtl8255(dev, 0x4, 0xe3b);
1553         write_rtl8255(dev, 0x4, 0xc3b);
1554         write_rtl8255(dev, 0x1, 0x0);
1555         write_rtl8255(dev, 0x4, 0x83b);
1556         write_rtl8255(dev, 0x3, 0x0);
1557         write_rtl8255(dev, 0x2, 0x0);
1558         write_rtl8255(dev, 0x4, 0xa3b);
1559         write_rtl8255(dev, 0x4, 0x83b);
1560         write_rtl8255(dev, 0x4, 0x43b);
1561         write_rtl8255(dev, 0x3, 0x0);
1562         write_rtl8255(dev, 0x2, 0x0);
1563         write_rtl8255(dev, 0x4, 0x63b);
1564         write_rtl8255(dev, 0x4, 0x43b);
1565         write_rtl8255(dev, 0x4, 0x43b);
1566         write_rtl8255(dev, 0x3, 0x100);
1567         write_rtl8255(dev, 0x4, 0x63b);
1568         write_rtl8255(dev, 0x4, 0x43b);
1569         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1570                 0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
1571         write_rtl8255(dev, 0x1, 0x807);
1572         write_rtl8255(dev, 0x4, 0xc3c);
1573         write_rtl8255(dev, 0x4, 0xe3c);
1574         write_rtl8255(dev, 0x4, 0xc3c);
1575         write_rtl8255(dev, 0x1, 0x0);
1576         write_rtl8255(dev, 0x4, 0x83c);
1577         write_rtl8255(dev, 0x3, 0x0);
1578         write_rtl8255(dev, 0x2, 0x0);
1579         write_rtl8255(dev, 0x4, 0xa3c);
1580         write_rtl8255(dev, 0x4, 0x83c);
1581         write_rtl8255(dev, 0x4, 0x43c);
1582         write_rtl8255(dev, 0x3, 0x0);
1583         write_rtl8255(dev, 0x2, 0x0);
1584         write_rtl8255(dev, 0x4, 0x63c);
1585         write_rtl8255(dev, 0x4, 0x43c);
1586         write_rtl8255(dev, 0x4, 0x43c);
1587         write_rtl8255(dev, 0x3, 0x100);
1588         write_rtl8255(dev, 0x4, 0x63c);
1589         write_rtl8255(dev, 0x4, 0x43c);
1590         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1591                 0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
1592         write_rtl8255(dev, 0x1, 0x807);
1593         write_rtl8255(dev, 0x4, 0xc3d);
1594         write_rtl8255(dev, 0x4, 0xe3d);
1595         write_rtl8255(dev, 0x4, 0xc3d);
1596         write_rtl8255(dev, 0x1, 0x0);
1597         write_rtl8255(dev, 0x4, 0x83d);
1598         write_rtl8255(dev, 0x3, 0x0);
1599         write_rtl8255(dev, 0x2, 0x0);
1600         write_rtl8255(dev, 0x4, 0xa3d);
1601         write_rtl8255(dev, 0x4, 0x83d);
1602         write_rtl8255(dev, 0x4, 0x43d);
1603         write_rtl8255(dev, 0x3, 0x0);
1604         write_rtl8255(dev, 0x2, 0x0);
1605         write_rtl8255(dev, 0x4, 0x63d);
1606         write_rtl8255(dev, 0x4, 0x43d);
1607         write_rtl8255(dev, 0x4, 0x43d);
1608         write_rtl8255(dev, 0x3, 0x100);
1609         write_rtl8255(dev, 0x4, 0x63d);
1610         write_rtl8255(dev, 0x4, 0x43d);
1611         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1612                 0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
1613         write_rtl8255(dev, 0x1, 0x807);
1614         write_rtl8255(dev, 0x4, 0xc3e);
1615         write_rtl8255(dev, 0x4, 0xe3e);
1616         write_rtl8255(dev, 0x4, 0xc3e);
1617         write_rtl8255(dev, 0x1, 0x0);
1618         write_rtl8255(dev, 0x4, 0x83e);
1619         write_rtl8255(dev, 0x3, 0x0);
1620         write_rtl8255(dev, 0x2, 0x0);
1621         write_rtl8255(dev, 0x4, 0xa3e);
1622         write_rtl8255(dev, 0x4, 0x83e);
1623         write_rtl8255(dev, 0x4, 0x43e);
1624         write_rtl8255(dev, 0x3, 0x0);
1625         write_rtl8255(dev, 0x2, 0x0);
1626         write_rtl8255(dev, 0x4, 0x63e);
1627         write_rtl8255(dev, 0x4, 0x43e);
1628         write_rtl8255(dev, 0x4, 0x43e);
1629         write_rtl8255(dev, 0x3, 0x100);
1630         write_rtl8255(dev, 0x4, 0x63e);
1631         write_rtl8255(dev, 0x4, 0x43e);
1632         write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
1633                 0x92402a00, 0xf8011, 0x70028000, 0xc00, 0x0);
1634         write_rtl8255(dev, 0x1, 0x807);
1635         write_rtl8255(dev, 0x4, 0xc3f);
1636         write_rtl8255(dev, 0x4, 0xe3f);
1637         write_rtl8255(dev, 0x4, 0xc3f);
1638         write_rtl8255(dev, 0x1, 0x0);
1639         write_rtl8255(dev, 0x4, 0x83f);
1640         write_rtl8255(dev, 0x3, 0x0);
1641         write_rtl8255(dev, 0x2, 0x0);
1642         write_rtl8255(dev, 0x4, 0xa3f);
1643         write_rtl8255(dev, 0x4, 0x83f);
1644         write_rtl8255(dev, 0x4, 0x43f);
1645         write_rtl8255(dev, 0x3, 0x0);
1646         write_rtl8255(dev, 0x2, 0x0);
1647         write_rtl8255(dev, 0x4, 0x63f);
1648         write_rtl8255(dev, 0x4, 0x43f);
1649         write_rtl8255(dev, 0x4, 0x43f);
1650         write_rtl8255(dev, 0x3, 0x100);
1651         write_rtl8255(dev, 0x4, 0x63f);
1652         write_rtl8255(dev, 0x4, 0x43f);
1653         write_rtl8255(dev, 0x4, 0x0);
1654         write_rtl8255(dev, 0x1, 0x0);
1655         write_rtl8255_reg0c(dev, 0x3539, 0x70000c03, 0xfef46178, 0x408000, 0x403307,
1656                 0x924f80c0, 0xf955c, 0x8400, 0x429200, 0x1ce20);
1657         write_rtl8255(dev, 0x1, 0x1c7);
1658         write_rtl8255(dev, 0x2, 0x26);
1659         write_rtl8255(dev, 0x3, 0x27);
1660         write_rtl8255(dev, 0x1, 0x47);
1661         write_rtl8255(dev, 0x4, 0x98c);
1662         write_rtl8255(dev, 0x5, 0x65);
1663         write_rtl8255(dev, 0x6, 0x13);
1664         write_rtl8255(dev, 0x7, 0x7c);
1665         write_rtl8255(dev, 0x8, 0x6);
1666         write_rtl8255(dev, 0x8, 0x7);
1667         write_rtl8255(dev, 0x8, 0x6);
1668         write_rtl8255(dev, 0x9, 0xce2);
1669         write_rtl8255(dev, 0xb, 0x1c5);
1670         write_rtl8255(dev, 0xd, 0xd7f);
1671         write_rtl8255(dev, 0xe, 0x369);
1672         write_rtl8255(dev, 0xa, 0xd56);
1673         write_rtl8255(dev, 0xa, 0xd57);
1674         mdelay(20);
1675         write_rtl8255(dev, 0xd, 0xd7e);
1676
1677 }
1678
1679
1680 void rtl8255_set_band_param(struct net_device *dev, short band)
1681 {
1682         if(band != BAND_A){
1683                 write_nic_dword(dev, 0x94, 0x3dc00002);
1684                 write_nic_dword(dev, 0x88, 0x00100040);
1685
1686                 write_phy_cck(dev, 0x13, 0xd0);
1687
1688                 write_phy_cck(dev, 0x41, 0x9d);
1689                 write_nic_dword(dev, 0x8c, 0x00082205);
1690                 write_nic_byte(dev, 0xb4, 0x66);
1691         }
1692 }
1693
1694 void rtl8255_rf_init(struct net_device *dev)
1695 {
1696         struct r8180_priv *priv = ieee80211_priv(dev);
1697         int i;
1698         u16 brsr;
1699 //      short channel /*= priv->chan*/ = 1;
1700         priv->chan = 1;
1701
1702         write_nic_word(dev, RFPinsOutput, 0x80);
1703         write_nic_word(dev, RFPinsSelect, 0x80 | SW_CONTROL_GPIO);
1704         write_nic_word(dev, RFPinsEnable, 0x80);
1705         write_nic_word(dev, RFPinsSelect, SW_CONTROL_GPIO);
1706
1707         write_nic_dword(dev, RF_TIMING, 0x000f800f);
1708
1709         brsr = read_nic_word(dev, BRSR);
1710
1711         write_nic_word(dev, 0x2c, 0xffff);
1712
1713
1714         rtl8180_set_anaparam(dev, RTL8255_ANAPARAM_ON);
1715         rtl8185_set_anaparam2(dev, RTL8255_ANAPARAM2_ON);
1716
1717         write_nic_dword(dev, 0x94, 0x11c00002);
1718
1719         write_nic_dword(dev, RF_PARA, 0x100040);
1720
1721         rtl8185_rf_pins_enable(dev);
1722
1723         rtl8255_init_BGband(dev);
1724         rtl8255_set_band_param(dev,BAND_BG);
1725
1726         write_phy_cck(dev, 0x0, 0x98);
1727         write_phy_cck(dev, 0x3, 0x20);
1728         write_phy_cck(dev, 0x4, 0x2e);
1729         write_phy_cck(dev, 0x5, 0x12);
1730         write_phy_cck(dev, 0x6, 0xfc);
1731         write_phy_cck(dev, 0x7, 0xd8);
1732         write_phy_cck(dev, 0x8, 0x2e);
1733         write_phy_cck(dev, 0x10, 0xd3);
1734         write_phy_cck(dev, 0x11, 0x88);
1735         write_phy_cck(dev, 0x12, 0x47);
1736         write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
1737
1738         write_phy_cck(dev, 0x19, 0x0);
1739         write_phy_cck(dev, 0x1a, 0xa0);
1740         write_phy_cck(dev, 0x1b, 0x8);
1741         write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
1742         write_phy_cck(dev, 0x41, 0x9d); /* Energy Threshold */
1743         //write_phy_cck(dev, 0x42, 0x0);
1744         write_phy_cck(dev, 0x43, 0x8);
1745
1746         write_nic_byte(dev, TESTR,0x8);
1747
1748         for(i=0;i<128;i++){
1749                 write_phy_ofdm(dev, 0x4b, rtl8255_agc[i]);
1750                 write_phy_ofdm(dev, 0x4a, (u8)i+ 0x80);
1751         }
1752
1753
1754         write_phy_ofdm(dev, 0x0, 0x1);
1755         write_phy_ofdm(dev, 0x1, 0x2);
1756         write_phy_ofdm(dev, 0x2, 0x43);
1757         write_phy_ofdm(dev, 0x3, 0x0);
1758         write_phy_ofdm(dev, 0x4, 0x0);
1759         write_phy_ofdm(dev, 0x5, 0x0);
1760         write_phy_ofdm(dev, 0x6, 0x40);
1761         write_phy_ofdm(dev, 0x7, 0x0);
1762         write_phy_ofdm(dev, 0x8, 0x40);
1763         write_phy_ofdm(dev, 0x9, 0xfe);
1764         write_phy_ofdm(dev, 0xa, 0x9);
1765         write_phy_ofdm(dev, 0xb, 0x80);
1766         write_phy_ofdm(dev, 0xc, 0x1);
1767         write_phy_ofdm(dev, 0xd, 0x43);
1768         write_phy_ofdm(dev, 0xe, 0xd3);
1769         write_phy_ofdm(dev, 0xf, 0x38);
1770         write_phy_ofdm(dev, 0x10, 0x4);
1771         write_phy_ofdm(dev, 0x11, 0x06);/*agc resp time 700*/
1772         write_phy_ofdm(dev, 0x12, 0x20);
1773         write_phy_ofdm(dev, 0x13, 0x20);
1774         write_phy_ofdm(dev, 0x14, 0x0);
1775         write_phy_ofdm(dev, 0x15, 0x40);
1776         write_phy_ofdm(dev, 0x16, 0x0);
1777         write_phy_ofdm(dev, 0x17, 0x40);
1778         write_phy_ofdm(dev, 0x18, 0xef);
1779         write_phy_ofdm(dev, 0x19, 0x25);
1780         write_phy_ofdm(dev, 0x1a, 0x20);
1781         write_phy_ofdm(dev, 0x1b, 0x7a);
1782         write_phy_ofdm(dev, 0x1c, 0x84);
1783         write_phy_ofdm(dev, 0x1e, 0x95);
1784         write_phy_ofdm(dev, 0x1f, 0x75);
1785         write_phy_ofdm(dev, 0x20, 0x1f);
1786         write_phy_ofdm(dev, 0x21, 0x17);
1787         write_phy_ofdm(dev, 0x22, 0x16);
1788         write_phy_ofdm(dev, 0x23, 0x70); //FIXME maybe not needed
1789         write_phy_ofdm(dev, 0x24, 0x70);
1790         write_phy_ofdm(dev, 0x25, 0x0);
1791         write_phy_ofdm(dev, 0x26, 0x10);
1792         write_phy_ofdm(dev, 0x27, 0x88);
1793
1794
1795         write_nic_dword(dev, 0x94, 0x3dc00002); //BAND DEPEND.
1796 //      write_nic_dword(dev, 0x94, 0x15c00002); //BAND DEPEND.
1797
1798         write_phy_cck(dev, 0x4, 0x18);
1799         write_phy_cck(dev, 0x43, 0x18);
1800         write_phy_cck(dev, 0x6, 0xdc);
1801         write_phy_cck(dev, 0x44, 0x2b);
1802         write_phy_cck(dev, 0x45, 0x2b);
1803         write_phy_cck(dev, 0x46, 0x25);
1804         write_phy_cck(dev, 0x47, 0x15);
1805         write_phy_cck(dev, 0x48, 0x0);
1806         write_phy_cck(dev, 0x49, 0x0);
1807         write_phy_cck(dev, 0x4a, 0x0);
1808         write_phy_cck(dev, 0x4b, 0x0);
1809 //      write_phy_cck(dev, 0x4c, 0x5);
1810 #if 0
1811         write_phy_cck(dev, 0x41, 0x9d); /* Energy Threshold */
1812         // TESTR 0xb 8187
1813         write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
1814 #endif
1815         //rtl8255_set_gain(dev, 1); /* FIXME this '1' is random */
1816
1817         rtl8255_SetTXPowerLevel(dev, priv->chan);
1818
1819         write_phy_cck(dev, 0x10, 0x93 |0x4); /* Rx ant B, 0xd3 for A */
1820         write_phy_ofdm(dev, 0x26, 0x90); /* Rx ant B, 0x10 for A */
1821
1822         rtl8185_tx_antenna(dev, 0x3); /* TX ant B, 0x0 for A*/
1823         /* make sure is waken up! */
1824         rtl8180_set_anaparam(dev, RTL8255_ANAPARAM_ON);
1825         rtl8185_set_anaparam2(dev, RTL8255_ANAPARAM2_ON);
1826
1827         rtl8255_set_band_param(dev,BAND_BG);
1828
1829         write_phy_cck(dev, 0x41, 0x9d);
1830
1831         rtl8255_set_gain(dev, 4);
1832         //rtl8255_set_energy_threshold(dev);
1833         write_phy_cck(dev, 0x41, 0x9d);
1834         rtl8255_rf_set_chan(dev, priv->chan);
1835
1836         write_nic_word(dev, BRSR, brsr);
1837 }
1838